diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 09c21d54c87a..e7b91bc9278f 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -3691,15 +3691,15 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str { } } terr_integer_as_char => { - format!("expected an integral type but found char") + format!("expected an integral type but found `char`") } terr_int_mismatch(ref values) => { - format!("expected {} but found {}", + format!("expected `{}` but found `{}`", values.expected.to_str(), values.found.to_str()) } terr_float_mismatch(ref values) => { - format!("expected {} but found {}", + format!("expected `{}` but found `{}`", values.expected.to_str(), values.found.to_str()) } @@ -3767,13 +3767,13 @@ pub fn provided_trait_methods(cx: ctxt, id: ast::DefId) -> ~[@Method] { } _ => { cx.sess.bug(format!("provided_trait_methods: \ - {:?} is not a trait", + `{:?}` is not a trait", id)) } } } _ => { - cx.sess.bug(format!("provided_trait_methods: {:?} is not \ + cx.sess.bug(format!("provided_trait_methods: `{:?}` is not \ a trait", id)) } diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index eff8680f27cb..f048637d68fb 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -768,7 +768,7 @@ pub fn instantiate_trait_ref(ccx: &CrateCtxt, _ => { ccx.tcx.sess.span_fatal( ast_trait_ref.path.span, - format!("{} is not a trait", + format!("`{}` is not a trait", path_to_str(&ast_trait_ref.path))); } } diff --git a/src/test/compile-fail/issue-2330.rs b/src/test/compile-fail/issue-2330.rs index 6152e82294d1..e46dbaf0ae0e 100644 --- a/src/test/compile-fail/issue-2330.rs +++ b/src/test/compile-fail/issue-2330.rs @@ -15,7 +15,7 @@ trait channel { } // `chan` is not a trait, it's an enum -impl chan for int { //~ ERROR chan is not a trait +impl chan for int { //~ ERROR `chan` is not a trait fn send(&self, v: int) { fail!() } } diff --git a/src/test/compile-fail/issue-3907.rs b/src/test/compile-fail/issue-3907.rs index 5d292531b49f..767e674fcda1 100644 --- a/src/test/compile-fail/issue-3907.rs +++ b/src/test/compile-fail/issue-3907.rs @@ -17,7 +17,7 @@ struct S { name: int } -impl Foo for S { //~ ERROR: Foo is not a trait +impl Foo for S { //~ ERROR: `Foo` is not a trait fn bar() { } }