-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityMedium priorityS-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
I tried this code. However it triggers an internal compiler error (ICE).
Code
trait MyTrait {
type Target: ?Sized;
}
impl<A: ?Sized> MyTrait for A {
type Target = A;
}
fn main() {
bug_run::<dyn MyTrait<Target = u8>>();
}
fn bug_run<T: ?Sized>()
where
<T as MyTrait>::Target: Sized,
{
bug::<T>();
}
fn bug<T>() {
std::mem::size_of::<T>();
}
Meta
rustc --version --verbose
:
rustc 1.74.0-nightly (2f5df8a94 2023-08-31)
binary: rustc
commit-hash: 2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19
commit-date: 2023-08-31
host: x86_64-unknown-linux-gnu
release: 1.74.0-nightly
LLVM version: 17.0.0
Error output
warning: unused return value of `std::mem::size_of` that must be used
--> bug_1.rs:21:5
|
21 | std::mem::size_of::<T>();
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
|
21 | let _ = std::mem::size_of::<T>();
| +++++++
thread 'rustc' panicked at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/compiler/rustc_codegen_ssa/src/mir/rvalue.rs:675:25:
assertion failed: bx.cx().type_is_sized(ty)
Backtrace
thread 'rustc' panicked at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/compiler/rustc_codegen_ssa/src/mir/rvalue.rs:675:25:
assertion failed: bx.cx().type_is_sized(ty)
stack backtrace:
0: rust_begin_unwind
at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/library/std/src/panicking.rs:619:5
1: core::panicking::panic_fmt
at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/library/core/src/panicking.rs:72:14
2: core::panicking::panic
at /rustc/2f5df8a94bb3c5fae4e3fcbfc8ef20f1f976cb19/library/core/src/panicking.rs:127:5
3: <rustc_codegen_ssa::mir::FunctionCx<rustc_codegen_llvm::builder::Builder>>::codegen_rvalue_operand
4: rustc_codegen_ssa::mir::codegen_mir::<rustc_codegen_llvm::builder::Builder>
5: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
6: rustc_codegen_llvm::base::compile_codegen_unit
7: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
8: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
9: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
10: rustc_interface::passes::start_codegen
11: <rustc_middle::ty::context::GlobalCtxt>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_span::ErrorGuaranteed>>
12: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: 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: please attach the file at `/home/coding/rustc-ice-2023-09-01T12:24:17.5235892Z-11165.txt` to your bug report
query stack during panic:
end of query stack
warning: 1 warning emitted
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityMedium priorityS-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
matthiaskrgr commentedon Sep 1, 2023
Regression in nightly-2020-11-16
commit[0] 2020-11-14: Auto merge of #78809 - vn-ki:fix-issue-76064, r=oli-obk
commit[1] 2020-11-14: Auto merge of #79049 - tmiasko:lower-intrinsics, r=jonas-schievink
commit[2] 2020-11-15: Auto merge of #79065 - Dylan-DPC:rollup-gag1drk, r=Dylan-DPC
commit[3] 2020-11-15: Auto merge of #78472 - hermitcore:builtins, r=Mark-Simulacrum
commit[4] 2020-11-15: Auto merge of #79070 - jonas-schievink:rollup-wacn2b8, r=jonas-schievink
commit[5] 2020-11-15: Auto merge of #79064 - ehuss:rustbook-logs, r=Mark-Simulacrum
matthiaskrgr commentedon Sep 1, 2023
This is a compiles without warning -> ice regression!
compiler-errors commentedon Sep 1, 2023
This is the same root cause as #57893
apiraino commentedon Sep 4, 2023
WG-prioritization assigning priority (Zulip discussion).
@rustbot label -I-prioritize +P-medium