Skip to content
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

Rollup of 12 pull requests #35769

Merged
merged 32 commits into from
Aug 18, 2016
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
127489a
Update compiler error 0093 to use new error format
stanislav-tkach Aug 9, 2016
1cf9caf
add mips-uclibc targets
Aug 16, 2016
f0ff2d3
E0403 update error format
circuitfox Aug 17, 2016
34f856e
Update LLVM to include 4 backported commits by @majnemer.
eddyb Aug 17, 2016
4254b31
Update minimum CMake version in README
spladug Aug 17, 2016
7675e4b
Update E0009 to new format
Aug 17, 2016
12a159a
Add 'make help' for rustbuild
SimonSapin Aug 17, 2016
feeed0b
Fixes issue #11004
GuillaumeGomez Aug 17, 2016
d01bfb1
Remove trailing white space
Aug 17, 2016
6a1efbd
Merge branch 'master' into E0403-update-error-format
circuitfox Aug 17, 2016
2179def
New output for E0407
tvladyslav Aug 16, 2016
2d36642
Properly invalidate the early exit cache
nagisa Aug 17, 2016
2c3250a
Nice graphs
nagisa Aug 17, 2016
8d78237
Add new error code tests
GuillaumeGomez Aug 17, 2016
de5aaee
Updated test for E0221
tvladyslav Aug 17, 2016
3c4ecc9
Display secondary span for E0053 for Sort TypeErrors
KiChjang Aug 10, 2016
34bc3c9
Display secondary span for E0053 for Mutability TypeErrors
KiChjang Aug 17, 2016
31d56cb
Add UI test for E0053
KiChjang Aug 17, 2016
ed54226
Fix tidy check.
tvladyslav Aug 17, 2016
612506b
Rollup merge of #35346 - DarkEld3r:e0093-formatting, r=jonathandturner
eddyb Aug 18, 2016
5e9a5b3
Rollup merge of #35734 - japaric:mips-uclibc, r=alexcrichton
eddyb Aug 18, 2016
71759ec
Rollup merge of #35739 - circuitfox:E0403-update-error-format, r=jona…
eddyb Aug 18, 2016
99e5efd
Rollup merge of #35740 - eddyb:llvm-prl-fix, r=alexcrichton
eddyb Aug 18, 2016
7a27444
Rollup merge of #35742 - spladug:readme-cmake-version, r=nikomatsakis
eddyb Aug 18, 2016
394c449
Rollup merge of #35744 - DevShep:ds/update_E0009, r=jonathandturner
eddyb Aug 18, 2016
f1861b8
Rollup merge of #35749 - GuillaumeGomez:raw_field, r=jonathandturner
eddyb Aug 18, 2016
1e13de8
Rollup merge of #35750 - SimonSapin:help, r=alexcrichton
eddyb Aug 18, 2016
64c1aef
Rollup merge of #35751 - nagisa:mir-scope-fix-again, r=eddyb
eddyb Aug 18, 2016
c3601d4
Rollup merge of #35756 - crypto-universe:E0407, r=GuillaumeGomez
eddyb Aug 18, 2016
8ccc11b
Rollup merge of #35765 - KiChjang:e0053-bonus, r=jonathandturner
eddyb Aug 18, 2016
d36b296
Rollup merge of #35768 - GuillaumeGomez:err_codes, r=jonathandturner
eddyb Aug 18, 2016
d69cd72
Rollup merge of #35770 - crypto-universe:E0221, r=jonathandturner
eddyb Aug 18, 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
Display secondary span for E0053 for Mutability TypeErrors
  • Loading branch information
KiChjang committed Aug 17, 2016
commit 34bc3c94f2639c16d3c009026e4b0e1d1a83d9a2
28 changes: 28 additions & 0 deletions src/librustc_typeck/check/compare_method.rs
Original file line number Diff line number Diff line change
@@ -338,6 +338,34 @@ pub fn compare_impl_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
};

let (impl_err_span, trait_err_span) = match terr {
TypeError::Mutability => {
if let Some(trait_m_node_id) = tcx.map.as_local_node_id(trait_m.def_id) {
let trait_m_iter = match tcx.map.expect_trait_item(trait_m_node_id).node {
TraitItem_::MethodTraitItem(ref trait_m_sig, _) =>
trait_m_sig.decl.inputs.iter(),
_ => bug!("{:?} is not a MethodTraitItem", trait_m)
};

impl_m_iter.zip(trait_m_iter).find(|&(ref impl_arg, ref trait_arg)| {
match (&impl_arg.ty.node, &trait_arg.ty.node) {
(&Ty_::TyRptr(_, ref impl_mt), &Ty_::TyRptr(_, ref trait_mt)) |
(&Ty_::TyPtr(ref impl_mt), &Ty_::TyPtr(ref trait_mt)) =>
impl_mt.mutbl != trait_mt.mutbl,
_ => false
}
}).map(|(ref impl_arg, ref trait_arg)| {
match (impl_arg.to_self(), trait_arg.to_self()) {
(Some(impl_self), Some(trait_self)) =>
(impl_self.span, Some(trait_self.span)),
(None, None) => (impl_arg.ty.span, Some(trait_arg.ty.span)),
_ => bug!("impl and trait fns have different first args, \
impl: {:?}, trait: {:?}", impl_arg, trait_arg)
}
}).unwrap_or((origin.span(), tcx.map.span_if_local(trait_m.def_id)))
} else {
(origin.span(), tcx.map.span_if_local(trait_m.def_id))
}
}
TypeError::Sorts(ExpectedFound { expected, found }) => {
if let Some(trait_m_node_id) = tcx.map.as_local_node_id(trait_m.def_id) {
let trait_m_iter = match tcx.map.expect_trait_item(trait_m_node_id).node {
14 changes: 10 additions & 4 deletions src/test/compile-fail/E0053.rs
Original file line number Diff line number Diff line change
@@ -9,15 +9,21 @@
// except according to those terms.

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

struct Bar;

impl Foo for Bar {
fn foo(x: i16) { } //~ ERROR E0053
fn bar(&mut self) { } //~ ERROR E0053
fn foo(x: i16) { }
//~^ ERROR method `foo` has an incompatible type for trait
//~| NOTE expected u16
fn bar(&mut self) { }
//~^ ERROR method `bar` has an incompatible type for trait
//~| NOTE values differ in mutability
//~| NOTE expected type `fn(&Bar)`
//~| NOTE found type `fn(&mut Bar)`
}

fn main() {