Skip to content

ICE: internal compiler error: error: the type T has an unknown layout #125810

Open

Description

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

A-layoutArea: Memory layout of typesC-bugCategory: This is a bug.F-arbitrary_self_types`#![feature(arbitrary_self_types)]`F-dispatch_from_dyn`#![feature(dispatch_from_dyn)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions