Add regression test
This commit is contained in:
parent
ede0556ab5
commit
4e8d2f0040
30
tests/ui/methods/opaque_param_in_ufc.rs
Normal file
30
tests/ui/methods/opaque_param_in_ufc.rs
Normal file
@ -0,0 +1,30 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
struct Foo<T>(T);
|
||||
|
||||
impl Foo<u32> {
|
||||
fn method() {}
|
||||
fn method2(self) {}
|
||||
}
|
||||
|
||||
type Bar = impl Sized;
|
||||
|
||||
fn bar() -> Bar {
|
||||
42_u32
|
||||
}
|
||||
|
||||
impl Foo<Bar> {
|
||||
fn foo() -> Bar {
|
||||
Self::method();
|
||||
//~^ ERROR: no function or associated item named `method` found for struct `Foo<Bar>`
|
||||
Foo::<Bar>::method();
|
||||
//~^ ERROR: no function or associated item named `method` found for struct `Foo<Bar>`
|
||||
let x = Foo(bar());
|
||||
Foo::method2(x);
|
||||
let x = Self(bar());
|
||||
Self::method2(x);
|
||||
//~^ ERROR: no function or associated item named `method2` found for struct `Foo<Bar>`
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
36
tests/ui/methods/opaque_param_in_ufc.stderr
Normal file
36
tests/ui/methods/opaque_param_in_ufc.stderr
Normal file
@ -0,0 +1,36 @@
|
||||
error[E0599]: no function or associated item named `method` found for struct `Foo<Bar>` in the current scope
|
||||
--> $DIR/opaque_param_in_ufc.rs:17:15
|
||||
|
|
||||
LL | struct Foo<T>(T);
|
||||
| ------------- function or associated item `method` not found for this struct
|
||||
...
|
||||
LL | Self::method();
|
||||
| ^^^^^^ function or associated item not found in `Foo<Bar>`
|
||||
|
|
||||
= note: the function or associated item was found for
|
||||
- `Foo<u32>`
|
||||
|
||||
error[E0599]: no function or associated item named `method` found for struct `Foo<Bar>` in the current scope
|
||||
--> $DIR/opaque_param_in_ufc.rs:19:21
|
||||
|
|
||||
LL | struct Foo<T>(T);
|
||||
| ------------- function or associated item `method` not found for this struct
|
||||
...
|
||||
LL | Foo::<Bar>::method();
|
||||
| ^^^^^^ function or associated item not found in `Foo<Bar>`
|
||||
|
|
||||
= note: the function or associated item was found for
|
||||
- `Foo<u32>`
|
||||
|
||||
error[E0599]: no function or associated item named `method2` found for struct `Foo<Bar>` in the current scope
|
||||
--> $DIR/opaque_param_in_ufc.rs:24:15
|
||||
|
|
||||
LL | struct Foo<T>(T);
|
||||
| ------------- function or associated item `method2` not found for this struct
|
||||
...
|
||||
LL | Self::method2(x);
|
||||
| ^^^^^^^ function or associated item not found in `Foo<Bar>`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0599`.
|
Loading…
x
Reference in New Issue
Block a user