Skip to content

-Zmeta-stats ICE: with thread 'rustc' panicked at 'called Result::unwrap() on an Err value: Os { code: 5, kind: PermissionDenied, message: "Access is denied." } #101001

Closed

Description

@klensy

-Zmeta-stats started ICEing between nightly-2022-07-15 and nightly-2022-07-16, looking at diff c2f428d...23e21bd it's probably #96544, so @m-ysk ?

Code

cargo new --lib hello
cd hello
RUSTFLAGS="-Zmeta-stats" cargo build

Meta

rustc --version --verbose:

rustc 1.65.0-nightly (e1b28cd2f 2022-08-19)
binary: rustc
commit-hash: e1b28cd2f16bd5b832183d7968cae3bb9213e78d
commit-date: 2022-08-19
host: x86_64-pc-windows-msvc
release: 1.65.0-nightly
LLVM version: 15.0.0

Error output

<output>
Backtrace

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 5, kind: PermissionDenied, message: "Access is denied." }', compiler\rustc_metadata\src\rmeta\encoder.rs:774:22
stack backtrace:
   0:     0x7fffb7e59982 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6af6f9f3a4c35d3a
   1:     0x7fffb7e94c8b - core::fmt::write::he3f07bcff4ed6652
   2:     0x7fffb7e4c48a - <std::io::IoSliceMut as core::fmt::Debug>::fmt::hf6257fd727ae80d5
   3:     0x7fffb7e5d254 - std::panicking::default_hook::hb6687dad6f786ea1
   4:     0x7fffb7e5ce8a - std::panicking::default_hook::hb6687dad6f786ea1
   5:     0x7fff99b8a9f2 - rustc_driver[1d98c199491bd8cd]::describe_lints
   6:     0x7fffb7e5dc52 - std::panicking::rust_panic_with_hook::hf223e88fa60de009
   7:     0x7fffb7e5d9dd - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::h230f1146d8ddd341
   8:     0x7fffb7e5a67f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6af6f9f3a4c35d3a
   9:     0x7fffb7e5d6a0 - rust_begin_unwind
  10:     0x7fffb7ec9f35 - core::panicking::panic_fmt::he533ea2e8c7ab1f5
  11:     0x7fffb7eca0b3 - core::result::unwrap_failed::ha67da4e5ef765d0c
  12:     0x7fff99665e50 - <rustc_metadata[24368a714c5ae756]::rmeta::encoder::EncodeContext as rustc_type_ir[15febabf03c45dc7]::codec::TyEncoder>::predicate_shorthands
  13:     0x7fff980fc525 - rustc_metadata[24368a714c5ae756]::rmeta::encoder::encode_metadata
  14:     0x7fff980fdd6c - <rustc_metadata[24368a714c5ae756]::rmeta::encoder::EncodeContext as rustc_serialize[3bf25e14274047cb]::serialize::Encoder>::emit_raw_bytes
  15:     0x7fff980fba6e - rustc_metadata[24368a714c5ae756]::rmeta::encoder::encode_metadata
  16:     0x7fff980f4711 - rustc_metadata[24368a714c5ae756]::fs::encode_and_write_metadata
  17:     0x7fff974c3b0c - <rustc_interface[3b6d288906cb4b04]::passes::LintStoreExpandImpl as rustc_expand[4331ab26a72f6383]::base::LintStoreExpand>::pre_expansion_lint
  18:     0x7fff974b00dc - <rustc_interface[3b6d288906cb4b04]::queries::Queries>::ongoing_codegen
  19:     0x7fff97466c69 - <unknown>
  20:     0x7fff974630eb - <unknown>
  21:     0x7fff97486532 - <unknown>
  22:     0x7fff9749d727 - rustc_driver[1d98c199491bd8cd]::args::arg_expand_all
  23:     0x7fff97466449 - <unknown>
  24:     0x7fff9748cbed - <unknown>
  25:     0x7fffb7e6e41c - std::sys::windows::thread::Thread::new::h5a05fdb6284bcf7c
  26:     0x7ff800497034 - BaseThreadInitThunk
  27:     0x7ff802e22651 - RtlUserThreadStart

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.65.0-nightly (e1b28cd2f 2022-08-19) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -Z meta-stats

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Aug 25, 2022
  2. isikkema commented on Aug 25, 2022

    @isikkema

    Looks like file is created write-only here: https://github.com/rust-lang/rust/blob/master/compiler/rustc_serialize/src/opaque.rs#L196

    and is trying to be read here: https://github.com/rust-lang/rust/blob/master/compiler/rustc_metadata/src/rmeta/encoder.rs#L780

    I haven't contributed here yet, but it looks to me like File::options().read(true).write(true).create(true).truncate(true).open(path)? instead of File::create(path)? would fix this.

    Should I make a PR? I unfortunately don't have a computer good enough to compile locally atm.

  3. klensy commented on Aug 26, 2022

    @klensy
    ContributorAuthor

    That should probably works, File::options().read(true).write(true).create(true).truncate(true).open(path)?, but looks little hacky.

  4. isikkema commented on Aug 26, 2022

    @isikkema

    That should probably works, File::options().read(true).write(true).create(true).truncate(true).open(path)?, but looks little hacky.

    I agree it looks wonky, but the only other option would be storing the path in FileEncoder and then creating a new read handle on it later, AFAIK. <-- I like this option much less.

  5. matthiaskrgr commented on Aug 28, 2022

    @matthiaskrgr
    Member

    bash mvce

    rustc --crate-type lib -Zmeta-stats  - <<'EOF'
    
    pub fn a() {}
    
    EOF
  6. added 2 commits that reference this issue on Aug 28, 2022
  7. added 2 commits that reference this issue on Sep 20, 2022
    c1bffa5
    3f377d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions