diff options
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/attr.rs | 11 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/diagnostics.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/generics.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 22 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/pat.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/path.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/ty.rs | 2 | 
9 files changed, 29 insertions, 24 deletions
| diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs index cec657f7b67..02dab95233a 100644 --- a/compiler/rustc_parse/src/parser/attr.rs +++ b/compiler/rustc_parse/src/parser/attr.rs @@ -204,8 +204,11 @@ impl<'a> Parser<'a> { attr_sp, fluent::parse_inner_attr_not_permitted_after_outer_doc_comment, ) - .span_label_mv(attr_sp, fluent::parse_label_attr) - .span_label_mv(prev_doc_comment_span, fluent::parse_label_prev_doc_comment) + .with_span_label(attr_sp, fluent::parse_label_attr) + .with_span_label( + prev_doc_comment_span, + fluent::parse_label_prev_doc_comment, + ) } Some(InnerAttrForbiddenReason::AfterOuterAttribute { prev_outer_attr_sp }) => self .dcx() @@ -213,8 +216,8 @@ impl<'a> Parser<'a> { attr_sp, fluent::parse_inner_attr_not_permitted_after_outer_attr, ) - .span_label_mv(attr_sp, fluent::parse_label_attr) - .span_label_mv(prev_outer_attr_sp, fluent::parse_label_prev_attr), + .with_span_label(attr_sp, fluent::parse_label_attr) + .with_span_label(prev_outer_attr_sp, fluent::parse_label_prev_attr), Some(InnerAttrForbiddenReason::InCodeBlock) | None => { self.dcx().struct_span_err(attr_sp, fluent::parse_inner_attr_not_permitted) } diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index a9cf26d991c..720a610fdf5 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -2847,8 +2847,8 @@ impl<'a> Parser<'a> { let span = label.ident.span.to(self.prev_token.span); self.dcx() .struct_span_err(span, "block label not supported here") - .span_label_mv(span, "not supported here") - .tool_only_span_suggestion_mv( + .with_span_label(span, "not supported here") + .with_tool_only_span_suggestion( label.ident.span.until(self.token.span), "remove this block label", "", diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index ec91670175e..8ca02452342 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1753,7 +1753,7 @@ impl<'a> Parser<'a> { err: impl FnOnce(&Self) -> DiagnosticBuilder<'a>, ) -> L { if let Some(diag) = self.dcx().steal_diagnostic(lifetime.span, StashKey::LifetimeIsChar) { - diag.span_suggestion_verbose_mv( + diag.with_span_suggestion_verbose( lifetime.span.shrink_to_hi(), "add `'` to close the char literal", "'", @@ -1762,7 +1762,7 @@ impl<'a> Parser<'a> { .emit(); } else { err(self) - .span_suggestion_verbose_mv( + .with_span_suggestion_verbose( lifetime.span.shrink_to_hi(), "add `'` to close the char literal", "'", diff --git a/compiler/rustc_parse/src/parser/generics.rs b/compiler/rustc_parse/src/parser/generics.rs index 66aa8cbcda4..48cf04f7790 100644 --- a/compiler/rustc_parse/src/parser/generics.rs +++ b/compiler/rustc_parse/src/parser/generics.rs @@ -145,7 +145,7 @@ impl<'a> Parser<'a> { mistyped_const_ident.span, format!("`const` keyword was mistyped as `{}`", mistyped_const_ident.as_str()), ) - .span_suggestion_verbose_mv( + .with_span_suggestion_verbose( mistyped_const_ident.span, "use the `const` keyword", kw::Const.as_str(), diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index a6513408a1e..bcff820da79 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -741,11 +741,11 @@ impl<'a> Parser<'a> { Ok(Some(item)) => items.extend(item), Err(err) => { self.consume_block(Delimiter::Brace, ConsumeClosingDelim::Yes); - err.span_label_mv( + err.with_span_label( open_brace_span, "while parsing this item list starting here", ) - .span_label_mv(self.prev_token.span, "the item list ends here") + .with_span_label(self.prev_token.span, "the item list ends here") .emit(); break; } @@ -765,8 +765,8 @@ impl<'a> Parser<'a> { E0584, "found a documentation comment that doesn't document anything", ) - .span_label_mv(self.token.span, "this doc comment doesn't document anything") - .help_mv( + .with_span_label(self.token.span, "this doc comment doesn't document anything") + .with_help( "doc comments must come before what they document, if a comment was \ intended use `//`", ) @@ -1218,7 +1218,7 @@ impl<'a> Parser<'a> { let before_trait = trai.path.span.shrink_to_lo(); let const_up_to_impl = const_span.with_hi(impl_span.lo()); - err.multipart_suggestion_mv( + err.with_multipart_suggestion( "you might have meant to write a const trait impl", vec![(const_up_to_impl, "".to_owned()), (before_trait, "const ".to_owned())], Applicability::MaybeIncorrect, @@ -1457,7 +1457,7 @@ impl<'a> Parser<'a> { if this.token == token::Not { if let Err(err) = this.unexpected::<()>() { - err.note_mv(fluent::parse_macro_expands_to_enum_variant).emit(); + err.with_note(fluent::parse_macro_expands_to_enum_variant).emit(); } this.bump(); @@ -1855,7 +1855,7 @@ impl<'a> Parser<'a> { if eq_typo || semi_typo { self.bump(); // Gracefully handle small typos. - err.span_suggestion_short_mv( + err.with_span_suggestion_short( self.prev_token.span, "field names and their types are separated with `:`", ":", @@ -1935,10 +1935,10 @@ impl<'a> Parser<'a> { lo.to(self.prev_token.span), format!("functions are not allowed in {adt_ty} definitions"), ) - .help_mv( + .with_help( "unlike in C++, Java, and C#, functions are declared in `impl` blocks", ) - .help_mv("see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information") + .with_help("see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information") } Err(err) => { err.cancel(); @@ -1954,7 +1954,9 @@ impl<'a> Parser<'a> { lo.with_hi(ident.span.hi()), format!("structs are not allowed in {adt_ty} definitions"), ) - .help_mv("consider creating a new `struct` definition instead of nesting"), + .with_help( + "consider creating a new `struct` definition instead of nesting", + ), Err(err) => { err.cancel(); self.restore_snapshot(snapshot); diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index c13adfb0532..ff2fb6271a8 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -847,7 +847,7 @@ impl<'a> Parser<'a> { pprust::token_to_string(&self.prev_token) ); expect_err - .span_suggestion_verbose_mv( + .with_span_suggestion_verbose( self.prev_token.span.shrink_to_hi().until(self.token.span), msg, " @ ", @@ -863,7 +863,7 @@ impl<'a> Parser<'a> { // Parsed successfully, therefore most probably the code only // misses a separator. expect_err - .span_suggestion_short_mv( + .with_span_suggestion_short( sp, format!("missing `{token_str}`"), token_str, diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index 00dc307ab60..7918e03750c 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -464,7 +464,7 @@ impl<'a> Parser<'a> { self_ .dcx() .struct_span_err(self_.token.span, msg) - .span_label_mv(self_.token.span, format!("expected {expected}")) + .with_span_label(self_.token.span, format!("expected {expected}")) }); PatKind::Lit(self.mk_expr(lo, ExprKind::Lit(lit))) } else { diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index 5ad17a30980..e7cad74b4dd 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -128,7 +128,7 @@ impl<'a> Parser<'a> { self.prev_token.span, "found single colon before projection in qualified path", ) - .span_suggestion_mv( + .with_span_suggestion( self.prev_token.span, "use double colon", "::", diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 61d72857c36..a4fb92c67ac 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -1116,7 +1116,7 @@ impl<'a> Parser<'a> { let before_fn_path = fn_path.span.shrink_to_lo(); self.dcx() .struct_span_err(generic_args_span, "`Fn` traits cannot take lifetime parameters") - .multipart_suggestion_mv( + .with_multipart_suggestion( "consider using a higher-ranked trait bound instead", vec![(generic_args_span, "".to_owned()), (before_fn_path, snippet)], Applicability::MaybeIncorrect, | 
