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

Nightly (2022-01-22) error with Rocket 0.5.0-rc.1 #93232

Closed
timschonborn opened this issue Jan 23, 2022 · 1 comment
Closed

Nightly (2022-01-22) error with Rocket 0.5.0-rc.1 #93232

timschonborn opened this issue Jan 23, 2022 · 1 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.

Comments

@timschonborn
Copy link

timschonborn commented Jan 23, 2022

When trying to build my rocket application using the nightly channel I receive an internal compiler error. Since the error asked me to make an issue here I am :)

This is my first bug report so please let me know if anything needs to be improved!

Code

#[macro_use]
extern crate rocket;
extern crate rocket_contrib;


#[get("/")]
fn index() -> &'static str {
    "Rust Rocket is running!\n"
}

async fn main() -> Result<(), Error> {

    match rocket::build()
        .mount(
            "/",
            routes![index],
        )
        .launch()
        .await
    {
        Err(e) => println!("{:?}", e),
        _ => (),
    }
    Ok(())
}
// Cargo.toml
[package]
name = "bug"
version = "0.1.0"
edition = "2021"

[dependencies]
rocket = {version = "0.5.0-rc.1", features=["json"]}

[dependencies.rocket_contrib]
version = "0.4.10"
features = ["tera_templates", "diesel_postgres_pool", "serde_json"]

Meta

rustc --version --verbose:

rustc 1.60.0-nightly (bfe156467 2022-01-22)
binary: rustc
commit-hash: bfe15646761a75f0259e204cab071565eed2b1e5
commit-date: 2022-01-22
host: x86_64-apple-darwin
release: 1.60.0-nightly
LLVM version: 13.0.0

Error output

error: internal compiler error: compiler/rustc_mir_transform/src/generator.rs:755:13: Broken MIR: generator contains type &mut either::Either<TempPath, PathBuf> in MIR, but typeck only knows about {ResumeTy, &mut temp_file::TempFile, P, PathBuf, either::Either<TempPath, PathBuf>, TempPath, tokio::task::JoinHandle<std::result::Result<(), PathPersistError>>, (), &PathBuf, impl futures::Future<Output = std::result::Result<(), std::io::Error>>, &mut &str, impl futures::Future<Output = std::result::Result<tokio::fs::File, std::io::Error>>, tokio::fs::File, &str, &[u8], tokio::io::util::write_all::WriteAll<tokio::fs::File>} and [&mut fs::temp_file::TempFile, P]
   --> /Users/timschoenborn/.cargo/registry/src/github.com-1ecc6299db9ec823/rocket-0.5.0-rc.1/src/fs/temp_file.rs:167:5
    |
