Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustc_typeck/coherence/orphan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> {
.span_label(item.span, &format!("impl doesn't use types inside crate"))
.note(&format!("the impl does not reference any types defined in \
this crate"))
.note("define and implement a trait or new type instead")
.emit();
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/E0117.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
impl Drop for u32 {} //~ ERROR E0117
//~^ NOTE impl doesn't use types inside crate
//~| NOTE the impl does not reference any types defined in this crate
//~| NOTE define and implement a trait or new type instead

fn main() {
}
1 change: 1 addition & 0 deletions src/test/compile-fail/E0206.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ impl Copy for Foo { }
//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
//~| NOTE impl doesn't use types inside crate
//~| NOTE the impl does not reference any types defined in this crate
//~| NOTE define and implement a trait or new type instead

#[derive(Copy, Clone)]
struct Bar;
Expand Down
5 changes: 4 additions & 1 deletion src/test/compile-fail/coherence-impls-copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ impl Copy for (MyType, MyType) {}
//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
//~| NOTE impl doesn't use types inside crate
//~| NOTE the impl does not reference any types defined in this crate
//~| NOTE define and implement a trait or new type instead

impl Copy for &'static NotSync {}
//~^ ERROR the trait `Copy` may not be implemented for this type
Expand All @@ -46,15 +47,17 @@ impl Copy for [MyType] {}
//~^ ERROR the trait `Copy` may not be implemented for this type
//~| NOTE type is not a structure or enumeration
//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
//~| NOTE impl doesn't use types inside crate
//~| NOTE the impl does not reference any types defined in this crate
//~| NOTE define and implement a trait or new type instead
//~| NOTE impl doesn't use types inside crate

impl Copy for &'static [NotSync] {}
//~^ ERROR the trait `Copy` may not be implemented for this type
//~| NOTE type is not a structure or enumeration
//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
//~| NOTE impl doesn't use types inside crate
//~| NOTE the impl does not reference any types defined in this crate
//~| NOTE define and implement a trait or new type instead

fn main() {
}