-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]``#[feature(type_alias_impl_trait)]`
Description
#![feature(type_alias_impl_trait)]
type Tait<T> = impl Sized;
fn foo<T, U>(x: T) {
loop {
break;
let _: Tait<U> = String::new();
}
let _: Tait<T> = x;
}
this passes but should error. The issue is that when writing the opaque type into the TypeckResults
we drop the previous entry without comparing them for equality.
self.typeck_results.concrete_opaque_types.insert(opaque_type_key.def_id, hidden_type); |
normally this would get caught by borrowck which does handle them correctly, however Tait<U>
is defined in unreachable code so mir borrowck does not catch this.
we do explicitly check that the opaques from unreachable code are equal to the reachable ones but this check uses the opaques from hir typeck which means we again ignore Tait<U>
there.
compiler-errors
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]``#[feature(type_alias_impl_trait)]`