-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
ICE whilst experimenting with opaque/existential types. #70877
Comments
I can still reproduce the issue after a
|
Not completely sure, but I think this might be another example of this ICE (playground): #![feature(type_alias_impl_trait)]
pub trait Baz { }
impl Baz for () { }
type Qux = impl Baz;
pub trait Foo {
type Assoc;
}
impl Foo for () {
type Assoc = Qux;
}
type Bar = impl Foo<Assoc = Qux>;
fn assign() -> Bar {}
fn assign2() -> Qux {}
extern "C" {
pub fn lint_me() -> <Bar as Foo>::Assoc;
}
fn main() {} |
I've looked into this a little bit - I don't know what the correct behavior is, but hopefully this saves someone some time when they go to fix this (or someone can tell me what the correct behavior is and I can fix it). The following assumes the test case from my previous comment. This error is emitted during MIR type-check here: rust/src/librustc_mir/borrow_check/type_check/mod.rs Lines 1289 to 1295 in 4fb54ed
It happens when the rust/src/librustc_typeck/check/writeback.rs Line 486 in 4fb54ed
In particular, this case is when we're considering the rust/src/librustc_typeck/check/writeback.rs Lines 464 to 470 in 4fb54ed
This code exists to avoid considering #![feature(type_alias_impl_trait)]
trait TA {}
impl TA for () {}
type A = impl TA;
fn foo() -> A { } // defining use
fn foo1() -> A { foo() } // not a defining use
rust/src/librustc_typeck/check/mod.rs Lines 3274 to 3277 in 4fb54ed
That ends up at
This looks over the type (in this case, the return type, As a result of this, Because As I see it, there are two possible options here:
|
Triage: This is no longer ICE with the latest nightly, marking as E-needs-test. |
ICE whilst experimenting with opaque/existential types.
I tried this code:
I expected to see this happen:
"oof"
in stdoutInstead, this happened: ICE!
Meta
rustc --version --verbose
:Backtrace:
(The above backtrace but with
RUST_BACKTRACE="full"
)The text was updated successfully, but these errors were encountered: