-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Trait's types could not be determined #114057
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
Labels
C-bug
Category: This is a bug.
fixed-by-next-solver
Fixed by the next-generation trait solver, `-Znext-solver`.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
This one works okay: pub trait A {
type B;
fn m(b: Self::B);
}
pub trait C<'a> {
type D: 'a;
}
struct S;
impl<'a> C<'a> for S {
type D = ();
}
struct T<D: 'static> {
d: &'static D,
}
impl A for S
where
for<'a> S: C<'a> {
type B = T<<S as C<'static>>::D>;
fn m(b: Self::B) {
f(b.d)
}
}
fn f(d: &<S as C>::D) {}
fn main() {} |
This one also (Just proxying a type, that means that something strange with struct's generics): pub trait A {
type B;
fn m(b: Self::B);
}
pub trait C<'a> {
type D: 'a;
}
struct S;
impl<'a> C<'a> for S {
type D = ();
}
struct T1<D: 'static> {
d: &'static D,
}
type T<CG> = T1<<CG as C<'static>>::D>;
impl A for S
where
for<'a> S: C<'a> {
type B = T<S>;
fn m(b: Self::B) {
f(b.d);
}
}
fn f(d: &<S as C>::D) {}
fn main() {} |
This worked fine before 1.70.0 so it's a regression. |
minimized trait Bar<'a> {
type Assoc: 'static;
}
impl<'a> Bar<'a> for () {
type Assoc = ();
}
struct ImplsStatic<CG: Bar<'static>> {
d: &'static <CG as Bar<'static>>::Assoc,
}
fn caller(b: ImplsStatic<()>)
where
for<'a> (): Bar<'a>
{
let _: &<() as Bar<'static>>::Assoc = b.d;
}
fn main() {} |
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 4, 2023
Remove is global hack In attempt to fix rust-lang#114057 we found several issues with how compiler computes layouts, this change removes `is_global` from `and` to stop impl from being shadowed. In depth conversation can be read here https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Getting.20different.20types.20from.20almost.20same.20inputs This is a fix candidate opened for performance run. r? `@lcnr`
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium |
Once #116417 this will be fixed. |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
C-bug
Category: This is a bug.
fixed-by-next-solver
Fixed by the next-generation trait solver, `-Znext-solver`.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: