Skip to content

ICE: args not compatible with generics for .. #137514

Open
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![feature(generic_const_exprs)]

trait Bar<const N: usize> {}

trait BB = Bar<{ 1i32 + 1 }>;

fn foo(x: &dyn BB) {}

original:

#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
#![feature(trait_alias)]

trait Bar<const N: usize> {}

trait BB = Bar<{ 1i32 + 1 }>;

fn foo(x: &dyn BB) {}
//~^ ERROR the trait alias `BB` is not dyn compatible [E0038]

fn main(&String) {}

Version information

rustc 1.87.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.87.0-dev
LLVM version: 20.1.0

Possibly related line of code:
https://github.com/rust-lang/rust/blob/unknown/compiler/rustc_middle/src/ty/context.rs#L2724-L2736

Command:
/home/gh-matthiaskrgr/.rustup/toolchains/local-debug-assertions/bin/rustc

Version information

rustc 1.87.0-dev
binary: rustc
commit-hash: b522e7c5ea8334fbccb9dd7f9b33759304743fd0
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.87.0-dev
LLVM version: 20.1.0

Possibly related line of code:

.iter()
.copied()
)
)
);
} else {
bug!(
"args not compatible with generics for {}: args={:#?}, generics={:#?}",
self.def_path_str(def_id),
args,
ty::GenericArgs::identity_for_item(self, def_id)
);
}

Command:
/home/gh-matthiaskrgr/.rustup/toolchains/local-debug-assertions/bin/rustc

@rustbot label +F-generic_const_exprs +F-trait_alias

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-generic_const_exprs`#![feature(generic_const_exprs)]`F-trait_alias`#![feature(trait_alias)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some wayrequires-incomplete-featuresThis issue requires the use of incomplete features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions