File tree 12 files changed +182
-0
lines changed
12 files changed +182
-0
lines changed Original file line number Diff line number Diff line change
1
+ pub trait Trait { }
Original file line number Diff line number Diff line change
1
+ pub trait Trait { }
2
+
3
+ impl Trait for ( ) { }
Original file line number Diff line number Diff line change
1
+ //! This test checks that we do need to implement
2
+ //! all members, even if their where bounds only hold
3
+ //! due to other impls.
4
+
5
+ trait Foo < T > {
6
+ fn foo ( )
7
+ where
8
+ Self : Foo < ( ) > ;
9
+ }
10
+
11
+ impl Foo < ( ) > for ( ) {
12
+ fn foo ( ) { }
13
+ }
14
+
15
+ impl Foo < u32 > for ( ) { }
16
+ //~^ ERROR: not all trait items implemented, missing: `foo`
17
+
18
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0046]: not all trait items implemented, missing: `foo`
2
+ --> $DIR/trivial_impl.rs:15:1
3
+ |
4
+ LL | / fn foo()
5
+ LL | | where
6
+ LL | | Self: Foo<()>;
7
+ | |______________________- `foo` from trait
8
+ ...
9
+ LL | impl Foo<u32> for () {}
10
+ | ^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
11
+
12
+ error: aborting due to previous error
13
+
14
+ For more information about this error, try `rustc --explain E0046`.
Original file line number Diff line number Diff line change
1
+ //! This test checks that we currently need to implement
2
+ //! members, even if their where bounds don't hold for the impl type.
3
+
4
+ trait Foo < T > {
5
+ fn foo ( )
6
+ where
7
+ Self : Foo < ( ) > ;
8
+ }
9
+
10
+ impl Foo < u32 > for ( ) { }
11
+ //~^ ERROR: not all trait items implemented, missing: `foo`
12
+
13
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0046]: not all trait items implemented, missing: `foo`
2
+ --> $DIR/trivial_impl2.rs:10:1
3
+ |
4
+ LL | / fn foo()
5
+ LL | | where
6
+ LL | | Self: Foo<()>;
7
+ | |______________________- `foo` from trait
8
+ ...
9
+ LL | impl Foo<u32> for () {}
10
+ | ^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
11
+
12
+ error: aborting due to previous error
13
+
14
+ For more information about this error, try `rustc --explain E0046`.
Original file line number Diff line number Diff line change
1
+ //! Check that we don't break orphan rules.
2
+ //! The dependency may add an impl for `u8` later,
3
+ //! which would break this crate. We want to avoid adding
4
+ //! more ways in which adding an impl can be a breaking change.
5
+
6
+ // aux-build:trivial3.rs
7
+
8
+ extern crate trivial3;
9
+
10
+ pub trait Foo {
11
+ fn foo ( )
12
+ where
13
+ Self : trivial3:: Trait ;
14
+ }
15
+
16
+ impl Foo for u8 { }
17
+ //~^ ERROR not all trait items implemented, missing: `foo`
18
+
19
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0046]: not all trait items implemented, missing: `foo`
2
+ --> $DIR/trivial_impl3.rs:16:1
3
+ |
4
+ LL | / fn foo()
5
+ LL | | where
6
+ LL | | Self: trivial3::Trait;
7
+ | |______________________________- `foo` from trait
8
+ ...
9
+ LL | impl Foo for u8 {}
10
+ | ^^^^^^^^^^^^^^^ missing `foo` in implementation
11
+
12
+ error: aborting due to previous error
13
+
14
+ For more information about this error, try `rustc --explain E0046`.
Original file line number Diff line number Diff line change
1
+ //! Check that we don't break orphan rules.
2
+ //! The dependency may add an impl for `u8` later,
3
+ //! which would break this crate. We want to avoid adding
4
+ //! more ways in which adding an impl can be a breaking change.
5
+ //! This test differs from `trivial_impl3` because there actually
6
+ //! exists any impl for `Trait`, which has an effect on coherence.
7
+
8
+ // aux-build:trivial4.rs
9
+
10
+ extern crate trivial4;
11
+
12
+ pub trait Foo {
13
+ fn foo ( )
14
+ where
15
+ Self : trivial4:: Trait ;
16
+ }
17
+
18
+ impl Foo for u8 { }
19
+ //~^ ERROR not all trait items implemented, missing: `foo`
20
+
21
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0046]: not all trait items implemented, missing: `foo`
2
+ --> $DIR/trivial_impl4.rs:18:1
3
+ |
4
+ LL | / fn foo()
5
+ LL | | where
6
+ LL | | Self: trivial4::Trait;
7
+ | |______________________________- `foo` from trait
8
+ ...
9
+ LL | impl Foo for u8 {}
10
+ | ^^^^^^^^^^^^^^^ missing `foo` in implementation
11
+
12
+ error: aborting due to previous error
13
+
14
+ For more information about this error, try `rustc --explain E0046`.
Original file line number Diff line number Diff line change
1
+ //! This test checks that we currently need to implement
2
+ //! members, even if their where bounds don't hold for the impl type.
3
+
4
+ trait Foo {
5
+ fn foo ( )
6
+ where
7
+ Self : Sized ;
8
+ }
9
+
10
+ impl Foo for ( ) {
11
+ fn foo ( ) { }
12
+ }
13
+
14
+ // Must not be allowed
15
+ impl Foo for i32 { }
16
+ //~^ ERROR: not all trait items implemented, missing: `foo`
17
+
18
+ // Should be allowed
19
+ impl Foo for dyn std:: fmt:: Debug { }
20
+ //~^ ERROR: not all trait items implemented, missing: `foo`
21
+
22
+ impl Foo for dyn std:: fmt:: Display {
23
+ fn foo ( ) { }
24
+ }
25
+
26
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0046]: not all trait items implemented, missing: `foo`
2
+ --> $DIR/trivial_impl_sized.rs:15:1
3
+ |
4
+ LL | / fn foo()
5
+ LL | | where
6
+ LL | | Self: Sized;
7
+ | |____________________- `foo` from trait
8
+ ...
9
+ LL | impl Foo for i32 {}
10
+ | ^^^^^^^^^^^^^^^^ missing `foo` in implementation
11
+
12
+ error[E0046]: not all trait items implemented, missing: `foo`
13
+ --> $DIR/trivial_impl_sized.rs:19:1
14
+ |
15
+ LL | / fn foo()
16
+ LL | | where
17
+ LL | | Self: Sized;
18
+ | |____________________- `foo` from trait
19
+ ...
20
+ LL | impl Foo for dyn std::fmt::Debug {}
21
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
22
+
23
+ error: aborting due to 2 previous errors
24
+
25
+ For more information about this error, try `rustc --explain E0046`.
You can’t perform that action at this time.
0 commit comments