Const blocks in fns with trivially unsatisifiable clauses can render addition of trait impls a post-monomorphization breaking change
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start with the const evaluation and trait obligation handling discussed in the linked issue #165153 and PR #142293; the payload does not name Rust compiler files or tests. Reproduce the downstream const { panic!() } case with and without the upstream trait impl, then trace why evaluation changes after monomorphization. Done means the compiler behavior and the compatibility implications are understood and addressed.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Back in closed PR #142293 after [@]BoxyUwU pointed out the issues with suppressing const eval if there are trivially unsatisfiable clauses in scope in the context of GCI (now tracked in issue https://github.com/rust-lang/rust/issues/165153), it made me realize (CC https://github.com/rust-lang/rust/pull/142293#issuecomment-3229975360 (from 2025)) that const blocks are affected by this problem.
Reproducer
Upstream crate upstream:
pub trait Trait {}
// NOTE: Adding this impl breaks downstream.
//impl Trait for () {}
Downstream crate downstream:
fn scope()
where
for<'_delay> (): upstream::Trait,
{
const { panic!() } // NOTE: panics at comptime post-mono if upstream adds the impl
}
Of course, due to the existence of 1IR ("one-impl rule"), the addition of trait impls is already breaking (pre-mono even).
Moreover, at the time of writing two unstable features are affected by this issue (also pre-mono), namely GCI (https://github.com/rust-lang/rust/issues/165153) and DFV (https://github.com/rust-lang/rust/issues/165152) meaning this mistake is easy to make by rustc devs.
However, by posting https://github.com/rust-lang/rust/issues/165152#issuecomment-6722673316 @theemathas made me realize that we should probably track this in a GH issue.
- Lenguaje dominante
- Rust
- Estrellas
- 121k
- Forks
- 17.3k
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 525
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de rust-lang/rust
-
Windows `File::set_permissions` silently does nothing when clearing `readonly` leaves `FileAttributes == 0`Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. AbiertoA-filesystem C-bug O-windows T-libs
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
A-run-make relnotes relnotes-needs-review relnotes-tracking-issue T-lang T-libs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
relnotes relnotes-needs-review relnotes-tracking-issue T-compiler T-libs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
A-LLVM O-Arm O-UEFI O-x86_64 relnotes relnotes-needs-review relnotes-tracking-issue T-compiler
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
rust-lang/rust#165504 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
relnotes relnotes-tracking-issue T-libs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
Todos los issues de rust-lang/rust
Issues similares
-
agent-self
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
yologdev/yoyo-evolve#1176 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Richard-Zhang1019/Crossbow#431 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
saschanaz/jxl-winthumb#69 ·
-
ready
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
TusanHomichi/PSIV#504 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día