mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 11:48:30 +00:00
don't include trailing open parens in labels for reference patterns
This commit is contained in:
parent
203d3109d8
commit
a064e78663
@ -2774,7 +2774,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
// If the subpattern's span is is from an expansion, the emitted label will not be trimmed.
|
// If the subpattern's span is is from an expansion, the emitted label will not be trimmed.
|
||||||
let source_map = self.tcx.sess.source_map();
|
let source_map = self.tcx.sess.source_map();
|
||||||
let cutoff_span = source_map
|
let cutoff_span = source_map
|
||||||
.span_extend_prev_while(cutoff_span, char::is_whitespace)
|
.span_extend_prev_while(cutoff_span, |c| c.is_whitespace() || c == '(')
|
||||||
.unwrap_or(cutoff_span);
|
.unwrap_or(cutoff_span);
|
||||||
// Ensure we use the syntax context and thus edition of `subpat.span`; this will be a hard
|
// Ensure we use the syntax context and thus edition of `subpat.span`; this will be a hard
|
||||||
// error if the subpattern is of edition >= 2024.
|
// error if the subpattern is of edition >= 2024.
|
||||||
|
@ -284,7 +284,7 @@ error: reference patterns may only be written when the default binding mode is `
|
|||||||
--> $DIR/migration_lint.rs:150:10
|
--> $DIR/migration_lint.rs:150:10
|
||||||
|
|
|
|
||||||
LL | let [&(_)] = &[&0];
|
LL | let [&(_)] = &[&0];
|
||||||
| -^^---
|
| -^----
|
||||||
| ||
|
| ||
|
||||||
| |this reference pattern
|
| |this reference pattern
|
||||||
| default binding mode is `ref`
|
| default binding mode is `ref`
|
||||||
|
Loading…
Reference in New Issue
Block a user