Skip to content

Commit

Permalink
Revert "Rollup merge of rust-lang#99213 - davidtwco:translation-migra…
Browse files Browse the repository at this point in the history
…te-passes, r=compiler-errors"

This reverts commit 79857a7, reversing
changes made to 6f8fb91.
  • Loading branch information
matthiaskrgr committed Jul 17, 2022
1 parent 1cd72b7 commit 31c431f
Show file tree
Hide file tree
Showing 41 changed files with 718 additions and 1,090 deletions.
1 change: 0 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4239,7 +4239,6 @@ dependencies = [
"rustc_hir",
"rustc_index",
"rustc_lexer",
"rustc_macros",
"rustc_middle",
"rustc_serialize",
"rustc_session",
Expand Down
151 changes: 0 additions & 151 deletions compiler/rustc_error_messages/locales/en-US/passes.ftl

This file was deleted.

9 changes: 0 additions & 9 deletions compiler/rustc_error_messages/locales/en-US/privacy.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,3 @@ privacy-unnamed-item-is-private = {$kind} is private
privacy-in-public-interface = {$vis_descr} {$kind} `{$descr}` in public interface
.label = can't leak {$vis_descr} {$kind}
.visibility-label = `{$descr}` declared as {$vis_descr}
privacy-from-private-dep-in-public-interface =
{$kind} `{$descr}` from private dependency '{$krate}' in public interface
private-in-public-lint =
{$vis_descr} {$kind} `{$descr}` in public interface (error {$kind ->
[trait] E0445
*[other] E0446
})
1 change: 0 additions & 1 deletion compiler/rustc_error_messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ fluent_messages! {
expand => "../locales/en-US/expand.ftl",
lint => "../locales/en-US/lint.ftl",
parser => "../locales/en-US/parser.ftl",
passes => "../locales/en-US/passes.ftl",
privacy => "../locales/en-US/privacy.ftl",
typeck => "../locales/en-US/typeck.ftl",
}
Expand Down
111 changes: 77 additions & 34 deletions compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,6 @@ pub trait IntoDiagnosticArg {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static>;
}

macro_rules! into_diagnostic_arg_using_display {
($( $ty:ty ),+ $(,)?) => {
$(
impl IntoDiagnosticArg for $ty {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
self.to_string().into_diagnostic_arg()
}
}
)+
}
}

into_diagnostic_arg_using_display!(
i8,
u8,
i16,
u16,
i32,
u32,
i64,
u64,
i128,
u128,
std::num::NonZeroU32,
hir::Target,
Edition,
Ident,
);

impl IntoDiagnosticArg for bool {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
if self {
Expand All @@ -79,9 +50,81 @@ impl IntoDiagnosticArg for bool {
}
}

impl IntoDiagnosticArg for char {
impl IntoDiagnosticArg for i8 {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Owned(self.to_string()))
}
}

impl IntoDiagnosticArg for u8 {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Owned(format!("{:?}", self)))
DiagnosticArgValue::Str(Cow::Owned(self.to_string()))
}
}

impl IntoDiagnosticArg for i16 {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Owned(self.to_string()))
}
}

impl IntoDiagnosticArg for u16 {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Owned(self.to_string()))
}
}

impl IntoDiagnosticArg for i32 {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Owned(self.to_string()))
}
}

impl IntoDiagnosticArg for u32 {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Owned(self.to_string()))
}
}

impl IntoDiagnosticArg for i64 {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Owned(self.to_string()))
}
}

impl IntoDiagnosticArg for u64 {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Owned(self.to_string()))
}
}

impl IntoDiagnosticArg for i128 {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Owned(self.to_string()))
}
}

impl IntoDiagnosticArg for u128 {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Owned(self.to_string()))
}
}

impl IntoDiagnosticArg for String {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Owned(self))
}
}

impl IntoDiagnosticArg for std::num::NonZeroU32 {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Owned(self.to_string()))
}
}

impl IntoDiagnosticArg for Edition {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Owned(self.to_string()))
}
}

Expand All @@ -91,15 +134,15 @@ impl IntoDiagnosticArg for Symbol {
}
}

impl<'a> IntoDiagnosticArg for &'a str {
impl IntoDiagnosticArg for Ident {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
self.to_string().into_diagnostic_arg()
}
}

impl IntoDiagnosticArg for String {
impl<'a> IntoDiagnosticArg for &'a str {
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
DiagnosticArgValue::Str(Cow::Owned(self))
self.to_string().into_diagnostic_arg()
}
}

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_errors/src/diagnostic_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,6 @@ macro_rules! error_code {
pub struct LintDiagnosticBuilder<'a, G: EmissionGuarantee>(DiagnosticBuilder<'a, G>);

impl<'a, G: EmissionGuarantee> LintDiagnosticBuilder<'a, G> {
#[rustc_lint_diagnostics]
/// Return the inner `DiagnosticBuilder`, first setting the primary message to `msg`.
pub fn build(mut self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'a, G> {
self.0.set_primary_message(msg);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_macros/src/diagnostics/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl<'a> SessionDiagnosticDerive<'a> {
return DiagnosticDeriveError::ErrorHandled.to_compile_error();
}
(Some(DiagnosticDeriveKind::Lint), _) => {
span_err(span, "only `#[error(..)]` and `#[warning(..)]` are supported")
span_err(span, "only `#[error(..)]` and `#[warn(..)]` are supported")
.help("use the `#[error(...)]` attribute to create a error")
.emit();
return DiagnosticDeriveError::ErrorHandled.to_compile_error();
Expand Down
Loading

0 comments on commit 31c431f

Please sign in to comment.