Make the error for opaque types that have no hidden types a bit informative
This commit is contained in:
parent
4d2e965106
commit
29c8732436
45 changed files with 115 additions and 56 deletions
|
|
@ -724,7 +724,12 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
|
|||
Some((_, ty)) => ty,
|
||||
None => {
|
||||
let span = tcx.def_span(def_id);
|
||||
tcx.sess.span_err(span, "could not find defining uses");
|
||||
let name = tcx.item_name(tcx.parent(def_id.to_def_id()).unwrap());
|
||||
let label = format!(
|
||||
"`{}` must be used in combination with a concrete type within the same module",
|
||||
name
|
||||
);
|
||||
tcx.sess.struct_span_err(span, "unconstrained opaque type").note(&label).emit();
|
||||
tcx.ty_error()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub trait Trait2 {
|
|||
|
||||
impl<'c, S: Trait2> Trait2 for &'c mut S {
|
||||
type FooFuture<'a> = impl Trait1;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
fn foo<'a>() -> Self::FooFuture<'a> {
|
||||
Struct(unimplemented!())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/issue-87258_a.rs:18:26
|
||||
|
|
||||
LL | type FooFuture<'a> = impl Trait1;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `FooFuture` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ pub trait Trait2 {
|
|||
}
|
||||
|
||||
type Helper<'xenon, 'yttrium, KABOOM: Trait2> = impl Trait1;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
|
||||
impl<'c, S: Trait2> Trait2 for &'c mut S {
|
||||
type FooFuture<'a> = Helper<'c, 'a, S>;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/issue-87258_b.rs:17:49
|
||||
|
|
||||
LL | type Helper<'xenon, 'yttrium, KABOOM: Trait2> = impl Trait1;
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: `Helper` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ struct C;
|
|||
impl<'a> A<'a> for C {
|
||||
type B<'b> = impl Clone;
|
||||
//~^ ERROR: lifetime bound not satisfied
|
||||
//~| ERROR: could not find defining uses
|
||||
//~| ERROR: unconstrained opaque type
|
||||
|
||||
fn a(&'a self) -> Self::B<'a> {} //~ ERROR: non-defining opaque type use in defining scope
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,11 +29,13 @@ LL | impl<'a> A<'a> for C {
|
|||
LL | type B<'b> = impl Clone;
|
||||
| ^^
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/issue-88595.rs:19:18
|
||||
|
|
||||
LL | type B<'b> = impl Clone;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `B` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
mod a {
|
||||
type Foo = impl PartialEq<(Foo, i32)>;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
|
||||
struct Bar;
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ mod a {
|
|||
|
||||
mod b {
|
||||
type Foo = impl PartialEq<(Foo, i32)>;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
|
||||
struct Bar;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,18 @@
|
|||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:4:16
|
||||
|
|
||||
LL | type Foo = impl PartialEq<(Foo, i32)>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `Foo` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:17:16
|
||||
|
|
||||
LL | type Foo = impl PartialEq<(Foo, i32)>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `Foo` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
type A = impl Foo;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
type B = impl Foo;
|
||||
|
||||
trait Foo {}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/two_tait_defining_each_other2.rs:3:10
|
||||
|
|
||||
LL | type A = impl Foo;
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: `A` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ impl Trait for () {
|
|||
type T = Self;
|
||||
|
||||
#[inline] //~ ERROR attribute should be applied to function or closure
|
||||
type U = impl Trait; //~ ERROR could not find defining uses
|
||||
type U = impl Trait; //~ ERROR unconstrained opaque type
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -61,11 +61,13 @@ LL | #[inline]
|
|||
LL | type T;
|
||||
| ------- not a function or closure
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/inline-trait-and-foreign-items.rs:26:14
|
||||
|
|
||||
LL | type U = impl Trait;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `U` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to 6 previous errors; 2 warnings emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ trait T {
|
|||
}
|
||||
|
||||
type Foo = impl T;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
|
||||
fn a() -> Foo {
|
||||
// This is not a defining use, it doesn't actually constrain the opaque type.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/impl_trait_fallback3.rs:9:12
|
||||
|
|
||||
LL | type Foo = impl T;
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `Foo` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ trait Service {
|
|||
struct Struct;
|
||||
|
||||
impl Service for Struct {
|
||||
type Future = impl Trait; //~ ERROR: could not find defining uses
|
||||
type Future = impl Trait; //~ ERROR: unconstrained opaque type
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/issue-68621.rs:14:19
|
||||
|
|
||||
LL | type Future = impl Trait;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `Future` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ trait TraitWithAssoc {
|
|||
}
|
||||
|
||||
type Foo<V> = impl Trait<V>;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
|
||||
trait Trait<U> {}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@ note: used non-generic type `<T as TraitWithAssoc>::Assoc` for generic parameter
|
|||
LL | type Foo<V> = impl Trait<V>;
|
||||
| ^
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/bound_reduction2.rs:9:15
|
||||
|
|
||||
LL | type Foo<V> = impl Trait<V>;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `Foo` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
type X<'a> = impl Into<&'static str> + From<&'a str>;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
|
||||
fn f<'a: 'static>(t: &'a str) -> X<'a> {
|
||||
//~^ WARNING unnecessary lifetime parameter
|
||||
|
|
|
|||
|
|
@ -15,11 +15,13 @@ LL | type X<'a> = impl Into<&'static str> + From<&'a str>;
|
|||
LL | t
|
||||
| ^
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/bounds-are-checked.rs:6:14
|
||||
|
|
||||
LL | type X<'a> = impl Into<&'static str> + From<&'a str>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `X` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@
|
|||
fn main() {}
|
||||
|
||||
// declared but never defined
|
||||
type Bar = impl std::fmt::Debug; //~ ERROR could not find defining uses
|
||||
type Bar = impl std::fmt::Debug; //~ ERROR unconstrained opaque type
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/declared_but_never_defined.rs:6:12
|
||||
|
|
||||
LL | type Bar = impl std::fmt::Debug;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `Bar` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ fn main() {}
|
|||
|
||||
mod boo {
|
||||
// declared in module but not defined inside of it
|
||||
pub type Boo = impl ::std::fmt::Debug; //~ ERROR could not find defining uses
|
||||
pub type Boo = impl ::std::fmt::Debug; //~ ERROR unconstrained opaque type
|
||||
}
|
||||
|
||||
fn bomp() -> boo::Boo {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/declared_but_not_defined_in_scope.rs:7:20
|
||||
|
|
||||
LL | pub type Boo = impl ::std::fmt::Debug;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `Boo` must be used in combination with a concrete type within the same module
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/declared_but_not_defined_in_scope.rs:11:5
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
fn main() {}
|
||||
|
||||
type Two<'a, 'b> = impl std::fmt::Debug;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
|
||||
fn one<'a>(t: &'a ()) -> Two<'a, 'a> {
|
||||
t
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@ note: lifetime used multiple times
|
|||
LL | type Two<'a, 'b> = impl std::fmt::Debug;
|
||||
| ^^ ^^
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/generic_duplicate_lifetime_param.rs:5:20
|
||||
|
|
||||
LL | type Two<'a, 'b> = impl std::fmt::Debug;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `Two` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ fn main() {}
|
|||
|
||||
// test that unused generic parameters are ok
|
||||
type TwoTys<T, U> = impl Debug;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
type TwoLifetimes<'a, 'b> = impl Debug;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
type TwoConsts<const X: usize, const Y: usize> = impl Debug;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
|
||||
fn one_ty<T: Debug>(t: T) -> TwoTys<T, T> {
|
||||
t
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@ note: type used multiple times
|
|||
LL | type TwoTys<T, U> = impl Debug;
|
||||
| ^ ^
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/generic_duplicate_param_use.rs:8:21
|
||||
|
|
||||
LL | type TwoTys<T, U> = impl Debug;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `TwoTys` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: non-defining opaque type use in defining scope
|
||||
--> $DIR/generic_duplicate_param_use.rs:21:5
|
||||
|
|
@ -28,11 +30,13 @@ note: lifetime used multiple times
|
|||
LL | type TwoLifetimes<'a, 'b> = impl Debug;
|
||||
| ^^ ^^
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/generic_duplicate_param_use.rs:10:29
|
||||
|
|
||||
LL | type TwoLifetimes<'a, 'b> = impl Debug;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `TwoLifetimes` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: non-defining opaque type use in defining scope
|
||||
--> $DIR/generic_duplicate_param_use.rs:26:5
|
||||
|
|
@ -46,11 +50,13 @@ note: constant used multiple times
|
|||
LL | type TwoConsts<const X: usize, const Y: usize> = impl Debug;
|
||||
| ^ ^
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/generic_duplicate_param_use.rs:12:50
|
||||
|
|
||||
LL | type TwoConsts<const X: usize, const Y: usize> = impl Debug;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `TwoConsts` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ use std::fmt::Debug;
|
|||
fn main() {}
|
||||
|
||||
type OneTy<T> = impl Debug;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
type OneLifetime<'a> = impl Debug;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
type OneConst<const X: usize> = impl Debug;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
|
||||
// Not defining uses, because they doesn't define *all* possible generics.
|
||||
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@ note: used non-generic type `u32` for generic parameter
|
|||
LL | type OneTy<T> = impl Debug;
|
||||
| ^
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/generic_nondefining_use.rs:7:17
|
||||
|
|
||||
LL | type OneTy<T> = impl Debug;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `OneTy` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: non-defining opaque type use in defining scope
|
||||
--> $DIR/generic_nondefining_use.rs:22:5
|
||||
|
|
@ -25,11 +27,13 @@ LL | type OneLifetime<'a> = impl Debug;
|
|||
LL | 6u32
|
||||
| ^^^^
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/generic_nondefining_use.rs:9:24
|
||||
|
|
||||
LL | type OneLifetime<'a> = impl Debug;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `OneLifetime` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: non-defining opaque type use in defining scope
|
||||
--> $DIR/generic_nondefining_use.rs:27:5
|
||||
|
|
@ -43,11 +47,13 @@ note: used non-generic constant `123_usize` for generic parameter
|
|||
LL | type OneConst<const X: usize> = impl Debug;
|
||||
| ^
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/generic_nondefining_use.rs:11:33
|
||||
|
|
||||
LL | type OneConst<const X: usize> = impl Debug;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `OneConst` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ trait IterBits {
|
|||
}
|
||||
|
||||
type IterBitsIter<T, E, I> = impl std::iter::Iterator<Item = I>;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
|
||||
impl<T: Copy, E> IterBits for T
|
||||
where
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@ note: used non-generic type `u8` for generic parameter
|
|||
LL | type IterBitsIter<T, E, I> = impl std::iter::Iterator<Item = I>;
|
||||
| ^
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/issue-60564.rs:8:30
|
||||
|
|
||||
LL | type IterBitsIter<T, E, I> = impl std::iter::Iterator<Item = I>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `IterBitsIter` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#![feature(type_alias_impl_trait)]
|
||||
trait Trait<T> {}
|
||||
type Alias<'a, U> = impl Trait<U>;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
fn f<'a>() -> Alias<'a, ()> {}
|
||||
//~^ ERROR non-defining opaque type use in defining scope
|
||||
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@ note: used non-generic type `()` for generic parameter
|
|||
LL | type Alias<'a, U> = impl Trait<U>;
|
||||
| ^
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/issue-68368-non-defining-use-2.rs:7:21
|
||||
|
|
||||
LL | type Alias<'a, U> = impl Trait<U>;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `Alias` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#![feature(type_alias_impl_trait)]
|
||||
trait Trait<T> {}
|
||||
type Alias<'a, U> = impl Trait<U>;
|
||||
//~^ ERROR could not find defining uses
|
||||
//~^ ERROR unconstrained opaque type
|
||||
fn f<'a>() -> Alias<'a, ()> {}
|
||||
//~^ ERROR non-defining opaque type use in defining scope
|
||||
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@ note: used non-generic type `()` for generic parameter
|
|||
LL | type Alias<'a, U> = impl Trait<U>;
|
||||
| ^
|
||||
|
||||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/issue-68368-non-defining-use.rs:7:21
|
||||
|
|
||||
LL | type Alias<'a, U> = impl Trait<U>;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `Alias` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
use std::fmt::Debug;
|
||||
|
||||
type FooX = impl Debug;
|
||||
//~^ could not find defining uses
|
||||
//~^ unconstrained opaque type
|
||||
|
||||
trait Foo<A> { }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/nested-tait-inference3.rs:6:13
|
||||
|
|
||||
LL | type FooX = impl Debug;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `FooX` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
// Issue 52985: user code provides no use case that allows a type alias `impl Trait`
|
||||
// We now emit a 'could not find defining uses' error
|
||||
// We now emit a 'unconstrained opaque type' error
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
type Foo = impl Copy; //~ could not find defining uses
|
||||
type Foo = impl Copy; //~ unconstrained opaque type
|
||||
|
||||
// make compiler happy about using 'Foo'
|
||||
fn bar(x: Foo) -> Foo {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/no_inferrable_concrete_type.rs:6:12
|
||||
|
|
||||
LL | type Foo = impl Copy;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: `Foo` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
type Foo = impl Fn() -> Foo;
|
||||
//~^ ERROR: could not find defining uses
|
||||
//~^ ERROR: unconstrained opaque type
|
||||
|
||||
fn crash(x: Foo) -> Foo {
|
||||
x
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/type-alias-impl-trait-with-cycle-error.rs:3:12
|
||||
|
|
||||
LL | type Foo = impl Fn() -> Foo;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `Foo` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ pub trait Bar<T> {
|
|||
}
|
||||
|
||||
type Foo = impl Bar<Foo, Item = Foo>;
|
||||
//~^ ERROR: could not find defining uses
|
||||
//~^ ERROR: unconstrained opaque type
|
||||
|
||||
fn crash(x: Foo) -> Foo {
|
||||
x
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
error: could not find defining uses
|
||||
error: unconstrained opaque type
|
||||
--> $DIR/type-alias-impl-trait-with-cycle-error2.rs:7:12
|
||||
|
|
||||
LL | type Foo = impl Bar<Foo, Item = Foo>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `Foo` must be used in combination with a concrete type within the same module
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue