Skip to content

Commit fa5964f

Browse files
s/MetaVarExpr::Length/MetaVarExpr::Len/
1 parent 6a19a87 commit fa5964f

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

compiler/rustc_expand/src/mbe/metavar_expr.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub(crate) enum MetaVarExpr {
2323

2424
/// The length of the repetition at a particular depth, where 0 is the inner-most
2525
/// repetition. The `usize` is the depth.
26-
Length(usize),
26+
Len(usize),
2727
}
2828

2929
impl MetaVarExpr {
@@ -48,13 +48,13 @@ impl MetaVarExpr {
4848
MetaVarExpr::Ignore(parse_ident(&mut iter, psess, ident.span)?)
4949
}
5050
"index" => MetaVarExpr::Index(parse_depth(&mut iter, psess, ident.span)?),
51-
"length" => MetaVarExpr::Length(parse_depth(&mut iter, psess, ident.span)?),
51+
"len" => MetaVarExpr::Len(parse_depth(&mut iter, psess, ident.span)?),
5252
_ => {
5353
let err_msg = "unrecognized meta-variable expression";
5454
let mut err = psess.dcx.struct_span_err(ident.span, err_msg);
5555
err.span_suggestion(
5656
ident.span,
57-
"supported expressions are count, ignore, index and length",
57+
"supported expressions are count, ignore, index and len",
5858
"",
5959
Applicability::MachineApplicable,
6060
);
@@ -68,7 +68,7 @@ impl MetaVarExpr {
6868
pub(crate) fn ident(&self) -> Option<Ident> {
6969
match *self {
7070
MetaVarExpr::Count(ident, _) | MetaVarExpr::Ignore(ident) => Some(ident),
71-
MetaVarExpr::Index(..) | MetaVarExpr::Length(..) => None,
71+
MetaVarExpr::Index(..) | MetaVarExpr::Len(..) => None,
7272
}
7373
}
7474
}
@@ -111,7 +111,7 @@ fn parse_count<'psess>(
111111
Ok(MetaVarExpr::Count(ident, depth))
112112
}
113113

114-
/// Parses the depth used by index(depth) and length(depth).
114+
/// Parses the depth used by index(depth) and len(depth).
115115
fn parse_depth<'psess>(
116116
iter: &mut RefTokenTreeCursor<'_>,
117117
psess: &'psess ParseSess,

compiler/rustc_expand/src/mbe/quoted.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ fn parse_sep_and_kleene_op<'a>(
357357

358358
// `$$` or a meta-variable is the lhs of a macro but shouldn't.
359359
//
360-
// For example, `macro_rules! foo { ( ${length()} ) => {} }`
360+
// For example, `macro_rules! foo { ( ${len()} ) => {} }`
361361
fn span_dollar_dollar_or_metavar_in_the_lhs_err(sess: &Session, token: &Token) {
362362
sess.dcx()
363363
.span_err(token.span, format!("unexpected token: {}", pprust::token_to_string(token)));

compiler/rustc_expand/src/mbe/transcribe.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -675,14 +675,14 @@ fn transcribe_metavar_expr<'a>(
675675
}
676676
None => return Err(out_of_bounds_err(cx, repeats.len(), sp.entire(), "index")),
677677
},
678-
MetaVarExpr::Length(depth) => match repeats.iter().nth_back(depth) {
678+
MetaVarExpr::Len(depth) => match repeats.iter().nth_back(depth) {
679679
Some((_, length)) => {
680680
result.push(TokenTree::token_alone(
681681
TokenKind::lit(token::Integer, sym::integer(*length), None),
682682
visited_span(),
683683
));
684684
}
685-
None => return Err(out_of_bounds_err(cx, repeats.len(), sp.entire(), "length")),
685+
None => return Err(out_of_bounds_err(cx, repeats.len(), sp.entire(), "len")),
686686
},
687687
}
688688
Ok(())

0 commit comments

Comments
 (0)