-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Reduce kw::Empty
usage, part 1
#137977
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Reduce kw::Empty
usage, part 1
#137977
Conversation
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 |
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+ |
…storino Reduce `kw::Empty` usage, part 1 This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way. r? `@spastorino`
…storino Reduce `kw::Empty` usage, part 1 This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way. r? ``@spastorino``
It's clearer than using `kw::Empty` to mean `None`.
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.
3ef8935
to
af92a33
Compare
I rebased. @bors r=spastorino |
…storino Reduce `kw::Empty` usage, part 1 This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way. r? `@spastorino`
…storino Reduce `kw::Empty` usage, part 1 This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way. r? ``@spastorino``
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#134797 (Ergonomic ref counting) - rust-lang#137549 (Clean up various LLVM FFI things in codegen_llvm) - rust-lang#137977 (Reduce `kw::Empty` usage, part 1) - rust-lang#138042 (Suggest struct or union to add generic that impls trait) - rust-lang#138141 (tests: fix some typos in comment) - rust-lang#138150 (Streamline HIR intravisit `visit_id` calls for items) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#137977 - nnethercote:less-kw-Empty-1, r=spastorino Reduce `kw::Empty` usage, part 1 This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way. r? ```@spastorino```
Changes required due to - rust-lang/rust#137977: Reduce `kw::Empty` usage, part 1 Resolves: model-checking#3932
Changes required due to - rust-lang/rust#137977: Reduce `kw::Empty` usage, part 1 Resolves: #3932 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
…storino Reduce `kw::Empty` usage, part 1 This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way. r? ```@spastorino```
PR rust-lang#137977 changed `DefPathData::TypeNs` to contain `Option<Symbol>` to account for RPITIT assoc types being anonymous. This commit changes it back to `Symbol` and gives anonymous assoc types their own variant. It makes things a bit nicer overall.
…ompiler-errors Tweak `DefPathData` Some improvements in and around `DefPathData`, following on from rust-lang#137977. r? `@spastorino`
Rollup merge of rust-lang#139662 - nnethercote:tweak-DefPathData, r=compiler-errors Tweak `DefPathData` Some improvements in and around `DefPathData`, following on from rust-lang#137977. r? `@spastorino`
PR rust-lang#137977 changed `DefPathData::TypeNs` to contain `Option<Symbol>` to account for RPITIT assoc types being anonymous. This commit changes it back to `Symbol` and gives anonymous assoc types their own variant. It makes things a bit nicer overall.
…ompiler-errors Tweak `DefPathData` Some improvements in and around `DefPathData`, following on from rust-lang#137977. r? `@spastorino`
This PR fixes some confusing
kw::Empty
usage, fixing a crash test along the way.r? @spastorino