File tree 4 files changed +16
-0
lines changed
4 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -3813,6 +3813,7 @@ dependencies = [
3813
3813
" atty" ,
3814
3814
" rustc_data_structures" ,
3815
3815
" rustc_error_messages" ,
3816
+ " rustc_hir" ,
3816
3817
" rustc_lint_defs" ,
3817
3818
" rustc_macros" ,
3818
3819
" rustc_serialize" ,
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ rustc_serialize = { path = "../rustc_serialize" }
13
13
rustc_span = { path = " ../rustc_span" }
14
14
rustc_macros = { path = " ../rustc_macros" }
15
15
rustc_data_structures = { path = " ../rustc_data_structures" }
16
+ rustc_hir = { path = " ../rustc_hir" }
16
17
rustc_lint_defs = { path = " ../rustc_lint_defs" }
17
18
unicode-width = " 0.1.4"
18
19
atty = " 0.2"
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use crate::{
5
5
} ;
6
6
use rustc_data_structures:: stable_map:: FxHashMap ;
7
7
use rustc_error_messages:: FluentValue ;
8
+ use rustc_hir as hir;
8
9
use rustc_lint_defs:: { Applicability , LintExpectationId } ;
9
10
use rustc_span:: edition:: LATEST_STABLE_EDITION ;
10
11
use rustc_span:: symbol:: { Ident , Symbol } ;
@@ -160,6 +161,16 @@ impl<'source> Into<FluentValue<'source>> for DiagnosticArgValue<'source> {
160
161
}
161
162
}
162
163
164
+ impl IntoDiagnosticArg for hir:: ConstContext {
165
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
166
+ DiagnosticArgValue :: Str ( Cow :: Borrowed ( match self {
167
+ hir:: ConstContext :: ConstFn => "constant function" ,
168
+ hir:: ConstContext :: Static ( _) => "static" ,
169
+ hir:: ConstContext :: Const => "constant" ,
170
+ } ) )
171
+ }
172
+ }
173
+
163
174
/// Trait implemented by error types. This should not be implemented manually. Instead, use
164
175
/// `#[derive(SessionSubdiagnostic)]` -- see [rustc_macros::SessionSubdiagnostic].
165
176
#[ rustc_diagnostic_item = "AddSubdiagnostic" ]
Original file line number Diff line number Diff line change @@ -1595,6 +1595,9 @@ impl fmt::Display for ConstContext {
1595
1595
}
1596
1596
}
1597
1597
1598
+ // NOTE: `IntoDiagnosticArg` impl for `ConstContext` lives in `rustc_errors`
1599
+ // due to a cyclical dependency between hir that crate.
1600
+
1598
1601
/// A literal.
1599
1602
pub type Lit = Spanned < LitKind > ;
1600
1603
You can’t perform that action at this time.
0 commit comments