Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f0b3a5e

Browse files
committedSep 27, 2024
Use mir_promoted
1 parent f90fd69 commit f0b3a5e

File tree

4 files changed

+16
-22
lines changed

4 files changed

+16
-22
lines changed
 

‎compiler/rustc_mir_transform/src/lib.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,6 @@ fn mir_promoted(
331331
_ => ConstQualifs::default(),
332332
};
333333

334-
tcx.ensure_with_value().mir_flags(def);
335-
336334
// the `by_move_body` query uses the raw mir, so make sure it is run.
337335
if tcx.needs_coroutine_by_move_body_def_id(def.to_def_id()) {
338336
tcx.ensure_with_value().coroutine_by_move_body_def_id(def);
@@ -372,7 +370,7 @@ fn mir_flags<'tcx>(tcx: TyCtxt<'tcx>, local_def_id: LocalDefId) -> MirFlags {
372370
return flags;
373371
}
374372

375-
let body = &*tcx.mir_built(local_def_id).borrow();
373+
let body = &*tcx.mir_promoted(local_def_id).0.borrow();
376374

377375
if is_nounwind(body) {
378376
flags.insert(MirFlags::IS_NOUNWIND);
@@ -435,6 +433,7 @@ fn mir_drops_elaborated_and_const_checked(tcx: TyCtxt<'_>, def: LocalDefId) -> &
435433
if pm::should_run_pass(tcx, &inline::Inline) {
436434
tcx.ensure_with_value().mir_inliner_callees(ty::InstanceKind::Item(def.to_def_id()));
437435
}
436+
tcx.ensure_with_value().mir_flags(def);
438437
}
439438

440439
let (body, _) = tcx.mir_promoted(def);

‎tests/ui/coroutine/clone-rpit.next.stderr

-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ note: ...which requires promoting constants in MIR for `foo::{closure#0}`...
1414
|
1515
LL | move |_: ()| {
1616
| ^^^^^^^^^^^^
17-
note: ...which requires stashing some local properties of `foo::{closure#0}` before the body is stolen...
18-
--> $DIR/clone-rpit.rs:15:5
19-
|
20-
LL | move |_: ()| {
21-
| ^^^^^^^^^^^^
2217
note: ...which requires building MIR for `foo::{closure#0}`...
2318
--> $DIR/clone-rpit.rs:15:5
2419
|

‎tests/ui/lint/unused/lint-unused-variables.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: unused variable: `a`
2-
--> $DIR/lint-unused-variables.rs:68:9
2+
--> $DIR/lint-unused-variables.rs:8:5
33
|
4-
LL | a: i32,
5-
| ^ help: if this is intentional, prefix it with an underscore: `_a`
4+
LL | a: i32,
5+
| ^ help: if this is intentional, prefix it with an underscore: `_a`
66
|
77
note: the lint level is defined here
88
--> $DIR/lint-unused-variables.rs:5:9
@@ -11,13 +11,13 @@ LL | #![deny(unused_variables)]
1111
| ^^^^^^^^^^^^^^^^
1212

1313
error: unused variable: `a`
14-
--> $DIR/lint-unused-variables.rs:8:5
14+
--> $DIR/lint-unused-variables.rs:22:9
1515
|
16-
LL | a: i32,
17-
| ^ help: if this is intentional, prefix it with an underscore: `_a`
16+
LL | a: i32,
17+
| ^ help: if this is intentional, prefix it with an underscore: `_a`
1818

1919
error: unused variable: `a`
20-
--> $DIR/lint-unused-variables.rs:22:9
20+
--> $DIR/lint-unused-variables.rs:68:9
2121
|
2222
LL | a: i32,
2323
| ^ help: if this is intentional, prefix it with an underscore: `_a`

‎tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: unused variable: `a`
2-
--> $DIR/param-attrs-cfg.rs:107:27
2+
--> $DIR/param-attrs-cfg.rs:24:23
33
|
4-
LL | #[cfg(something)] a: i32,
5-
| ^ help: if this is intentional, prefix it with an underscore: `_a`
4+
LL | #[cfg(something)] a: i32,
5+
| ^ help: if this is intentional, prefix it with an underscore: `_a`
66
|
77
note: the lint level is defined here
88
--> $DIR/param-attrs-cfg.rs:5:9
@@ -11,13 +11,13 @@ LL | #![deny(unused_variables)]
1111
| ^^^^^^^^^^^^^^^^
1212

1313
error: unused variable: `a`
14-
--> $DIR/param-attrs-cfg.rs:24:23
14+
--> $DIR/param-attrs-cfg.rs:41:27
1515
|
16-
LL | #[cfg(something)] a: i32,
17-
| ^ help: if this is intentional, prefix it with an underscore: `_a`
16+
LL | #[cfg(something)] a: i32,
17+
| ^ help: if this is intentional, prefix it with an underscore: `_a`
1818

1919
error: unused variable: `a`
20-
--> $DIR/param-attrs-cfg.rs:41:27
20+
--> $DIR/param-attrs-cfg.rs:107:27
2121
|
2222
LL | #[cfg(something)] a: i32,
2323
| ^ help: if this is intentional, prefix it with an underscore: `_a`

0 commit comments

Comments
 (0)
Failed to load comments.