Remove dead code
This commit is contained in:
parent
1f9d846a58
commit
f5cc5ca8c7
4 changed files with 37 additions and 5 deletions
|
@ -905,7 +905,6 @@ fn constructor_sub_pattern_tys<'a, 'tcx: 'a>(cx: &MatchCheckCtxt<'a, 'tcx>,
|
||||||
ty::TySlice(ty) | ty::TyArray(ty, _) => match *ctor {
|
ty::TySlice(ty) | ty::TyArray(ty, _) => match *ctor {
|
||||||
Slice(length) => (0..length).map(|_| ty).collect(),
|
Slice(length) => (0..length).map(|_| ty).collect(),
|
||||||
ConstantValue(_) => vec![],
|
ConstantValue(_) => vec![],
|
||||||
Single => vec![ty],
|
|
||||||
_ => bug!("bad slice pattern {:?} {:?}", ctor, ty)
|
_ => bug!("bad slice pattern {:?} {:?}", ctor, ty)
|
||||||
},
|
},
|
||||||
ty::TyRef(_, ref ty_and_mut) => vec![ty_and_mut.ty],
|
ty::TyRef(_, ref ty_and_mut) => vec![ty_and_mut.ty],
|
||||||
|
@ -914,9 +913,6 @@ fn constructor_sub_pattern_tys<'a, 'tcx: 'a>(cx: &MatchCheckCtxt<'a, 'tcx>,
|
||||||
// Use T as the sub pattern type of Box<T>.
|
// Use T as the sub pattern type of Box<T>.
|
||||||
vec![substs.type_at(0)]
|
vec![substs.type_at(0)]
|
||||||
} else {
|
} else {
|
||||||
if let ConstantValue(_) = *ctor {
|
|
||||||
return vec![];
|
|
||||||
}
|
|
||||||
adt.variants[ctor.variant_index_for_adt(adt)].fields.iter().map(|field| {
|
adt.variants[ctor.variant_index_for_adt(adt)].fields.iter().map(|field| {
|
||||||
let is_visible = adt.is_enum()
|
let is_visible = adt.is_enum()
|
||||||
|| field.vis.is_accessible_from(cx.module, cx.tcx);
|
|| field.vis.is_accessible_from(cx.module, cx.tcx);
|
||||||
|
@ -1025,7 +1021,6 @@ fn constructor_covered_by_range(ctor: &Constructor,
|
||||||
(end == RangeEnd::Excluded && to == Ordering::Equal);
|
(end == RangeEnd::Excluded && to == Ordering::Equal);
|
||||||
Ok(some_or_ok!(cmp_from(&from.val)) && end)
|
Ok(some_or_ok!(cmp_from(&from.val)) && end)
|
||||||
}
|
}
|
||||||
Variant(_) |
|
|
||||||
Single => Ok(true),
|
Single => Ok(true),
|
||||||
_ => bug!(),
|
_ => bug!(),
|
||||||
}
|
}
|
||||||
|
|
21
src/test/ui/const-eval/issue-47971.rs
Normal file
21
src/test/ui/const-eval/issue-47971.rs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
// must-compile-successfully
|
||||||
|
|
||||||
|
#![feature(const_fn)]
|
||||||
|
|
||||||
|
struct S(pub &'static u32, pub u32);
|
||||||
|
|
||||||
|
const fn g(ss: &S) -> &u32 { &ss.1 }
|
||||||
|
|
||||||
|
static T: S = S(g(&T), 0);
|
||||||
|
|
||||||
|
fn main () { }
|
|
@ -24,6 +24,7 @@
|
||||||
],
|
],
|
||||||
"label": null,
|
"label": null,
|
||||||
"suggested_replacement": null,
|
"suggested_replacement": null,
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -51,6 +52,7 @@
|
||||||
],
|
],
|
||||||
"label": null,
|
"label": null,
|
||||||
"suggested_replacement": null,
|
"suggested_replacement": null,
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -80,6 +82,7 @@
|
||||||
],
|
],
|
||||||
"label": null,
|
"label": null,
|
||||||
"suggested_replacement": "1 / (2 + 3)",
|
"suggested_replacement": "1 / (2 + 3)",
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -89,6 +89,7 @@ mod foo {
|
||||||
],
|
],
|
||||||
"label": "not found in this scope",
|
"label": "not found in this scope",
|
||||||
"suggested_replacement": null,
|
"suggested_replacement": null,
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -118,6 +119,7 @@ mod foo {
|
||||||
"suggested_replacement": "use std::collections::binary_heap::Iter;
|
"suggested_replacement": "use std::collections::binary_heap::Iter;
|
||||||
|
|
||||||
",
|
",
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -140,6 +142,7 @@ mod foo {
|
||||||
"suggested_replacement": "use std::collections::btree_map::Iter;
|
"suggested_replacement": "use std::collections::btree_map::Iter;
|
||||||
|
|
||||||
",
|
",
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -162,6 +165,7 @@ mod foo {
|
||||||
"suggested_replacement": "use std::collections::btree_set::Iter;
|
"suggested_replacement": "use std::collections::btree_set::Iter;
|
||||||
|
|
||||||
",
|
",
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -184,6 +188,7 @@ mod foo {
|
||||||
"suggested_replacement": "use std::collections::hash_map::Iter;
|
"suggested_replacement": "use std::collections::hash_map::Iter;
|
||||||
|
|
||||||
",
|
",
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -206,6 +211,7 @@ mod foo {
|
||||||
"suggested_replacement": "use std::collections::hash_set::Iter;
|
"suggested_replacement": "use std::collections::hash_set::Iter;
|
||||||
|
|
||||||
",
|
",
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -228,6 +234,7 @@ mod foo {
|
||||||
"suggested_replacement": "use std::collections::linked_list::Iter;
|
"suggested_replacement": "use std::collections::linked_list::Iter;
|
||||||
|
|
||||||
",
|
",
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -250,6 +257,7 @@ mod foo {
|
||||||
"suggested_replacement": "use std::collections::vec_deque::Iter;
|
"suggested_replacement": "use std::collections::vec_deque::Iter;
|
||||||
|
|
||||||
",
|
",
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -272,6 +280,7 @@ mod foo {
|
||||||
"suggested_replacement": "use std::option::Iter;
|
"suggested_replacement": "use std::option::Iter;
|
||||||
|
|
||||||
",
|
",
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -294,6 +303,7 @@ mod foo {
|
||||||
"suggested_replacement": "use std::path::Iter;
|
"suggested_replacement": "use std::path::Iter;
|
||||||
|
|
||||||
",
|
",
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -316,6 +326,7 @@ mod foo {
|
||||||
"suggested_replacement": "use std::result::Iter;
|
"suggested_replacement": "use std::result::Iter;
|
||||||
|
|
||||||
",
|
",
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -338,6 +349,7 @@ mod foo {
|
||||||
"suggested_replacement": "use std::slice::Iter;
|
"suggested_replacement": "use std::slice::Iter;
|
||||||
|
|
||||||
",
|
",
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -360,6 +372,7 @@ mod foo {
|
||||||
"suggested_replacement": "use std::sync::mpsc::Iter;
|
"suggested_replacement": "use std::sync::mpsc::Iter;
|
||||||
|
|
||||||
",
|
",
|
||||||
|
"suggestion_approximate": null,
|
||||||
"expansion": null
|
"expansion": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue