diff options
| author | bors <bors@rust-lang.org> | 2024-02-15 08:29:42 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-02-15 08:29:42 +0000 |
| commit | 4ae1e79876fcee94a56c1edf7c029a677084d7fc (patch) | |
| tree | f38ecb8022af776bc59eaefcd915fa7d214f2827 /compiler/rustc_const_eval/src | |
| parent | bd6b3361339522cc258d1f4165e3340e4cb1add4 (diff) | |
| parent | 829b59a47d502dcb441f47a4e182e9f39c76a7b6 (diff) | |
| download | rust-4ae1e79876fcee94a56c1edf7c029a677084d7fc.tar.gz rust-4ae1e79876fcee94a56c1edf7c029a677084d7fc.zip | |
Auto merge of #121131 - matthiaskrgr:rollup-mo3b8nz, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #111106 (Add known issue of let binding to format_args doc) - #118749 (Make contributing to windows bindings easier) - #120982 (Add APIs for fetching foreign items ) - #121022 (rustdoc: cross-crate re-exports: correctly render late-bound params in source order even if early-bound params are present) - #121082 (Clarified docs on non-atomic oprations on owned/mut refs to atomics) - #121084 (Make sure `tcx.create_def` also depends on the forever red node, instead of just `tcx.at(span).create_def`) - #121098 (Remove unnecessary else block from `thread_local!` expanded code) - #121105 (Do not report overflow errors on ConstArgHasType goals) - #121116 (Reinstate some delayed bugs.) - #121122 (Enforce coroutine-closure layouts are identical) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/validate.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs index b5c70538c52..1ff72516324 100644 --- a/compiler/rustc_const_eval/src/transform/validate.rs +++ b/compiler/rustc_const_eval/src/transform/validate.rs @@ -98,6 +98,26 @@ impl<'tcx> MirPass<'tcx> for Validator { } } } + + // Enforce that coroutine-closure layouts are identical. + if let Some(layout) = body.coroutine_layout() + && let Some(by_move_body) = body.coroutine_by_move_body() + && let Some(by_move_layout) = by_move_body.coroutine_layout() + { + if layout != by_move_layout { + // If this turns out not to be true, please let compiler-errors know. + // It is possible to support, but requires some changes to the layout + // computation code. + cfg_checker.fail( + Location::START, + format!( + "Coroutine layout differs from by-move coroutine layout:\n\ + layout: {layout:#?}\n\ + by_move_layout: {by_move_layout:#?}", + ), + ); + } + } } } |
