-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from dtolnay/compiletest
Add ui test for missing DynClone supertrait
- Loading branch information
Showing
4 changed files
with
71 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
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,7 @@ | ||
#[rustversion::attr(not(nightly), ignore)] | ||
#[cfg_attr(miri, ignore)] | ||
#[test] | ||
fn ui() { | ||
let t = trybuild::TestCases::new(); | ||
t.compile_fail("tests/ui/*.rs"); | ||
} |
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,5 @@ | ||
pub trait MyTrait {} | ||
|
||
dyn_clone::clone_trait_object!(MyTrait); | ||
|
||
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,55 @@ | ||
error[E0277]: the trait bound `dyn MyTrait: Clone` is not satisfied | ||
--> tests/ui/missing-supertrait.rs:3:1 | ||
| | ||
3 | dyn_clone::clone_trait_object!(MyTrait); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `dyn MyTrait` | ||
| | ||
= note: required because of the requirements on the impl of `DynClone` for `dyn MyTrait` | ||
note: required by a bound in `clone_box` | ||
--> src/lib.rs | ||
| | ||
| T: ?Sized + DynClone, | ||
| ^^^^^^^^ required by this bound in `clone_box` | ||
= note: this error originates in the macro `$crate::__internal_clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the trait bound `dyn MyTrait + Send: Clone` is not satisfied | ||
--> tests/ui/missing-supertrait.rs:3:1 | ||
| | ||
3 | dyn_clone::clone_trait_object!(MyTrait); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `dyn MyTrait + Send` | ||
| | ||
= note: required because of the requirements on the impl of `DynClone` for `dyn MyTrait + Send` | ||
note: required by a bound in `clone_box` | ||
--> src/lib.rs | ||
| | ||
| T: ?Sized + DynClone, | ||
| ^^^^^^^^ required by this bound in `clone_box` | ||
= note: this error originates in the macro `$crate::__internal_clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the trait bound `dyn MyTrait + Sync: Clone` is not satisfied | ||
--> tests/ui/missing-supertrait.rs:3:1 | ||
| | ||
3 | dyn_clone::clone_trait_object!(MyTrait); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `dyn MyTrait + Sync` | ||
| | ||
= note: required because of the requirements on the impl of `DynClone` for `dyn MyTrait + Sync` | ||
note: required by a bound in `clone_box` | ||
--> src/lib.rs | ||
| | ||
| T: ?Sized + DynClone, | ||
| ^^^^^^^^ required by this bound in `clone_box` | ||
= note: this error originates in the macro `$crate::__internal_clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the trait bound `dyn MyTrait + Send + Sync: Clone` is not satisfied | ||
--> tests/ui/missing-supertrait.rs:3:1 | ||
| | ||
3 | dyn_clone::clone_trait_object!(MyTrait); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `dyn MyTrait + Send + Sync` | ||
| | ||
= note: required because of the requirements on the impl of `DynClone` for `dyn MyTrait + Send + Sync` | ||
note: required by a bound in `clone_box` | ||
--> src/lib.rs | ||
| | ||
| T: ?Sized + DynClone, | ||
| ^^^^^^^^ required by this bound in `clone_box` | ||
= note: this error originates in the macro `$crate::__internal_clone_trait_object` (in Nightly builds, run with -Z macro-backtrace for more info) |