diff options
| author | SLASHLogin <loginmlgxd@gmail.com> | 2022-11-09 13:47:46 +0100 |
|---|---|---|
| committer | SLASHLogin <loginmlgxd@gmail.com> | 2022-11-09 14:57:54 +0100 |
| commit | 39895b071645f2c377e4a9a3c16f92bc5c93c807 (patch) | |
| tree | 3aa9f390c681ee3bd3ab08b3b363288598bda3b9 /compiler/rustc_errors/src | |
| parent | 0baac880fcddf4b63a1a1f8a9cd2cec3b984a45e (diff) | |
| download | rust-39895b071645f2c377e4a9a3c16f92bc5c93c807.tar.gz rust-39895b071645f2c377e4a9a3c16f92bc5c93c807.zip | |
Add constructor for `Diagnostic` that takes `Vec<(DiagnosticMessage, Style)>`
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index b24814bfa38..0ee4c6e722f 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -214,6 +214,21 @@ impl Diagnostic { } #[track_caller] + pub fn new_with_messages(level: Level, messages: Vec<(DiagnosticMessage, Style)>) -> Self { + Diagnostic { + level, + message: messages, + code: None, + span: MultiSpan::new(), + children: vec![], + suggestions: Ok(vec![]), + args: Default::default(), + sort_span: DUMMY_SP, + is_lint: false, + } + } + + #[track_caller] pub fn new_with_code<M: Into<DiagnosticMessage>>( level: Level, code: Option<DiagnosticId>, |
