Skip to content

Commit a42873e

Browse files
committed
Auto merge of rust-lang#122676 - matthiaskrgr:rollup-noti0vr, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - rust-lang#122639 (Fix typos) - rust-lang#122654 (interpret/memory: explain why we use == on bool) - rust-lang#122656 (simplify_cfg: rename some passes so that they make more sense) - rust-lang#122657 (Move `option_env!` and `env!` tests to the `env-macro` directory) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 80e5694 + 069b933 commit a42873e

File tree

62 files changed

+65
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+65
-62
lines changed

compiler/rustc_const_eval/src/interpret/memory.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
949949
/// Runs the close in "validation" mode, which means the machine's memory read hooks will be
950950
/// suppressed. Needless to say, this must only be set with great care! Cannot be nested.
951951
pub(super) fn run_for_validation<R>(&self, f: impl FnOnce() -> R) -> R {
952+
// This deliberately uses `==` on `bool` to follow the pattern
953+
// `assert!(val.replace(new) == old)`.
952954
assert!(
953955
self.memory.validation_in_progress.replace(true) == false,
954956
"`validation_in_progress` was already set"

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1935,7 +1935,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
19351935
}
19361936
}
19371937

1938-
/// Determine if the associated item withe the given DefId matches
1938+
/// Determine if the associated item with the given DefId matches
19391939
/// the desired name via a doc alias.
19401940
fn matches_by_doc_alias(&self, def_id: DefId) -> bool {
19411941
let Some(name) = self.method_name else {

compiler/rustc_mir_build/src/build/scope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
774774
let (current_root, parent_root) =
775775
if self.tcx.sess.opts.unstable_opts.maximal_hir_to_mir_coverage {
776776
// Some consumers of rustc need to map MIR locations back to HIR nodes. Currently
777-
// the the only part of rustc that tracks MIR -> HIR is the
777+
// the only part of rustc that tracks MIR -> HIR is the
778778
// `SourceScopeLocalData::lint_root` field that tracks lint levels for MIR
779779
// locations. Normally the number of source scopes is limited to the set of nodes
780780
// with lint annotations. The -Zmaximal-hir-to-mir-coverage flag changes this

compiler/rustc_mir_transform/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ fn run_analysis_cleanup_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
507507
let passes: &[&dyn MirPass<'tcx>] = &[
508508
&cleanup_post_borrowck::CleanupPostBorrowck,
509509
&remove_noop_landing_pads::RemoveNoopLandingPads,
510-
&simplify::SimplifyCfg::EarlyOpt,
510+
&simplify::SimplifyCfg::PostAnalysis,
511511
&deref_separator::Derefer,
512512
];
513513

@@ -544,7 +544,7 @@ fn run_runtime_cleanup_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
544544
let passes: &[&dyn MirPass<'tcx>] = &[
545545
&lower_intrinsics::LowerIntrinsics,
546546
&remove_place_mention::RemovePlaceMention,
547-
&simplify::SimplifyCfg::ElaborateDrops,
547+
&simplify::SimplifyCfg::PreOptimizations,
548548
];
549549

550550
pm::run_passes(tcx, body, passes, Some(MirPhase::Runtime(RuntimePhase::PostCleanup)));

compiler/rustc_mir_transform/src/simplify.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ pub enum SimplifyCfg {
3737
Initial,
3838
PromoteConsts,
3939
RemoveFalseEdges,
40-
EarlyOpt,
41-
ElaborateDrops,
40+
/// Runs at the beginning of "analysis to runtime" lowering, *before* drop elaboration.
41+
PostAnalysis,
42+
/// Runs at the end of "analysis to runtime" lowering, *after* drop elaboration.
43+
/// This is before the main optimization passes on runtime MIR kick in.
44+
PreOptimizations,
4245
Final,
4346
MakeShim,
4447
AfterUninhabitedEnumBranching,
@@ -50,8 +53,8 @@ impl SimplifyCfg {
5053
SimplifyCfg::Initial => "SimplifyCfg-initial",
5154
SimplifyCfg::PromoteConsts => "SimplifyCfg-promote-consts",
5255
SimplifyCfg::RemoveFalseEdges => "SimplifyCfg-remove-false-edges",
53-
SimplifyCfg::EarlyOpt => "SimplifyCfg-early-opt",
54-
SimplifyCfg::ElaborateDrops => "SimplifyCfg-elaborate-drops",
56+
SimplifyCfg::PostAnalysis => "SimplifyCfg-post-analysis",
57+
SimplifyCfg::PreOptimizations => "SimplifyCfg-pre-optimizations",
5558
SimplifyCfg::Final => "SimplifyCfg-final",
5659
SimplifyCfg::MakeShim => "SimplifyCfg-make_shim",
5760
SimplifyCfg::AfterUninhabitedEnumBranching => {

src/tools/tidy/src/issues.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -968,8 +968,6 @@
968968
"ui/errors/issue-89280-emitter-overflow-splice-lines.rs",
969969
"ui/errors/issue-99572-impl-trait-on-pointer.rs",
970970
"ui/expr/if/issue-4201.rs",
971-
"ui/extenv/issue-110547.rs",
972-
"ui/extenv/issue-55897.rs",
973971
"ui/extern/auxiliary/issue-80074-macro-2.rs",
974972
"ui/extern/auxiliary/issue-80074-macro.rs",
975973
"ui/extern/issue-10025.rs",

src/tools/tidy/src/ui_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const ENTRY_LIMIT: usize = 900;
1818
// FIXME: The following limits should be reduced eventually.
1919

2020
const ISSUES_ENTRY_LIMIT: usize = 1750;
21-
const ROOT_ENTRY_LIMIT: usize = 866;
21+
const ROOT_ENTRY_LIMIT: usize = 859;
2222

2323
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
2424
"rs", // test source files

tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-abort.mir renamed to tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-abort.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// MIR for `main` after SimplifyCfg-elaborate-drops
1+
// MIR for `main` after SimplifyCfg-pre-optimizations
22

33
fn main() -> () {
44
let mut _0: ();

tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir renamed to tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-unwind.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// MIR for `main` after SimplifyCfg-elaborate-drops
1+
// MIR for `main` after SimplifyCfg-pre-optimizations
22

33
fn main() -> () {
44
let mut _0: ();

tests/mir-opt/array_index_is_temporary.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: SimplifyCfg-elaborate-drops
1+
//@ unit-test: SimplifyCfg-pre-optimizations
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33
// Retagging (from Stacked Borrows) relies on the array index being a fresh
44
// temporary, so that side-effects cannot change it.
@@ -10,7 +10,7 @@ unsafe fn foo(z: *mut usize) -> u32 {
1010
}
1111

1212

13-
// EMIT_MIR array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir
13+
// EMIT_MIR array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.mir
1414
fn main() {
1515
// CHECK-LABEL: fn main(
1616
// CHECK: debug x => [[x:_.*]];

0 commit comments

Comments
 (0)