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 1
1
-include ../tools.mk
2
2
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
6
10
7
11
dump-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 /" \
10
14
| sort \
11
15
> "$(TMPDIR ) /$(1 ) .nm"
12
16
Original file line number Diff line number Diff line change 10
10
11
11
#![ crate_type="rlib" ]
12
12
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
+
13
27
pub fn some_test_function < T > ( t : T ) -> T {
14
28
t
15
29
}
Original file line number Diff line number Diff line change @@ -18,3 +18,9 @@ pub fn user() {
18
18
let x = 2u64 ;
19
19
stable_symbol_names1:: some_test_function ( & x) ;
20
20
}
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