From 86c8eae7745b47ada8305dcdac16b7f2dbdd68c9 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Wed, 26 Jun 2024 16:01:38 +0000 Subject: Automatically taint InferCtxt when errors are emitted --- tests/ui/const-generics/generic_const_exprs/opaque_type.rs | 1 + .../const-generics/generic_const_exprs/opaque_type.stderr | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'tests/ui/const-generics/generic_const_exprs') diff --git a/tests/ui/const-generics/generic_const_exprs/opaque_type.rs b/tests/ui/const-generics/generic_const_exprs/opaque_type.rs index 56b8acbf88c..7209290a36e 100644 --- a/tests/ui/const-generics/generic_const_exprs/opaque_type.rs +++ b/tests/ui/const-generics/generic_const_exprs/opaque_type.rs @@ -2,6 +2,7 @@ #![allow(incomplete_features)] type Foo = impl Sized; +//~^ ERROR: unconstrained opaque type fn with_bound() -> Foo where diff --git a/tests/ui/const-generics/generic_const_exprs/opaque_type.stderr b/tests/ui/const-generics/generic_const_exprs/opaque_type.stderr index e9fb8c0f403..c7a266205b4 100644 --- a/tests/ui/const-generics/generic_const_exprs/opaque_type.stderr +++ b/tests/ui/const-generics/generic_const_exprs/opaque_type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/opaque_type.rs:10:17 + --> $DIR/opaque_type.rs:11:17 | LL | type Foo = impl Sized; | ---------- the found opaque type @@ -11,12 +11,20 @@ LL | let _: [u8; (N / 2) as Foo] = [0; (N / 2) as usize]; found opaque type `Foo` error[E0605]: non-primitive cast: `usize` as `Foo` - --> $DIR/opaque_type.rs:10:17 + --> $DIR/opaque_type.rs:11:17 | LL | let _: [u8; (N / 2) as Foo] = [0; (N / 2) as usize]; | ^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object -error: aborting due to 2 previous errors +error: unconstrained opaque type + --> $DIR/opaque_type.rs:4:12 + | +LL | type Foo = impl Sized; + | ^^^^^^^^^^ + | + = note: `Foo` must be used in combination with a concrete type within the same module + +error: aborting due to 3 previous errors Some errors have detailed explanations: E0308, E0605. For more information about an error, try `rustc --explain E0308`. -- cgit 1.4.1-3-g733a5