Document never type fallback in !'s docs#124419
Conversation
|
rustbot has assigned @workingjubilee. Use |
workingjubilee
left a comment
There was a problem hiding this comment.
Thanks! Some minor clarity-related nits. Overall looks good to me.
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
|
nice! @bors r+ rollup |
| /// To prevent such errors, the compiler remembers where it inserted `absurd` calls, and | ||
| /// if it can't infer their type, it sets the type to the fallback type: | ||
| /// ```rust, ignore | ||
| /// type Fallback = /* An arbitrarily selected type! */; |
There was a problem hiding this comment.
"Arbitrarily selected" here sounds like "the compiler picks from some set", not "we made a choice and taught it to the compiler". I'm not sure what would be better, though.
There was a problem hiding this comment.
There's nothing stopping us from having arbitrarily complicated fallback logic, aside from a reluctance to implement anything more complex, which is why I suggested it that way.
We do pick from a set.
The set has one member. :^)
There was a problem hiding this comment.
Hoping to grow the set to two :p
I'm also not a fan of "arbitrary" here because we did purposefully choose the fallback type...
But I'm not sure how to phrase this properly :/
There was a problem hiding this comment.
Whenever I use arbitrary I strongly mean the "the reason for why is because I said so", because often there were multiple reasonable choices we could have made, but we could only make one (one set, with any number of members).
Co-authored-by: Kevin Reid <kpreid@switchb.org> Co-authored-by: Herman Skogseth <herman.skogseth@me.com> Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
|
Thanks to everyone who participated in the discussions and suggested improvements to the documentation! <3 @bors r=workingjubilee |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
|
@bors r+ |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (80451a4): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 675.937s -> 674.735s (-0.18%) |
Pulled the documentation I've written for #123939.
I want a single place where never type fallback is explained, which can be referred in all the lints and migration materials.