-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce kw::Empty
usage, part 1
#137977
base: master
Are you sure you want to change the base?
Reduce kw::Empty
usage, part 1
#137977
Conversation
It's clearer than using `kw::Empty` to mean `None`.
Best reviewed one commit at a time. |
Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred in src/tools/compiletest cc @jieyouxu Some changes occurred to the CTFE machinery Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
Currently it relies on special treatment of `kw::Empty`, which is really easy to get wrong. This commit makes the special case clearer in the type system by using `Option`. It's a bit clumsy, but the synthetic name handling itself is a bit clumsy; better to make it explicit than sneak it in. Fixes rust-lang#133426.
292031d
to
3ef8935
Compare
"crashtest no longer crashes/triggers ICE, horray! Please give it a meaningful \ | ||
"crashtest no longer crashes/triggers ICE, hooray! Please give it a meaningful \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was like why did this PR get tagged as compiletest. 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left a minor comment r=me doing whatever you feel is better there :).
| DefKind::TyParam | ||
| DefKind::ExternCrate => DefPathData::TypeNs(name.unwrap()), | ||
| DefKind::ExternCrate => DefPathData::TypeNs(Some(name.unwrap())), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just name
here? I guess you want to make the thing explode if is None
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. At the moment a None
name only makes sense for DefKind::AssocTy
, so I don't want to accept other combinations that aren't necessary.
@bors r+ |
This PR fixes some confusing
kw::Empty
usage, fixing a crash test along the way.r? @spastorino