about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2017-11-01 13:32:14 +0800
committerGitHub <noreply@github.com>2017-11-01 13:32:14 +0800
commitcf0fe06bb9d0d5bb8200ec752a9b51bf746d3f5a (patch)
tree28c25ea21d61e3b85ddc2f14db824d45f08f3016 /src/test
parent26af3e1c4ec460703da391af037bf8c2999ea61f (diff)
parentb67d72b4345822de3172ddcd83e95ceab0b8d6b2 (diff)
downloadrust-cf0fe06bb9d0d5bb8200ec752a9b51bf746d3f5a.tar.gz
rust-cf0fe06bb9d0d5bb8200ec752a9b51bf746d3f5a.zip
Rollup merge of #45646 - sinkuu:dead-code-alias-in-pat, r=arielb1
Count type aliases used in patterns as usage by dead_code lint

Fixes #45614.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/dead-code-alias-in-pat.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/run-pass/dead-code-alias-in-pat.rs b/src/test/run-pass/dead-code-alias-in-pat.rs
new file mode 100644
index 00000000000..a37d671e5c1
--- /dev/null
+++ b/src/test/run-pass/dead-code-alias-in-pat.rs
@@ -0,0 +1,18 @@
+// 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.
+
+#![deny(dead_code)]
+
+fn main() {
+    struct Foo<T> { x: T }
+    type Bar = Foo<u32>;
+    let spam = |Bar { x }| x != 0;
+    println!("{}", spam(Foo { x: 10 }));
+}