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] Static items with an fn type which uses a wildcard results in an ICE #74086

Closed
RDambrosio016 opened this issue Jul 6, 2020 · 2 comments · Fixed by #74270
Closed

[ICE] Static items with an fn type which uses a wildcard results in an ICE #74086

RDambrosio016 opened this issue Jul 6, 2020 · 2 comments · Fixed by #74270
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@RDambrosio016
Copy link
Contributor

Code

static BUG: fn(_) -> u8 = |_| 8;

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=534f07f9eb0e8b5f12f6fd99b5b98f24
The actual cause seems to be the fn(_), return type does not affect it

Meta

rustc --version --verbose:

rustc 1.44.0-nightly (6dee5f112 2020-04-06)
binary: rustc
commit-hash: 6dee5f1126dfd5c9314ee5ae9d9eb010e35ef257
commit-date: 2020-04-06
host: x86_64-pc-windows-msvc
release: 1.44.0-nightly
LLVM version: 9.0

The bug seems to appear in both stable and nightly

Error output

error: internal compiler error: src/librustc_codegen_llvm/context.rs:849: failed to get layout for `[type error]`: the type `[type error]` has an unknown layout
Backtrace

   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: <std::io::IoSlice as core::fmt::Debug>::fmt
   3: std::panicking::take_hook
   4: std::panicking::take_hook
   5: rustc_driver::report_ice
   6: std::panicking::rust_panic_with_hook
   7: rustc_errors::diagnostic_builder::DiagnosticBuilder::code
   8: rustc_errors::HandlerInner::treat_err_as_bug
   9: rustc_errors::Handler::bug
  10: rustc_middle::util::bug::bug_fmt
  11: rustc_middle::ty::walk::walk_shallow
  12: rustc_middle::ty::walk::walk_shallow
  13: rustc_middle::util::bug::bug_fmt
  14: rustc_middle::util::bug::bug_fmt
  15: <rustc_codegen_llvm::context::CodegenCx as rustc_target::abi::LayoutOf>::spanned_layout_of
  16: <rustc_codegen_llvm::context::CodegenCx as rustc_target::abi::LayoutOf>::layout_of
  17: <rustc_codegen_llvm::llvm_::OperandBundleDef as core::ops::drop::Drop>::drop
  18: <rustc_codegen_llvm::llvm_::OperandBundleDef as core::ops::drop::Drop>::drop
  19: <rustc_codegen_llvm::builder::Builder as rustc_codegen_ssa::traits::builder::BuilderMethods>::unchecked_umul
  20: <rustc_codegen_llvm::llvm_::ffi::debuginfo::DISPFlags as core::fmt::Debug>::fmt
  21: <rustc_target::abi::TyAndLayout<&rustc_middle::ty::TyS> as rustc_codegen_llvm::type_of::LayoutLlvmExt>::llvm_type
  22: rustc_codegen_llvm::mono_item::<impl rustc_codegen_ssa::traits::declare::PreDefineMethods for rustc_codegen_llvm::context::CodegenCx>::predefine_static
  23: <rustc_codegen_llvm::base::ValueIter as core::iter::traits::iterator::Iterator>::next
  24: <rustc_codegen_llvm::llvm_::ffi::PassKind as core::fmt::Debug>::fmt
  25: <rustc_target::abi::TyAndLayout<&rustc_middle::ty::TyS> as rustc_codegen_llvm::type_of::LayoutLlvmExt>::pointee_info_at
  26: <rustc_codegen_llvm::base::ValueIter as core::iter::traits::iterator::Iterator>::next
  27: <rustc_codegen_llvm::back::lto::ThinLTOImports as core::fmt::Debug>::fmt
  28: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  29: rustc_interface::passes::QueryContext::print_stats
  30: <rustc_interface::util::ReplaceBodyWithLoop as rustc_ast::mut_visit::MutVisitor>::visit_mac
  31: rustc_interface::queries::Queries::ongoing_codegen
  32: rustc_driver::pretty::print_after_hir_lowering
  33: <rustc_span::symbol::SymbolStr as core::fmt::Display>::fmt
  34: <rustc_span::symbol::SymbolStr as core::fmt::Display>::fmt
  35: <(&rustc_middle::ty::sty::Const, rustc_middle::mir::Field) as rustc_middle::ty::query::keys::Key>::query_crate
  36: rustc_driver::pretty::print_after_hir_lowering
  37: ZN244_$LT$std..error..$LT$impl$u20$core..convert..From$LT$alloc..string..String$GT$$u20$for$u20$alloc..boxed..Box$LT$dyn$u20$std..error..Error$u2b$core..marker..Sync$u2b$core..marker..Send$GT$$GT$..from..StringError$u20$as$u20$core..fmt..Display$GT$3fmt17
  38: std::sys::windows::thread::Thread::new
  39: BaseThreadInitThunk
  40: RtlUserThreadStart

@RDambrosio016 RDambrosio016 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 Jul 6, 2020
@lcnr lcnr added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Jul 6, 2020
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jul 6, 2020
@lcnr
Copy link
Contributor

lcnr commented Jul 6, 2020

Regressed between version 1.43.0 and 1.44.1

@spastorino spastorino added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jul 7, 2020
@spastorino
Copy link
Member

Prioritized as P-medium as discussed on this Zulip topic

@davidtwco davidtwco self-assigned this Jul 12, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 13, 2020
…der-type-error, r=estebank

typeck: report placeholder type error w/out span

Fixes rust-lang#74086.

This PR fixes a regression introduced in rust-lang#70369 which meant that an error was not being emitted for invalid placeholder types when there wasn't a span available.

r? @estebank
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 13, 2020
…der-type-error, r=estebank

typeck: report placeholder type error w/out span

Fixes rust-lang#74086.

This PR fixes a regression introduced in rust-lang#70369 which meant that an error was not being emitted for invalid placeholder types when there wasn't a span available.

r? @estebank
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 13, 2020
…der-type-error, r=estebank

typeck: report placeholder type error w/out span

Fixes rust-lang#74086.

This PR fixes a regression introduced in rust-lang#70369 which meant that an error was not being emitted for invalid placeholder types when there wasn't a span available.

r? @estebank
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 13, 2020
…der-type-error, r=estebank

typeck: report placeholder type error w/out span

Fixes rust-lang#74086.

This PR fixes a regression introduced in rust-lang#70369 which meant that an error was not being emitted for invalid placeholder types when there wasn't a span available.

r? @estebank
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 14, 2020
…der-type-error, r=estebank

typeck: report placeholder type error w/out span

Fixes rust-lang#74086.

This PR fixes a regression introduced in rust-lang#70369 which meant that an error was not being emitted for invalid placeholder types when there wasn't a span available.

r? @estebank
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 14, 2020
…der-type-error, r=estebank

typeck: report placeholder type error w/out span

Fixes rust-lang#74086.

This PR fixes a regression introduced in rust-lang#70369 which meant that an error was not being emitted for invalid placeholder types when there wasn't a span available.

r? @estebank
@bors bors closed this as completed in 1114f22 Jul 14, 2020
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) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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.

5 participants