Skip to content

Rollup of 19 pull requests #35857

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Aug 20, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
377ae44
explicitly show how iterating over `..` fails
matthew-piziak Aug 15, 2016
c186da7
RangeFull for-loop iteration fails because of IntoIterator
matthew-piziak Aug 16, 2016
dcee93a
replace Add example with something more evocative of addition
matthew-piziak Aug 16, 2016
da1f773
rustdoc: remove the `!` from macro URLs and titles
nrc Aug 3, 2016
e6cc4c5
Fix links
nrc Aug 15, 2016
0dc13ee
updated E0395 to new error format
clementmiao Aug 18, 2016
dae1406
updated E0396 to new error format
clementmiao Aug 18, 2016
6976991
Fix tiny spelling mistake in book
ErikUggeldahl Aug 18, 2016
c2b6f72
Add a few doc examples for `std::ffi::OsStr`.
frewsxcv Aug 18, 2016
06302cb
Fix minor typo
cantino Aug 18, 2016
9563f14
demonstrate `RHS != Self` use cases for `Mul` and `Div`
matthew-piziak Aug 18, 2016
469b7fd
split example into three sections with explanation
matthew-piziak Aug 18, 2016
301401e
Redirect
nrc Aug 16, 2016
161cb36
Update error message for E0084
pliniker Aug 18, 2016
a516dbb
note that calling drop() explicitly is a compiler error
matthew-piziak Aug 16, 2016
6c66eaa
replace `AddAssign` example with something more evocative of addition
matthew-piziak Aug 18, 2016
ffbb860
Add workaround to detect correct compiler version
Aug 18, 2016
39f318b
Update error format for E0232
mlayne Aug 18, 2016
2128d31
Fix label messages for E0133
wdv4758h Aug 19, 2016
06147ac
replace `Not` example with something more evocative
matthew-piziak Aug 19, 2016
c0eccb1
replace `Neg` example with something more evocative of negation
matthew-piziak Aug 19, 2016
3b64cf6
Update E0428 to new format
trixnz Aug 19, 2016
54d0acd
wording fixes in error messages
Aug 19, 2016
d791aa1
Fix broken tests for E0428
trixnz Aug 20, 2016
d5595d1
Rollup merge of #35234 - nrc:rustdoc-macros, r=steveklabnik
Aug 20, 2016
2d32a69
Rollup merge of #35701 - matthew-piziak:rangefull-example-error, r=st…
Aug 20, 2016
ed9a18a
Rollup merge of #35709 - matthew-piziak:add-trait-example, r=Guillaum…
Aug 20, 2016
ba8611e
Rollup merge of #35710 - matthew-piziak:explicit-drop, r=steveklabnik
Aug 20, 2016
54a4199
Rollup merge of #35775 - frewsxcv:os-str-doc-examples, r=GuillaumeGomez
Aug 20, 2016
7c843c4
Rollup merge of #35778 - clementmiao:E0395_new_error_format, r=jonath…
Aug 20, 2016
69612f0
Rollup merge of #35780 - clementmiao:E0396_new_err_format, r=jonathan…
Aug 20, 2016
f4b123f
Rollup merge of #35781 - ErikUggeldahl:spellingfix, r=apasel422
Aug 20, 2016
ad17e0c
Rollup merge of #35794 - cantino:fix-typo, r=apasel422
Aug 20, 2016
a36ff81
Rollup merge of #35800 - matthew-piziak:mul-div-examples, r=steveklabnik
Aug 20, 2016
15277eb
Rollup merge of #35804 - pliniker:master, r=jonathandturner
Aug 20, 2016
0155eb1
Rollup merge of #35806 - matthew-piziak:addassign-example, r=stevekla…
Aug 20, 2016
a361cdb
Rollup merge of #35811 - jonathandturner:fix_rustbuild_version_test, …
Aug 20, 2016
b9c0a8c
Rollup merge of #35812 - mlayne:E0232, r=jonathandturner
Aug 20, 2016
f17ff3a
Rollup merge of #35818 - wdv4758h:E0133-label, r=Aatch
Aug 20, 2016
cc431a0
Rollup merge of #35827 - matthew-piziak:neg-example, r=steveklabnik
Aug 20, 2016
0d69b88
Rollup merge of #35830 - matthew-piziak:not-example, r=steveklabnik
Aug 20, 2016
b22352f
Rollup merge of #35831 - trixnz:error-428, r=jonathandturner
Aug 20, 2016
9072861
Rollup merge of #35839 - jonathandturner:error_touchup, r=Aatch
Aug 20, 2016
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
Prev Previous commit
Next Next commit
wording fixes in error messages
  • Loading branch information
