-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Do not feed anon const a type that references generics that it does not have #138256
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
Conversation
HIR ty lowering was modified cc @fmease |
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.
This makes sense. It's not like such an anon const could even type check without itself being able to refer to generic parameters in the first place lol.
I guess the only reason we don't just delay a bug here is we have to feed something for the type_of
and feeding an error const might cause us to just silence type checking errors for the anon const (e.g. we have no way to feed a type that is never equal to what the user could have written... I guess that's not true but no nice way)
// We also error if the type contains any regions as effectively any region will wind | ||
// up as a region variable in mir borrowck. It would also be somewhat concerning if | ||
// hir typeck was using equality but mir borrowck wound up using subtyping as that could | ||
// result in a non-infer in hir typeck but a region variable in borrowck. |
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.
u moved this comment but I don't think this makes any sense here? this error is about non region stuff whereas the comment is about erroring on stuff involving regions
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.
Wrong comment on wrong block, meant to slice it up so each exception was commented individually but copied wrong lol
eb679ee
to
3cd3df2
Compare
This comment has been minimized.
This comment has been minimized.
3cd3df2
to
ed6dfdd
Compare
This PR changes a file inside |
@bors r+ rollup |
…oxyUwU Do not feed anon const a type that references generics that it does not have Fixes rust-lang#137865 See the comment I left in the code. We could alternatively give these anon consts the generics from the parent, but that would be moving in a GCE-esque direction that we may not want. Open to tweaks here. r? BoxyUwU
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#137715 (Allow int literals for pattern types with int base types) - rust-lang#138002 (Disable CFI for weakly linked syscalls) - rust-lang#138051 (Add support for downloading GCC from CI) - rust-lang#138231 (Prevent ICE in autodiff validation by emitting user-friendly errors) - rust-lang#138245 (stabilize `ci_rustc_if_unchanged_logic` test for local environments) - rust-lang#138256 (Do not feed anon const a type that references generics that it does not have) - rust-lang#138284 (Do not write user type annotation for const param value path) - rust-lang#138296 (Remove `AdtFlags::IS_ANONYMOUS` and `Copy`/`Clone` condition for anonymous ADT) - rust-lang#138352 (miri native_calls: ensure we actually expose *mutable* provenance to the memory FFI can access) - rust-lang#138354 (remove redundant `body` arguments) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#137715 (Allow int literals for pattern types with int base types) - rust-lang#138002 (Disable CFI for weakly linked syscalls) - rust-lang#138051 (Add support for downloading GCC from CI) - rust-lang#138231 (Prevent ICE in autodiff validation by emitting user-friendly errors) - rust-lang#138245 (stabilize `ci_rustc_if_unchanged_logic` test for local environments) - rust-lang#138256 (Do not feed anon const a type that references generics that it does not have) - rust-lang#138284 (Do not write user type annotation for const param value path) - rust-lang#138296 (Remove `AdtFlags::IS_ANONYMOUS` and `Copy`/`Clone` condition for anonymous ADT) - rust-lang#138352 (miri native_calls: ensure we actually expose *mutable* provenance to the memory FFI can access) - rust-lang#138354 (remove redundant `body` arguments) r? `@ghost` `@rustbot` modify labels: rollup
Fixes #137865
See the comment I left in the code. We could alternatively give these anon consts the generics from the parent, but that would be moving in a GCE-esque direction that we may not want. Open to tweaks here.
r? BoxyUwU