diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index e2f27074dbfc9206a2fe466a0546ef53e9fa4b82..fa3715b6891a06d29c8c4387dc5e11b5a15d07f4 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -337,8 +337,10 @@ fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> { fn fold_region(&mut self, r: ty::Region) -> ty::Region { match r { - // Never make variables for regions bound within the type itself. - ty::ReLateBound(..) => { return r; } + // Never make variables for regions bound within the type itself, + // nor for erased regions. + ty::ReLateBound(..) | + ty::ReErased => { return r; } // Early-bound regions should really have been substituted away before // we get to this point. diff --git a/src/librustc/infer/error_reporting.rs b/src/librustc/infer/error_reporting.rs index 2f67042ca1c25f8f0512db17ed3752691c6d8608..041abf9b7de1e0af3ba6d2b74e4a8e6ecd4e9df8 100644 --- a/src/librustc/infer/error_reporting.rs +++ b/src/librustc/infer/error_reporting.rs @@ -216,7 +216,10 @@ fn explain_span<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, // // We shouldn't really be having unification failures with ReVar // and ReLateBound though. - ty::ReSkolemized(..) | ty::ReVar(_) | ty::ReLateBound(..) => { + ty::ReSkolemized(..) | + ty::ReVar(_) | + ty::ReLateBound(..) | + ty::ReErased => { (format!("lifetime {:?}", region), None) } }; diff --git a/src/librustc/infer/freshen.rs b/src/librustc/infer/freshen.rs index 5ded6dc73646ea04f5920446cdfb9385693d8b82..880661a882af3c38e114390d6d39226b5eccd020 100644 --- a/src/librustc/infer/freshen.rs +++ b/src/librustc/infer/freshen.rs @@ -23,7 +23,7 @@ //! error messages or in any other form. Freshening is only really useful as an internal detail. //! //! __An important detail concerning regions.__ The freshener also replaces *all* regions with -//! 'static. The reason behind this is that, in general, we do not take region relationships into +//! 'erased. The reason behind this is that, in general, we do not take region relationships into //! account when making type-overloaded decisions. This is important because of the design of the //! region inferencer, which is not based on unification but rather on accumulating and then //! solving a set of constraints. In contrast, the type inferencer assigns a value to each type @@ -96,9 +96,10 @@ fn fold_region(&mut self, r: ty::Region) -> ty::Region { ty::ReScope(_) | ty::ReVar(_) | ty::ReSkolemized(..) | - ty::ReEmpty => { - // replace all free regions with 'static - ty::ReStatic + ty::ReEmpty | + ty::ReErased => { + // replace all free regions with 'erased + ty::ReErased } } } diff --git a/src/librustc/infer/region_inference/mod.rs b/src/librustc/infer/region_inference/mod.rs index 2211a565a325f215a2af2ca7ead346fc61d0f6dc..ebfa942e5e415d880d74f03d12c545166623117f 100644 --- a/src/librustc/infer/region_inference/mod.rs +++ b/src/librustc/infer/region_inference/mod.rs @@ -25,7 +25,7 @@ use middle::free_region::FreeRegionMap; use ty::{self, Ty, TyCtxt}; use ty::{BoundRegion, Region, RegionVid}; -use ty::{ReEmpty, ReStatic, ReFree, ReEarlyBound}; +use ty::{ReEmpty, ReStatic, ReFree, ReEarlyBound, ReErased}; use ty::{ReLateBound, ReScope, ReVar, ReSkolemized, BrFresh}; use std::cell::{Cell, RefCell}; @@ -918,8 +918,10 @@ fn lub_concrete_regions(&self, free_regions: &FreeRegionMap, a: Region, b: Regio (ReLateBound(..), _) | (_, ReLateBound(..)) | (ReEarlyBound(..), _) | - (_, ReEarlyBound(..)) => { - bug!("cannot relate bound region: LUB({:?}, {:?})", a, b); + (_, ReEarlyBound(..)) | + (ReErased, _) | + (_, ReErased) => { + bug!("cannot relate region: LUB({:?}, {:?})", a, b); } (ReStatic, _) | (_, ReStatic) => { diff --git a/src/librustc/ty/flags.rs b/src/librustc/ty/flags.rs index b12581b34003d64841a6d5253171254fb0edba37..44b450784ed2a9c51e87cb1b6d891cbd7cecb234 100644 --- a/src/librustc/ty/flags.rs +++ b/src/librustc/ty/flags.rs @@ -187,7 +187,7 @@ fn add_region(&mut self, r: ty::Region) { } ty::ReLateBound(debruijn, _) => { self.add_depth(debruijn.depth); } ty::ReEarlyBound(..) => { self.add_flags(TypeFlags::HAS_RE_EARLY_BOUND); } - ty::ReStatic => {} + ty::ReStatic | ty::ReErased => {} _ => { self.add_flags(TypeFlags::HAS_FREE_REGIONS); } } diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index f76f4c01df344f0fdcf1d32d4a24f51c327ca3da..1a944e04effd76475221e67bcc3ac73a02c03696 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -421,12 +421,12 @@ fn collect_late_bound_regions(&self, value: &Binder, just_constraint: bool collector.regions } - /// Replace any late-bound regions bound in `value` with `'static`. Useful in trans but also + /// Replace any late-bound regions bound in `value` with `'erased`. Useful in trans but also /// method lookup and a few other places where precise region relationships are not required. pub fn erase_late_bound_regions(self, value: &Binder) -> T where T : TypeFoldable<'tcx> { - self.replace_late_bound_regions(value, |_| ty::ReStatic).0 + self.replace_late_bound_regions(value, |_| ty::ReErased).0 } /// Rewrite any late-bound regions so that they are anonymous. Region numbers are @@ -547,15 +547,15 @@ fn fold_binder(&mut self, t: &ty::Binder) -> ty::Binder fn fold_region(&mut self, r: ty::Region) -> ty::Region { // because late-bound regions affect subtyping, we can't // erase the bound/free distinction, but we can replace - // all free regions with 'static. + // all free regions with 'erased. // // Note that we *CAN* replace early-bound regions -- the // type system never "sees" those, they get substituted - // away. In trans, they will always be erased to 'static + // away. In trans, they will always be erased to 'erased // whenever a substitution occurs. match r { ty::ReLateBound(..) => r, - _ => ty::ReStatic + _ => ty::ReErased } } } @@ -651,7 +651,7 @@ fn visit_region(&mut self, r: ty::Region) -> bool { // does this represent a region that cannot be named // in a global way? used in fulfillment caching. match r { - ty::ReStatic | ty::ReEmpty => {} + ty::ReStatic | ty::ReEmpty | ty::ReErased => {} _ => return true, } } diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 2bb88e52f8887b06496e6b0100a3626322ca8179..e2a9a954126691251632aa830fb4cf4900cc7775 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -705,6 +705,9 @@ pub enum Region { /// The only way to get an instance of ReEmpty is to have a region /// variable with no constraints. ReEmpty, + + /// Erased region, used by trait selection, in MIR and during trans. + ReErased, } #[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug)] diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 2db9ceb8a05c8ddc8517fd7364f1c16b76682759..fbc565ca847b656ce7c272165588a80b61a83400 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -89,7 +89,7 @@ pub fn with_self_ty(&self, self_ty: Ty<'tcx>) -> Substs<'tcx> { pub fn erase_regions(self) -> Substs<'tcx> { let Substs { types, regions } = self; - let regions = regions.map(|_| ty::ReStatic); + let regions = regions.map(|_| ty::ReErased); Substs { types: types, regions: regions } } diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 416347919a83fea27006caeb2c7ea9882795dbd0..7745f00c2ebd9ac50c54dff8ac2a16b929e7d991 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -348,7 +348,7 @@ fn helper<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, let region = |state: &mut SipHasher, r: ty::Region| { match r { - ty::ReStatic => {} + ty::ReStatic | ty::ReErased => {} ty::ReLateBound(db, ty::BrAnon(i)) => { db.hash(state); i.hash(state); diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index e600e7b72da0e6be5c6483fd1c31ab98e1c6eba9..0bfb7c1ed55321da22e6c9fe412b2dedcbc04686 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -148,28 +148,36 @@ pub fn parameterized(f: &mut fmt::Formatter, write!(f, "{}", cont) } }; - let print_region = |f: &mut fmt::Formatter, region: &ty::Region| -> _ { - if verbose { - write!(f, "{:?}", region) - } else { - let s = region.to_string(); - if s.is_empty() { - // This happens when the value of the region - // parameter is not easily serialized. This may be - // because the user omitted it in the first place, - // or because it refers to some block in the code, - // etc. I'm not sure how best to serialize this. - write!(f, "'_") + + let print_regions = |f: &mut fmt::Formatter, start: &str, regions: &[ty::Region]| { + // Don't print any regions if they're all erased. + if regions.iter().all(|r| *r == ty::ReErased) { + return Ok(()); + } + + for region in regions { + start_or_continue(f, start, ", ")?; + if verbose { + write!(f, "{:?}", region)?; } else { - write!(f, "{}", s) + let s = region.to_string(); + if s.is_empty() { + // This happens when the value of the region + // parameter is not easily serialized. This may be + // because the user omitted it in the first place, + // or because it refers to some block in the code, + // etc. I'm not sure how best to serialize this. + write!(f, "'_")?; + } else { + write!(f, "{}", s)?; + } } } + + Ok(()) }; - for region in substs.regions.get_slice(subst::TypeSpace) { - start_or_continue(f, "<", ", ")?; - print_region(f, region)?; - } + print_regions(f, "<", substs.regions.get_slice(subst::TypeSpace))?; let num_supplied_defaults = if verbose { 0 @@ -211,10 +219,7 @@ pub fn parameterized(f: &mut fmt::Formatter, write!(f, "::{}", item_name)?; } - for region in substs.regions.get_slice(subst::FnSpace) { - start_or_continue(f, "::<", ", ")?; - print_region(f, region)?; - } + print_regions(f, "::<", substs.regions.get_slice(subst::FnSpace))?; // FIXME: consider being smart with defaults here too for ty in substs.types.get_slice(subst::FnSpace) { @@ -536,7 +541,9 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "ReSkolemized({}, {:?})", id.index, bound_region) } - ty::ReEmpty => write!(f, "ReEmpty") + ty::ReEmpty => write!(f, "ReEmpty"), + + ty::ReErased => write!(f, "ReErased") } } } @@ -600,7 +607,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", br) } ty::ReScope(_) | - ty::ReVar(_) => Ok(()), + ty::ReVar(_) | + ty::ReErased => Ok(()), ty::ReStatic => write!(f, "'static"), ty::ReEmpty => write!(f, "'"), } diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index 7d4f02bfe1109cdb9bd1a9dc4717d813b742bc57..7f814f5dfaa919691d4bb4fce05c80ab72d3e70e 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -369,7 +369,8 @@ fn guarantee_valid(&mut self, ty::ReLateBound(..) | ty::ReEarlyBound(..) | ty::ReVar(..) | - ty::ReSkolemized(..) => { + ty::ReSkolemized(..) | + ty::ReErased => { span_bug!( cmt.span, "invalid borrow lifetime: {:?}", diff --git a/src/librustc_metadata/tydecode.rs b/src/librustc_metadata/tydecode.rs index 797af8964a14da196088b5a6acc0f8eff4cea786..d96996a017986ca2304080948a7f83d0740c1779 100644 --- a/src/librustc_metadata/tydecode.rs +++ b/src/librustc_metadata/tydecode.rs @@ -221,12 +221,9 @@ pub fn parse_region(&mut self) -> ty::Region { assert_eq!(self.next(), '|'); ty::ReScope(scope) } - 't' => { - ty::ReStatic - } - 'e' => { - ty::ReStatic - } + 't' => ty::ReStatic, + 'e' => ty::ReEmpty, + 'E' => ty::ReErased, _ => bug!("parse_region: bad input") } } diff --git a/src/librustc_metadata/tyencode.rs b/src/librustc_metadata/tyencode.rs index 87a2e50bb25e9b4e446778b56faef139f89844cd..48811c68f58695a786e8cabacb519d7901e5749c 100644 --- a/src/librustc_metadata/tyencode.rs +++ b/src/librustc_metadata/tyencode.rs @@ -283,6 +283,9 @@ pub fn enc_region(w: &mut Cursor>, cx: &ctxt, r: ty::Region) { ty::ReEmpty => { write!(w, "e"); } + ty::ReErased => { + write!(w, "E"); + } ty::ReVar(_) | ty::ReSkolemized(..) => { // these should not crop up after typeck bug!("cannot encode region variables"); diff --git a/src/librustc_trans/_match.rs b/src/librustc_trans/_match.rs index 419e19532dd7c3e738360cc2d5dd7c4f703c8317..5bc92a9c45f3d50202f10ae925e65ce5dfe07365 100644 --- a/src/librustc_trans/_match.rs +++ b/src/librustc_trans/_match.rs @@ -731,7 +731,7 @@ fn bind_subslice_pat(bcx: Block, let slice_begin = InBoundsGEP(bcx, base, &[C_uint(bcx.ccx(), offset_left)]); let slice_len_offset = C_uint(bcx.ccx(), offset_left + offset_right); let slice_len = Sub(bcx, len, slice_len_offset, DebugLoc::None); - let slice_ty = bcx.tcx().mk_imm_ref(bcx.tcx().mk_region(ty::ReStatic), + let slice_ty = bcx.tcx().mk_imm_ref(bcx.tcx().mk_region(ty::ReErased), bcx.tcx().mk_slice(unit_ty)); let scratch = rvalue_scratch_datum(bcx, slice_ty, ""); Store(bcx, slice_begin, expr::get_dataptr(bcx, scratch.val)); diff --git a/src/librustc_trans/callee.rs b/src/librustc_trans/callee.rs index 5b2cfbe46490d458ec569e7dd0ccecfbb1ecd351..79882891f63d3f2af79d65cc96feec7b2eb0e607 100644 --- a/src/librustc_trans/callee.rs +++ b/src/librustc_trans/callee.rs @@ -328,7 +328,7 @@ pub fn trans_fn_pointer_shim<'a, 'tcx>( }; let bare_fn_ty_maybe_ref = if is_by_ref { - tcx.mk_imm_ref(tcx.mk_region(ty::ReStatic), bare_fn_ty) + tcx.mk_imm_ref(tcx.mk_region(ty::ReErased), bare_fn_ty) } else { bare_fn_ty }; diff --git a/src/librustc_trans/closure.rs b/src/librustc_trans/closure.rs index 9cc5cbbbb65cb332088c22fc7b7a42a826820f45..9196cfce16feb3c85f2b937605b18c169f1689ea 100644 --- a/src/librustc_trans/closure.rs +++ b/src/librustc_trans/closure.rs @@ -123,10 +123,10 @@ fn get_self_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, -> Ty<'tcx> { match tcx.closure_kind(closure_id) { ty::ClosureKind::Fn => { - tcx.mk_imm_ref(tcx.mk_region(ty::ReStatic), fn_ty) + tcx.mk_imm_ref(tcx.mk_region(ty::ReErased), fn_ty) } ty::ClosureKind::FnMut => { - tcx.mk_mut_ref(tcx.mk_region(ty::ReStatic), fn_ty) + tcx.mk_mut_ref(tcx.mk_region(ty::ReErased), fn_ty) } ty::ClosureKind::FnOnce => fn_ty, } @@ -344,7 +344,7 @@ fn trans_fn_once_adapter_shim<'a, 'tcx>( // Find a version of the closure type. Substitute static for the // region since it doesn't really matter. let closure_ty = tcx.mk_closure_from_closure_substs(closure_def_id, substs); - let ref_closure_ty = tcx.mk_imm_ref(tcx.mk_region(ty::ReStatic), closure_ty); + let ref_closure_ty = tcx.mk_imm_ref(tcx.mk_region(ty::ReErased), closure_ty); // Make a version with the type of by-ref closure. let ty::ClosureTy { unsafety, abi, mut sig } = diff --git a/src/librustc_trans/consts.rs b/src/librustc_trans/consts.rs index bd36c18a47ee2252803f48a04b189274809380b9..045bb21fddade985dd819ed3d6419f5ca3166ceb 100644 --- a/src/librustc_trans/consts.rs +++ b/src/librustc_trans/consts.rs @@ -382,7 +382,7 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, // Don't copy data to do a deref+ref // (i.e., skip the last auto-deref). llconst = addr_of(cx, llconst, type_of::align_of(cx, ty), "autoref"); - ty = cx.tcx().mk_imm_ref(cx.tcx().mk_region(ty::ReStatic), ty); + ty = cx.tcx().mk_imm_ref(cx.tcx().mk_region(ty::ReErased), ty); } } else if adj.autoderefs > 0 { let (dv, dt) = const_deref(cx, llconst, ty); diff --git a/src/librustc_trans/context.rs b/src/librustc_trans/context.rs index 1ddcbc79aed5fe0ea04d06c35459ead0c9361ead..550455a7fb7a2306a4f800f2cacdcf6b427136b5 100644 --- a/src/librustc_trans/context.rs +++ b/src/librustc_trans/context.rs @@ -495,7 +495,7 @@ pub fn empty_substs_for_scheme(&self, scheme: &ty::TypeScheme<'tcx>) assert!(scheme.generics.types.is_empty()); self.tcx().mk_substs( Substs::new(VecPerParamSpace::empty(), - scheme.generics.regions.map(|_| ty::ReStatic))) + scheme.generics.regions.map(|_| ty::ReErased))) } pub fn symbol_hasher(&self) -> &RefCell { diff --git a/src/librustc_trans/expr.rs b/src/librustc_trans/expr.rs index d75516ff648372a6d8f7c64ca73f4bfeb010711b..b6663bd9a69e60c31c1827d640fd4d37254f486a 100644 --- a/src/librustc_trans/expr.rs +++ b/src/librustc_trans/expr.rs @@ -1978,7 +1978,7 @@ fn auto_ref<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, // Compute final type. Note that we are loose with the region and // mutability, since those things don't matter in trans. let referent_ty = lv_datum.ty; - let ptr_ty = bcx.tcx().mk_imm_ref(bcx.tcx().mk_region(ty::ReStatic), referent_ty); + let ptr_ty = bcx.tcx().mk_imm_ref(bcx.tcx().mk_region(ty::ReErased), referent_ty); // Construct the resulting datum. The right datum to return here would be an Lvalue datum, // because there is cleanup scheduled and the datum doesn't own the data, but for thin pointers diff --git a/src/librustc_trans/meth.rs b/src/librustc_trans/meth.rs index 4b81d993e02e17b4c1d9a50f7d770bbdda01327c..062b3d4a6e4bfd55fa99c93da5bb0dbb6d3820da 100644 --- a/src/librustc_trans/meth.rs +++ b/src/librustc_trans/meth.rs @@ -271,7 +271,7 @@ pub fn get_vtable_methods<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // the method may have some early-bound lifetimes, add // regions for those let num_dummy_regions = trait_method_type.generics.regions.len(FnSpace); - let dummy_regions = vec![ty::ReStatic; num_dummy_regions]; + let dummy_regions = vec![ty::ReErased; num_dummy_regions]; let method_substs = substs.clone() .with_method(vec![], dummy_regions); let method_substs = tcx.mk_substs(method_substs); diff --git a/src/librustc_trans/mir/constant.rs b/src/librustc_trans/mir/constant.rs index 0403c7b1f757b89fb166b9744c869af6fa67627b..d4c60214179ad18ba25678ec40bc7809412cff2d 100644 --- a/src/librustc_trans/mir/constant.rs +++ b/src/librustc_trans/mir/constant.rs @@ -667,7 +667,7 @@ fn const_rvalue(&self, rvalue: &mir::Rvalue<'tcx>, let tr_lvalue = self.const_lvalue(lvalue, span)?; let ty = tr_lvalue.ty; - let ref_ty = tcx.mk_ref(tcx.mk_region(ty::ReStatic), + let ref_ty = tcx.mk_ref(tcx.mk_region(ty::ReErased), ty::TypeAndMut { ty: ty, mutbl: bk.to_mutbl_lossy() }); let base = match tr_lvalue.base { diff --git a/src/librustc_trans/mir/rvalue.rs b/src/librustc_trans/mir/rvalue.rs index 6d141862ac3fffdc911f01572c3123a78441e64d..4d80ec28da665177f180049cdfbb1b866d50492a 100644 --- a/src/librustc_trans/mir/rvalue.rs +++ b/src/librustc_trans/mir/rvalue.rs @@ -371,7 +371,7 @@ pub fn trans_rvalue_operand(&mut self, let ty = tr_lvalue.ty.to_ty(bcx.tcx()); let ref_ty = bcx.tcx().mk_ref( - bcx.tcx().mk_region(ty::ReStatic), + bcx.tcx().mk_region(ty::ReErased), ty::TypeAndMut { ty: ty, mutbl: bk.to_mutbl_lossy() } ); diff --git a/src/librustc_trans/monomorphize.rs b/src/librustc_trans/monomorphize.rs index cf84dd57d0254e61a7f67a95a4c6098e7a90d574..a0355dcc66e618c773b1bd0a1efcf970be13a61b 100644 --- a/src/librustc_trans/monomorphize.rs +++ b/src/librustc_trans/monomorphize.rs @@ -180,7 +180,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { impl<'tcx> Instance<'tcx> { pub fn new(def_id: DefId, substs: &'tcx Substs<'tcx>) -> Instance<'tcx> { - assert!(substs.regions.iter().all(|&r| r == ty::ReStatic)); + assert!(substs.regions.iter().all(|&r| r == ty::ReErased)); Instance { def: def_id, substs: substs } } pub fn mono<'a>(scx: &SharedCrateContext<'a, 'tcx>, def_id: DefId) -> Instance<'tcx> { diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 0bb078dfbcba2d5304f81b3f20df9c1d6db0d727..d6b696a25483caf1ed67c43aa57c3f09ec74c835 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -976,7 +976,7 @@ fn pick_autorefd_method(&mut self, // In general, during probing we erase regions. See // `impl_self_ty()` for an explanation. - let region = tcx.mk_region(ty::ReStatic); + let region = tcx.mk_region(ty::ReErased); // Search through mutabilities in order to find one where pick works: [hir::MutImmutable, hir::MutMutable].iter().filter_map(|&m| { @@ -1240,7 +1240,7 @@ fn xform_method_self_ty(&self, let method_regions = method.generics.regions.get_slice(subst::FnSpace) .iter() - .map(|_| ty::ReStatic) + .map(|_| ty::ReErased) .collect(); placeholder = (*substs).clone().with_method(Vec::new(), method_regions); @@ -1276,7 +1276,7 @@ fn impl_ty_and_substs(&self, let region_placeholders = impl_pty.generics.regions.map( - |_| ty::ReStatic); // see erase_late_bound_regions() for an expl of why 'static + |_| ty::ReErased); // see erase_late_bound_regions() for an expl of why 'erased let substs = subst::Substs::new(type_vars, region_placeholders); (impl_pty.ty, substs) diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 612007da0e97acf33992d1ffd36e59fd8904af2a..01a310da25ddd26a364f0526a51df43c7e8f844f 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -520,7 +520,7 @@ fn add_constraints_from_region(&mut self, } ty::ReFree(..) | ty::ReScope(..) | ty::ReVar(..) | - ty::ReSkolemized(..) | ty::ReEmpty => { + ty::ReSkolemized(..) | ty::ReEmpty | ty::ReErased => { // We don't expect to see anything but 'static or bound // regions when visiting member types or method types. bug!("unexpected region encountered in variance \ diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 0f3c62aca2a8595b51eba8be4f38b854ba3cbcce..d7b4ad1128c6a4d9487105fec825d509ffe073be 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -827,7 +827,8 @@ fn clean(&self, cx: &DocContext) -> Option { ty::ReScope(..) | ty::ReVar(..) | ty::ReSkolemized(..) | - ty::ReEmpty => None + ty::ReEmpty | + ty::ReErased => None } } } diff --git a/src/test/compile-fail/non-interger-atomic.rs b/src/test/compile-fail/non-interger-atomic.rs index 0b7b33de42193850bd41802a56d2b5d3f2c0aeb6..50240b475578c6a66f903e1f8cee08cfc476951f 100644 --- a/src/test/compile-fail/non-interger-atomic.rs +++ b/src/test/compile-fail/non-interger-atomic.rs @@ -60,22 +60,22 @@ unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) { unsafe fn test_Bar_load(p: &mut Bar, v: Bar) { intrinsics::atomic_load(p); - //~^ ERROR expected basic integer type, found `&'static std::ops::Fn() + 'static` + //~^ ERROR expected basic integer type, found `&std::ops::Fn()` } unsafe fn test_Bar_store(p: &mut Bar, v: Bar) { intrinsics::atomic_store(p, v); - //~^ ERROR expected basic integer type, found `&'static std::ops::Fn() + 'static` + //~^ ERROR expected basic integer type, found `&std::ops::Fn()` } unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) { intrinsics::atomic_xchg(p, v); - //~^ ERROR expected basic integer type, found `&'static std::ops::Fn() + 'static` + //~^ ERROR expected basic integer type, found `&std::ops::Fn()` } unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) { intrinsics::atomic_cxchg(p, v, v); - //~^ ERROR expected basic integer type, found `&'static std::ops::Fn() + 'static` + //~^ ERROR expected basic integer type, found `&std::ops::Fn()` } unsafe fn test_Quux_load(p: &mut Quux, v: Quux) { diff --git a/src/test/run-pass/issue-21058.rs b/src/test/run-pass/issue-21058.rs index af767464db35170ca31443c7eafdde94a778a08f..19cd1cf3df717721c9bbfcdb85825b0699aa437a 100644 --- a/src/test/run-pass/issue-21058.rs +++ b/src/test/run-pass/issue-21058.rs @@ -26,5 +26,5 @@ fn main() { std::intrinsics::type_name::(), // DST std::intrinsics::type_name::() - )}, ("[u8]", "str", "std::marker::Send + 'static", "NT", "DST")); + )}, ("[u8]", "str", "std::marker::Send", "NT", "DST")); }