diff options
| author | Jana Dönszelmann <jonathan@donsz.nl> | 2025-07-31 17:19:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-31 17:19:39 +0200 |
| commit | edd25748484f09941e0926ade4b9a63b54c56e16 (patch) | |
| tree | a2564436d5c0d3283b210c254b0baae40acf37c4 /compiler/rustc_parse/src/validate_attr.rs | |
| parent | eec13cd27381e3224608fcabcae3881d43fa9a38 (diff) | |
| parent | 51cd9b564f75b8330893b919b90e293530d1c395 (diff) | |
| download | rust-edd25748484f09941e0926ade4b9a63b54c56e16.tar.gz rust-edd25748484f09941e0926ade4b9a63b54c56e16.zip | |
Rollup merge of #144711 - compiler-errors:op-span, r=petrochenkov
Consider operator's span when computing binop expr span When computing the span of a binop consisting of `lhs` and `rhs`, we previously just took the spans of `lhs.span.to(rhs.span)`. In the case that both `lhs` and `rhs` are both arguments to a macro, this can produce a wildly incorrect span. To fix this, first compute the span between `lhs` and the binary operator, which will cause `lhs` to possibly be adjusted to a relevant macro metavar, and then compute that span extended to `rhs`, which will cause it to also be adjusted to a relevant macro metavar. This coincidentally fixes a FIXME in `tests/ui/lint/wide_pointer_comparisons.rs` and suppresses a nonsense suggestion.
Diffstat (limited to 'compiler/rustc_parse/src/validate_attr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/validate_attr.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/validate_attr.rs b/compiler/rustc_parse/src/validate_attr.rs index bc4c605afad..a7f8d3b9139 100644 --- a/compiler/rustc_parse/src/validate_attr.rs +++ b/compiler/rustc_parse/src/validate_attr.rs @@ -106,7 +106,7 @@ pub fn parse_meta<'a>(psess: &'a ParseSess, attr: &Attribute) -> PResult<'a, Met res } else { // Example cases: - // - `#[foo = 1+1]`: results in `ast::ExprKind::BinOp`. + // - `#[foo = 1+1]`: results in `ast::ExprKind::Binary`. // - `#[foo = include_str!("nonexistent-file.rs")]`: // results in `ast::ExprKind::Err`. In that case we delay // the error because an earlier error will have already |
