about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-09-09 18:14:23 +0000
committerbors <bors@rust-lang.org>2025-09-09 18:14:23 +0000
commit7ad23f43a225546c095123de52cc07d8719f8e2b (patch)
tree0e99435039bfbf29f791983825ed7062bc785f77 /compiler/rustc_parse/src/parser/expr.rs
parent364da5d88d772fa40fb20353443595385443ac25 (diff)
parenta40ec4c50a0a0475123675c3f4202eaf5cbedb77 (diff)
downloadrust-7ad23f43a225546c095123de52cc07d8719f8e2b.tar.gz
rust-7ad23f43a225546c095123de52cc07d8719f8e2b.zip
Auto merge of #146375 - matthiaskrgr:rollup-utik9zj, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#145463 (Reject invalid literal suffixes in tuple indexing, tuple struct indexing, and struct field name position)
 - rust-lang/rust#145929 (fix APITIT being treated as a normal generic parameter in suggestions)
 - rust-lang/rust#146001 (Update getopts to remove unicode-width dependency)
 - rust-lang/rust#146365 (triagebot: warn about #[rustc_intrinsic_const_stable_indirect])
 - rust-lang/rust#146366 (add approx_delta to all gamma tests)
 - rust-lang/rust#146373 (fix comments about trait solver cycle heads)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs26
1 files changed, 6 insertions, 20 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 4c02547357e..81a5d48d94e 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -1163,7 +1163,10 @@ impl<'a> Parser<'a> {
                         suffix,
                     }) => {
                         if let Some(suffix) = suffix {
-                            self.expect_no_tuple_index_suffix(current.span, suffix);
+                            self.dcx().emit_err(errors::InvalidLiteralSuffixOnTupleIndex {
+                                span: current.span,
+                                suffix,
+                            });
                         }
                         match self.break_up_float(symbol, current.span) {
                             // 1e2
@@ -1239,7 +1242,8 @@ impl<'a> Parser<'a> {
         suffix: Option<Symbol>,
     ) -> Box<Expr> {
         if let Some(suffix) = suffix {
-            self.expect_no_tuple_index_suffix(ident_span, suffix);
+            self.dcx()
+                .emit_err(errors::InvalidLiteralSuffixOnTupleIndex { span: ident_span, suffix });
         }
         self.mk_expr(lo.to(ident_span), ExprKind::Field(base, Ident::new(field, ident_span)))
     }
@@ -2225,24 +2229,6 @@ impl<'a> Parser<'a> {
         })
     }
 
-    pub(super) fn expect_no_tuple_index_suffix(&self, span: Span, suffix: Symbol) {
-        if [sym::i32, sym::u32, sym::isize, sym::usize].contains(&suffix) {
-            // #59553: warn instead of reject out of hand to allow the fix to percolate
-            // through the ecosystem when people fix their macros
-            self.dcx().emit_warn(errors::InvalidLiteralSuffixOnTupleIndex {
-                span,
-                suffix,
-                exception: true,
-            });
-        } else {
-            self.dcx().emit_err(errors::InvalidLiteralSuffixOnTupleIndex {
-                span,
-                suffix,
-                exception: false,
-            });
-        }
-    }
-
     /// Matches `'-' lit | lit` (cf. `ast_validation::AstValidator::check_expr_within_pat`).
     /// Keep this in sync with `Token::can_begin_literal_maybe_minus`.
     pub fn parse_literal_maybe_minus(&mut self) -> PResult<'a, Box<Expr>> {