Skip to content

Commit

Permalink
rustc_codegen_ssa: Don't let IncorrectCguReuseType errors get lost
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Enselic committed Dec 15, 2023
1 parent 1559dd2 commit c25589a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/assert_module_sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,13 @@ impl CguReuseTracker {

if error {
let at_least = if at_least { 1 } else { 0 };
errors::IncorrectCguReuseType {
sess.emit_err(errors::IncorrectCguReuseType {
span: *error_span,
cgu_user_name,
actual_reuse,
expected_reuse,
at_least,
};
});
}
} else {
sess.emit_fatal(errors::CguNotRecorded { cgu_user_name, cgu_name });
Expand Down
4 changes: 2 additions & 2 deletions tests/incremental/thinlto/cgu_invalidated_via_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
kind="no")]
#![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-foo",
cfg="cfail3",
kind="post-lto")]
kind="pre-lto")]

#![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-bar",
cfg="cfail2",
kind="pre-lto")]
#![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-bar",
cfg="cfail3",
kind="post-lto")]
kind="pre-lto")]

mod foo {

Expand Down
12 changes: 8 additions & 4 deletions tests/incremental/thinlto/cgu_keeps_identical_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,25 @@

#![feature(rustc_attrs)]
#![crate_type = "rlib"]
#![rustc_expected_cgu_reuse(module = "cgu_keeps_identical_fn-foo", cfg = "cfail2", kind = "no")]
#![rustc_expected_cgu_reuse(
module = "cgu_keeps_identical_fn-foo",
cfg = "cfail2",
kind = "pre-lto"
)]
#![rustc_expected_cgu_reuse(
module = "cgu_keeps_identical_fn-foo",
cfg = "cfail3",
kind = "post-lto"
kind = "pre-lto"
)]
#![rustc_expected_cgu_reuse(
module = "cgu_keeps_identical_fn-bar",
cfg = "cfail2",
kind = "post-lto"
kind = "pre-lto"
)]
#![rustc_expected_cgu_reuse(
module = "cgu_keeps_identical_fn-bar",
cfg = "cfail3",
kind = "post-lto"
kind = "pre-lto"
)]

mod foo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
kind="no")]
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-foo",
cfg="cfail3",
kind="post-lto")]
kind="pre-lto")]

#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-bar",
cfg="cfail2",
kind="pre-lto")]
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-bar",
cfg="cfail3",
kind="post-lto")]
kind="pre-lto")]

#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-baz",
cfg="cfail2",
kind="post-lto")]
kind="pre-lto")]
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-baz",
cfg="cfail3",
kind="post-lto")]
kind="pre-lto")]
mod foo {

#[cfg(cfail1)]
Expand Down

0 comments on commit c25589a

Please sign in to comment.