Skip to content

Commit ea76c5e

Browse files
authored
Rollup merge of #40753 - mandeep:change-ObjectSafetyViolation-message, r=brson
Change object safety violation message Hello! This is my first pull request to rust so hopefully all goes well. This PR should fix issue #40670. I changed the error message in object_safety.rs and the corresponding compile-fail test in object-safety-supertrait-mentions-Self.rs. Once the changes were made, I ran ```python x.py test src/tools/tidy``` and ```python x.py test```. Tidy passed and the compile-fail tests passed, however the test suite failed on the tcp tests as my machine has IPv6 disabled. I'm not sure what to do in this case besides letting travis run the suite against my changes. Please let me know if there's anything I can do to help further. Thanks! Mandeep
2 parents 08134cf + 7d302d2 commit ea76c5e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/librustc/traits/object_safety.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl ObjectSafetyViolation {
4646
"the trait cannot require that `Self : Sized`".into(),
4747
ObjectSafetyViolation::SupertraitSelf =>
4848
"the trait cannot use `Self` as a type parameter \
49-
in the supertrait listing".into(),
49+
in the supertraits or where-clauses".into(),
5050
ObjectSafetyViolation::Method(name, MethodViolationCode::StaticMethod) =>
5151
format!("method `{}` has no receiver", name).into(),
5252
ObjectSafetyViolation::Method(name, MethodViolationCode::ReferencesSelf) =>

src/test/compile-fail/object-safety-supertrait-mentions-Self.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn make_bar<T:Bar<u32>>(t: &T) -> &Bar<u32> {
2424

2525
fn make_baz<T:Baz>(t: &T) -> &Baz {
2626
//~^ ERROR E0038
27-
//~| NOTE the trait cannot use `Self` as a type parameter in the supertrait listing
27+
//~| NOTE the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
2828
//~| NOTE the trait `Baz` cannot be made into an object
2929
t
3030
}

0 commit comments

Comments
 (0)