Skip to content

Commit e4b9a8a

Browse files
committed
Using def_path to fix tests.
1 parent a6711d3 commit e4b9a8a

22 files changed

+1558
-1557
lines changed

compiler/rustc_middle/src/mir/mono.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,12 +525,20 @@ impl<'tcx> CodegenUnit<'tcx> {
525525
tcx: TyCtxt<'tcx>,
526526
) -> Vec<(MonoItem<'tcx>, MonoItemData)> {
527527
// The codegen tests rely on items being process in the same order as
528-
// they appear in the file, so for local items, we sort by span first
528+
// they appear in the file, so for local items, we sort by span and def_path first
529529
#[derive(PartialEq, Eq, PartialOrd, Ord)]
530-
struct ItemSortKey<'tcx>(Option<Span>, SymbolName<'tcx>);
530+
struct ItemSortKey<'tcx>(Option<Span>, Option<String>, SymbolName<'tcx>);
531531

532532
fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx>, item: MonoItem<'tcx>) -> ItemSortKey<'tcx> {
533-
ItemSortKey(item.local_span(tcx), item.symbol_name(tcx))
533+
ItemSortKey(
534+
// For codegen tests purposes, we don't care about non-local items' order,
535+
// so we just sort non-local items by symbol names.
536+
item.local_span(tcx),
537+
item.def_id()
538+
.as_local()
539+
.map(|_| tcx.def_path(item.def_id()).to_string_no_crate_verbose()),
540+
item.symbol_name(tcx),
541+
)
534542
}
535543

536544
let mut items: Vec<_> = self.items().iter().map(|(&i, &data)| (i, data)).collect();

src/tools/compiletest/src/runtest/assembly.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ impl TestCx<'_> {
4242
LinkToAux::Yes,
4343
Vec::new(),
4444
);
45-
4645
let proc_res = self.compose_and_run_compiler(rustc, None, self.testpaths);
4746
(proc_res, output_path)
4847
}

tests/assembly-llvm/asm/aarch64-modifiers.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,35 +55,17 @@ check!(vreg vreg "add {0}.4s, {0}.4s, {0}.4s");
5555
// CHECK: //NO_APP
5656
check!(vreg_b vreg "ldr {:b}, [x0]");
5757

58-
// CHECK-LABEL: vreg_h:
59-
// CHECK: //APP
60-
// CHECK: ldr h0, [x0]
61-
// CHECK: //NO_APP
62-
check!(vreg_h vreg "ldr {:h}, [x0]");
63-
64-
// CHECK-LABEL: vreg_s:
65-
// CHECK: //APP
66-
// CHECK: ldr s0, [x0]
67-
// CHECK: //NO_APP
68-
check!(vreg_s vreg "ldr {:s}, [x0]");
69-
7058
// CHECK-LABEL: vreg_d:
7159
// CHECK: //APP
7260
// CHECK: ldr d0, [x0]
7361
// CHECK: //NO_APP
7462
check!(vreg_d vreg "ldr {:d}, [x0]");
7563

76-
// CHECK-LABEL: vreg_q:
77-
// CHECK: //APP
78-
// CHECK: ldr q0, [x0]
79-
// CHECK: //NO_APP
80-
check!(vreg_q vreg "ldr {:q}, [x0]");
81-
82-
// CHECK-LABEL: vreg_v:
64+
// CHECK-LABEL: vreg_h:
8365
// CHECK: //APP
84-
// CHECK: add v0.4s, v0.4s, v0.4s
66+
// CHECK: ldr h0, [x0]
8567
// CHECK: //NO_APP
86-
check!(vreg_v vreg "add {0:v}.4s, {0:v}.4s, {0:v}.4s");
68+
check!(vreg_h vreg "ldr {:h}, [x0]");
8769

8870
// CHECK-LABEL: vreg_low16:
8971
// CHECK: //APP
@@ -97,32 +79,50 @@ check!(vreg_low16 vreg_low16 "add {0}.4s, {0}.4s, {0}.4s");
9779
// CHECK: //NO_APP
9880
check!(vreg_low16_b vreg_low16 "ldr {:b}, [x0]");
9981

82+
// CHECK-LABEL: vreg_low16_d:
83+
// CHECK: //APP
84+
// CHECK: ldr d0, [x0]
85+
// CHECK: //NO_APP
86+
check!(vreg_low16_d vreg_low16 "ldr {:d}, [x0]");
87+
10088
// CHECK-LABEL: vreg_low16_h:
10189
// CHECK: //APP
10290
// CHECK: ldr h0, [x0]
10391
// CHECK: //NO_APP
10492
check!(vreg_low16_h vreg_low16 "ldr {:h}, [x0]");
10593

94+
// CHECK-LABEL: vreg_low16_q:
95+
// CHECK: //APP
96+
// CHECK: ldr q0, [x0]
97+
// CHECK: //NO_APP
98+
check!(vreg_low16_q vreg_low16 "ldr {:q}, [x0]");
99+
106100
// CHECK-LABEL: vreg_low16_s:
107101
// CHECK: //APP
108102
// CHECK: ldr s0, [x0]
109103
// CHECK: //NO_APP
110104
check!(vreg_low16_s vreg_low16 "ldr {:s}, [x0]");
111105

112-
// CHECK-LABEL: vreg_low16_d:
106+
// CHECK-LABEL: vreg_low16_v:
113107
// CHECK: //APP
114-
// CHECK: ldr d0, [x0]
108+
// CHECK: add v0.4s, v0.4s, v0.4s
115109
// CHECK: //NO_APP
116-
check!(vreg_low16_d vreg_low16 "ldr {:d}, [x0]");
110+
check!(vreg_low16_v vreg_low16 "add {0:v}.4s, {0:v}.4s, {0:v}.4s");
117111

118-
// CHECK-LABEL: vreg_low16_q:
112+
// CHECK-LABEL: vreg_q:
119113
// CHECK: //APP
120114
// CHECK: ldr q0, [x0]
121115
// CHECK: //NO_APP
122-
check!(vreg_low16_q vreg_low16 "ldr {:q}, [x0]");
116+
check!(vreg_q vreg "ldr {:q}, [x0]");
123117

124-
// CHECK-LABEL: vreg_low16_v:
118+
// CHECK-LABEL: vreg_s:
119+
// CHECK: //APP
120+
// CHECK: ldr s0, [x0]
121+
// CHECK: //NO_APP
122+
check!(vreg_s vreg "ldr {:s}, [x0]");
123+
124+
// CHECK-LABEL: vreg_v:
125125
// CHECK: //APP
126126
// CHECK: add v0.4s, v0.4s, v0.4s
127127
// CHECK: //NO_APP
128-
check!(vreg_low16_v vreg_low16 "add {0:v}.4s, {0:v}.4s, {0:v}.4s");
128+
check!(vreg_v vreg "add {0:v}.4s, {0:v}.4s, {0:v}.4s");

0 commit comments

Comments
 (0)