Skip to content

Commit 54d0acd

Browse files
author
Jonathan Turner
committed
wording fixes in error messages
1 parent 413ada3 commit 54d0acd

File tree

18 files changed

+35
-34
lines changed

18 files changed

+35
-34
lines changed

src/librustc/ty/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
9898
values.expected,
9999
values.found)
100100
}
101-
Mutability => write!(f, "values differ in mutability"),
101+
Mutability => write!(f, "types differ in mutability"),
102102
BoxMutability => {
103-
write!(f, "boxed values differ in mutability")
103+
write!(f, "boxed types differ in mutability")
104104
}
105105
VecMutability => write!(f, "vectors differ in mutability"),
106106
PtrMutability => write!(f, "pointers differ in mutability"),

src/librustc_errors/emitter.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,9 @@ impl EmitterWriter {
426426
continue;
427427
}
428428
// Check to make sure we're not in any <*macros>
429-
if !cm.span_to_filename(def_site).contains("macros>") {
429+
if !cm.span_to_filename(def_site).contains("macros>") &&
430+
!trace.macro_decl_name.starts_with("#[")
431+
{
430432
new_labels.push((trace.call_site,
431433
"in this macro invocation".to_string()));
432434
break;

src/librustc_typeck/check/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use rustc::hir;
2929
pub fn check_legal_trait_for_method_call(ccx: &CrateCtxt, span: Span, trait_id: DefId) {
3030
if ccx.tcx.lang_items.drop_trait() == Some(trait_id) {
3131
struct_span_err!(ccx.tcx.sess, span, E0040, "explicit use of destructor method")
32-
.span_label(span, &format!("call to destructor method"))
32+
.span_label(span, &format!("explicit destructor calls not allowed"))
3333
.emit();
3434
}
3535
}

src/librustc_typeck/check/compare_method.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ pub fn compare_impl_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
402402
infcx.note_type_err(
403403
&mut diag,
404404
origin,
405-
trait_err_span.map(|sp| (sp, format!("original trait requirement"))),
405+
trait_err_span.map(|sp| (sp, format!("type in trait"))),
406406
Some(infer::ValuePairs::Types(ExpectedFound {
407407
expected: trait_fty,
408408
found: impl_fty
@@ -575,7 +575,7 @@ pub fn compare_const_impl<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
575575
infcx.note_type_err(
576576
&mut diag,
577577
origin,
578-
Some((trait_c_span, format!("original trait requirement"))),
578+
Some((trait_c_span, format!("type in trait"))),
579579
Some(infer::ValuePairs::Types(ExpectedFound {
580580
expected: trait_ty,
581581
found: impl_ty

src/librustc_typeck/check/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
10131013
// We can only get the spans from local trait definition
10141014
// Same for E0324 and E0325
10151015
if let Some(trait_span) = tcx.map.span_if_local(ty_trait_item.def_id()) {
1016-
err.span_label(trait_span, &format!("original trait requirement"));
1016+
err.span_label(trait_span, &format!("item in trait"));
10171017
}
10181018
err.emit()
10191019
}
@@ -1041,7 +1041,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
10411041
impl_trait_ref);
10421042
err.span_label(impl_item.span, &format!("does not match trait"));
10431043
if let Some(trait_span) = tcx.map.span_if_local(ty_trait_item.def_id()) {
1044-
err.span_label(trait_span, &format!("original trait requirement"));
1044+
err.span_label(trait_span, &format!("item in trait"));
10451045
}
10461046
err.emit()
10471047
}
@@ -1064,7 +1064,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
10641064
impl_trait_ref);
10651065
err.span_label(impl_item.span, &format!("does not match trait"));
10661066
if let Some(trait_span) = tcx.map.span_if_local(ty_trait_item.def_id()) {
1067-
err.span_label(trait_span, &format!("original trait requirement"));
1067+
err.span_label(trait_span, &format!("item in trait"));
10681068
}
10691069
err.emit()
10701070
}
@@ -4408,8 +4408,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
44084408
expected at most {}, found {}",
44094409
count(type_defs.len()),
44104410
count(types.len()))
4411-
.span_label(span, &format!("expected {}",
4412-
count(type_defs.len()))).emit();
4411+
.span_label(span, &format!("too many type parameters")).emit();
44134412

44144413
// To prevent derived errors to accumulate due to extra
44154414
// type parameters, we force instantiate_value_path to

src/librustc_typeck/coherence/orphan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
3737
"cannot define inherent `impl` for a type outside of the \
3838
crate where the type is defined")
3939
.span_label(item.span, &format!("impl for type defined outside of crate."))
40-
.span_note(item.span, &format!("define and implement a trait or new type instead"))
40+
.note("define and implement a trait or new type instead")
4141
.emit();
4242
}
4343
}

src/librustc_typeck/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ impl Foo for Bar {
572572
// error, expected u16, found i16
573573
fn foo(x: i16) { }
574574
575-
// error, values differ in mutability
575+
// error, types differ in mutability
576576
fn bar(&mut self) { }
577577
}
578578
```

src/test/compile-fail/E0040.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ fn main() {
2222
let mut x = Foo { x: -7 };
2323
x.drop();
2424
//~^ ERROR E0040
25-
//~| NOTE call to destructor method
25+
//~| NOTE explicit destructor calls not allowed
2626
}

src/test/compile-fail/E0053.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// except according to those terms.
1010

1111
trait Foo {
12-
fn foo(x: u16); //~ NOTE original trait requirement
13-
fn bar(&self); //~ NOTE original trait requirement
12+
fn foo(x: u16); //~ NOTE type in trait
13+
fn bar(&self); //~ NOTE type in trait
1414
}
1515

1616
struct Bar;
@@ -21,7 +21,7 @@ impl Foo for Bar {
2121
//~| NOTE expected u16
2222
fn bar(&mut self) { }
2323
//~^ ERROR method `bar` has an incompatible type for trait
24-
//~| NOTE values differ in mutability
24+
//~| NOTE types differ in mutability
2525
//~| NOTE expected type `fn(&Bar)`
2626
//~| NOTE found type `fn(&mut Bar)`
2727
}

src/test/compile-fail/E0087.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ fn foo<T>() {}
1212

1313
fn main() {
1414
foo::<f64, bool>(); //~ ERROR E0087
15-
//~^ NOTE expected
15+
//~^ NOTE too many type parameters
1616
}

0 commit comments

Comments
 (0)