Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: -Zprint-type-sizes: generators: overlap-locals.rs #105591

Closed
matthiaskrgr opened this issue Dec 12, 2022 · 1 comment · Fixed by #105623
Closed

ICE: -Zprint-type-sizes: generators: overlap-locals.rs #105591

matthiaskrgr opened this issue Dec 12, 2022 · 1 comment · Fixed by #105623
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

from src/test/ui/generator/overlap-locals.rs

// run-pass

#![feature(generators)]

fn main() {
    let a = || {
        {
            let w: i32 = 4;
            yield;
            println!("{:?}", w);
        }
        {
            let z: i32 = 7;
            yield;
            println!("{:?}", z);
        }
    };
    assert_eq!(8, std::mem::size_of_val(&a));
}

Meta

rustc --version --verbose:

rustc 1.68.0-nightly (bdb07a8ec 2022-12-11)
binary: rustc
commit-hash: bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4
commit-date: 2022-12-11
host: x86_64-unknown-linux-gnu
release: 1.68.0-nightly
LLVM version: 15.0.6

Error output

rustc src/test/ui/generator/overlap-locals.rs -Zprint-type-sizes

<output>
Backtrace

print-type-size type: `std::fmt::Formatter<'_>`: 64 bytes, alignment: 8 bytes
print-type-size     field `.buf`: 16 bytes
print-type-size     field `.width`: 16 bytes
print-type-size     field `.precision`: 16 bytes
print-type-size     field `.flags`: 4 bytes
print-type-size     field `.fill`: 4 bytes
print-type-size     field `.align`: 1 bytes
print-type-size     end padding: 7 bytes
print-type-size type: `std::fmt::Arguments<'_>`: 48 bytes, alignment: 8 bytes
print-type-size     field `.fmt`: 16 bytes
print-type-size     field `.pieces`: 16 bytes
print-type-size     field `.args`: 16 bytes
print-type-size type: `std::option::Option<std::fmt::Arguments<'_>>`: 48 bytes, alignment: 8 bytes
print-type-size     variant `Some`: 48 bytes
print-type-size         field `.0`: 48 bytes
print-type-size     variant `None`: 0 bytes
print-type-size type: `unwind::libunwind::_Unwind_Exception`: 32 bytes, alignment: 8 bytes
print-type-size     field `.exception_class`: 8 bytes
print-type-size     field `.exception_cleanup`: 8 bytes
print-type-size     field `.private`: 16 bytes
print-type-size type: `std::panic::Location<'_>`: 24 bytes, alignment: 8 bytes
print-type-size     field `.file`: 16 bytes
print-type-size     field `.line`: 4 bytes
print-type-size     field `.col`: 4 bytes
print-type-size type: `std::option::Option<&[std::fmt::rt::v1::Argument]>`: 16 bytes, alignment: 8 bytes
print-type-size     variant `Some`: 16 bytes
print-type-size         field `.0`: 16 bytes
print-type-size     variant `None`: 0 bytes
print-type-size type: `std::option::Option<usize>`: 16 bytes, alignment: 8 bytes
print-type-size     discriminant: 8 bytes
print-type-size     variant `Some`: 8 bytes
print-type-size         field `.0`: 8 bytes
print-type-size     variant `None`: 0 bytes
print-type-size type: `[closure@std::rt::lang_start<()>::{closure#0}]`: 8 bytes, alignment: 8 bytes
print-type-size     end padding: 8 bytes
print-type-size type: `[generator@/home/matthias/vcs/github/rust/src/test/ui/generator/overlap-locals.rs:6:13: 6:15]`: 8 bytes, alignment: 4 bytes
print-type-size     discriminant: 1 bytes
print-type-size     variant `Suspend0`: 8 bytes
print-type-size         padding: 3 bytes
print-type-size         field `.w`: 4 bytes, alignment: 4 bytes
print-type-size     variant `Suspend1`: 8 bytes
print-type-size         padding: 3 bytes
print-type-size         field `.z`: 4 bytes, alignment: 4 bytes
print-type-size     variant `Unresumed`: 0 bytes
print-type-size     variant `Returned`: 0 bytes
print-type-size     variant `Panicked`: 0 bytes
thread '<unnamed>' panicked at 'max_variant_size 9 > 8 overall_size', compiler/rustc_session/src/code_stats.rs:177:25
stack backtrace:
   0:     0x7fb6295667da - std::backtrace_rs::backtrace::libunwind::trace::h3bfe63c4aecfa0e2
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fb6295667da - std::backtrace_rs::backtrace::trace_unsynchronized::h978c02637c6cb8f9
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fb6295667da - std::sys_common::backtrace::_print_fmt::h86a708dcb1665377
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fb6295667da - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdbf89765373fb801
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fb6295c92ee - core::fmt::write::hbf11a3bb4e6d2aba
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/core/src/fmt/mod.rs:1208:17
   5:     0x7fb629556c65 - std::io::Write::write_fmt::hd68261eacc348bbd
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/std/src/io/mod.rs:1682:15
   6:     0x7fb6295665a5 - std::sys_common::backtrace::_print::ha8e375b58cdeca4a
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fb6295665a5 - std::sys_common::backtrace::print::he3086c07df1167ca
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fb6295692ef - std::panicking::default_hook::{{closure}}::h0c12a9095c948e43
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/std/src/panicking.rs:267:22
   9:     0x7fb62956902b - std::panicking::default_hook::h1ae5478ad617eb24
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/std/src/panicking.rs:286:9
  10:     0x7fb629569b0c - std::panicking::rust_panic_with_hook::h63a24f957ccb5d93
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/std/src/panicking.rs:688:13
  11:     0x7fb6295698a9 - std::panicking::begin_panic_handler::{{closure}}::h1499194b322f3b28
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/std/src/panicking.rs:579:13
  12:     0x7fb629566c8c - std::sys_common::backtrace::__rust_end_short_backtrace::h5569dab7b5c29ca8
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/std/src/sys_common/backtrace.rs:137:18
  13:     0x7fb6295695b2 - rust_begin_unwind
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/std/src/panicking.rs:575:5
  14:     0x7fb6295c5cd3 - core::panicking::panic_fmt::h81b99a9e904184d4
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/core/src/panicking.rs:64:14
  15:     0x7fb62d29e324 - <rustc_session[8c69ddbebe7c913d]::code_stats::CodeStats>::print_type_sizes
  16:     0x7fb62ba7f3ce - <rustc_interface[649c07bcaa826da7]::interface::Compiler>::enter::<rustc_driver[c8d19d3afee4bdc9]::run_compiler::{closure#1}::{closure#2}, core[5029ced7f280b950]::result::Result<core[5029ced7f280b950]::option::Option<rustc_interface[649c07bcaa826da7]::queries::Linker>, rustc_errors[4c9e772a36c84051]::ErrorGuaranteed>>
  17:     0x7fb62ba79f78 - rustc_span[61aa4dc18b27dd6c]::with_source_map::<core[5029ced7f280b950]::result::Result<(), rustc_errors[4c9e772a36c84051]::ErrorGuaranteed>, rustc_interface[649c07bcaa826da7]::interface::run_compiler<core[5029ced7f280b950]::result::Result<(), rustc_errors[4c9e772a36c84051]::ErrorGuaranteed>, rustc_driver[c8d19d3afee4bdc9]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  18:     0x7fb62ba79a65 - <scoped_tls[5892410b08f734b5]::ScopedKey<rustc_span[61aa4dc18b27dd6c]::SessionGlobals>>::set::<rustc_interface[649c07bcaa826da7]::interface::run_compiler<core[5029ced7f280b950]::result::Result<(), rustc_errors[4c9e772a36c84051]::ErrorGuaranteed>, rustc_driver[c8d19d3afee4bdc9]::run_compiler::{closure#1}>::{closure#0}, core[5029ced7f280b950]::result::Result<(), rustc_errors[4c9e772a36c84051]::ErrorGuaranteed>>
  19:     0x7fb62ba79052 - std[ebc28cf04754cd8d]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[649c07bcaa826da7]::util::run_in_thread_pool_with_globals<rustc_interface[649c07bcaa826da7]::interface::run_compiler<core[5029ced7f280b950]::result::Result<(), rustc_errors[4c9e772a36c84051]::ErrorGuaranteed>, rustc_driver[c8d19d3afee4bdc9]::run_compiler::{closure#1}>::{closure#0}, core[5029ced7f280b950]::result::Result<(), rustc_errors[4c9e772a36c84051]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5029ced7f280b950]::result::Result<(), rustc_errors[4c9e772a36c84051]::ErrorGuaranteed>>
  20:     0x7fb62c0ecfee - <<std[ebc28cf04754cd8d]::thread::Builder>::spawn_unchecked_<rustc_interface[649c07bcaa826da7]::util::run_in_thread_pool_with_globals<rustc_interface[649c07bcaa826da7]::interface::run_compiler<core[5029ced7f280b950]::result::Result<(), rustc_errors[4c9e772a36c84051]::ErrorGuaranteed>, rustc_driver[c8d19d3afee4bdc9]::run_compiler::{closure#1}>::{closure#0}, core[5029ced7f280b950]::result::Result<(), rustc_errors[4c9e772a36c84051]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5029ced7f280b950]::result::Result<(), rustc_errors[4c9e772a36c84051]::ErrorGuaranteed>>::{closure#1} as core[5029ced7f280b950]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  21:     0x7fb62d5da623 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::heae35e1afc4b24eb
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/alloc/src/boxed.rs:2000:9
  22:     0x7fb62d5da623 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h82b51f76f931d41c
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/alloc/src/boxed.rs:2000:9
  23:     0x7fb62d5da623 - std::sys::unix::thread::Thread::new::thread_start::h66d484584973ef33
                               at /rustc/bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4/library/std/src/sys/unix/thread.rs:108:17
  24:     0x7fb6293068fd - <unknown>
  25:     0x7fb629388a60 - <unknown>
  26:                0x0 - <unknown>

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue labels Dec 12, 2022
@jruderman
Copy link
Contributor

Regression in rollup b12b836, perhaps from #104019. CC @compiler-errors

@compiler-errors compiler-errors self-assigned this Dec 12, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 14, 2022
…e-fix, r=Nilstrieb

Fix `-Z print-type-sizes` for generators with discriminant field ordered first

Fixes rust-lang#105589
Fixes rust-lang#105591
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 14, 2022
…e-fix, r=Nilstrieb

Fix `-Z print-type-sizes` for generators with discriminant field ordered first

Fixes rust-lang#105589
Fixes rust-lang#105591
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 15, 2022
…e-fix, r=Nilstrieb

Fix `-Z print-type-sizes` for generators with discriminant field ordered first

Fixes rust-lang#105589
Fixes rust-lang#105591
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 15, 2022
…e-fix, r=Nilstrieb

Fix `-Z print-type-sizes` for generators with discriminant field ordered first

Fixes rust-lang#105589
Fixes rust-lang#105591
@bors bors closed this as completed in 5d24760 Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants