session: impl IntoDiagnosticArg
for CrateType
Forward the `Display` implementation for `CrateType` to `IntoDiagnosticArg` so that it can be used in diagnostic structs. Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
f7b42102e6
commit
d45004806d
1 changed files with 7 additions and 1 deletions
|
@ -24,7 +24,7 @@ use rustc_span::RealFileName;
|
||||||
use rustc_span::SourceFileHashAlgorithm;
|
use rustc_span::SourceFileHashAlgorithm;
|
||||||
|
|
||||||
use rustc_errors::emitter::HumanReadableErrorType;
|
use rustc_errors::emitter::HumanReadableErrorType;
|
||||||
use rustc_errors::{ColorConfig, HandlerFlags};
|
use rustc_errors::{ColorConfig, DiagnosticArgValue, HandlerFlags, IntoDiagnosticArg};
|
||||||
|
|
||||||
use std::collections::btree_map::{
|
use std::collections::btree_map::{
|
||||||
Iter as BTreeMapIter, Keys as BTreeMapKeysIter, Values as BTreeMapValuesIter,
|
Iter as BTreeMapIter, Keys as BTreeMapKeysIter, Values as BTreeMapValuesIter,
|
||||||
|
@ -2694,6 +2694,12 @@ impl fmt::Display for CrateType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl IntoDiagnosticArg for CrateType {
|
||||||
|
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
|
||||||
|
self.to_string().into_diagnostic_arg()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||||
pub enum PpSourceMode {
|
pub enum PpSourceMode {
|
||||||
/// `-Zunpretty=normal`
|
/// `-Zunpretty=normal`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue