diff options
| author | ParkHanbum <kese111@gmail.com> | 2016-09-29 16:24:14 +0900 |
|---|---|---|
| committer | ParkHanbum <kese111@gmail.com> | 2016-10-06 15:52:09 +0900 |
| commit | cb700e78ed24300e8609b1f8bd442ede4fae03d2 (patch) | |
| tree | c73706ac89c3daedb0de129b4bc4f545619564a0 | |
| parent | b543f3a4b29f15d6db7fb0ccab8bdc9900cbf84e (diff) | |
Add testcase for issue-32948
ref : https://github.com/rust-lang/rust/issue/32948
3 files changed, 29 insertions, 5 deletions
diff --git a/src/test/run-make/stable-symbol-names/Makefile b/src/test/run-make/stable-symbol-names/Makefile index da96d1b1dcf..c1b14440faa 100644 --- a/src/test/run-make/stable-symbol-names/Makefile +++ b/src/test/run-make/stable-symbol-names/Makefile @@ -1,12 +1,16 @@ -include ../tools.mk -# This test case makes sure that monomorphizations of the same function with the -# same set of generic arguments will have the same symbol names when -# instantiated in different crates. +# The following command will: +# 1. dump the symbols of a library using `nm` +# 2. extract only those lines that we are interested in via `grep` +# 3. from those lines, extract just the symbol name via `sed` +# (symbol names always start with "_ZN" and end with "E") +# 4. sort those symbol names for deterministic comparison +# 5. write the result into a file dump-symbols = nm "$(TMPDIR)/lib$(1).rlib" \ - | grep "some_test_function" \ - | sed "s/^[0-9a-f]\{8,16\}/00000000/" \ + | grep -E "some_test_function|Bar|bar" \ + | sed "s/.*\(_ZN.*E\).*/\1/" \ | sort \ > "$(TMPDIR)/$(1).nm" diff --git a/src/test/run-make/stable-symbol-names/stable-symbol-names1.rs b/src/test/run-make/stable-symbol-names/stable-symbol-names1.rs index 7b2cd857113..5c73ff0fab6 100644 --- a/src/test/run-make/stable-symbol-names/stable-symbol-names1.rs +++ b/src/test/run-make/stable-symbol-names/stable-symbol-names1.rs @@ -10,6 +10,20 @@ #![crate_type="rlib"] +pub trait Foo { + fn foo<T>(); +} + +pub struct Bar; + +impl Foo for Bar { + fn foo<T>() {} +} + +pub fn bar() { + Bar::foo::<Bar>(); +} + pub fn some_test_function<T>(t: T) -> T { t } diff --git a/src/test/run-make/stable-symbol-names/stable-symbol-names2.rs b/src/test/run-make/stable-symbol-names/stable-symbol-names2.rs index ff027d6b46c..097dce876af 100644 --- a/src/test/run-make/stable-symbol-names/stable-symbol-names2.rs +++ b/src/test/run-make/stable-symbol-names/stable-symbol-names2.rs @@ -18,3 +18,9 @@ pub fn user() { let x = 2u64; stable_symbol_names1::some_test_function(&x); } + +pub fn trait_impl_test_function() { + use stable_symbol_names1::*; + Bar::foo::<Bar>(); + bar(); +} |
