Skip to content

Commit 75cd69c

Browse files
committed
Warn unused type aliases
1 parent a759098 commit 75cd69c

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed

src/librustc/middle/dead.rs

+1
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ impl<'a, 'tcx> DeadVisitor<'a, 'tcx> {
413413
hir::ItemStatic(..)
414414
| hir::ItemConst(..)
415415
| hir::ItemFn(..)
416+
| hir::ItemTy(..)
416417
| hir::ItemEnum(..)
417418
| hir::ItemStruct(..)
418419
| hir::ItemUnion(..) => true,

src/librustc_data_structures/graph/tests.rs

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
use graph::*;
1212
use std::fmt::Debug;
1313

14-
type TestNode = Node<&'static str>;
15-
type TestEdge = Edge<&'static str>;
1614
type TestGraph = Graph<&'static str, &'static str>;
1715

1816
fn create_graph() -> TestGraph {

src/test/compile-fail/issue-32119.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#![feature(rustc_attrs)]
12+
#![allow(dead_code)]
1213

1314
pub type T = ();
1415
mod foo { pub use super::T; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2016 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+
#![deny(dead_code)]
12+
13+
type Used = u8;
14+
type Unused = u8; //~ ERROR type alias is never used
15+
16+
fn id(x: Used) -> Used { x }
17+
18+
fn main() {
19+
id(0);
20+
}

src/test/compile-fail/macro-tt-matchers.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#![feature(rustc_attrs)]
12+
#![allow(dead_code)]
1213

1314
macro_rules! foo {
1415
($x:tt) => (type Alias = $x<i32>;)

0 commit comments

Comments
 (0)