From 763152b995bb506ac88c852a030c84a012bcf983 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sun, 21 Dec 2014 14:20:15 -0500 Subject: [PATCH] Tweak region-related error messages that changed slightly due to coercion changes, and also stop printing semi-useless inference by-products. --- src/librustc/middle/ty.rs | 4 ++++ .../region-lifetime-bounds-on-fns-where-clause.rs | 2 +- .../region-multiple-lifetime-bounds-on-fns-where-clause.rs | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index f05404759c4e1..aaa80f840fdae 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -4577,6 +4577,10 @@ pub fn note_and_explain_type_err(cx: &ctxt, err: &type_err) { "concrete lifetime that was found is ", conc_region, ""); } + terr_regions_overly_polymorphic(_, ty::ReInfer(ty::ReVar(_))) => { + // don't bother to print out the message below for + // inference variables, it's not very illuminating. + } terr_regions_overly_polymorphic(_, conc_region) => { note_and_explain_region(cx, "expected concrete lifetime is ", diff --git a/src/test/compile-fail/region-lifetime-bounds-on-fns-where-clause.rs b/src/test/compile-fail/region-lifetime-bounds-on-fns-where-clause.rs index 381144f2599c1..3e6a95b04f743 100644 --- a/src/test/compile-fail/region-lifetime-bounds-on-fns-where-clause.rs +++ b/src/test/compile-fail/region-lifetime-bounds-on-fns-where-clause.rs @@ -15,7 +15,7 @@ fn a<'a, 'b>(x: &mut &'a int, y: &mut &'b int) where 'b: 'a { fn b<'a, 'b>(x: &mut &'a int, y: &mut &'b int) { // Illegal now because there is no `'b:'a` declaration. - *x = *y; //~ ERROR mismatched types + *x = *y; //~ ERROR cannot infer } fn c<'a,'b>(x: &mut &'a int, y: &mut &'b int) { diff --git a/src/test/compile-fail/region-multiple-lifetime-bounds-on-fns-where-clause.rs b/src/test/compile-fail/region-multiple-lifetime-bounds-on-fns-where-clause.rs index a03911e1d0e18..2d635e9fc2718 100644 --- a/src/test/compile-fail/region-multiple-lifetime-bounds-on-fns-where-clause.rs +++ b/src/test/compile-fail/region-multiple-lifetime-bounds-on-fns-where-clause.rs @@ -16,8 +16,8 @@ fn a<'a, 'b, 'c>(x: &mut &'a int, y: &mut &'b int, z: &mut &'c int) where 'b: 'a fn b<'a, 'b, 'c>(x: &mut &'a int, y: &mut &'b int, z: &mut &'c int) { // Illegal now because there is no `'b:'a` declaration. - *x = *y; //~ ERROR mismatched types - *z = *y; //~ ERROR mismatched types + *x = *y; //~ ERROR cannot infer + *z = *y; //~ ERROR cannot infer } fn c<'a,'b, 'c>(x: &mut &'a int, y: &mut &'b int, z: &mut &'c int) {