File tree Expand file tree Collapse file tree 3 files changed +29
-5
lines changed
src/test/run-make/stable-symbol-names Expand file tree Collapse file tree 3 files changed +29
-5
lines changed Original file line number Diff line number Diff line change 11-include ../tools.mk
22
3- # This test case makes sure that monomorphizations of the same function with the
4- # same set of generic arguments will have the same symbol names when
5- # instantiated in different crates.
3+ # The following command will:
4+ # 1. dump the symbols of a library using `nm`
5+ # 2. extract only those lines that we are interested in via `grep`
6+ # 3. from those lines, extract just the symbol name via `sed`
7+ # (symbol names always start with "_ZN" and end with "E")
8+ # 4. sort those symbol names for deterministic comparison
9+ # 5. write the result into a file
610
711dump-symbols = nm "$(TMPDIR ) /lib$(1 ) .rlib" \
8- | grep "some_test_function" \
9- | sed "s/^[0-9a-f]\{8,16\}/00000000 /" \
12+ | grep -E "some_test_function|Bar|bar " \
13+ | sed "s/.*\(_ZN.*E\).*/\1 /" \
1014 | sort \
1115 > "$(TMPDIR ) /$(1 ) .nm"
1216
Original file line number Diff line number Diff line change 1010
1111#![ crate_type="rlib" ]
1212
13+ pub trait Foo {
14+ fn foo < T > ( ) ;
15+ }
16+
17+ pub struct Bar ;
18+
19+ impl Foo for Bar {
20+ fn foo < T > ( ) { }
21+ }
22+
23+ pub fn bar ( ) {
24+ Bar :: foo :: < Bar > ( ) ;
25+ }
26+
1327pub fn some_test_function < T > ( t : T ) -> T {
1428 t
1529}
Original file line number Diff line number Diff line change @@ -18,3 +18,9 @@ pub fn user() {
1818 let x = 2u64 ;
1919 stable_symbol_names1:: some_test_function ( & x) ;
2020}
21+
22+ pub fn trait_impl_test_function ( ) {
23+ use stable_symbol_names1:: * ;
24+ Bar :: foo :: < Bar > ( ) ;
25+ bar ( ) ;
26+ }
You can’t perform that action at this time.
0 commit comments