Skip to content

Commit 0df1e32

Browse files
authored
Unrolled build for rust-lang#140229
Rollup merge of rust-lang#140229 - nnethercote:pre-DelimArgs-spacing, r=petrochenkov `DelimArgs` tweaks r? `@petrochenkov`
2 parents 862156d + 7fe6bc5 commit 0df1e32

File tree

3 files changed

+4
-20
lines changed

3 files changed

+4
-20
lines changed

compiler/rustc_ast/src/ast.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -1927,7 +1927,7 @@ impl AttrArgs {
19271927
}
19281928

19291929
/// Delimited arguments, as used in `#[attr()/[]/{}]` or `mac!()/[]/{}`.
1930-
#[derive(Clone, Encodable, Decodable, Debug)]
1930+
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
19311931
pub struct DelimArgs {
19321932
pub dspan: DelimSpan,
19331933
pub delim: Delimiter, // Note: `Delimiter::Invisible` never occurs
@@ -1942,18 +1942,6 @@ impl DelimArgs {
19421942
}
19431943
}
19441944

1945-
impl<CTX> HashStable<CTX> for DelimArgs
1946-
where
1947-
CTX: crate::HashStableContext,
1948-
{
1949-
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
1950-
let DelimArgs { dspan, delim, tokens } = self;
1951-
dspan.hash_stable(ctx, hasher);
1952-
delim.hash_stable(ctx, hasher);
1953-
tokens.hash_stable(ctx, hasher);
1954-
}
1955-
}
1956-
19571945
/// Represents a macro definition.
19581946
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
19591947
pub struct MacroDef {

compiler/rustc_ast_lowering/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
916916
}
917917

918918
fn lower_delim_args(&self, args: &DelimArgs) -> DelimArgs {
919-
DelimArgs { dspan: args.dspan, delim: args.delim, tokens: args.tokens.clone() }
919+
args.clone()
920920
}
921921

922922
/// Lower an associated item constraint.

compiler/rustc_attr_parsing/src/context.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::collections::BTreeMap;
33
use std::ops::Deref;
44
use std::sync::LazyLock;
55

6-
use rustc_ast::{self as ast, DelimArgs};
6+
use rustc_ast as ast;
77
use rustc_attr_data_structures::AttributeKind;
88
use rustc_errors::{DiagCtxtHandle, Diagnostic};
99
use rustc_feature::Features;
@@ -315,11 +315,7 @@ impl<'sess> AttributeParser<'sess> {
315315
fn lower_attr_args(&self, args: &ast::AttrArgs, lower_span: impl Fn(Span) -> Span) -> AttrArgs {
316316
match args {
317317
ast::AttrArgs::Empty => AttrArgs::Empty,
318-
ast::AttrArgs::Delimited(args) => AttrArgs::Delimited(DelimArgs {
319-
dspan: args.dspan,
320-
delim: args.delim,
321-
tokens: args.tokens.clone(),
322-
}),
318+
ast::AttrArgs::Delimited(args) => AttrArgs::Delimited(args.clone()),
323319
// This is an inert key-value attribute - it will never be visible to macros
324320
// after it gets lowered to HIR. Therefore, we can extract literals to handle
325321
// nonterminals in `#[doc]` (e.g. `#[doc = $e]`).

0 commit comments

Comments
 (0)