forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#117294 - matthiaskrgr:rollup-xylsec7, r=matth…
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#116834 (Remove `rustc_symbol_mangling/messages.ftl`.) - rust-lang#117212 (Properly restore snapshot when failing to recover parsing ternary) - rust-lang#117246 (Fix ICE: Restrict param constraint suggestion) - rust-lang#117247 (NVPTX: Allow PassMode::Direct for ptx kernels for now) - rust-lang#117270 (Hide internal methods from documentation) - rust-lang#117281 (std::thread : add SAFETY comment) - rust-lang#117287 (fix miri target information for Test step) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
19 changed files
with
299 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,46 @@ | ||
//! Errors emitted by symbol_mangling. | ||
|
||
use rustc_errors::{DiagnosticArgValue, IntoDiagnosticArg}; | ||
use rustc_macros::Diagnostic; | ||
use rustc_errors::{ErrorGuaranteed, IntoDiagnostic}; | ||
use rustc_span::Span; | ||
use std::fmt; | ||
|
||
#[derive(Diagnostic)] | ||
#[diag(symbol_mangling_test_output)] | ||
pub struct TestOutput { | ||
#[primary_span] | ||
pub span: Span, | ||
pub kind: Kind, | ||
pub content: String, | ||
} | ||
|
||
// This diagnostic doesn't need translation because (a) it doesn't contain any | ||
// natural language, and (b) it's only used in tests. So we construct it | ||
// manually and avoid the fluent machinery. | ||
impl IntoDiagnostic<'_> for TestOutput { | ||
fn into_diagnostic( | ||
self, | ||
handler: &'_ rustc_errors::Handler, | ||
) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> { | ||
let TestOutput { span, kind, content } = self; | ||
|
||
#[allow(rustc::untranslatable_diagnostic)] | ||
let mut diag = handler.struct_err(format!("{kind}({content})")); | ||
diag.set_span(span); | ||
diag | ||
} | ||
} | ||
|
||
pub enum Kind { | ||
SymbolName, | ||
Demangling, | ||
DemanglingAlt, | ||
DefPath, | ||
} | ||
|
||
impl IntoDiagnosticArg for Kind { | ||
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { | ||
let kind = match self { | ||
Kind::SymbolName => "symbol-name", | ||
Kind::Demangling => "demangling", | ||
Kind::DemanglingAlt => "demangling-alt", | ||
Kind::DefPath => "def-path", | ||
impl fmt::Display for Kind { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
match self { | ||
Kind::SymbolName => write!(f, "symbol-name"), | ||
Kind::Demangling => write!(f, "demangling"), | ||
Kind::DemanglingAlt => write!(f, "demangling-alt"), | ||
Kind::DefPath => write!(f, "def-path"), | ||
} | ||
.into(); | ||
DiagnosticArgValue::Str(kind) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.