-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |