Skip to content

Commit d9e6023

Browse files
committed
Rename enum from Grouping to Parens
1 parent d74089c commit d9e6023

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ impl Expr {
13911391
path.clone(),
13921392
TraitBoundModifiers::NONE,
13931393
self.span,
1394-
Grouping::None,
1394+
Parens::No,
13951395
))),
13961396
_ => None,
13971397
}
@@ -3361,11 +3361,11 @@ pub struct TraitRef {
33613361
pub ref_id: NodeId,
33623362
}
33633363

3364-
/// Whether a `PolyTraitRef` is enclosed in parentheses or not.
3364+
/// Whether enclosing parentheses are present or not.
33653365
#[derive(Clone, Encodable, Decodable, Debug)]
3366-
pub enum Grouping {
3367-
None,
3368-
Parenthesized,
3366+
pub enum Parens {
3367+
Yes,
3368+
No,
33693369
}
33703370

33713371
#[derive(Clone, Encodable, Decodable, Debug)]
@@ -3381,9 +3381,9 @@ pub struct PolyTraitRef {
33813381

33823382
pub span: Span,
33833383

3384-
/// When `Parenthesized`, the first and last character of `span` are an opening
3384+
/// When `Yes`, the first and last character of `span` are an opening
33853385
/// and a closing paren respectively.
3386-
pub grouping: Grouping,
3386+
pub parens: Parens,
33873387
}
33883388

33893389
impl PolyTraitRef {
@@ -3392,14 +3392,14 @@ impl PolyTraitRef {
33923392
path: Path,
33933393
modifiers: TraitBoundModifiers,
33943394
span: Span,
3395-
grouping: Grouping,
3395+
parens: Parens,
33963396
) -> Self {
33973397
PolyTraitRef {
33983398
bound_generic_params: generic_params,
33993399
modifiers,
34003400
trait_ref: TraitRef { path, ref_id: DUMMY_NODE_ID },
34013401
span,
3402-
grouping,
3402+
parens,
34033403
}
34043404
}
34053405
}

compiler/rustc_ast/src/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ macro_rules! common_visitor_and_walkers {
11421142
vis: &mut V,
11431143
p: &$($lt)? $($mut)? PolyTraitRef,
11441144
) -> V::Result {
1145-
let PolyTraitRef { bound_generic_params, modifiers, trait_ref, span, grouping: _ } = p;
1145+
let PolyTraitRef { bound_generic_params, modifiers, trait_ref, span, parens: _ } = p;
11461146
try_visit!(visit_modifiers(vis, modifiers));
11471147
try_visit!(visit_generic_params(vis, bound_generic_params));
11481148
try_visit!(vis.visit_trait_ref(trait_ref));

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12091209
modifiers: TraitBoundModifiers::NONE,
12101210
trait_ref: TraitRef { path: path.clone(), ref_id: t.id },
12111211
span: t.span,
1212-
grouping: ast::Grouping::None,
1212+
parens: ast::Parens::No,
12131213
},
12141214
itctx,
12151215
);

compiler/rustc_expand/src/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl<'a> ExtCtxt<'a> {
195195
},
196196
trait_ref: self.trait_ref(path),
197197
span,
198-
grouping: ast::Grouping::None,
198+
parens: ast::Parens::No,
199199
}
200200
}
201201

compiler/rustc_lint/src/unused.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ impl EarlyLintPass for UnusedParens {
13691369
.map(|s| s.ident.name == kw::PathRoot)
13701370
.unwrap_or(false);
13711371

1372-
if let ast::Grouping::Parenthesized = poly_trait_ref.grouping
1372+
if let ast::Parens::Yes = poly_trait_ref.parens
13731373
&& (is_last || !fn_with_explicit_ret_ty)
13741374
&& !dyn2015_exception
13751375
{

compiler/rustc_parse/src/parser/ty.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ impl<'a> Parser<'a> {
310310
path,
311311
lo,
312312
parse_plus,
313-
ast::Grouping::None,
313+
ast::Parens::No,
314314
)?;
315315
let err = self.dcx().create_err(errors::TransposeDynOrImpl {
316316
span: kw.span,
@@ -343,7 +343,7 @@ impl<'a> Parser<'a> {
343343
path,
344344
lo,
345345
parse_plus,
346-
ast::Grouping::None,
346+
ast::Parens::No,
347347
)?
348348
}
349349
}
@@ -429,7 +429,7 @@ impl<'a> Parser<'a> {
429429
path,
430430
lo,
431431
true,
432-
ast::Grouping::Parenthesized,
432+
ast::Parens::Yes,
433433
),
434434
// For `('a) + …`, we know that `'a` in type position already lead to an error being
435435
// emitted. To reduce output, let's indirectly suppress E0178 (bad `+` in type) and
@@ -510,14 +510,14 @@ impl<'a> Parser<'a> {
510510
path: ast::Path,
511511
lo: Span,
512512
parse_plus: bool,
513-
grouping: ast::Grouping,
513+
parens: ast::Parens,
514514
) -> PResult<'a, TyKind> {
515515
let poly_trait_ref = PolyTraitRef::new(
516516
generic_params,
517517
path,
518518
TraitBoundModifiers::NONE,
519519
lo.to(self.prev_token.span),
520-
grouping,
520+
parens,
521521
);
522522
let bounds = vec![GenericBound::Trait(poly_trait_ref)];
523523
self.parse_remaining_bounds(bounds, parse_plus)
@@ -849,7 +849,7 @@ impl<'a> Parser<'a> {
849849
Ok(TyKind::MacCall(P(MacCall { path, args: self.parse_delim_args()? })))
850850
} else if allow_plus == AllowPlus::Yes && self.check_plus() {
851851
// `Trait1 + Trait2 + 'a`
852-
self.parse_remaining_bounds_path(ThinVec::new(), path, lo, true, ast::Grouping::None)
852+
self.parse_remaining_bounds_path(ThinVec::new(), path, lo, true, ast::Parens::No)
853853
} else {
854854
// Just a type path.
855855
Ok(TyKind::Path(None, path))
@@ -1207,7 +1207,7 @@ impl<'a> Parser<'a> {
12071207
}
12081208
}
12091209

1210-
let grouping = if has_parens { ast::Grouping::Parenthesized } else { ast::Grouping::None };
1210+
let grouping = if has_parens { ast::Parens::Yes } else { ast::Parens::No };
12111211
let poly_trait = PolyTraitRef::new(
12121212
lifetime_defs,
12131213
path,

compiler/rustc_resolve/src/late/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3832,7 +3832,7 @@ fn mk_where_bound_predicate(
38323832
ref_id: DUMMY_NODE_ID,
38333833
},
38343834
span: DUMMY_SP,
3835-
grouping: ast::Grouping::None,
3835+
parens: ast::Parens::No,
38363836
})],
38373837
};
38383838

0 commit comments

Comments
 (0)