forked from softdevteam/ykrustc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/rust-lang/rust into sync-…
…20201211 So as to inherit: rust-lang/rust#79375
- Loading branch information
Showing
59 changed files
with
635 additions
and
403 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Cannot use the associated type of | ||
a trait with uninferred generic parameters. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0212 | ||
pub trait Foo<T> { | ||
type A; | ||
fn get(&self, t: T) -> Self::A; | ||
} | ||
fn foo2<I : for<'x> Foo<&'x isize>>( | ||
field: I::A) {} // error! | ||
``` | ||
|
||
In this example, we have to instantiate `'x`, and | ||
we don't know what lifetime to instantiate it with. | ||
To fix this, spell out the precise lifetimes involved. | ||
Example: | ||
|
||
``` | ||
pub trait Foo<T> { | ||
type A; | ||
fn get(&self, t: T) -> Self::A; | ||
} | ||
fn foo3<I : for<'x> Foo<&'x isize>>( | ||
x: <I as Foo<&isize>>::A) {} // ok! | ||
fn foo4<'a, I : for<'x> Foo<&'x isize>>( | ||
x: <I as Foo<&'a isize>>::A) {} // ok! | ||
``` |
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
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
Oops, something went wrong.