diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-09 09:08:49 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-10 07:40:00 +1100 |
| commit | ed76b0b882d0acff9295bcd76c2b119cf83e7219 (patch) | |
| tree | b40f6c489904d201833e5e446afbfbee1501e26a /compiler/rustc_hir_analysis/src/check/intrinsicck.rs | |
| parent | 2ea7a37e1113febac8603729e33fdd94f2738807 (diff) | |
| download | rust-ed76b0b882d0acff9295bcd76c2b119cf83e7219.tar.gz rust-ed76b0b882d0acff9295bcd76c2b119cf83e7219.zip | |
Rename consuming chaining methods on `DiagnosticBuilder`.
In #119606 I added them and used a `_mv` suffix, but that wasn't great.
A `with_` prefix has three different existing uses.
- Constructors, e.g. `Vec::with_capacity`.
- Wrappers that provide an environment to execute some code, e.g.
`with_session_globals`.
- Consuming chaining methods, e.g. `Span::with_{lo,hi,ctxt}`.
The third case is exactly what we want, so this commit changes
`DiagnosticBuilder::foo_mv` to `DiagnosticBuilder::with_foo`.
Thanks to @compiler-errors for the suggestion.
Diffstat (limited to 'compiler/rustc_hir_analysis/src/check/intrinsicck.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/intrinsicck.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs index aadff6a97e3..db619d5169e 100644 --- a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs +++ b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs @@ -156,7 +156,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { self.tcx .dcx() .struct_span_err(expr.span, msg) - .note_mv( + .with_note( "only integers, floats, SIMD vectors, pointers and function pointers \ can be used as arguments for inline assembly", ) @@ -171,7 +171,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { self.tcx .dcx() .struct_span_err(expr.span, msg) - .note_mv(format!("`{ty}` does not implement the Copy trait")) + .with_note(format!("`{ty}` does not implement the Copy trait")) .emit(); } @@ -191,11 +191,11 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { self.tcx .dcx() .struct_span_err(vec![in_expr.span, expr.span], msg) - .span_label_mv(in_expr.span, format!("type `{in_expr_ty}`")) - .span_label_mv(expr.span, format!("type `{ty}`")) - .note_mv( + .with_span_label(in_expr.span, format!("type `{in_expr_ty}`")) + .with_span_label(expr.span, format!("type `{ty}`")) + .with_note( "asm inout arguments must have the same type, \ - unless they are both pointers or integers of the same size", + unless they are both pointers or integers of the same size", ) .emit(); } @@ -242,7 +242,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { self.tcx .dcx() .struct_span_err(expr.span, msg) - .note_mv(format!( + .with_note(format!( "this is required to use type `{}` with register class `{}`", ty, reg_class.name(), @@ -459,11 +459,11 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { self.tcx .dcx() .struct_span_err(*op_sp, "invalid `sym` operand") - .span_label_mv( + .with_span_label( self.tcx.def_span(anon_const.def_id), format!("is {} `{}`", ty.kind().article(), ty), ) - .help_mv( + .with_help( "`sym` operands must refer to either a function or a static", ) .emit(); |
