about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2018-03-13 14:24:03 +0100
committerMichael Woerister <michaelwoerister@posteo>2018-04-06 12:14:08 +0200
commit94d36cf2948a999210516ff9001f93277f331d04 (patch)
treef9f25fc6232bdba566445eda4ed8212e509cb08e /src/test/codegen
parent2d2cf0306c4d96d4da3d45f566286d0c9b6c82ce (diff)
downloadrust-94d36cf2948a999210516ff9001f93277f331d04.tar.gz
rust-94d36cf2948a999210516ff9001f93277f331d04.zip
Make sure that generics are internalized in executables even with -Zshare-generics
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/local-generics-in-exe-internalized.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/codegen/local-generics-in-exe-internalized.rs b/src/test/codegen/local-generics-in-exe-internalized.rs
new file mode 100644
index 00000000000..162a025c302
--- /dev/null
+++ b/src/test/codegen/local-generics-in-exe-internalized.rs
@@ -0,0 +1,22 @@
+// Copyright 2018 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.
+
+// compile-flags: -C no-prepopulate-passes -Zshare-generics=yes
+
+// Check that local generics are internalized if they are in the same CGU
+
+// CHECK: define internal {{.*}} @_ZN34local_generics_in_exe_internalized3foo{{.*}}
+pub fn foo<T>(x: T, y: T) -> (T, T) {
+    (x, y)
+}
+
+fn main() {
+    let _ = foo(0u8, 1u8);
+}