diff options
| author | bors <bors@rust-lang.org> | 2021-08-26 15:24:01 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-26 15:24:01 +0000 |
| commit | 4b9f4b221b92193c7e95b1beb502c6eb32c3b613 (patch) | |
| tree | d2ecb2a06dba763092dedb6af14ff1315f108969 /src/test | |
| parent | 20997f6ad81721542e9ef97bb2f58190903a34d8 (diff) | |
| parent | edb4b2d8c2a9eafc3bdfdb97d5b676afc3f31248 (diff) | |
| download | rust-4b9f4b221b92193c7e95b1beb502c6eb32c3b613.tar.gz rust-4b9f4b221b92193c7e95b1beb502c6eb32c3b613.zip | |
Auto merge of #88308 - eddyb:cooked-layouts, r=nagisa
Morph `layout_raw` query into `layout_of`. Before this PR, `LayoutCx::layout_of` wrapped the `layout_raw` query, to: * normalize the type, before attempting to compute the layout * pass the layout to `record_layout_for_printing`, for `-Zprint-type-sizes` Moving those two responsibilities into the query may reduce overhead (due to cached calls skipping those steps), but I want to do a perf run to know. One of the changes I had to make was changing the return type of the query, to be able to both get out the type produced by normalizing inside the query *and* to match the signature of the old `TyCtxt::layout_of`. This change may be worse, perf-wise, so that's another reason I want to check. r? `@nagisa` cc `@oli-obk`
Diffstat (limited to 'src/test')
4 files changed, 12 insertions, 12 deletions
diff --git a/src/test/ui/consts/const-size_of-cycle.stderr b/src/test/ui/consts/const-size_of-cycle.stderr index 129457ebdf9..1067eb003f7 100644 --- a/src/test/ui/consts/const-size_of-cycle.stderr +++ b/src/test/ui/consts/const-size_of-cycle.stderr @@ -15,6 +15,7 @@ note: ...which requires const-evaluating + checking `Foo::bytes::{constant#0}`.. LL | bytes: [u8; std::mem::size_of::<Foo>()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which requires computing layout of `Foo`... + = note: ...which requires computing layout of `[u8; _]`... = note: ...which requires normalizing `[u8; _]`... = note: ...which again requires simplifying constant for the type system `Foo::bytes::{constant#0}`, completing the cycle note: cycle used when checking that `Foo` is well-formed diff --git a/src/test/ui/consts/issue-44415.stderr b/src/test/ui/consts/issue-44415.stderr index 38841e99a72..9e3db5ce9a4 100644 --- a/src/test/ui/consts/issue-44415.stderr +++ b/src/test/ui/consts/issue-44415.stderr @@ -15,6 +15,7 @@ note: ...which requires const-evaluating + checking `Foo::bytes::{constant#0}`.. LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }], | ^^^^^^ = note: ...which requires computing layout of `Foo`... + = note: ...which requires computing layout of `[u8; _]`... = note: ...which requires normalizing `[u8; _]`... = note: ...which again requires simplifying constant for the type system `Foo::bytes::{constant#0}`, completing the cycle note: cycle used when checking that `Foo` is well-formed diff --git a/src/test/ui/recursion/issue-26548-recursion-via-normalize.rs b/src/test/ui/recursion/issue-26548-recursion-via-normalize.rs index 4d1cd059c27..03cb3e24b7d 100644 --- a/src/test/ui/recursion/issue-26548-recursion-via-normalize.rs +++ b/src/test/ui/recursion/issue-26548-recursion-via-normalize.rs @@ -1,6 +1,8 @@ -//~ ERROR cycle detected when computing layout of -//~| NOTE ...which requires computing layout of -//~| NOTE ...which again requires computing layout of +//~ ERROR cycle detected when computing layout of `S` +//~| NOTE ...which requires computing layout of `std::option::Option<<S as Mirror>::It>`... +//~| NOTE ...which requires computing layout of `std::option::Option<S>`... +//~| NOTE ...which again requires computing layout of `S`, completing the cycle +//~| NOTE cycle used when computing layout of `std::option::Option<S>` // build-fail @@ -13,6 +15,5 @@ impl<T: ?Sized> Mirror for T { struct S(Option<<S as Mirror>::It>); fn main() { - //~^ NOTE cycle used when optimizing MIR for `main` let _s = S(None); } diff --git a/src/test/ui/recursion/issue-26548-recursion-via-normalize.stderr b/src/test/ui/recursion/issue-26548-recursion-via-normalize.stderr index be55890c08c..21c0e1e6de5 100644 --- a/src/test/ui/recursion/issue-26548-recursion-via-normalize.stderr +++ b/src/test/ui/recursion/issue-26548-recursion-via-normalize.stderr @@ -1,12 +1,9 @@ -error[E0391]: cycle detected when computing layout of `std::option::Option<S>` +error[E0391]: cycle detected when computing layout of `S` | - = note: ...which requires computing layout of `S`... - = note: ...which again requires computing layout of `std::option::Option<S>`, completing the cycle -note: cycle used when optimizing MIR for `main` - --> $DIR/issue-26548-recursion-via-normalize.rs:15:1 - | -LL | fn main() { - | ^^^^^^^^^ + = note: ...which requires computing layout of `std::option::Option<<S as Mirror>::It>`... + = note: ...which requires computing layout of `std::option::Option<S>`... + = note: ...which again requires computing layout of `S`, completing the cycle + = note: cycle used when computing layout of `std::option::Option<S>` error: aborting due to previous error |
