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.
This commit is contained in:
parent
2ea7a37e11
commit
ed76b0b882
76 changed files with 296 additions and 293 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue