-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
5 changed files
with
107 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,12 @@ | ||
// incremental | ||
|
||
struct Wrapper<T>(T); | ||
|
||
struct Local<T, U>(T, U); | ||
|
||
impl<T> Local { //~ ERROR missing generics for struct `Local` | ||
type AssocType3 = T; //~ ERROR inherent associated types are unstable | ||
|
||
const WRAPPED_ASSOC_3: Wrapper<Self::AssocType3> = Wrapper(); | ||
} | ||
//~^ ERROR `main` function not found |
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 @@ | ||
error[E0601]: `main` function not found in crate `issue_109768` | ||
--> $DIR/issue-109768.rs:11:2 | ||
| | ||
LL | } | ||
| ^ consider adding a `main` function to `$DIR/issue-109768.rs` | ||
|
||
error[E0107]: missing generics for struct `Local` | ||
--> $DIR/issue-109768.rs:7:9 | ||
| | ||
LL | impl<T> Local { | ||
| ^^^^^ expected 2 generic arguments | ||
| | ||
note: struct defined here, with 2 generic parameters: `T`, `U` | ||
--> $DIR/issue-109768.rs:5:8 | ||
| | ||
LL | struct Local<T, U>(T, U); | ||
| ^^^^^ - - | ||
help: add missing generic arguments | ||
| | ||
LL | impl<T> Local<T, U> { | ||
| ++++++ | ||
|
||
error[E0658]: inherent associated types are unstable | ||
--> $DIR/issue-109768.rs:8:5 | ||
| | ||
LL | type AssocType3 = T; | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information | ||
= help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0107, E0601, E0658. | ||
For more information about an error, try `rustc --explain E0107`. |
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,22 @@ | ||
#![feature(inherent_associated_types)] | ||
#![allow(incomplete_features)] | ||
|
||
struct Foo<T>(T); | ||
|
||
impl Foo<fn(&'static ())> { | ||
type Assoc = u32; | ||
} | ||
|
||
trait Other {} | ||
impl Other for u32 {} | ||
|
||
// FIXME(inherent_associated_types): Avoid emitting two diagnostics (they only differ in span). | ||
// FIXME(inherent_associated_types): Enhancement: Spruce up the diagnostic by saying something like | ||
// "implementation is not general enough" as is done for traits via | ||
// `try_report_trait_placeholder_mismatch`. | ||
|
||
fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} | ||
//~^ ERROR mismatched types | ||
//~| ERROR mismatched types | ||
|
||
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,21 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-109789.rs:18:1 | ||
| | ||
LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | ||
| | ||
= note: expected struct `Foo<fn(&'static ())>` | ||
found struct `Foo<for<'a> fn(&'a ())>` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-109789.rs:18:11 | ||
| | ||
LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | ||
| | ||
= note: expected struct `Foo<fn(&'static ())>` | ||
found struct `Foo<for<'a> fn(&'a ())>` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
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,17 @@ | ||
// check-pass | ||
|
||
#![feature(inherent_associated_types)] | ||
#![allow(incomplete_features)] | ||
|
||
struct Foo<T>(T); | ||
|
||
impl<'a> Foo<fn(&'a ())> { | ||
type Assoc = &'a (); | ||
} | ||
|
||
trait Other {} | ||
impl Other for u32 {} | ||
|
||
fn bar(_: for<'a> fn(Foo<fn(&'a ())>::Assoc)) {} | ||
|
||
fn main() {} |