167 | /     {
168 | |         let new_path = path.as_ref().to_path_buf();
169 | |         match self {
170 | |             TempFile::File { path: either, .. } => {
...   |
203 | |         Ok(())
204 | |     }
    | |_____^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/bfe15646761a75f0259e204cab071565eed2b1e5/compiler/rustc_errors/src/lib.rs:1115:9

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.60.0-nightly (bfe156467 2022-01-22) running on x86_64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 --crate-type lib

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

query stack during panic:
#0 [optimized_mir] optimizing MIR for `fs::temp_file::<impl at /Users/timschoenborn/.cargo/registry/src/github.com-1ecc6299db9ec823/rocket-0.5.0-rc.1/src/fs/temp_file.rs:116:1: 472:2>::persist_to::{closure#0}`
#1 [layout_of] computing layout of `[static generator@/Users/timschoenborn/.cargo/registry/src/github.com-1ecc6299db9ec823/rocket-0.5.0-rc.1/src/fs/temp_file.rs:167:5: 204:6]`
#2 [layout_of] computing layout of `core::future::from_generator::GenFuture<[static generator@/Users/timschoenborn/.cargo/registry/src/github.com-1ecc6299db9ec823/rocket-0.5.0-rc.1/src/fs/temp_file.rs:167:5: 204:6]>`
#3 [layout_of] computing layout of `impl core::future::future::Future<Output = [async output]>`
#4 [optimized_mir] optimizing MIR for `fs::temp_file::<impl at /Users/timschoenborn/.cargo/registry/src/github.com-1ecc6299db9ec823/rocket-0.5.0-rc.1/src/fs/temp_file.rs:116:1: 472:2>::persist_to`
end of query stack
error: could not compile `rocket`
Backtrace

stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: std::panic::panic_any::<rustc_errors::ExplicitBug>
   2: <rustc_errors::HandlerInner>::span_bug::<rustc_span::span_encoding::Span>
   3: <rustc_errors::Handler>::span_bug::<rustc_span::span_encoding::Span>
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, ()>
   5: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>
   6: rustc_middle::util::bug::span_bug_fmt::<rustc_span::span_encoding::Span>
   7: <rustc_mir_transform::generator::StateTransform as rustc_middle::mir::MirPass>::run_pass
   8: rustc_mir_transform::pass_manager::run_passes
   9: rustc_mir_transform::optimized_mir
  10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, &rustc_middle::mir::Body>>
  11: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::optimized_mir, rustc_query_impl::plumbing::QueryCtxt>
  12: <rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt>>::layout_of_uncached
  13: rustc_middle::ty::layout::layout_of
  14: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::layout_of, rustc_query_impl::plumbing::QueryCtxt>
  15: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::layout_of
  16: <rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt> as rustc_middle::ty::layout::LayoutOf>::layout_of
  17: core::iter::adapters::process_results::<core::iter::adapters::map::Map<core::slice::iter::Iter<rustc_middle::ty::FieldDef>, <rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt>>::layout_of_uncached::{closure#5}::{closure#0}>, rustc_target::abi::TyAndLayout<&rustc_middle::ty::TyS>, rustc_middle::ty::layout::LayoutError, <core::result::Result<alloc::vec::Vec<rustc_target::abi::TyAndLayout<&rustc_middle::ty::TyS>>, rustc_middle::ty::layout::LayoutError> as core::iter::traits::collect::FromIterator<core::result::Result<rustc_target::abi::TyAndLayout<&rustc_middle::ty::TyS>, rustc_middle::ty::layout::LayoutError>>>::from_iter<core::iter::adapters::map::Map<core::slice::iter::Iter<rustc_middle::ty::FieldDef>, <rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt>>::layout_of_uncached::{closure#5}::{closure#0}>>::{closure#0}, alloc::vec::Vec<rustc_target::abi::TyAndLayout<&rustc_middle::ty::TyS>>>
  18: core::iter::adapters::process_results::<core::iter::adapters::map::Map<core::slice::iter::Iter<rustc_middle::ty::VariantDef>, <rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt>>::layout_of_uncached::{closure#5}>, alloc::vec::Vec<rustc_target::abi::TyAndLayout<&rustc_middle::ty::TyS>>, rustc_middle::ty::layout::LayoutError, <core::result::Result<rustc_index::vec::IndexVec<rustc_target::abi::VariantIdx, alloc::vec::Vec<rustc_target::abi::TyAndLayout<&rustc_middle::ty::TyS>>>, rustc_middle::ty::layout::LayoutError> as core::iter::traits::collect::FromIterator<core::result::Result<alloc::vec::Vec<rustc_target::abi::TyAndLayout<&rustc_middle::ty::TyS>>, rustc_middle::ty::layout::LayoutError>>>::from_iter<core::iter::adapters::map::Map<core::slice::iter::Iter<rustc_middle::ty::VariantDef>, <rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt>>::layout_of_uncached::{closure#5}>>::{closure#0}, rustc_index::vec::IndexVec<rustc_target::abi::VariantIdx, alloc::vec::Vec<rustc_target::abi::TyAndLayout<&rustc_middle::ty::TyS>>>>
  19: <rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt>>::layout_of_uncached
  20: rustc_middle::ty::layout::layout_of
  21: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::layout_of, rustc_query_impl::plumbing::QueryCtxt>
  22: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::layout_of
  23: rustc_middle::ty::layout::layout_of
  24: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::layout_of, rustc_query_impl::plumbing::QueryCtxt>
  25: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::layout_of
  26: <rustc_mir_transform::const_prop::ConstProp as rustc_middle::mir::MirPass>::run_pass
  27: rustc_mir_transform::pass_manager::run_passes
  28: rustc_mir_transform::optimized_mir
  29: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, &rustc_middle::mir::Body>>
  30: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::optimized_mir, rustc_query_impl::plumbing::QueryCtxt>
  31: <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root
  32: rustc_metadata::rmeta::encoder::encode_metadata_impl
  33: rustc_data_structures::sync::join::<rustc_metadata::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}, rustc_metadata::rmeta::encoder::EncodedMetadata, ()>
  34: rustc_metadata::rmeta::encoder::encode_metadata
  35: <rustc_interface::passes::QueryContext>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_errors::ErrorReported>>
  36: <rustc_interface::queries::Queries>::ongoing_codegen
  37: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>>
  38: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  39: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@timschonborn timschonborn 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 Jan 23, 2022
@timschonborn timschonborn changed the title Latest Nightly error with Rocket 0.5.0-rc.1 Nightly (2022-01-22) error with Rocket 0.5.0-rc.1 Jan 23, 2022
@lqd
Copy link
Member

lqd commented Jan 23, 2022

Thanks for opening an issue!

It doesn't look like the given example builds regardless of the ICE, but I was able to reproduce the issue with a minimal rocket example:

#[macro_use]
extern crate rocket;


#[get("/")]
fn index() -> &'static str {
    "Rust Rocket is running!\n"
}

#[launch]
fn rocket() -> _ {
    rocket::build()
        .mount("/", routes![index])
}

This is a duplicate of #93161, is already fixed on master, but not available on nightly yet. It will be fixed in the next nightly which will contain #93165.

The 2 most recent nightlies have this issue:

  • "nightly-2022-01-23" on rustup: rustc 1.60.0-nightly (bfe156467 2022-01-22)
  • "nightly-2022-01-22" on rustup: rustc 1.60.0-nightly (17d29dcdc 2022-01-21).

I've checked that this example and rocket will both build with the PR, (via rustup-toolchain-master of PR #93165's try artifacts d634ef421795e0140724aa9fddf8137b83e616c9 ) so I'll close this issue as a duplicate.

While there are other ICEs that are still not fixed, it is thus expected that this one will be. Please reopen this issue if tomorrow's nightly doesn't fix it though.

@lqd lqd closed this as completed Jan 23, 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) ❄️ 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