Some ICEs manifest as if the crate compiled successfully

Abierto
#173 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
rust
Área
testing

Línea de trabajo

Comienza con tests/compiletest.rs y tests/ui/break-rust.rs, y luego ejecuta cargo test para reproducir el caso en el que rustc entra en pánico pero trybuild informa de éxito. Sigue cómo el harness interpreta el resultado del proceso del compilador; el trabajo está terminado cuando este ICE se informa como una compilación fallida en lugar de como una prueba compile-fail exitosa.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

For example the following ICE in nightly-2020-06-04 (https://github.com/rust-lang/rust/issues/97698):

// tests/compiletest.rs

#[test]
fn ui() {
    let t = trybuild::TestCases::new();
    t.compile_fail("tests/ui/break-rust.rs");
}
// tests/ui/break-rust.rs

trait AmbiguousIfImpl<A> {
    fn method() {}
}

struct One;
struct Two;

impl<T> AmbiguousIfImpl<One> for T {}
impl<T> AmbiguousIfImpl<Two> for T {}

struct Struct;

fn main() {
    <Struct as AmbiguousIfImpl<_>>::method();
}
$ cargo test

running 1 test

test tests/ui/break-rust.rs ... error
Expected test case to fail to compile, but it succeeded.

test ui ... FAILED

failures:

---- ui stdout ----
thread 'ui' panicked at '1 of 1 tests failed', github.com-1ecc6299db9ec823/trybuild-1.0.61/src/run.rs:100:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.38s

error: test failed, to rerun pass '--test compiletest'

Meanwhile the crate definitely fails to build and rustc exits with nonzero code.

thread 'rustc' panicked at 'range end index 2 out of range for slice of length 1', library/core/src/slice/index.rs:73:5
stack backtrace:
  …
error: internal compiler error: unexpected panic

note: 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: rustc 1.63.0-nightly (a6b8c6954 2022-06-03) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
Lenguaje dominante
Rust
Estrellas
1k
Forks
87
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de dtolnay/trybuild

Todos los issues de dtolnay/trybuild

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.