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: internal compiler error: error: the type T has an unknown layout #125810

Open
matthiaskrgr opened this issue May 31, 2024 · 1 comment
Open
Labels
A-layout Area: Memory layout of types C-bug Category: This is a bug. F-arbitrary_self_types `#![feature(arbitrary_self_types)]` F-dispatch_from_dyn `#![feature(dispatch_from_dyn)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

snippet:

#![feature(arbitrary_self_types, dispatch_from_dyn)]

use std::ops::{Deref, DispatchFromDyn};

trait Trait<T: Deref<Target = Self> + DispatchFromDyn<T>> {
    fn MONO_BUF(self: T) -> dyn Trait<T>;
}

fn main() {}

Version information

rustc 1.80.0-nightly (366da30d5 2024-05-31)
binary: rustc
commit-hash: 366da30d554719e7490950aeea5d3f3a5927e313
commit-date: 2024-05-31
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.6

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

warning: trait `Trait` is never used
 --> /tmp/icemaker_global_tempdir.LMPz7J6APUgI/rustc_testrunner_tmpdir_reporting.JILMpr3PO0Dq/mvce.rs:5:7
  |
5 | trait Trait<T: Deref<Target = Self> + DispatchFromDyn<T>> {
  |       ^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: trait method `MONO_BUF` should have a snake case name
 --> /tmp/icemaker_global_tempdir.LMPz7J6APUgI/rustc_testrunner_tmpdir_reporting.JILMpr3PO0Dq/mvce.rs:6:8
  |
6 |     fn MONO_BUF(self: T) -> dyn Trait<T>;
  |        ^^^^^^^^ help: convert the identifier to snake case: `mono_buf`
  |
  = note: `#[warn(non_snake_case)]` on by default

warning: 2 warnings emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: error: the type `T` has an unknown layout
                                 while computing layout for type T/#1
 --> /tmp/icemaker_global_tempdir.LMPz7J6APUgI/rustc_testrunner_tmpdir_reporting.JILMpr3PO0Dq/mvce.rs:6:5
  |
6 |     fn MONO_BUF(self: T) -> dyn Trait<T>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: delayed at compiler/rustc_trait_selection/src/traits/object_safety.rs:507:35 - disabled backtrace
 --> /tmp/icemaker_global_tempdir.LMPz7J6APUgI/rustc_testrunner_tmpdir_reporting.JILMpr3PO0Dq/mvce.rs:6:5
  |
6 |     fn MONO_BUF(self: T) -> dyn Trait<T>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: receiver when `Self = ()` should have a Scalar ABI; found None
 --> /tmp/icemaker_global_tempdir.LMPz7J6APUgI/rustc_testrunner_tmpdir_reporting.JILMpr3PO0Dq/mvce.rs:6:5
  |
6 |     fn MONO_BUF(self: T) -> dyn Trait<T>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: delayed at compiler/rustc_trait_selection/src/traits/object_safety.rs:523:31 - disabled backtrace
 --> /tmp/icemaker_global_tempdir.LMPz7J6APUgI/rustc_testrunner_tmpdir_reporting.JILMpr3PO0Dq/mvce.rs:6:5
  |
6 |     fn MONO_BUF(self: T) -> dyn Trait<T>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: receiver when `Self = (dyn Trait<T> + 'static)` should have a ScalarPair ABI; found None
 --> /tmp/icemaker_global_tempdir.LMPz7J6APUgI/rustc_testrunner_tmpdir_reporting.JILMpr3PO0Dq/mvce.rs:6:5
  |
6 |     fn MONO_BUF(self: T) -> dyn Trait<T>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: delayed at compiler/rustc_trait_selection/src/traits/object_safety.rs:541:31 - disabled backtrace
 --> /tmp/icemaker_global_tempdir.LMPz7J6APUgI/rustc_testrunner_tmpdir_reporting.JILMpr3PO0Dq/mvce.rs:6:5
  |
6 |     fn MONO_BUF(self: T) -> dyn Trait<T>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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 make sure that you have updated to the latest nightly

note: rustc 1.80.0-nightly (366da30d5 2024-05-31) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

@rustbot label +F-arbitrary_self_types +F-dispatch_from_dyn

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels May 31, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-arbitrary_self_types `#![feature(arbitrary_self_types)]` F-dispatch_from_dyn `#![feature(dispatch_from_dyn)]` labels May 31, 2024
@jieyouxu jieyouxu added A-layout Area: Memory layout of types S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jun 4, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Jun 9, 2024
@GrigorenkoPV
Copy link
Contributor

GrigorenkoPV commented Jun 19, 2024

Regression in nightly-2021-09-02 (29ef6cf...50171c3)
Sorry, misinformation.

In actuality, it started to ICE ever since nightly-2018-11-04, before that there was no DispatchFromDyn in std::ops

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-layout Area: Memory layout of types C-bug Category: This is a bug. F-arbitrary_self_types `#![feature(arbitrary_self_types)]` F-dispatch_from_dyn `#![feature(dispatch_from_dyn)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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

4 participants