File tree 2 files changed +44
-1
lines changed
2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -424,10 +424,10 @@ struct DeadVisitor<'a, 'tcx: 'a> {
424
424
impl < ' a , ' tcx > DeadVisitor < ' a , ' tcx > {
425
425
fn should_warn_about_item ( & mut self , item : & hir:: Item ) -> bool {
426
426
let should_warn = match item. node {
427
+ hir:: ItemTy ( ref ty, _) => self . live_symbols . contains ( & ty. id ) ,
427
428
hir:: ItemStatic ( ..)
428
429
| hir:: ItemConst ( ..)
429
430
| hir:: ItemFn ( ..)
430
- | hir:: ItemTy ( ..)
431
431
| hir:: ItemEnum ( ..)
432
432
| hir:: ItemStruct ( ..)
433
433
| hir:: ItemUnion ( ..) => true ,
Original file line number Diff line number Diff line change
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
+ #![ forbid( dead_code) ]
12
+
13
+ // The most simple case: support one layer
14
+ // Issue #42303 was originally reported about this issue
15
+ mod a {
16
+ pub struct Foo ;
17
+
18
+ type Bar = Foo ;
19
+
20
+ impl Bar {
21
+ pub fn baz ( & self ) { }
22
+ }
23
+ }
24
+
25
+ // Multiple layers of re-defining,
26
+ // to make sure we don't regress here
27
+ mod b {
28
+ pub struct Foo ;
29
+
30
+ type Bar = Foo ;
31
+ type FooBar = Bar ;
32
+ type Baz = FooBar ;
33
+ type FooBarBaz = Baz ;
34
+
35
+ impl FooBarBaz {
36
+ pub fn baz ( & self ) { }
37
+ }
38
+ }
39
+
40
+ fn main ( ) {
41
+ a:: Foo . baz ( ) ;
42
+ b:: Foo . baz ( ) ;
43
+ }
You can’t perform that action at this time.
0 commit comments