about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard Burtescu <edy.burt@gmail.com>2015-01-29 13:50:19 +0200
committerEduard Burtescu <edy.burt@gmail.com>2015-02-16 16:29:22 +0200
commit5918d33feff253f1f9d90e5211766d2b319aecc1 (patch)
treed9390ca15a7969f4422b5513760dffa09c9670b1
parentbd9c67e181aaf304767593a239486e07119286cc (diff)
downloadrust-5918d33feff253f1f9d90e5211766d2b319aecc1.tar.gz
rust-5918d33feff253f1f9d90e5211766d2b319aecc1.zip
rust_typeck: remove unnecessary typing of `&[]` as `&'static [T; 0]`.
-rw-r--r--src/librustc/middle/infer/error_reporting.rs1
-rw-r--r--src/librustc/middle/infer/mod.rs5
-rw-r--r--src/librustc_typeck/check/mod.rs20
3 files changed, 2 insertions, 24 deletions
diff --git a/src/librustc/middle/infer/error_reporting.rs b/src/librustc/middle/infer/error_reporting.rs
index 5d7a56ef0e6..72454046eb9 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 6c987bba389..00e377d65fe 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 27b17c9fc97..1c15e295ad9 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);
       }