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

Compiler error while building https://github.com/Kampfkarren/full-moon #88498

Closed
she3o opened this issue Aug 30, 2021 · 5 comments
Closed

Compiler error while building https://github.com/Kampfkarren/full-moon #88498

she3o opened this issue Aug 30, 2021 · 5 comments
Labels
C-bug Category: This is a bug. 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.

Comments

@she3o
Copy link

she3o commented Aug 30, 2021

Code

git clone https://github.com/Kampfkarren/full-moon
cd full-moon
cargo build --release

Meta

rustc --version --verbose:

rustc 1.56.0-nightly (0035d9dce 2021-08-16)
binary: rustc
commit-hash: 0035d9dcecee49d1f7349932bfa52c05a6f83641
commit-date: 2021-08-16
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 12.0.1

Error output

I omitted the warnings produced by the compiler prior to panicking. They seemed irrelevant to the bug.

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:1976 ~ full_moon[1fdd]::ast::parsers::{impl#225}::parse::{closure#0}), const_param_did: None }) (end of phase Optimization) at bb65[0]:
use of local _155, which has no storage here
    --> full-moon/src/ast/parsers.rs:1858:4
     |
1858 |               }
     |               ^
...
1865 | / make_op_parser!(BinOp, ParseBinOp,
1866 | |     {
1867 | |         And,
1868 | |         Caret,
...    |
1882 | |     }
1883 | | );
     | |__- in this macro invocation
     |
     = note: delayed at compiler/rustc_mir/src/transform/validate.rs:121:36
     = note: this error: internal compiler error originates in the macro `make_op_parser` (in Nightly builds, run with -Z macro-backtrace for more info)

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:1990 ~ full_moon[1fdd]::ast::parsers::{impl#230}::parse::{closure#0}), const_param_did: None }) (end of phase Optimization) at bb17[0]:
use of local _35, which has no storage here
    --> full-moon/src/ast/parsers.rs:1858:4
     |
1858 |               }
     |               ^
...
1885 | / make_op_parser!(UnOp, ParseUnOp,
1886 | |     {
1887 | |         Minus,
1888 | |         Not,
1889 | |         Hash,
1890 | |     }
1891 | | );
     | |__- in this macro invocation
     |
     = note: delayed at compiler/rustc_mir/src/transform/validate.rs:121:36
     = note: this error: internal compiler error originates in the macro `make_op_parser` (in Nightly builds, run with -Z macro-backtrace for more info)

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1134:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.56.0-nightly (0035d9dce 2021-08-16) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C embed-bitcode=no -C target-cpu=native --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
warning: `full_moon` (lib) generated 62 warnings
error: could not compile `full_moon`; 62 warnings emitted

Backtrace

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1134:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/0035d9dcecee49d1f7349932bfa52c05a6f83641/library/std/src/panicking.rs:517:5
   1: std::panicking::begin_panic_fmt
             at /rustc/0035d9dcecee49d1f7349932bfa52c05a6f83641/library/std/src/panicking.rs:460:5
   2: rustc_errors::HandlerInner::flush_delayed
   3: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
   4: core::ptr::drop_in_place<rustc_session::parse::ParseSess>
   5: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
   6: core::ptr::drop_in_place<rustc_interface::interface::Compiler>
   7: rustc_span::with_source_map
   8: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@she3o she3o added C-bug Category: This is a bug. 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. labels Aug 30, 2021
@she3o
Copy link
Author

she3o commented Aug 30, 2021

rustup default stable fixed this. Compilation is successful and no errors are produced.

rustc --version --verbose:

rustc 1.54.0 (a178d0322 2021-07-26)
binary: rustc
commit-hash: a178d0322ce20e33eac124758e837cbd80a6f633
commit-date: 2021-07-26
host: x86_64-unknown-linux-gnu
release: 1.54.0
LLVM version: 12.0.1

@she3o
Copy link
Author

she3o commented Aug 30, 2021

rustup default beta also fixed this. Compilation is successful and no errors are produced.

rustc --version --verbose:

rustc 1.55.0-beta.9 (27e88d367 2021-08-28)
binary: rustc
commit-hash: 27e88d367c140907655bae9c7975fac411a5c344
commit-date: 2021-08-28
host: x86_64-unknown-linux-gnu
release: 1.55.0-beta.9
LLVM version: 12.0.1

@she3o
Copy link
Author

she3o commented Aug 30, 2021

This seems like a bug in nightly and was fixed in beta. Closing.

@she3o she3o closed this as completed Aug 30, 2021
@SNCPlay42
Copy link
Contributor

SNCPlay42 commented Aug 30, 2021

This seems like a bug in nightly and was fixed in beta

This is backwards; the nightly branch has fresher code than the beta branch (which is in turn fresher than stable). So this was working fine in stable and beta but has regressed in nightly.

And while this does look similar to #88307, it also looks slightly different (there is no as cast involved here as far as I can tell from the code). This should probably be reopened (or a reduction of this case could be added to that issue).

@SNCPlay42
Copy link
Contributor

Reduced:

pub enum UnOp {
    Not(Vec<()>),
}

pub fn foo() {
    if let Some(x) = None {
        match x {
            UnOp::Not(_) => {}
        }
    }
}

On second thought I think this is just a different way of allowing the compiler to infer the type of x, so this is a duplicate of #88307.

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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants