Skip to content

Commit 5715987

Browse files
committed
rust_typeck: remove unnecessary typing of &[] as &'static [T; 0].
1 parent 1b676a5 commit 5715987

File tree

3 files changed

+2
-24
lines changed

3 files changed

+2
-24
lines changed

src/librustc/middle/infer/error_reporting.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1421,7 +1421,6 @@ impl<'a, 'tcx> ErrorReportingHelpers<'tcx> for InferCtxt<'a, 'tcx> {
14211421
infer::MiscVariable(_) => "".to_string(),
14221422
infer::PatternRegion(_) => " for pattern".to_string(),
14231423
infer::AddrOfRegion(_) => " for borrow expression".to_string(),
1424-
infer::AddrOfSlice(_) => " for slice expression".to_string(),
14251424
infer::Autoref(_) => " for autoref".to_string(),
14261425
infer::Coercion(_) => " for automatic coercion".to_string(),
14271426
infer::LateBoundRegion(_, br, infer::FnCall) => {

src/librustc/middle/infer/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,6 @@ pub enum RegionVariableOrigin<'tcx> {
249249
// Regions created by `&` operator
250250
AddrOfRegion(Span),
251251

252-
// Regions created by `&[...]` literal
253-
AddrOfSlice(Span),
254-
255252
// Regions created as part of an autoref of a method receiver
256253
Autoref(Span),
257254

@@ -1286,7 +1283,6 @@ impl<'tcx> RegionVariableOrigin<'tcx> {
12861283
MiscVariable(a) => a,
12871284
PatternRegion(a) => a,
12881285
AddrOfRegion(a) => a,
1289-
AddrOfSlice(a) => a,
12901286
Autoref(a) => a,
12911287
Coercion(ref a) => a.span(),
12921288
EarlyBoundRegion(a, _) => a,
@@ -1309,7 +1305,6 @@ impl<'tcx> Repr<'tcx> for RegionVariableOrigin<'tcx> {
13091305
AddrOfRegion(a) => {
13101306
format!("AddrOfRegion({})", a.repr(tcx))
13111307
}
1312-
AddrOfSlice(a) => format!("AddrOfSlice({})", a.repr(tcx)),
13131308
Autoref(a) => format!("Autoref({})", a.repr(tcx)),
13141309
Coercion(ref a) => format!("Coercion({})", a.repr(tcx)),
13151310
EarlyBoundRegion(a, b) => {

src/librustc_typeck/check/mod.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3600,24 +3600,8 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
36003600
// Finally, borrowck is charged with guaranteeing that the
36013601
// value whose address was taken can actually be made to live
36023602
// as long as it needs to live.
3603-
match oprnd.node {
3604-
// String literals are already, implicitly converted to slices.
3605-
//ast::ExprLit(lit) if ast_util::lit_is_str(lit) => fcx.expr_ty(oprnd),
3606-
// Empty slices live in static memory.
3607-
ast::ExprVec(ref elements) if elements.len() == 0 => {
3608-
// Note: we do not assign a lifetime of
3609-
// static. This is because the resulting type
3610-
// `&'static [T]` would require that T outlives
3611-
// `'static`!
3612-
let region = fcx.infcx().next_region_var(
3613-
infer::AddrOfSlice(expr.span));
3614-
ty::mk_rptr(tcx, tcx.mk_region(region), tm)
3615-
}
3616-
_ => {
3617-
let region = fcx.infcx().next_region_var(infer::AddrOfRegion(expr.span));
3618-
ty::mk_rptr(tcx, tcx.mk_region(region), tm)
3619-
}
3620-
}
3603+
let region = fcx.infcx().next_region_var(infer::AddrOfRegion(expr.span));
3604+
ty::mk_rptr(tcx, tcx.mk_region(region), tm)
36213605
};
36223606
fcx.write_ty(id, oprnd_t);
36233607
}

0 commit comments

Comments
 (0)