File tree Expand file tree Collapse file tree 4 files changed +16
-0
lines changed Expand file tree Collapse file tree 4 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -3813,6 +3813,7 @@ dependencies = [
38133813 " atty" ,
38143814 " rustc_data_structures" ,
38153815 " rustc_error_messages" ,
3816+ " rustc_hir" ,
38163817 " rustc_lint_defs" ,
38173818 " rustc_macros" ,
38183819 " rustc_serialize" ,
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ rustc_serialize = { path = "../rustc_serialize" }
1313rustc_span = { path = " ../rustc_span" }
1414rustc_macros = { path = " ../rustc_macros" }
1515rustc_data_structures = { path = " ../rustc_data_structures" }
16+ rustc_hir = { path = " ../rustc_hir" }
1617rustc_lint_defs = { path = " ../rustc_lint_defs" }
1718unicode-width = " 0.1.4"
1819atty = " 0.2"
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use crate::{
55} ;
66use rustc_data_structures:: stable_map:: FxHashMap ;
77use rustc_error_messages:: FluentValue ;
8+ use rustc_hir as hir;
89use rustc_lint_defs:: { Applicability , LintExpectationId } ;
910use rustc_span:: edition:: LATEST_STABLE_EDITION ;
1011use rustc_span:: symbol:: { Ident , Symbol } ;
@@ -160,6 +161,16 @@ impl<'source> Into<FluentValue<'source>> for DiagnosticArgValue<'source> {
160161 }
161162}
162163
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+
163174/// Trait implemented by error types. This should not be implemented manually. Instead, use
164175/// `#[derive(SessionSubdiagnostic)]` -- see [rustc_macros::SessionSubdiagnostic].
165176#[ rustc_diagnostic_item = "AddSubdiagnostic" ]
Original file line number Diff line number Diff line change @@ -1595,6 +1595,9 @@ impl fmt::Display for ConstContext {
15951595 }
15961596}
15971597
1598+ // NOTE: `IntoDiagnosticArg` impl for `ConstContext` lives in `rustc_errors`
1599+ // due to a cyclical dependency between hir that crate.
1600+
15981601/// A literal.
15991602pub type Lit = Spanned < LitKind > ;
16001603
You can’t perform that action at this time.
0 commit comments