diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-08-30 02:39:06 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-09-01 11:17:03 +0300 |
| commit | ea6aca7726bd035ae79fc4643f863178c8f26e90 (patch) | |
| tree | 009389c2e2d9347c66b28c13016bbed40122d923 /src/librustc | |
| parent | 28ddd7a4ef30a89091dbf48cae18f571326510fb (diff) | |
| download | rust-ea6aca7726bd035ae79fc4643f863178c8f26e90.tar.gz rust-ea6aca7726bd035ae79fc4643f863178c8f26e90.zip | |
rustc: take TyCtxt and RegionMaps in CodeMap::span.
Diffstat (limited to 'src/librustc')
| -rw-r--r-- | src/librustc/infer/error_reporting/mod.rs | 31 | ||||
| -rw-r--r-- | src/librustc/infer/error_reporting/note.rs | 112 | ||||
| -rw-r--r-- | src/librustc/infer/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/region.rs | 48 | ||||
| -rw-r--r-- | src/librustc/ty/error.rs | 37 | ||||
| -rw-r--r-- | src/librustc/ty/structural_impls.rs | 16 |
6 files changed, 105 insertions, 141 deletions
diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 4c55c1474a3..d86626c210e 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -64,7 +64,7 @@ use std::fmt; use hir; use hir::map as hir_map; use hir::def_id::DefId; -use middle::region; +use middle::region::{self, RegionMaps}; use traits::{ObligationCause, ObligationCauseCode}; use ty::{self, Region, TyCtxt, TypeFoldable}; use ty::error::TypeError; @@ -83,6 +83,7 @@ mod anon_anon_conflict; impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn note_and_explain_region(self, + region_maps: &RegionMaps, err: &mut DiagnosticBuilder, prefix: &str, region: ty::Region<'tcx>, @@ -130,13 +131,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { format!("{}unknown scope: {:?}{}. Please report a bug.", prefix, scope, suffix) }; - let span = match scope.span(&self.hir) { - Some(s) => s, - None => { - err.note(&unknown_scope()); - return; - } - }; + let span = scope.span(self, region_maps); let tag = match self.hir.find(scope.node_id()) { Some(hir_map::NodeBlock(_)) => "block", Some(hir_map::NodeExpr(expr)) => match expr.node { @@ -260,8 +255,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { - - pub fn report_region_errors(&self, errors: &Vec<RegionResolutionError<'tcx>>) { + pub fn report_region_errors(&self, + region_maps: &RegionMaps, + errors: &Vec<RegionResolutionError<'tcx>>) { debug!("report_region_errors(): {} errors to start", errors.len()); // try to pre-process the errors, which will group some of them @@ -285,16 +281,16 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // the error. If all of these fails, we fall back to a rather // general bit of code that displays the error information ConcreteFailure(origin, sub, sup) => { - - self.report_concrete_failure(origin, sub, sup).emit(); + self.report_concrete_failure(region_maps, origin, sub, sup).emit(); } GenericBoundFailure(kind, param_ty, sub) => { - self.report_generic_bound_failure(kind, param_ty, sub); + self.report_generic_bound_failure(region_maps, kind, param_ty, sub); } SubSupConflict(var_origin, sub_origin, sub_r, sup_origin, sup_r) => { - self.report_sub_sup_conflict(var_origin, + self.report_sub_sup_conflict(region_maps, + var_origin, sub_origin, sub_r, sup_origin, @@ -773,6 +769,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } fn report_generic_bound_failure(&self, + region_maps: &RegionMaps, origin: SubregionOrigin<'tcx>, bound_kind: GenericKind<'tcx>, sub: Region<'tcx>) @@ -840,6 +837,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { err.help(&format!("consider adding an explicit lifetime bound for `{}`", bound_kind)); self.tcx.note_and_explain_region( + region_maps, &mut err, &format!("{} must be valid for ", labeled_user_string), sub, @@ -853,6 +851,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } fn report_sub_sup_conflict(&self, + region_maps: &RegionMaps, var_origin: RegionVariableOrigin, sub_origin: SubregionOrigin<'tcx>, sub_region: Region<'tcx>, @@ -860,14 +859,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { sup_region: Region<'tcx>) { let mut err = self.report_inference_failure(var_origin); - self.tcx.note_and_explain_region(&mut err, + self.tcx.note_and_explain_region(region_maps, &mut err, "first, the lifetime cannot outlive ", sup_region, "..."); self.note_region_origin(&mut err, &sup_origin); - self.tcx.note_and_explain_region(&mut err, + self.tcx.note_and_explain_region(region_maps, &mut err, "but, the lifetime must be valid for ", sub_region, "..."); diff --git a/src/librustc/infer/error_reporting/note.rs b/src/librustc/infer/error_reporting/note.rs index 87047d0df14..3e78cce80f5 100644 --- a/src/librustc/infer/error_reporting/note.rs +++ b/src/librustc/infer/error_reporting/note.rs @@ -9,6 +9,7 @@ // except according to those terms. use infer::{self, InferCtxt, SubregionOrigin}; +use middle::region::RegionMaps; use ty::{self, Region}; use ty::error::TypeError; use errors::DiagnosticBuilder; @@ -144,6 +145,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } pub(super) fn report_concrete_failure(&self, + region_maps: &RegionMaps, origin: SubregionOrigin<'tcx>, sub: Region<'tcx>, sup: Region<'tcx>) @@ -151,7 +153,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { match origin { infer::Subtype(trace) => { let terr = TypeError::RegionsDoesNotOutlive(sup, sub); - self.report_and_explain_type_error(trace, &terr) + let mut err = self.report_and_explain_type_error(trace, &terr); + self.tcx.note_and_explain_region(region_maps, &mut err, "", sup, "..."); + self.tcx.note_and_explain_region(region_maps, &mut err, + "...does not necessarily outlive ", sub, ""); + err } infer::Reborrow(span) => { let mut err = struct_span_err!(self.tcx.sess, @@ -159,11 +165,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { E0312, "lifetime of reference outlives lifetime of \ borrowed content..."); - self.tcx.note_and_explain_region(&mut err, + self.tcx.note_and_explain_region(region_maps, &mut err, "...the reference is valid for ", sub, "..."); - self.tcx.note_and_explain_region(&mut err, + self.tcx.note_and_explain_region(region_maps, &mut err, "...but the borrowed content is only valid for ", sup, ""); @@ -177,27 +183,27 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { of captured variable `{}`...", self.tcx .local_var_name_str_def_index(upvar_id.var_id)); - self.tcx.note_and_explain_region(&mut err, + self.tcx.note_and_explain_region(region_maps, &mut err, "...the borrowed pointer is valid for ", sub, "..."); - self.tcx - .note_and_explain_region( - &mut err, - &format!("...but `{}` is only valid for ", - self.tcx.local_var_name_str_def_index(upvar_id.var_id)), - sup, - ""); + self.tcx.note_and_explain_region( + region_maps, + &mut err, + &format!("...but `{}` is only valid for ", + self.tcx.local_var_name_str_def_index(upvar_id.var_id)), + sup, + ""); err } infer::InfStackClosure(span) => { let mut err = struct_span_err!(self.tcx.sess, span, E0314, "closure outlives stack frame"); - self.tcx.note_and_explain_region(&mut err, + self.tcx.note_and_explain_region(region_maps, &mut err, "...the closure must be valid for ", sub, "..."); - self.tcx.note_and_explain_region(&mut err, + self.tcx.note_and_explain_region(region_maps, &mut err, "...but the closure's stack frame is only valid \ for ", sup, @@ -209,8 +215,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { span, E0315, "cannot invoke closure outside of its lifetime"); - self.tcx - .note_and_explain_region(&mut err, "the closure is only valid for ", sup, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, + "the closure is only valid for ", sup, ""); err } infer::DerefPointer(span) => { @@ -218,8 +224,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { span, E0473, "dereference of reference outside its lifetime"); - self.tcx - .note_and_explain_region(&mut err, "the reference is only valid for ", sup, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, + "the reference is only valid for ", sup, ""); err } infer::FreeVariable(span, id) => { @@ -229,9 +235,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { "captured variable `{}` does not outlive the \ enclosing closure", self.tcx.local_var_name_str(id)); - self.tcx - .note_and_explain_region(&mut err, "captured variable is valid for ", sup, ""); - self.tcx.note_and_explain_region(&mut err, "closure is valid for ", sub, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, + "captured variable is valid for ", sup, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, + "closure is valid for ", sub, ""); err } infer::IndexSlice(span) => { @@ -239,7 +246,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { span, E0475, "index of slice outside its lifetime"); - self.tcx.note_and_explain_region(&mut err, "the slice is only valid for ", sup, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, + "the slice is only valid for ", sup, ""); err } infer::RelateObjectBound(span) => { @@ -248,8 +256,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { E0476, "lifetime of the source pointer does not outlive \ lifetime bound of the object type"); - self.tcx.note_and_explain_region(&mut err, "object type is valid for ", sub, ""); - self.tcx.note_and_explain_region(&mut err, + self.tcx.note_and_explain_region(region_maps, &mut err, + "object type is valid for ", sub, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, "source pointer is only valid for ", sup, ""); @@ -264,10 +273,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { self.ty_to_string(ty)); match *sub { ty::ReStatic => { - self.tcx.note_and_explain_region(&mut err, "type must satisfy ", sub, "") + self.tcx.note_and_explain_region(region_maps, &mut err, + "type must satisfy ", sub, "") } _ => { - self.tcx.note_and_explain_region(&mut err, "type must outlive ", sub, "") + self.tcx.note_and_explain_region(region_maps, &mut err, + "type must outlive ", sub, "") } } err @@ -275,11 +286,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { infer::RelateRegionParamBound(span) => { let mut err = struct_span_err!(self.tcx.sess, span, E0478, "lifetime bound not satisfied"); - self.tcx.note_and_explain_region(&mut err, + self.tcx.note_and_explain_region(region_maps, &mut err, "lifetime parameter instantiated with ", sup, ""); - self.tcx.note_and_explain_region(&mut err, + self.tcx.note_and_explain_region(region_maps, &mut err, "but lifetime parameter must outlive ", sub, ""); @@ -292,7 +303,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { "the type `{}` (provided as the value of a type \ parameter) is not valid at this point", self.ty_to_string(ty)); - self.tcx.note_and_explain_region(&mut err, "type must outlive ", sub, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, + "type must outlive ", sub, ""); err } infer::CallRcvr(span) => { @@ -301,8 +313,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { E0480, "lifetime of method receiver does not outlive the \ method call"); - self.tcx - .note_and_explain_region(&mut err, "the receiver is only valid for ", sup, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, + "the receiver is only valid for ", sup, ""); err } infer::CallArg(span) => { @@ -311,7 +323,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { E0481, "lifetime of function argument does not outlive \ the function call"); - self.tcx.note_and_explain_region(&mut err, + self.tcx.note_and_explain_region(region_maps, &mut err, "the function argument is only valid for ", sup, ""); @@ -323,7 +335,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { E0482, "lifetime of return value does not outlive the \ function call"); - self.tcx.note_and_explain_region(&mut err, + self.tcx.note_and_explain_region(region_maps, &mut err, "the return value is only valid for ", sup, ""); @@ -335,8 +347,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { E0483, "lifetime of operand does not outlive the \ operation"); - self.tcx - .note_and_explain_region(&mut err, "the operand is only valid for ", sup, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, + "the operand is only valid for ", sup, ""); err } infer::AddrOf(span) => { @@ -344,8 +356,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { span, E0484, "reference is not valid at the time of borrow"); - self.tcx - .note_and_explain_region(&mut err, "the borrow is only valid for ", sup, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, + "the borrow is only valid for ", sup, ""); err } infer::AutoBorrow(span) => { @@ -354,7 +366,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { E0485, "automatically reference is not valid at the time \ of borrow"); - self.tcx.note_and_explain_region(&mut err, + self.tcx.note_and_explain_region(region_maps, &mut err, "the automatic borrow is only valid for ", sup, ""); @@ -367,7 +379,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { "type of expression contains references that are \ not valid during the expression: `{}`", self.ty_to_string(t)); - self.tcx.note_and_explain_region(&mut err, "type is only valid for ", sup, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, + "type is only valid for ", sup, ""); err } infer::SafeDestructor(span) => { @@ -377,8 +390,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { "unsafe use of destructor: destructor might be \ called while references are dead"); // FIXME (22171): terms "super/subregion" are suboptimal - self.tcx.note_and_explain_region(&mut err, "superregion: ", sup, ""); - self.tcx.note_and_explain_region(&mut err, "subregion: ", sub, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, "superregion: ", sup, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, "subregion: ", sub, ""); err } infer::BindingTypeIsNotValidAtDecl(span) => { @@ -387,8 +400,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { E0488, "lifetime of variable does not enclose its \ declaration"); - self.tcx - .note_and_explain_region(&mut err, "the variable is only valid for ", sup, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, + "the variable is only valid for ", sup, ""); err } infer::ParameterInScope(_, span) => { @@ -396,8 +409,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { span, E0489, "type/lifetime parameter not in scope here"); - self.tcx - .note_and_explain_region(&mut err, "the parameter is only valid for ", sub, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, + "the parameter is only valid for ", sub, ""); err } infer::DataBorrowed(ty, span) => { @@ -406,8 +419,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { E0490, "a value of type `{}` is borrowed for too long", self.ty_to_string(ty)); - self.tcx.note_and_explain_region(&mut err, "the type is valid for ", sub, ""); - self.tcx.note_and_explain_region(&mut err, "but the borrow lasts for ", sup, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, + "the type is valid for ", sub, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, + "but the borrow lasts for ", sup, ""); err } infer::ReferenceOutlivesReferent(ty, span) => { @@ -417,8 +432,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { "in type `{}`, reference has a longer lifetime \ than the data it references", self.ty_to_string(ty)); - self.tcx.note_and_explain_region(&mut err, "the pointer is valid for ", sub, ""); - self.tcx.note_and_explain_region(&mut err, + self.tcx.note_and_explain_region(region_maps, &mut err, + "the pointer is valid for ", sub, ""); + self.tcx.note_and_explain_region(region_maps, &mut err, "but the referenced data is only valid for ", sup, ""); diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index 27c6a4c5cf2..21af92a25e6 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -1084,7 +1084,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // this infcx was in use. This is totally hokey but // otherwise we have a hard time separating legit region // errors from silly ones. - self.report_region_errors(&errors); // see error_reporting module + self.report_region_errors(region_map, &errors); // see error_reporting module } } diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 8b01d5045c6..10a21a582f5 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -16,7 +16,6 @@ //! Most of the documentation on regions can be found in //! `middle/infer/region_inference/README.md` -use hir::map as hir_map; use util::nodemap::{FxHashMap, NodeMap, NodeSet}; use ty; @@ -161,34 +160,31 @@ impl CodeExtent { /// Returns the span of this CodeExtent. Note that in general the /// returned span may not correspond to the span of any node id in /// the AST. - pub fn span(&self, hir_map: &hir_map::Map) -> Option<Span> { - match hir_map.find(self.node_id()) { - Some(hir_map::NodeBlock(ref blk)) => { - match *self { - CodeExtent::CallSiteScope(_) | - CodeExtent::ParameterScope(_) | - CodeExtent::Misc(_) | - CodeExtent::DestructionScope(_) => Some(blk.span), - - CodeExtent::Remainder(r) => { - assert_eq!(r.block, blk.id); - // Want span for extent starting after the - // indexed statement and ending at end of - // `blk`; reuse span of `blk` and shift `lo` - // forward to end of indexed statement. - // - // (This is the special case aluded to in the - // doc-comment for this method) - let stmt_span = blk.stmts[r.first_statement_index as usize].span; - Some(Span::new(stmt_span.hi(), blk.span.hi(), stmt_span.ctxt())) - } + pub fn span(&self, tcx: TyCtxt, region_maps: &RegionMaps) -> Span { + let root_node = region_maps.root_body.unwrap().node_id; + assert_eq!(DefId::local(tcx.hir.node_to_hir_id(self.node_id()).owner), + DefId::local(tcx.hir.node_to_hir_id(root_node).owner)); + let span = tcx.hir.span(self.node_id()); + if let CodeExtent::Remainder(r) = *self { + if let hir::map::NodeBlock(ref blk) = tcx.hir.get(r.block) { + // Want span for extent starting after the + // indexed statement and ending at end of + // `blk`; reuse span of `blk` and shift `lo` + // forward to end of indexed statement. + // + // (This is the special case aluded to in the + // doc-comment for this method) + + let stmt_span = blk.stmts[r.first_statement_index as usize].span; + + // To avoid issues with macro-generated spans, the span + // of the statement must be nested in that of the block. + if span.lo() <= stmt_span.lo() && stmt_span.lo() <= span.hi() { + return Span::new(stmt_span.lo(), span.hi(), span.ctxt()); } } - Some(hir_map::NodeExpr(ref expr)) => Some(expr.span), - Some(hir_map::NodeStmt(ref stmt)) => Some(stmt.span), - Some(hir_map::NodeItem(ref item)) => Some(item.span), - Some(_) | None => None, } + span } } diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 802994ae094..49d7f40000f 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -36,11 +36,11 @@ pub enum TypeError<'tcx> { TupleSize(ExpectedFound<usize>), FixedArraySize(ExpectedFound<usize>), ArgCount, + RegionsDoesNotOutlive(Region<'tcx>, Region<'tcx>), - RegionsNotSame(Region<'tcx>, Region<'tcx>), - RegionsNoOverlap(Region<'tcx>, Region<'tcx>), RegionsInsufficientlyPolymorphic(BoundRegion, Region<'tcx>), RegionsOverlyPolymorphic(BoundRegion, Region<'tcx>), + Sorts(ExpectedFound<Ty<'tcx>>), IntMismatch(ExpectedFound<ty::IntVarValue>), FloatMismatch(ExpectedFound<ast::FloatTy>), @@ -110,12 +110,6 @@ impl<'tcx> fmt::Display for TypeError<'tcx> { RegionsDoesNotOutlive(..) => { write!(f, "lifetime mismatch") } - RegionsNotSame(..) => { - write!(f, "lifetimes are not the same") - } - RegionsNoOverlap(..) => { - write!(f, "lifetimes do not intersect") - } RegionsInsufficientlyPolymorphic(br, _) => { write!(f, "expected bound lifetime parameter{}{}, found concrete lifetime", @@ -243,33 +237,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { use self::TypeError::*; match err.clone() { - RegionsDoesNotOutlive(subregion, superregion) => { - self.note_and_explain_region(db, "", subregion, "..."); - self.note_and_explain_region(db, "...does not necessarily outlive ", - superregion, ""); - } - RegionsNotSame(region1, region2) => { - self.note_and_explain_region(db, "", region1, "..."); - self.note_and_explain_region(db, "...is not the same lifetime as ", - region2, ""); - } - RegionsNoOverlap(region1, region2) => { - self.note_and_explain_region(db, "", region1, "..."); - self.note_and_explain_region(db, "...does not overlap ", - region2, ""); - } - RegionsInsufficientlyPolymorphic(_, conc_region) => { - self.note_and_explain_region(db, "concrete lifetime that was found is ", - conc_region, ""); - } - RegionsOverlyPolymorphic(_, &ty::ReVar(_)) => { - // don't bother to print out the message below for - // inference variables, it's not very illuminating. - } - RegionsOverlyPolymorphic(_, conc_region) => { - self.note_and_explain_region(db, "expected concrete lifetime is ", - conc_region, ""); - } Sorts(values) => { let expected_str = values.expected.sort_string(self); let found_str = values.found.sort_string(self); diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 6353c5e0dd0..ae05568ab41 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -371,12 +371,6 @@ impl<'a, 'tcx> Lift<'tcx> for ty::error::TypeError<'a> { RegionsDoesNotOutlive(a, b) => { return tcx.lift(&(a, b)).map(|(a, b)| RegionsDoesNotOutlive(a, b)) } - RegionsNotSame(a, b) => { - return tcx.lift(&(a, b)).map(|(a, b)| RegionsNotSame(a, b)) - } - RegionsNoOverlap(a, b) => { - return tcx.lift(&(a, b)).map(|(a, b)| RegionsNoOverlap(a, b)) - } RegionsInsufficientlyPolymorphic(a, b) => { return tcx.lift(&b).map(|b| RegionsInsufficientlyPolymorphic(a, b)) } @@ -1057,12 +1051,6 @@ impl<'tcx> TypeFoldable<'tcx> for ty::error::TypeError<'tcx> { RegionsDoesNotOutlive(a, b) => { RegionsDoesNotOutlive(a.fold_with(folder), b.fold_with(folder)) }, - RegionsNotSame(a, b) => { - RegionsNotSame(a.fold_with(folder), b.fold_with(folder)) - }, - RegionsNoOverlap(a, b) => { - RegionsNoOverlap(a.fold_with(folder), b.fold_with(folder)) - }, RegionsInsufficientlyPolymorphic(a, b) => { RegionsInsufficientlyPolymorphic(a, b.fold_with(folder)) }, @@ -1088,9 +1076,7 @@ impl<'tcx> TypeFoldable<'tcx> for ty::error::TypeError<'tcx> { match *self { UnsafetyMismatch(x) => x.visit_with(visitor), AbiMismatch(x) => x.visit_with(visitor), - RegionsDoesNotOutlive(a, b) | - RegionsNotSame(a, b) | - RegionsNoOverlap(a, b) => { + RegionsDoesNotOutlive(a, b) => { a.visit_with(visitor) || b.visit_with(visitor) }, RegionsInsufficientlyPolymorphic(_, b) | |
