@@ -14,7 +14,7 @@ use rustc_errors::{Applicability, DiagnosticBuilder, ErrorGuaranteed, MultiSpan,
14
14
use rustc_lint_defs:: builtin:: PROC_MACRO_BACK_COMPAT ;
15
15
use rustc_lint_defs:: BuiltinLintDiagnostics ;
16
16
use rustc_parse:: { self , parser, MACRO_ARGUMENTS } ;
17
- use rustc_session:: { parse:: ParseSess , Limit , Session } ;
17
+ use rustc_session:: { parse:: ParseSess , Limit , Session , SessionDiagnostic } ;
18
18
use rustc_span:: def_id:: { CrateNum , DefId , LocalDefId } ;
19
19
use rustc_span:: edition:: Edition ;
20
20
use rustc_span:: hygiene:: { AstPass , ExpnData , ExpnKind , LocalExpnId } ;
@@ -1085,6 +1085,17 @@ impl<'a> ExtCtxt<'a> {
1085
1085
self . sess . parse_sess . span_diagnostic . struct_span_err ( sp, msg)
1086
1086
}
1087
1087
1088
+ pub fn create_err (
1089
+ & self ,
1090
+ err : impl SessionDiagnostic < ' a > ,
1091
+ ) -> DiagnosticBuilder < ' a , ErrorGuaranteed > {
1092
+ self . sess . create_err ( err)
1093
+ }
1094
+
1095
+ pub fn emit_err ( & self , err : impl SessionDiagnostic < ' a > ) -> ErrorGuaranteed {
1096
+ self . sess . emit_err ( err)
1097
+ }
1098
+
1088
1099
/// Emit `msg` attached to `sp`, without immediately stopping
1089
1100
/// compilation.
1090
1101
///
0 commit comments