Jonathan Turner committed Aug 19, 2016
commit 54d0acd2fc6414930ff27c01c8640f4e9c666ad5
4 changes: 2 additions & 2 deletions src/librustc/ty/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
values.expected,
values.found)
}
Mutability => write!(f, "values differ in mutability"),
Mutability => write!(f, "types differ in mutability"),
BoxMutability => {
write!(f, "boxed values differ in mutability")
write!(f, "boxed types differ in mutability")
}
VecMutability => write!(f, "vectors differ in mutability"),
PtrMutability => write!(f, "pointers differ in mutability"),
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_errors/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,9 @@ impl EmitterWriter {
continue;
}
// Check to make sure we're not in any <*macros>
if !cm.span_to_filename(def_site).contains("macros>") {
if !cm.span_to_filename(def_site).contains("macros>") &&
!trace.macro_decl_name.starts_with("#[")
{
new_labels.push((trace.call_site,
"in this macro invocation".to_string()));
break;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use rustc::hir;
pub fn check_legal_trait_for_method_call(ccx: &CrateCtxt, span: Span, trait_id: DefId) {
if ccx.tcx.lang_items.drop_trait() == Some(trait_id) {
struct_span_err!(ccx.tcx.sess, span, E0040, "explicit use of destructor method")
.span_label(span, &format!("call to destructor method"))
.span_label(span, &format!("explicit destructor calls not allowed"))
.emit();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/compare_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ pub fn compare_impl_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
infcx.note_type_err(
&mut diag,
origin,
trait_err_span.map(|sp| (sp, format!("original trait requirement"))),
trait_err_span.map(|sp| (sp, format!("type in trait"))),
Some(infer::ValuePairs::Types(ExpectedFound {
expected: trait_fty,
found: impl_fty
Expand Down Expand Up @@ -575,7 +575,7 @@ pub fn compare_const_impl<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
infcx.note_type_err(
&mut diag,
origin,
Some((trait_c_span, format!("original trait requirement"))),
Some((trait_c_span, format!("type in trait"))),
Some(infer::ValuePairs::Types(ExpectedFound {
expected: trait_ty,
found: impl_ty
Expand Down
9 changes: 4 additions & 5 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
// We can only get the spans from local trait definition
// Same for E0324 and E0325
if let Some(trait_span) = tcx.map.span_if_local(ty_trait_item.def_id()) {
err.span_label(trait_span, &format!("original trait requirement"));
err.span_label(trait_span, &format!("item in trait"));
}
err.emit()
}
Expand Down Expand Up @@ -1041,7 +1041,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
impl_trait_ref);
err.span_label(impl_item.span, &format!("does not match trait"));
if let Some(trait_span) = tcx.map.span_if_local(ty_trait_item.def_id()) {
err.span_label(trait_span, &format!("original trait requirement"));
err.span_label(trait_span, &format!("item in trait"));
}
err.emit()
}
Expand All @@ -1064,7 +1064,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
impl_trait_ref);
err.span_label(impl_item.span, &format!("does not match trait"));
if let Some(trait_span) = tcx.map.span_if_local(ty_trait_item.def_id()) {
err.span_label(trait_span, &format!("original trait requirement"));
err.span_label(trait_span, &format!("item in trait"));
}
err.emit()
}
Expand Down Expand Up @@ -4408,8 +4408,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
expected at most {}, found {}",
count(type_defs.len()),
count(types.len()))
.span_label(span, &format!("expected {}",
count(type_defs.len()))).emit();
.span_label(span, &format!("too many type parameters")).emit();

// To prevent derived errors to accumulate due to extra
// type parameters, we force instantiate_value_path to
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/coherence/orphan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
"cannot define inherent `impl` for a type outside of the \
crate where the type is defined")
.span_label(item.span, &format!("impl for type defined outside of crate."))
.span_note(item.span, &format!("define and implement a trait or new type instead"))
.note("define and implement a trait or new type instead")
.emit();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ impl Foo for Bar {
// error, expected u16, found i16
fn foo(x: i16) { }

// error, values differ in mutability
// error, types differ in mutability
fn bar(&mut self) { }
}
```
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/E0040.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ fn main() {
let mut x = Foo { x: -7 };
x.drop();
//~^ ERROR E0040
//~| NOTE call to destructor method
//~| NOTE explicit destructor calls not allowed
}
6 changes: 3 additions & 3 deletions src/test/compile-fail/E0053.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
// except according to those terms.

trait Foo {
fn foo(x: u16); //~ NOTE original trait requirement
fn bar(&self); //~ NOTE original trait requirement
fn foo(x: u16); //~ NOTE type in trait
fn bar(&self); //~ NOTE type in trait
}

struct Bar;
Expand All @@ -21,7 +21,7 @@ impl Foo for Bar {
//~| NOTE expected u16
fn bar(&mut self) { }
//~^ ERROR method `bar` has an incompatible type for trait
//~| NOTE values differ in mutability
//~| NOTE types differ in mutability
//~| NOTE expected type `fn(&Bar)`
//~| NOTE found type `fn(&mut Bar)`
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/E0087.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ fn foo<T>() {}

fn main() {
foo::<f64, bool>(); //~ ERROR E0087
//~^ NOTE expected
//~^ NOTE too many type parameters
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/associated-const-impl-wrong-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#![feature(associated_consts)]

trait Foo {
const BAR: u32; //~ NOTE original trait requirement
const BAR: u32; //~ NOTE type in trait
}

struct SignedBar;
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/coerce-mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ fn main() {
//~^ ERROR mismatched types
//~| expected type `&mut i32`
//~| found type `&{integer}`
//~| values differ in mutability
//~| types differ in mutability
}
4 changes: 2 additions & 2 deletions src/test/compile-fail/fn-variance-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ fn apply<T, F>(t: T, f: F) where F: FnOnce(T) {
fn main() {
apply(&3, takes_imm);
apply(&3, takes_mut);
//~^ ERROR (values differ in mutability)
//~^ ERROR (types differ in mutability)

apply(&mut 3, takes_mut);
apply(&mut 3, takes_imm);
//~^ ERROR (values differ in mutability)
//~^ ERROR (types differ in mutability)
}
6 changes: 3 additions & 3 deletions src/test/compile-fail/impl-wrong-item-for-trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

trait Foo {
fn bar(&self);
//~^ NOTE original trait requirement
//~| NOTE original trait requirement
const MY_CONST: u32; //~ NOTE original trait requirement
//~^ NOTE item in trait
//~| NOTE item in trait
const MY_CONST: u32; //~ NOTE item in trait
}

pub struct FooConstForMethod;
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/mut-pattern-mismatched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn main() {
let &_ //~ ERROR mismatched types
//~| expected type `&mut {integer}`
//~| found type `&_`
//~| values differ in mutability
//~| types differ in mutability
= foo;
let &mut _ = foo;

Expand All @@ -25,6 +25,6 @@ fn main() {
let &mut _ //~ ERROR mismatched types
//~| expected type `&{integer}`
//~| found type `&mut _`
//~| values differ in mutability
//~| types differ in mutability
= bar;
}
6 changes: 3 additions & 3 deletions src/test/compile-fail/ptr-coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ pub fn main() {
let x: *mut isize = x; //~ ERROR mismatched types
//~| expected type `*mut isize`
//~| found type `*const isize`
//~| values differ in mutability
//~| types differ in mutability

// & -> *mut
let x: *mut isize = &42; //~ ERROR mismatched types
//~| expected type `*mut isize`
//~| found type `&isize`
//~| values differ in mutability
//~| types differ in mutability

let x: *const isize = &42;
let x: *mut isize = x; //~ ERROR mismatched types
//~| expected type `*mut isize`
//~| found type `*const isize`
//~| values differ in mutability
//~| types differ in mutability
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/slice-mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ fn main() {
//~^ ERROR mismatched types
//~| expected type `&mut [_]`
//~| found type `&[isize]`
//~| values differ in mutability
//~| types differ in mutability
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0053]: method `foo` has an incompatible type for trait
--> $DIR/trait-impl-fn-incompatibility.rs:21:15
|
14 | fn foo(x: u16);
| --- original trait requirement
| --- type in trait
...
21 | fn foo(x: i16) { }
| ^^^ expected u16, found i16
Expand All @@ -11,10 +11,10 @@ error[E0053]: method `bar` has an incompatible type for trait
--> $DIR/trait-impl-fn-incompatibility.rs:22:28
|
15 | fn bar(&mut self, bar: &mut Bar);
| -------- original trait requirement
| -------- type in trait
...
22 | fn bar(&mut self, bar: &Bar) { }
| ^^^^ values differ in mutability
| ^^^^ types differ in mutability
|
= note: expected type `fn(&mut Bar, &mut Bar)`
= note: found type `fn(&mut Bar, &Bar)`
Expand Down