Skip to content

Commit c25589a

Browse files
committed
rustc_codegen_ssa: Don't let IncorrectCguReuseType errors get lost
In [100753], `IncorrectCguReuseType` accidentally stopped being emitted. Begin emitting it again rather than just blindly dropping it, and adjust tests accordingly. We assume that there are no bugs and that the currently expected CGU reuse is correct. If there are bugs, they will be discovered and fixed eventually, and the tests will then be updated. [100753]: 706452e#diff-048389738ddcbe0f9765291a29db1fed9a5f03693d4781cfb5aaa97ffb3c7f84
1 parent 1559dd2 commit c25589a

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

compiler/rustc_codegen_ssa/src/assert_module_sources.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,13 @@ impl CguReuseTracker {
278278

279279
if error {
280280
let at_least = if at_least { 1 } else { 0 };
281-
errors::IncorrectCguReuseType {
281+
sess.emit_err(errors::IncorrectCguReuseType {
282282
span: *error_span,
283283
cgu_user_name,
284284
actual_reuse,
285285
expected_reuse,
286286
at_least,
287-
};
287+
});
288288
}
289289
} else {
290290
sess.emit_fatal(errors::CguNotRecorded { cgu_user_name, cgu_name });

tests/incremental/thinlto/cgu_invalidated_via_import.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
kind="no")]
1515
#![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-foo",
1616
cfg="cfail3",
17-
kind="post-lto")]
17+
kind="pre-lto")]
1818

1919
#![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-bar",
2020
cfg="cfail2",
2121
kind="pre-lto")]
2222
#![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-bar",
2323
cfg="cfail3",
24-
kind="post-lto")]
24+
kind="pre-lto")]
2525

2626
mod foo {
2727

tests/incremental/thinlto/cgu_keeps_identical_fn.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,25 @@
99

1010
#![feature(rustc_attrs)]
1111
#![crate_type = "rlib"]
12-
#![rustc_expected_cgu_reuse(module = "cgu_keeps_identical_fn-foo", cfg = "cfail2", kind = "no")]
12+
#![rustc_expected_cgu_reuse(
13+
module = "cgu_keeps_identical_fn-foo",
14+
cfg = "cfail2",
15+
kind = "pre-lto"
16+
)]
1317
#![rustc_expected_cgu_reuse(
1418
module = "cgu_keeps_identical_fn-foo",
1519
cfg = "cfail3",
16-
kind = "post-lto"
20+
kind = "pre-lto"
1721
)]
1822
#![rustc_expected_cgu_reuse(
1923
module = "cgu_keeps_identical_fn-bar",
2024
cfg = "cfail2",
21-
kind = "post-lto"
25+
kind = "pre-lto"
2226
)]
2327
#![rustc_expected_cgu_reuse(
2428
module = "cgu_keeps_identical_fn-bar",
2529
cfg = "cfail3",
26-
kind = "post-lto"
30+
kind = "pre-lto"
2731
)]
2832

2933
mod foo {

tests/incremental/thinlto/independent_cgus_dont_affect_each_other.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@
1313
kind="no")]
1414
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-foo",
1515
cfg="cfail3",
16-
kind="post-lto")]
16+
kind="pre-lto")]
1717

1818
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-bar",
1919
cfg="cfail2",
2020
kind="pre-lto")]
2121
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-bar",
2222
cfg="cfail3",
23-
kind="post-lto")]
23+
kind="pre-lto")]
2424

2525
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-baz",
2626
cfg="cfail2",
27-
kind="post-lto")]
27+
kind="pre-lto")]
2828
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-baz",
2929
cfg="cfail3",
30-
kind="post-lto")]
30+
kind="pre-lto")]
3131
mod foo {
3232

3333
#[cfg(cfail1)]

0 commit comments

Comments
 (0)