@@ -997,32 +997,36 @@ impl DiagCtxt {
997
997
// Functions beginning with `struct_`/`create_` create a diagnostic. Other
998
998
// functions create and emit a diagnostic all in one go.
999
999
impl DiagCtxt {
1000
- // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing.
1000
+ // No `#[rustc_lint_diagnostics]` and no `impl Into<DiagnosticMessage>` because bug messages
1001
+ // aren't user-facing.
1001
1002
#[ track_caller]
1002
- pub fn struct_bug ( & self , msg : impl Into < DiagnosticMessage > ) -> Diag < ' _ , BugAbort > {
1003
- Diag :: new ( self , Bug , msg)
1003
+ pub fn struct_bug ( & self , msg : impl Into < Cow < ' static , str > > ) -> Diag < ' _ , BugAbort > {
1004
+ Diag :: new ( self , Bug , msg. into ( ) )
1004
1005
}
1005
1006
1006
- // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing.
1007
+ // No `#[rustc_lint_diagnostics]` and no `impl Into<DiagnosticMessage>` because bug messages
1008
+ // aren't user-facing.
1007
1009
#[ track_caller]
1008
- pub fn bug ( & self , msg : impl Into < DiagnosticMessage > ) -> ! {
1010
+ pub fn bug ( & self , msg : impl Into < Cow < ' static , str > > ) -> ! {
1009
1011
self . struct_bug ( msg) . emit ( )
1010
1012
}
1011
1013
1012
- // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing.
1014
+ // No `#[rustc_lint_diagnostics]` and no `impl Into<DiagnosticMessage>` because bug messages
1015
+ // aren't user-facing.
1013
1016
#[ track_caller]
1014
1017
pub fn struct_span_bug (
1015
1018
& self ,
1016
1019
span : impl Into < MultiSpan > ,
1017
- msg : impl Into < DiagnosticMessage > ,
1020
+ msg : impl Into < Cow < ' static , str > > ,
1018
1021
) -> Diag < ' _ , BugAbort > {
1019
1022
self . struct_bug ( msg) . with_span ( span)
1020
1023
}
1021
1024
1022
- // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing.
1025
+ // No `#[rustc_lint_diagnostics]` and no `impl Into<DiagnosticMessage>` because bug messages
1026
+ // aren't user-facing.
1023
1027
#[ track_caller]
1024
- pub fn span_bug ( & self , span : impl Into < MultiSpan > , msg : impl Into < DiagnosticMessage > ) -> ! {
1025
- self . struct_span_bug ( span, msg) . emit ( )
1028
+ pub fn span_bug ( & self , span : impl Into < MultiSpan > , msg : impl Into < Cow < ' static , str > > ) -> ! {
1029
+ self . struct_span_bug ( span, msg. into ( ) ) . emit ( )
1026
1030
}
1027
1031
1028
1032
#[ track_caller]
@@ -1136,24 +1140,28 @@ impl DiagCtxt {
1136
1140
}
1137
1141
1138
1142
/// Ensures that an error is printed. See `Level::DelayedBug`.
1139
- // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing.
1143
+ //
1144
+ // No `#[rustc_lint_diagnostics]` and no `impl Into<DiagnosticMessage>` because bug messages
1145
+ // aren't user-facing.
1140
1146
#[ track_caller]
1141
- pub fn delayed_bug ( & self , msg : impl Into < DiagnosticMessage > ) -> ErrorGuaranteed {
1142
- Diag :: < ErrorGuaranteed > :: new ( self , DelayedBug , msg) . emit ( )
1147
+ pub fn delayed_bug ( & self , msg : impl Into < Cow < ' static , str > > ) -> ErrorGuaranteed {
1148
+ Diag :: < ErrorGuaranteed > :: new ( self , DelayedBug , msg. into ( ) ) . emit ( )
1143
1149
}
1144
1150
1145
1151
/// Ensures that an error is printed. See `Level::DelayedBug`.
1146
1152
///
1147
1153
/// Note: this function used to be called `delay_span_bug`. It was renamed
1148
1154
/// to match similar functions like `span_err`, `span_warn`, etc.
1149
- // No `#[rustc_lint_diagnostics]` because bug messages aren't user-facing.
1155
+ //
1156
+ // No `#[rustc_lint_diagnostics]` and no `impl Into<DiagnosticMessage>` because bug messages
1157
+ // aren't user-facing.
1150
1158
#[ track_caller]
1151
1159
pub fn span_delayed_bug (
1152
1160
& self ,
1153
1161
sp : impl Into < MultiSpan > ,
1154
- msg : impl Into < DiagnosticMessage > ,
1162
+ msg : impl Into < Cow < ' static , str > > ,
1155
1163
) -> ErrorGuaranteed {
1156
- Diag :: < ErrorGuaranteed > :: new ( self , DelayedBug , msg) . with_span ( sp) . emit ( )
1164
+ Diag :: < ErrorGuaranteed > :: new ( self , DelayedBug , msg. into ( ) ) . with_span ( sp) . emit ( )
1157
1165
}
1158
1166
1159
1167
#[ rustc_lint_diagnostics]
0 commit comments