-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Provide correct parent for nested anon const #126228
Merged
Merged
Conversation
This file contains 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
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Jun 10, 2024
BoxyUwU
added
the
A-const-generics
Area: const generics (parameters and arguments)
label
Jun 10, 2024
compiler-errors
approved these changes
Jun 11, 2024
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.
Yep. This seems to me right. Thanks for the detailed comments 💞
@bors r+ |
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
Jun 11, 2024
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jun 12, 2024
…s, r=compiler-errors Provide correct parent for nested anon const Fixes rust-lang#126147 99% of this PR is just comments explaining what the issue is. `tcx.parent(` and `hir().get_parent_item(` give different results as the hir owner for all the hir of anon consts is the enclosing function. I didn't attempt to change that as being a hir owner requires a `DefId` and long term we want to stop creating anon consts' `DefId`s before hir ty lowering. So i just opted to change `generics_of` to use `tcx.parent` to get the parent for `AnonConst`'s. I'm not entirely sure about this being what we want, it does seem weird that we have two ways of getting the parent of an `AnonConst` and they both give different results. Alternatively we could just go ahead and make `const_evaluatable_unchecked` a hard error and stop providing generics to repeat exprs. Then this isn't an issue. (The FCW has been around for almost 4 years now) r? `@compiler-errors`
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 12, 2024
Rollup of 6 pull requests Successful merges: - rust-lang#123374 (DOC: Add FFI example for slice::from_raw_parts()) - rust-lang#126127 (Spell out other trait diagnostic) - rust-lang#126228 (Provide correct parent for nested anon const) - rust-lang#126249 (Simplify `[T; N]::try_map` signature) - rust-lang#126256 (Add {{target}} substitution to compiletest) - rust-lang#126263 (Make issue-122805.rs big endian compatible) r? `@ghost` `@rustbot` modify labels: rollup
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this pull request
Jun 12, 2024
…s, r=compiler-errors Provide correct parent for nested anon const Fixes rust-lang#126147 99% of this PR is just comments explaining what the issue is. `tcx.parent(` and `hir().get_parent_item(` give different results as the hir owner for all the hir of anon consts is the enclosing function. I didn't attempt to change that as being a hir owner requires a `DefId` and long term we want to stop creating anon consts' `DefId`s before hir ty lowering. So i just opted to change `generics_of` to use `tcx.parent` to get the parent for `AnonConst`'s. I'm not entirely sure about this being what we want, it does seem weird that we have two ways of getting the parent of an `AnonConst` and they both give different results. Alternatively we could just go ahead and make `const_evaluatable_unchecked` a hard error and stop providing generics to repeat exprs. Then this isn't an issue. (The FCW has been around for almost 4 years now) r? ``@compiler-errors``
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 12, 2024
…kingjubilee Rollup of 8 pull requests Successful merges: - rust-lang#123374 (DOC: Add FFI example for slice::from_raw_parts()) - rust-lang#126210 (docs(core): make more const_ptr doctests assert instead of printing) - rust-lang#126228 (Provide correct parent for nested anon const) - rust-lang#126242 (Simplify provider api to improve llvm ir) - rust-lang#126249 (Simplify `[T; N]::try_map` signature) - rust-lang#126256 (Add {{target}} substitution to compiletest) - rust-lang#126263 (Make issue-122805.rs big endian compatible) - rust-lang#126286 (Make `storage-live.rs` robust against rustc internal changes.) r? `@ghost` `@rustbot` modify labels: rollup
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this pull request
Jun 12, 2024
…s, r=compiler-errors Provide correct parent for nested anon const Fixes rust-lang#126147 99% of this PR is just comments explaining what the issue is. `tcx.parent(` and `hir().get_parent_item(` give different results as the hir owner for all the hir of anon consts is the enclosing function. I didn't attempt to change that as being a hir owner requires a `DefId` and long term we want to stop creating anon consts' `DefId`s before hir ty lowering. So i just opted to change `generics_of` to use `tcx.parent` to get the parent for `AnonConst`'s. I'm not entirely sure about this being what we want, it does seem weird that we have two ways of getting the parent of an `AnonConst` and they both give different results. Alternatively we could just go ahead and make `const_evaluatable_unchecked` a hard error and stop providing generics to repeat exprs. Then this isn't an issue. (The FCW has been around for almost 4 years now) r? ```@compiler-errors```
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 12, 2024
…llaumeGomez Rollup of 9 pull requests Successful merges: - rust-lang#126039 (Promote `arm64ec-pc-windows-msvc` to tier 2) - rust-lang#126075 (Remove `DebugWithInfcx` machinery) - rust-lang#126228 (Provide correct parent for nested anon const) - rust-lang#126232 (interpret: dyn trait metadata check: equate traits in a proper way) - rust-lang#126242 (Simplify provider api to improve llvm ir) - rust-lang#126294 (coverage: Replace the old span refiner with a single function) - rust-lang#126295 (No uninitalized report in a pre-returned match arm) - rust-lang#126312 (Update `rustc-perf` submodule) - rust-lang#126322 (Follow up to splitting core's PanicInfo and std's PanicInfo) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 12, 2024
Rollup merge of rust-lang#126228 - BoxyUwU:nested_repeat_expr_generics, r=compiler-errors Provide correct parent for nested anon const Fixes rust-lang#126147 99% of this PR is just comments explaining what the issue is. `tcx.parent(` and `hir().get_parent_item(` give different results as the hir owner for all the hir of anon consts is the enclosing function. I didn't attempt to change that as being a hir owner requires a `DefId` and long term we want to stop creating anon consts' `DefId`s before hir ty lowering. So i just opted to change `generics_of` to use `tcx.parent` to get the parent for `AnonConst`'s. I'm not entirely sure about this being what we want, it does seem weird that we have two ways of getting the parent of an `AnonConst` and they both give different results. Alternatively we could just go ahead and make `const_evaluatable_unchecked` a hard error and stop providing generics to repeat exprs. Then this isn't an issue. (The FCW has been around for almost 4 years now) r? ````@compiler-errors````
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-const-generics
Area: const generics (parameters and arguments)
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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.
Fixes #126147
99% of this PR is just comments explaining what the issue is.
tcx.parent(
andhir().get_parent_item(
give different results as the hir owner for all the hir of anon consts is the enclosing function. I didn't attempt to change that as being a hir owner requires aDefId
and long term we want to stop creating anon consts'DefId
s before hir ty lowering.So i just opted to change
generics_of
to usetcx.parent
to get the parent forAnonConst
's. I'm not entirely sure about this being what we want, it does seem weird that we have two ways of getting the parent of anAnonConst
and they both give different results.Alternatively we could just go ahead and make
const_evaluatable_unchecked
a hard error and stop providing generics to repeat exprs. Then this isn't an issue. (The FCW has been around for almost 4 years now)r? @compiler-errors