Skip to content

Commit eaf182e

Browse files
Add note for E0117
1 parent fc57e40 commit eaf182e

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

src/librustc_typeck/coherence/orphan.rs

+1
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> {
263263
.span_label(item.span, &format!("impl doesn't use types inside crate"))
264264
.note(&format!("the impl does not reference any types defined in \
265265
this crate"))
266+
.note("define and implement a trait or new type instead")
266267
.emit();
267268
return;
268269
}

src/test/compile-fail/E0117.rs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
impl Drop for u32 {} //~ ERROR E0117
1212
//~^ NOTE impl doesn't use types inside crate
1313
//~| NOTE the impl does not reference any types defined in this crate
14+
//~| NOTE define and implement a trait or new type instead
1415

1516
fn main() {
1617
}

src/test/compile-fail/E0206.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ impl Copy for Foo { }
1616
//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
1717
//~| NOTE impl doesn't use types inside crate
1818
//~| NOTE the impl does not reference any types defined in this crate
19+
//~| NOTE define and implement a trait or new type instead
1920

2021
#[derive(Copy, Clone)]
2122
struct Bar;

src/test/compile-fail/coherence-impls-copy.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ impl Copy for (MyType, MyType) {}
3737
//~| ERROR only traits defined in the current crate can be implemented for arbitrary types
3838
//~| NOTE impl doesn't use types inside crate
3939
//~| NOTE the impl does not reference any types defined in this crate
40+
//~| NOTE define and implement a trait or new type instead
4041

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

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

5962
fn main() {
6063
}

0 commit comments

Comments
 (0)