-
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
Associated const with supertrait associated type (named the same) causes ICE #93553
Comments
@rustbot prioritize nightly-to-beta regression |
ICE bisected to searched nightlies: from nightly-2021-12-12 to nightly-2022-02-01 bisected with cargo-bisect-rustc v0.6.1Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --start=2021-12-12 |
I'll take a stab at fixing this, unless @JulianKnodt (cc: #87648) wants to! @rustbot claim |
Hmmm actually this might make sense to be a miscompilation now, since it is kind of ambiguous. We probably should default to the old behavior, but @oli-obk not sure if that makes sense goin forward? |
So this is two bugs:
I know how to fix (2.), but I'll try to see if I can include something for (1.) as well... Otherwise I'll just put up the one-liner for (2.) |
mmm ok this is fair enough, edit: I guess I was just more worried that we'd have to introduce preference for types/consts here which may not have been defined previously |
Yeah, my understanding is that types and consts occupy mutually-exclusive positions in well-formed code, but we might not currently have the right information piped into path resolution to prefer resolving one over the other in cases like this. To demonstrate the issue, here is another regression in path resolution, which passes on Stable and fails on Nightly. Not an ICE, but not sure if we should be breaking existing code that compiles. trait Foo {
type Bar;
}
trait Baz: Foo {
const Bar: u32;
fn foo() -> Self::Bar;
} Happy to help work out a fix-forward, or defer that work to you if you're interested in whipping up a fix. Otherwise we might need to roll back #87648 (or at least gate its changes to path resolution behind the feature it introduces). |
since this only affects nightly, as long as we put in a fix, it should be ok to not rollback, I can try to look into that |
Cool! If you're gonna look into it, then I'll give the task to you. @rustbot release-assignment |
@rustbot claim |
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group. @rustbot label -I-prioritize +P-medium |
Fix ret > 1 bound if shadowed by const Prior to a change, it would only look at types in bounds. When it started looking for consts, shadowing type variables with a const would cause an ICE, so now defer looking at consts only if there are no types present. cc `@compiler-errors` Should Fix rust-lang#93553
Fix ret > 1 bound if shadowed by const Prior to a change, it would only look at types in bounds. When it started looking for consts, shadowing type variables with a const would cause an ICE, so now defer looking at consts only if there are no types present. cc ``@compiler-errors`` Should Fix rust-lang#93553
Fix ret > 1 bound if shadowed by const Prior to a change, it would only look at types in bounds. When it started looking for consts, shadowing type variables with a const would cause an ICE, so now defer looking at consts only if there are no types present. cc ```@compiler-errors``` Should Fix rust-lang#93553
Fix ret > 1 bound if shadowed by const Prior to a change, it would only look at types in bounds. When it started looking for consts, shadowing type variables with a const would cause an ICE, so now defer looking at consts only if there are no types present. cc ````@compiler-errors```` Should Fix rust-lang#93553
Fix ret > 1 bound if shadowed by const Prior to a change, it would only look at types in bounds. When it started looking for consts, shadowing type variables with a const would cause an ICE, so now defer looking at consts only if there are no types present. cc `````@compiler-errors````` Should Fix rust-lang#93553
Code
Meta
rust version:
(tried in the play.rust-lang.org playground)
This compiles successfully on the stable and beta channels.
Error output
Backtrace
The text was updated successfully, but these errors were encountered: