]> git.lizzy.rs Git - rust.git/commitdiff
Remove dead code
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Tue, 6 Feb 2018 09:24:53 +0000 (10:24 +0100)
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Thu, 8 Mar 2018 07:34:16 +0000 (08:34 +0100)
src/librustc_mir/hair/pattern/_match.rs
src/test/ui/const-eval/issue-47971.rs [new file with mode: 0644]
src/test/ui/lint/unused_parens_json_suggestion.stderr
src/test/ui/lint/use_suggestion_json.stderr

index 5476d73fb6b4ba314b5ce4409e8fcb6e4adc78c1..a3295aac80157690501b7e2de459e5b23d396e12 100644 (file)
@@ -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 @@ macro_rules! some_or_ok {
                       (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 (file)
index 0000000..4a2f0a7
--- /dev/null
@@ -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 () { }
index cd4379d90cf3158e61ecdca381b690667d6122a5..ac29d635a920dbdb0a674726fa5e038f1c44f435 100644 (file)
@@ -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
         }
       ],
index 00624f7e5ca47217f3bb96c3d85971db5ba59f8a..33cd61342f0e7fcb371d2fc925b56e602ef6732b 100644 (file)
@@ -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
         }
       ],