File tree Expand file tree Collapse file tree 5 files changed +107
-0
lines changed
tests/ui/associated-inherent-types Expand file tree Collapse file tree 5 files changed +107
-0
lines changed Original file line number Diff line number Diff line change 1+ // incremental
2+
3+ struct Wrapper < T > ( T ) ;
4+
5+ struct Local < T , U > ( T , U ) ;
6+
7+ impl < T > Local { //~ ERROR missing generics for struct `Local`
8+ type AssocType3 = T ; //~ ERROR inherent associated types are unstable
9+
10+ const WRAPPED_ASSOC_3 : Wrapper < Self :: AssocType3 > = Wrapper ( ) ;
11+ }
12+ //~^ ERROR `main` function not found
Original file line number Diff line number Diff line change 1+ error[E0601]: `main` function not found in crate `issue_109768`
2+ --> $DIR/issue-109768.rs:11:2
3+ |
4+ LL | }
5+ | ^ consider adding a `main` function to `$DIR/issue-109768.rs`
6+
7+ error[E0107]: missing generics for struct `Local`
8+ --> $DIR/issue-109768.rs:7:9
9+ |
10+ LL | impl<T> Local {
11+ | ^^^^^ expected 2 generic arguments
12+ |
13+ note: struct defined here, with 2 generic parameters: `T`, `U`
14+ --> $DIR/issue-109768.rs:5:8
15+ |
16+ LL | struct Local<T, U>(T, U);
17+ | ^^^^^ - -
18+ help: add missing generic arguments
19+ |
20+ LL | impl<T> Local<T, U> {
21+ | ++++++
22+
23+ error[E0658]: inherent associated types are unstable
24+ --> $DIR/issue-109768.rs:8:5
25+ |
26+ LL | type AssocType3 = T;
27+ | ^^^^^^^^^^^^^^^^^^^^
28+ |
29+ = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
30+ = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
31+
32+ error: aborting due to 3 previous errors
33+
34+ Some errors have detailed explanations: E0107, E0601, E0658.
35+ For more information about an error, try `rustc --explain E0107`.
Original file line number Diff line number Diff line change 1+ #![ feature( inherent_associated_types) ]
2+ #![ allow( incomplete_features) ]
3+
4+ struct Foo < T > ( T ) ;
5+
6+ impl Foo < fn ( & ' static ( ) ) > {
7+ type Assoc = u32 ;
8+ }
9+
10+ trait Other { }
11+ impl Other for u32 { }
12+
13+ // FIXME(inherent_associated_types): Avoid emitting two diagnostics (they only differ in span).
14+ // FIXME(inherent_associated_types): Enhancement: Spruce up the diagnostic by saying something like
15+ // "implementation is not general enough" as is done for traits via
16+ // `try_report_trait_placeholder_mismatch`.
17+
18+ fn bar ( _: Foo < for <' a > fn ( & ' a ( ) ) > :: Assoc ) { }
19+ //~^ ERROR mismatched types
20+ //~| ERROR mismatched types
21+
22+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0308]: mismatched types
2+ --> $DIR/issue-109789.rs:18:1
3+ |
4+ LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {}
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
6+ |
7+ = note: expected struct `Foo<fn(&'static ())>`
8+ found struct `Foo<for<'a> fn(&'a ())>`
9+
10+ error[E0308]: mismatched types
11+ --> $DIR/issue-109789.rs:18:11
12+ |
13+ LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {}
14+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
15+ |
16+ = note: expected struct `Foo<fn(&'static ())>`
17+ found struct `Foo<for<'a> fn(&'a ())>`
18+
19+ error: aborting due to 2 previous errors
20+
21+ For more information about this error, try `rustc --explain E0308`.
Original file line number Diff line number Diff line change 1+ // check-pass
2+
3+ #![ feature( inherent_associated_types) ]
4+ #![ allow( incomplete_features) ]
5+
6+ struct Foo < T > ( T ) ;
7+
8+ impl < ' a > Foo < fn ( & ' a ( ) ) > {
9+ type Assoc = & ' a ( ) ;
10+ }
11+
12+ trait Other { }
13+ impl Other for u32 { }
14+
15+ fn bar ( _: for <' a > fn ( Foo < fn ( & ' a ( ) ) > :: Assoc ) ) { }
16+
17+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments