Missing captures metadata when storing reference to Freeze type

Abierto
#166,040 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

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

Línea de trabajo

The report provides a Rust reproducer and the rustc command that emits LLVM IR, but names no source files or tests. Start by reading the compiler code that emits LLVM store instructions and attaches captures metadata, then reproduce the output with the supplied command. Done means both stores have consistent captures metadata for the reference to the Freeze type, with a regression test covering the case.

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

Descripción

A-codegen A-LLVM C-optimization T-compiler
pub fn f(a: [u8; 1024]) {
    let mut b = &a;
    std::hint::black_box(b as *const _);
    b = &a;
    std::hint::black_box(b as *const _);
}

rustc a.rs --crate-type=lib -O -Zmir-opt-level=0 -Cno-prepopulate-passes --emit llvm-ir

The second store to b has captures metadata !captures !8, while the first one does not:

...
  store ptr %a, ptr %b, align 8
  %_5 = load ptr, ptr %b, align 8, !nonnull !6, !noundef !6
; call core::hint::black_box::<*const [u8; 1024]>
  %_3 = call noundef ptr @_RINvNtCseHdv0ufVBMs_4core4hint9black_boxPAhj400_ECs5a4SndlX7Yo_1a(ptr noundef %_5)
  store ptr %a, ptr %b, align 8, !captures !8
  %_10 = load ptr, ptr %b, align 8, !nonnull !6, !noundef !6
; call core::hint::black_box::<*const [u8; 1024]>
  %_8 = call noundef ptr @_RINvNtCseHdv0ufVBMs_4core4hint9black_boxPAhj400_ECs5a4SndlX7Yo_1a(ptr noundef %_10)
...
!8 = !{!"address", !"read_provenance"}
Lenguaje dominante
Rust
Estrellas
122k
Forks
16.7k
Merge medio
2 d 16 h
PR fusionados (30 d)
515

Preparar el entorno

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 rust-lang/rust

Todos los issues de rust-lang/rust

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.