diff --git a/src/librustc/middle/infer/error_reporting.rs b/src/librustc/middle/infer/error_reporting.rs index 5d7a56ef0e6c..72454046eb94 100644 --- a/src/librustc/middle/infer/error_reporting.rs +++ b/src/librustc/middle/infer/error_reporting.rs @@ -1435,7 +1435,6 @@ impl<'a, 'tcx> ErrorReportingHelpers<'tcx> for InferCtxt<'a, 'tcx> { infer::MiscVariable(_) => "".to_string(), infer::PatternRegion(_) => " for pattern".to_string(), infer::AddrOfRegion(_) => " for borrow expression".to_string(), - infer::AddrOfSlice(_) => " for slice expression".to_string(), infer::Autoref(_) => " for autoref".to_string(), infer::Coercion(_) => " for automatic coercion".to_string(), infer::LateBoundRegion(_, br, infer::FnCall) => { diff --git a/src/librustc/middle/infer/mod.rs b/src/librustc/middle/infer/mod.rs index 6c987bba3899..00e377d65fea 100644 --- a/src/librustc/middle/infer/mod.rs +++ b/src/librustc/middle/infer/mod.rs @@ -247,9 +247,6 @@ pub enum RegionVariableOrigin<'tcx> { // Regions created by `&` operator AddrOfRegion(Span), - // Regions created by `&[...]` literal - AddrOfSlice(Span), - // Regions created as part of an autoref of a method receiver Autoref(Span), @@ -1273,7 +1270,6 @@ impl<'tcx> RegionVariableOrigin<'tcx> { MiscVariable(a) => a, PatternRegion(a) => a, AddrOfRegion(a) => a, - AddrOfSlice(a) => a, Autoref(a) => a, Coercion(ref a) => a.span(), EarlyBoundRegion(a, _) => a, @@ -1296,7 +1292,6 @@ impl<'tcx> Repr<'tcx> for RegionVariableOrigin<'tcx> { AddrOfRegion(a) => { format!("AddrOfRegion({})", a.repr(tcx)) } - AddrOfSlice(a) => format!("AddrOfSlice({})", a.repr(tcx)), Autoref(a) => format!("Autoref({})", a.repr(tcx)), Coercion(ref a) => format!("Coercion({})", a.repr(tcx)), EarlyBoundRegion(a, b) => { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 27b17c9fc970..1c15e295ad93 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -3586,24 +3586,8 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>, // Finally, borrowck is charged with guaranteeing that the // value whose address was taken can actually be made to live // as long as it needs to live. - match oprnd.node { - // String literals are already, implicitly converted to slices. - //ast::ExprLit(lit) if ast_util::lit_is_str(lit) => fcx.expr_ty(oprnd), - // Empty slices live in static memory. - ast::ExprVec(ref elements) if elements.len() == 0 => { - // Note: we do not assign a lifetime of - // static. This is because the resulting type - // `&'static [T]` would require that T outlives - // `'static`! - let region = fcx.infcx().next_region_var( - infer::AddrOfSlice(expr.span)); - ty::mk_rptr(tcx, tcx.mk_region(region), tm) - } - _ => { - let region = fcx.infcx().next_region_var(infer::AddrOfRegion(expr.span)); - ty::mk_rptr(tcx, tcx.mk_region(region), tm) - } - } + let region = fcx.infcx().next_region_var(infer::AddrOfRegion(expr.span)); + ty::mk_rptr(tcx, tcx.mk_region(region), tm) }; fcx.write_ty(id, oprnd_t); }