1 // Copyright 2012-2015 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.
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.
11 // ignore-tidy-linelength
12 // compile-flags:-Zprint-trans-items=eager
17 // This test asserts that no codegen items are generated for generic items that
18 // are never instantiated in the local crate.
25 pub fn foo<T: Copy>(x: T) -> (T, T) {
29 pub struct Struct<T> {
34 pub fn foo(self) -> T {
47 pub fn foo(self) -> T {
57 pub struct TupleStruct<T>(T);
59 impl<T> TupleStruct<T> {
60 pub fn foo(self) -> T {
67 pub type Pair<T> = (T, T);
69 pub struct NonGeneric {
74 pub fn foo(self) -> i32 {
78 pub fn generic_foo<T>(&self, x: T) -> (T, i32) {
82 pub fn generic_bar<T: Copy>(x: T) -> (T, T) {
87 // Only the non-generic methods should be instantiated:
88 //~ TRANS_ITEM fn unused_traits_and_generics::NonGeneric[0]::foo[0]
89 //~ TRANS_ITEM drop-glue i8