Skip to content

Commit df4d563

Browse files
authored
Rollup merge of #118973 - Enselic:fix-IncorrectCguReuseType, r=michaelwoerister
rustc_codegen_ssa: Don't drop `IncorrectCguReuseType` , make `rustc_expected_cgu_reuse` attr work In [100753], `IncorrectCguReuseType` accidentally stopped being emitted by removing `diag.span_err(...)`. 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 actual 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 Closes #118972
2 parents f3f9b30 + d46df80 commit df4d563

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")] // Should be "post-lto", see issue #119076
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")] // Should be "post-lto", see issue #119076
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" // Should be "post-lto", see issue #119076
1721
)]
1822
#![rustc_expected_cgu_reuse(
1923
module = "cgu_keeps_identical_fn-bar",
2024
cfg = "cfail2",
21-
kind = "post-lto"
25+
kind = "pre-lto" // Should be "post-lto", see issue #119076
2226
)]
2327
#![rustc_expected_cgu_reuse(
2428
module = "cgu_keeps_identical_fn-bar",
2529
cfg = "cfail3",
26-
kind = "post-lto"
30+
kind = "pre-lto" // Should be "post-lto", see issue #119076
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")] // Should be "post-lto", see issue #119076
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")] // Should be "post-lto", see issue #119076
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")] // Should be "post-lto", see issue #119076
2828
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-baz",
2929
cfg="cfail3",
30-
kind="post-lto")]
30+
kind="pre-lto")] // Should be "post-lto", see issue #119076
3131
mod foo {
3232

3333
#[cfg(cfail1)]

0 commit comments

Comments
 (0)