rust-lang / rust-lang/rust

Unable to match against secondary labels

Open
#141,896 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-compiletest A-compiletest-annotations C-bug T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

It seems there is no way to match label text other than error-pattern :/
I might fix that separately later hehe

Originally posted by @jdonszelmann in https://github.com/rust-lang/rust/pull/141891#discussion_r2120567611

Example stderr

error[E0596]: cannot borrow value as mutable, as it is not declared as mutable
  --> $DIR/borrowck-error-in-macro.rs:6:1
   |
LL | a::ice! {}
   | ^^^^^^^^^^
   | |
   | cannot borrow as mutable
   | a call in this macro requires a mutable binding due to mutable borrow of `d`
   |
   = note: this error originates in the macro `a::ice` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider changing this to be mutable
  --> $DIR/auxiliary/borrowck-error-in-macro.rs:6:17
   |
LL |             let mut c = || *d += 1;
   |                 +++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0596`.

AFAICT it's not yet possible to match cannot borrow as mutable with a NOTE 🤔

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The payload names no source file or test. Start by tracing the existing error-pattern matching behavior against the provided stderr, focusing on how secondary labels such as NOTE are handled. Done means a test can match “cannot borrow as mutable” as a NOTE rather than requiring an error-pattern match.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.