summaryrefslogtreecommitdiffstats
path: root/src/test/codegen-units/item-collection/unused-traits-and-generics.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/codegen-units/item-collection/unused-traits-and-generics.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/codegen-units/item-collection/unused-traits-and-generics.rs')
-rw-r--r--src/test/codegen-units/item-collection/unused-traits-and-generics.rs77
1 files changed, 0 insertions, 77 deletions
diff --git a/src/test/codegen-units/item-collection/unused-traits-and-generics.rs b/src/test/codegen-units/item-collection/unused-traits-and-generics.rs
deleted file mode 100644
index 561dc1a5c..000000000
--- a/src/test/codegen-units/item-collection/unused-traits-and-generics.rs
+++ /dev/null
@@ -1,77 +0,0 @@
-// compile-flags:-Zprint-mono-items=eager
-
-#![crate_type="lib"]
-#![deny(dead_code)]
-
-// This test asserts that no codegen items are generated for generic items that
-// are never instantiated in the local crate.
-
-pub trait Trait {
- fn foo() {}
- fn bar(&self) {}
-}
-
-pub fn foo<T: Copy>(x: T) -> (T, T) {
- (x, x)
-}
-
-pub struct Struct<T> {
- x: T
-}
-
-impl<T> Struct<T> {
- pub fn foo(self) -> T {
- self.x
- }
-
- pub fn bar() {}
-}
-
-pub enum Enum<T> {
- A(T),
- B { x: T }
-}
-
-impl<T> Enum<T> {
- pub fn foo(self) -> T {
- match self {
- Enum::A(x) => x,
- Enum::B { x } => x,
- }
- }
-
- pub fn bar() {}
-}
-
-pub struct TupleStruct<T>(T);
-
-impl<T> TupleStruct<T> {
- pub fn foo(self) -> T {
- self.0
- }
-
- pub fn bar() {}
-}
-
-pub type Pair<T> = (T, T);
-
-pub struct NonGeneric {
- x: i32
-}
-
-impl NonGeneric {
- pub fn foo(self) -> i32 {
- self.x
- }
-
- pub fn generic_foo<T>(&self, x: T) -> (T, i32) {
- (x, self.x)
- }
-
- pub fn generic_bar<T: Copy>(x: T) -> (T, T) {
- (x, x)
- }
-}
-
-// Only the non-generic methods should be instantiated:
-//~ MONO_ITEM fn NonGeneric::foo