diff options
| author | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2018-02-06 10:24:53 +0100 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2018-03-08 08:34:16 +0100 |
| commit | f5cc5ca8c73779e5fc4cac911f7d0b63b41b0ccd (patch) | |
| tree | b30dd710d5fa7f29450de3aed6616e55d311f132 | |
| parent | 1f9d846a5882dbdc4c599fa33e6256d2e37841a6 (diff) | |
| download | rust-f5cc5ca8c73779e5fc4cac911f7d0b63b41b0ccd.tar.gz rust-f5cc5ca8c73779e5fc4cac911f7d0b63b41b0ccd.zip | |
Remove dead code
| -rw-r--r-- | src/librustc_mir/hair/pattern/_match.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/const-eval/issue-47971.rs | 21 | ||||
| -rw-r--r-- | src/test/ui/lint/unused_parens_json_suggestion.stderr | 3 | ||||
| -rw-r--r-- | src/test/ui/lint/use_suggestion_json.stderr | 13 |
4 files changed, 37 insertions, 5 deletions
diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 5476d73fb6b..a3295aac801 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -905,7 +905,6 @@ fn constructor_sub_pattern_tys<'a, 'tcx: 'a>(cx: &MatchCheckCtxt<'a, 'tcx>, ty::TySlice(ty) | ty::TyArray(ty, _) => match *ctor { Slice(length) => (0..length).map(|_| ty).collect(), ConstantValue(_) => vec![], - Single => vec![ty], _ => bug!("bad slice pattern {:?} {:?}", ctor, 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>. vec![substs.type_at(0)] } else { - if let ConstantValue(_) = *ctor { - return vec![]; - } adt.variants[ctor.variant_index_for_adt(adt)].fields.iter().map(|field| { let is_visible = adt.is_enum() || 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); Ok(some_or_ok!(cmp_from(&from.val)) && end) } - Variant(_) | Single => Ok(true), _ => bug!(), } diff --git a/src/test/ui/const-eval/issue-47971.rs b/src/test/ui/const-eval/issue-47971.rs new file mode 100644 index 00000000000..4a2f0a7f38c --- /dev/null +++ b/src/test/ui/const-eval/issue-47971.rs @@ -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 () { } diff --git a/src/test/ui/lint/unused_parens_json_suggestion.stderr b/src/test/ui/lint/unused_parens_json_suggestion.stderr index cd4379d90cf..ac29d635a92 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_json_suggestion.stderr @@ -24,6 +24,7 @@ ], "label": null, "suggested_replacement": null, + "suggestion_approximate": null, "expansion": null } ], @@ -51,6 +52,7 @@ ], "label": null, "suggested_replacement": null, + "suggestion_approximate": null, "expansion": null } ], @@ -80,6 +82,7 @@ ], "label": null, "suggested_replacement": "1 / (2 + 3)", + "suggestion_approximate": null, "expansion": null } ], diff --git a/src/test/ui/lint/use_suggestion_json.stderr b/src/test/ui/lint/use_suggestion_json.stderr index 00624f7e5ca..33cd61342f0 100644 --- a/src/test/ui/lint/use_suggestion_json.stderr +++ b/src/test/ui/lint/use_suggestion_json.stderr @@ -89,6 +89,7 @@ mod foo { ], "label": "not found in this scope", "suggested_replacement": null, + "suggestion_approximate": null, "expansion": null } ], @@ -118,6 +119,7 @@ mod foo { "suggested_replacement": "use std::collections::binary_heap::Iter; ", + "suggestion_approximate": null, "expansion": null }, { @@ -140,6 +142,7 @@ mod foo { "suggested_replacement": "use std::collections::btree_map::Iter; ", + "suggestion_approximate": null, "expansion": null }, { @@ -162,6 +165,7 @@ mod foo { "suggested_replacement": "use std::collections::btree_set::Iter; ", + "suggestion_approximate": null, "expansion": null }, { @@ -184,6 +188,7 @@ mod foo { "suggested_replacement": "use std::collections::hash_map::Iter; ", + "suggestion_approximate": null, "expansion": null }, { @@ -206,6 +211,7 @@ mod foo { "suggested_replacement": "use std::collections::hash_set::Iter; ", + "suggestion_approximate": null, "expansion": null }, { @@ -228,6 +234,7 @@ mod foo { "suggested_replacement": "use std::collections::linked_list::Iter; ", + "suggestion_approximate": null, "expansion": null }, { @@ -250,6 +257,7 @@ mod foo { "suggested_replacement": "use std::collections::vec_deque::Iter; ", + "suggestion_approximate": null, "expansion": null }, { @@ -272,6 +280,7 @@ mod foo { "suggested_replacement": "use std::option::Iter; ", + "suggestion_approximate": null, "expansion": null }, { @@ -294,6 +303,7 @@ mod foo { "suggested_replacement": "use std::path::Iter; ", + "suggestion_approximate": null, "expansion": null }, { @@ -316,6 +326,7 @@ mod foo { "suggested_replacement": "use std::result::Iter; ", + "suggestion_approximate": null, "expansion": null }, { @@ -338,6 +349,7 @@ mod foo { "suggested_replacement": "use std::slice::Iter; ", + "suggestion_approximate": null, "expansion": null }, { @@ -360,6 +372,7 @@ mod foo { "suggested_replacement": "use std::sync::mpsc::Iter; ", + "suggestion_approximate": null, "expansion": null } ], |
