Next-generation trait solver has different compilation failure error output

Aperta
#165,977 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
22/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
compilers

Direzione di ricerca

The payload compares two rustc diagnostic outputs for the same Send/Sync failure in tests/compile_fail/diff_send.rs (git2-rs), involving src/diff.rs and src/repo.rs. The compiler code that builds these errors is not named, so the first step is to reproduce the difference by running the same file on stable and with the new solver. Done means the new-solver stderr reports the same notes as stable, which is a compiler-internals change and not a first-timer task.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

A-diagnostics T-compiler T-types WG-trait-system-refactor

when using trybuild to check the stderr output for compilation failures, the new solver seems to report less - https://github.com/rust-lang/git2-rs/actions/runs/43620785786/job/132525764327 / rust-lang/git2-rs#1342

On stable
error[E0277]: `*mut libgit2_sys::git_diff` cannot be sent between threads safely
  --> tests/compile_fail/diff_send.rs:27:17
   |
27 |         s.spawn(move || theirs.stats().unwrap().insertions());
   |           ----- -------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |           |     |
   |           |     `*mut libgit2_sys::git_diff` cannot be sent between threads safely
   |           |     within this `{closure@$DIR/tests/compile_fail/diff_send.rs:27:17: 27:24}`
   |           required by a bound introduced by this call
   |
   = help: within `{closure@$DIR/tests/compile_fail/diff_send.rs:27:17: 27:24}`, the trait `Send` is not implemented for `*mut libgit2_sys::git_diff`
note: required because it appears within the type `Diff<'_>`
  --> src/diff.rs
   |
   | pub struct Diff<'repo> {
   |            ^^^^
note: required because `theirs` is used within this closure
  --> tests/compile_fail/diff_send.rs:27:25
   |
27 |         s.spawn(move || theirs.stats().unwrap().insertions());
   |                         ^^^^^^
note: required by a bound in `Scope::<'scope, 'env>::spawn`
  --> $RUST/std/src/thread/scoped.rs

error[E0277]: `*mut libgit2_sys::git_repository` cannot be shared between threads safely
  --> tests/compile_fail/diff_send.rs:27:17
   |
27 |         s.spawn(move || theirs.stats().unwrap().insertions());
   |           ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut libgit2_sys::git_repository` cannot be shared between threads safely
   |           |
   |           required by a bound introduced by this call
   |
   = help: within `git2::Repository`, the trait `Sync` is not implemented for `*mut libgit2_sys::git_repository`
note: required because it appears within the type `git2::Repository`
  --> src/repo.rs
   |
   | pub struct Repository {
   |            ^^^^^^^^^^
   = note: required for `&git2::Repository` to implement `Send`
note: required because it appears within the type `PhantomData<&git2::Repository>`
  --> $RUST/core/src/marker.rs
note: required because it appears within the type `Diff<'_>`
  --> src/diff.rs
   |
   | pub struct Diff<'repo> {
   |            ^^^^
note: required because `theirs` is used within this closure
  --> tests/compile_fail/diff_send.rs:27:25
   |
27 |         s.spawn(move || theirs.stats().unwrap().insertions());
   |                         ^^^^^^
note: required by a bound in `Scope::<'scope, 'env>::spawn`
  --> $RUST/std/src/thread/scoped.rs
On nightly/with new solver
error[E0277]: `*mut libgit2_sys::git_diff` cannot be sent between threads safely
  --> tests/compile_fail/diff_send.rs:27:17
   |
27 |         s.spawn(move || theirs.stats().unwrap().insertions());
   |           ----- -------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |           |     |
   |           |     `*mut libgit2_sys::git_diff` cannot be sent between threads safely
   |           |     within this `{closure@$DIR/tests/compile_fail/diff_send.rs:27:17: 27:24}`
   |           required by a bound introduced by this call
   |
   = help: within `{closure@$DIR/tests/compile_fail/diff_send.rs:27:17: 27:24}`, the trait `Send` is not implemented for `*mut libgit2_sys::git_diff`
note: required because it appears within the type `Diff<'_>`
  --> src/diff.rs
   |
   | pub struct Diff<'repo> {
   |            ^^^^
note: required because `theirs` is used within this closure
  --> tests/compile_fail/diff_send.rs:27:25
   |
27 |         s.spawn(move || theirs.stats().unwrap().insertions());
   |                         ^^^^^^
note: required by a bound in `Scope::<'scope, 'env>::spawn`
  --> $RUST/std/src/thread/scoped.rs
Lingua principale
Rust
Stelle
122k
Fork
16.7k
Merge medio
2g 16h
PR unite (30g)
515

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rust-lang/rust

Tutte le issue di rust-lang/rust

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.