-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
account for self type when looking for source of unsolved ty var
- Loading branch information
Showing
5 changed files
with
52 additions
and
5 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
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
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
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,25 @@ | ||
// Test that we show the correct type parameter that couldn't be inferred and that we don't | ||
// end up stating nonsense like "type parameter `'a`" which we used to do. | ||
|
||
trait Trait<'a, T> { | ||
fn m(self); | ||
} | ||
|
||
impl<'a, A> Trait<'a, A> for () { | ||
fn m(self) {} | ||
} | ||
|
||
fn qualified() { | ||
<() as Trait<'static, _>>::m(()); | ||
//~^ ERROR type annotations needed | ||
//~| NOTE cannot infer type of the type parameter `T` | ||
|
||
} | ||
|
||
fn unqualified() { | ||
Trait::<'static, _>::m(()); | ||
//~^ ERROR type annotations needed | ||
//~| NOTE cannot infer type of the type parameter `T` | ||
} | ||
|
||
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,15 @@ | ||
error[E0282]: type annotations needed | ||
--> $DIR/issue-109905.rs:13:5 | ||
| | ||
LL | <() as Trait<'static, _>>::m(()); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the trait `Trait` | ||
|
||
error[E0282]: type annotations needed | ||
--> $DIR/issue-109905.rs:20:5 | ||
| | ||
LL | Trait::<'static, _>::m(()); | ||
| ^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the trait `Trait` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0282`. |