Repository navigation
Type std returns by receiver type arguments, and fuse Enum.at - #23
Merged
Merged
Conversation
…n a stage The std method table keeps returns that depend only on the receiver's own type parameters, with those parameters in order, and Typing substitutes the receiver's type arguments: as_ref on an &Option<String> is an Option<&String>. A list literal of one type is a list of it. Enum.at on a stage is nth, a filter over copied tuples matches by reference, and counts stay usize where one is expected.
This was referenced Oct 26, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while collapsing Figler's 52-function optional-attribute chain into one
Enumpipeline.mix rustq.stdkeeps a method's return type when it depends only on the receiver's own type parameters, and records those parameters in the order the type takes them.Typingbinds them to the receiver's type arguments with the newType.substitute/2. For example,name.as_ref()on an&Option<String>is anOption<&String>. The table grows from 173 entries to 293. A method whose return type uses its own parameters, like[T]::get'sI::Output, is still left out.Enum.aton a stage fuses to.nth(index). Before, it was.collect().get(index).cloned()with an untypedcollect.|&(set, field)| set.Enum.count,length, andbyte_sizestayusizewhere one is expected, through a sharedinteger_count/2helper. Before, they always cast toi64.as_reftyping is removed, since the std table now covers it.mix cipasses with 888 tests. With this branch, Figler'smix cialso passes, clippy included, apart from the dependency check that fails whenever RustQ comes from a local path.