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

Panic when matching a Option<&str> and returning a String #84315

Closed
pedroldk opened this issue Apr 18, 2021 · 1 comment
Closed

Panic when matching a Option<&str> and returning a String #84315

pedroldk opened this issue Apr 18, 2021 · 1 comment
Labels
A-incr-comp Area: Incremental compilation 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

@pedroldk
Copy link

Code

#![feature(proc_macro_hygiene, decl_macro)]

#[macro_use]
extern crate rocket;

#[get("/")]
fn index() -> String {
    format!("{:?}", routes![index])
}

#[get("/name")]
fn name() -> String {
    let x = &routes![name][0];
    match x.name {
        Some(y) => y.to_string(),
        None => "None".to_string(),
    }
}

fn main() {
    rocket::ignite().mount("/", routes![index, name]).launch();
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (392ba2ba1 2021-04-17)
binary: rustc
commit-hash: 392ba2ba1a7d6c542d2459fb8133bebf62a4a423
commit-date: 2021-04-17
host: x86_64-pc-windows-msvc
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

Running `rustc --crate-name weatherrs --edition=2018 src\main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=20594bb75e20956b --out-dir C:\Users\pedro\Projects\weatherrs\target\debug\deps -C incremental=C:\Users\pedro\Projects\weatherrs\target\debug\incremental -L dependency=C:\Users\pedro\Projects\weatherrs\target\debug\deps --extern rocket=C:\Users\pedro\Projects\weatherrs\target\debug\deps\librocket-24c64ea9176bc371.rlib`
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Some(Fingerprint(16035130432922222196, 6395012579070391062))`,
 right: `Some(Fingerprint(11764750703836629372, 13843522135975677865))`: found unstable fingerprints for predicates_of(core[d23b]::convert::From): GenericPredicates { parent: None, predicates: [(Binder(TraitPredicate(<Self as std::marker::Sized>), []), C:\Users\pedro\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\convert\mod.rs:365:20: 365:25 (#0)), (Binder(TraitPredicate(<T as std::marker::Sized>), []), C:\Users\pedro\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\convert\mod.rs:365:16: 365:17 (#0)), (Binder(TraitPredicate(<Self as std::convert::From<T>>), []), C:\Users\pedro\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\convert\mod.rs:365:1: 365:25 (#0))] }', /rustc/392ba2ba1a7d6c542d2459fb8133bebf62a4a423\compiler\rustc_query_system\src\query\plumbing.rs:593:5
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.53.0-nightly (392ba2ba1 2021-04-17) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

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

query stack during panic:
#0 [predicates_of] computing predicates of `std::convert::From`
#1 [typeck] type-checking `index`
end of query stack
error: could not compile `weatherrs`

Caused by:
  process didn't exit successfully: `rustc --crate-name weatherrs --edition=2018 src\main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=20594bb75e20956b --out-dir C:\Users\pedro\Projects\weatherrs\target\debug\deps -C incremental=C:\Users\pedro\Projects\weatherrs\target\debug\incremental -L dependency=C:\Users\pedro\Projects\weatherrs\target\debug\deps --extern rocket=C:\Users\pedro\Projects\weatherrs\target\debug\deps\librocket-24c64ea9176bc371.rlib` (exit code: 101)
Backtrace

query stack during panic:
#0 [predicates_of] computing predicates of `std::convert::From`
#1 [typeck] type-checking `index`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack

@pedroldk pedroldk 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 Apr 18, 2021
@jyn514 jyn514 added the A-incr-comp Area: Incremental compilation label Apr 18, 2021
@Aaron1011
Copy link
Member

Duplicate of #84341. This is fixed in the latest nightly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation 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

3 participants