Skip to content
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

Merged
merged 3 commits into from
Mar 7, 2025
Merged

Conversation

nnethercote
Copy link
Contributor

This PR fixes some confusing kw::Empty usage, fixing a crash test along the way.

r? @spastorino

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 4, 2025
@nnethercote
Copy link
Contributor Author

Best reviewed one commit at a time.

@nnethercote nnethercote marked this pull request as ready for review March 4, 2025 05:35
@rustbot
Copy link
Collaborator

rustbot commented Mar 4, 2025

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

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

"crashtest no longer crashes/triggers ICE, horray! Please give it a meaningful \
"crashtest no longer crashes/triggers ICE, hooray! Please give it a meaningful \
Copy link
Member

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. 😆

Copy link
Member

@spastorino spastorino left a 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())),
Copy link
Member

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?

Copy link
Contributor Author

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.

@spastorino
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Mar 5, 2025

📌 Commit 3ef8935 has been approved by spastorino

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 5, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Mar 7, 2025
…storino

Reduce `kw::Empty` usage, part 1

This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way.

r? `@spastorino`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 7, 2025
…storino

Reduce `kw::Empty` usage, part 1

This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way.

r? ``@spastorino``
@jhpratt
Copy link
Member

jhpratt commented Mar 7, 2025

@bors r-

#138152 (comment)

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 7, 2025
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.
@nnethercote
Copy link
Contributor Author

I rebased.

@bors r=spastorino

@bors
Copy link
Contributor

bors commented Mar 7, 2025

📌 Commit af92a33 has been approved by spastorino

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 7, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 7, 2025
…storino

Reduce `kw::Empty` usage, part 1

This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way.

r? `@spastorino`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 7, 2025
…storino

Reduce `kw::Empty` usage, part 1

This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way.

r? ``@spastorino``
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 7, 2025
…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
@bors bors merged commit 0defc4f into rust-lang:master Mar 7, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 7, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 7, 2025
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```
@nnethercote nnethercote deleted the less-kw-Empty-1 branch March 9, 2025 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants