@@ -1076,32 +1076,36 @@ impl DiagCtxt {
1076
1076
// Functions beginning with `struct_`/`create_` create a diagnostic. Other
1077
1077
// functions create and emit a diagnostic all in one go.
1078
1078
impl DiagCtxt {
1079
- // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing.
1079
+ // No `#[rustc_lint_diagnostics]` and no `impl Into<DiagMessage>` because bug messages aren't
1080
+ // user-facing.
1080
1081
#[ track_caller]
1081
- pub fn struct_bug ( & self , msg : impl Into < DiagMessage > ) -> Diag < ' _ , BugAbort > {
1082
- Diag :: new ( self , Bug , msg)
1082
+ pub fn struct_bug ( & self , msg : impl Into < Cow < ' static , str > > ) -> Diag < ' _ , BugAbort > {
1083
+ Diag :: new ( self , Bug , msg. into ( ) )
1083
1084
}
1084
1085
1085
- // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing.
1086
+ // No `#[rustc_lint_diagnostics]` and no `impl Into<DiagMessage>` because bug messages aren't
1087
+ // user-facing.
1086
1088
#[ track_caller]
1087
- pub fn bug ( & self , msg : impl Into < DiagMessage > ) -> ! {
1089
+ pub fn bug ( & self , msg : impl Into < Cow < ' static , str > > ) -> ! {
1088
1090
self . struct_bug ( msg) . emit ( )
1089
1091
}
1090
1092
1091
- // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing.
1093
+ // No `#[rustc_lint_diagnostics]` and no `impl Into<DiagMessage>` because bug messages aren't
1094
+ // user-facing.
1092
1095
#[ track_caller]
1093
1096
pub fn struct_span_bug (
1094
1097
& self ,
1095
1098
span : impl Into < MultiSpan > ,
1096
- msg : impl Into < DiagMessage > ,
1099
+ msg : impl Into < Cow < ' static , str > > ,
1097
1100
) -> Diag < ' _ , BugAbort > {
1098
1101
self . struct_bug ( msg) . with_span ( span)
1099
1102
}
1100
1103
1101
- // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing.
1104
+ // No `#[rustc_lint_diagnostics]` and no `impl Into<DiagMessage>` because bug messages aren't
1105
+ // user-facing.
1102
1106
#[ track_caller]
1103
- pub fn span_bug ( & self , span : impl Into < MultiSpan > , msg : impl Into < DiagMessage > ) -> ! {
1104
- self . struct_span_bug ( span, msg) . emit ( )
1107
+ pub fn span_bug ( & self , span : impl Into < MultiSpan > , msg : impl Into < Cow < ' static , str > > ) -> ! {
1108
+ self . struct_span_bug ( span, msg. into ( ) ) . emit ( )
1105
1109
}
1106
1110
1107
1111
#[ track_caller]
@@ -1215,24 +1219,28 @@ impl DiagCtxt {
1215
1219
}
1216
1220
1217
1221
/// Ensures that an error is printed. See `Level::DelayedBug`.
1218
- // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing.
1222
+ //
1223
+ // No `#[rustc_lint_diagnostics]` and no `impl Into<DiagMessage>` because bug messages aren't
1224
+ // user-facing.
1219
1225
#[ track_caller]
1220
- pub fn delayed_bug ( & self , msg : impl Into < DiagMessage > ) -> ErrorGuaranteed {
1221
- Diag :: < ErrorGuaranteed > :: new ( self , DelayedBug , msg) . emit ( )
1226
+ pub fn delayed_bug ( & self , msg : impl Into < Cow < ' static , str > > ) -> ErrorGuaranteed {
1227
+ Diag :: < ErrorGuaranteed > :: new ( self , DelayedBug , msg. into ( ) ) . emit ( )
1222
1228
}
1223
1229
1224
1230
/// Ensures that an error is printed. See `Level::DelayedBug`.
1225
1231
///
1226
1232
/// Note: this function used to be called `delay_span_bug`. It was renamed
1227
1233
/// to match similar functions like `span_err`, `span_warn`, etc.
1228
- // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing.
1234
+ //
1235
+ // No `#[rustc_lint_diagnostics]` and no `impl Into<DiagMessage>` because bug messages aren't
1236
+ // user-facing.
1229
1237
#[ track_caller]
1230
1238
pub fn span_delayed_bug (
1231
1239
& self ,
1232
1240
sp : impl Into < MultiSpan > ,
1233
- msg : impl Into < DiagMessage > ,
1241
+ msg : impl Into < Cow < ' static , str > > ,
1234
1242
) -> ErrorGuaranteed {
1235
- Diag :: < ErrorGuaranteed > :: new ( self , DelayedBug , msg) . with_span ( sp) . emit ( )
1243
+ Diag :: < ErrorGuaranteed > :: new ( self , DelayedBug , msg. into ( ) ) . with_span ( sp) . emit ( )
1236
1244
}
1237
1245
1238
1246
#[ rustc_lint_diagnostics]
0 commit comments