Skip to content

Commit f5cc5ca

Browse files
committed
Remove dead code
1 parent 1f9d846 commit f5cc5ca

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

src/librustc_mir/hair/pattern/_match.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,6 @@ fn constructor_sub_pattern_tys<'a, 'tcx: 'a>(cx: &MatchCheckCtxt<'a, 'tcx>,
905905
ty::TySlice(ty) | ty::TyArray(ty, _) => match *ctor {
906906
Slice(length) => (0..length).map(|_| ty).collect(),
907907
ConstantValue(_) => vec![],
908-
Single => vec![ty],
909908
_ => bug!("bad slice pattern {:?} {:?}", ctor, ty)
910909
},
911910
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>,
914913
// Use T as the sub pattern type of Box<T>.
915914
vec![substs.type_at(0)]
916915
} else {
917-
if let ConstantValue(_) = *ctor {
918-
return vec![];
919-
}
920916
adt.variants[ctor.variant_index_for_adt(adt)].fields.iter().map(|field| {
921917
let is_visible = adt.is_enum()
922918
|| field.vis.is_accessible_from(cx.module, cx.tcx);
@@ -1025,7 +1021,6 @@ fn constructor_covered_by_range(ctor: &Constructor,
10251021
(end == RangeEnd::Excluded && to == Ordering::Equal);
10261022
Ok(some_or_ok!(cmp_from(&from.val)) && end)
10271023
}
1028-
Variant(_) |
10291024
Single => Ok(true),
10301025
_ => bug!(),
10311026
}

src/test/ui/const-eval/issue-47971.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// must-compile-successfully
12+
13+
#![feature(const_fn)]
14+
15+
struct S(pub &'static u32, pub u32);
16+
17+
const fn g(ss: &S) -> &u32 { &ss.1 }
18+
19+
static T: S = S(g(&T), 0);
20+
21+
fn main () { }

src/test/ui/lint/unused_parens_json_suggestion.stderr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
],
2525
"label": null,
2626
"suggested_replacement": null,
27+
"suggestion_approximate": null,
2728
"expansion": null
2829
}
2930
],
@@ -51,6 +52,7 @@
5152
],
5253
"label": null,
5354
"suggested_replacement": null,
55+
"suggestion_approximate": null,
5456
"expansion": null
5557
}
5658
],
@@ -80,6 +82,7 @@
8082
],
8183
"label": null,
8284
"suggested_replacement": "1 / (2 + 3)",
85+
"suggestion_approximate": null,
8386
"expansion": null
8487
}
8588
],

src/test/ui/lint/use_suggestion_json.stderr

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ mod foo {
8989
],
9090
"label": "not found in this scope",
9191
"suggested_replacement": null,
92+
"suggestion_approximate": null,
9293
"expansion": null
9394
}
9495
],
@@ -118,6 +119,7 @@ mod foo {
118119
"suggested_replacement": "use std::collections::binary_heap::Iter;
119120

120121
",
122+
"suggestion_approximate": null,
121123
"expansion": null
122124
},
123125
{
@@ -140,6 +142,7 @@ mod foo {
140142
"suggested_replacement": "use std::collections::btree_map::Iter;
141143

142144
",
145+
"suggestion_approximate": null,
143146
"expansion": null
144147
},
145148
{
@@ -162,6 +165,7 @@ mod foo {
162165
"suggested_replacement": "use std::collections::btree_set::Iter;
163166

164167
",
168+
"suggestion_approximate": null,
165169
"expansion": null
166170
},
167171
{
@@ -184,6 +188,7 @@ mod foo {
184188
"suggested_replacement": "use std::collections::hash_map::Iter;
185189

186190
",
191+
"suggestion_approximate": null,
187192
"expansion": null
188193
},
189194
{
@@ -206,6 +211,7 @@ mod foo {
206211
"suggested_replacement": "use std::collections::hash_set::Iter;
207212

208213
",
214+
"suggestion_approximate": null,
209215
"expansion": null
210216
},
211217
{
@@ -228,6 +234,7 @@ mod foo {
228234
"suggested_replacement": "use std::collections::linked_list::Iter;
229235

230236
",
237+
"suggestion_approximate": null,
231238
"expansion": null
232239
},
233240
{
@@ -250,6 +257,7 @@ mod foo {
250257
"suggested_replacement": "use std::collections::vec_deque::Iter;
251258

252259
",
260+
"suggestion_approximate": null,
253261
"expansion": null
254262
},
255263
{
@@ -272,6 +280,7 @@ mod foo {
272280
"suggested_replacement": "use std::option::Iter;
273281

274282
",
283+
"suggestion_approximate": null,
275284
"expansion": null
276285
},
277286
{
@@ -294,6 +303,7 @@ mod foo {
294303
"suggested_replacement": "use std::path::Iter;
295304

296305
",
306+
"suggestion_approximate": null,
297307
"expansion": null
298308
},
299309
{
@@ -316,6 +326,7 @@ mod foo {
316326
"suggested_replacement": "use std::result::Iter;
317327

318328
",
329+
"suggestion_approximate": null,
319330
"expansion": null
320331
},
321332
{
@@ -338,6 +349,7 @@ mod foo {
338349
"suggested_replacement": "use std::slice::Iter;
339350

340351
",
352+
"suggestion_approximate": null,
341353
"expansion": null
342354
},
343355
{
@@ -360,6 +372,7 @@ mod foo {
360372
"suggested_replacement": "use std::sync::mpsc::Iter;
361373

362374
",
375+
"suggestion_approximate": null,
363376
"expansion": null
364377
}
365378
],

0 commit comments

Comments
 (0)