mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Auto merge of #155115 - JonathanBrouwer:rollup-RePrRPQ, r=JonathanBrouwer
Rollup of 6 pull requests Successful merges: - rust-lang/rust#152901 (Introduce a `#[diagnostic::on_unknown]` attribute) - rust-lang/rust#155078 (Reject dangling attributes in where clauses) - rust-lang/rust#154449 (Invert dependency between `rustc_errors` and `rustc_abi`.) - rust-lang/rust#154646 (Add suggestion to `.to_owned()` used on `Cow` when borrowing) - rust-lang/rust#154993 (compiletest: pass -Zunstable-options for unpretty and no-codegen paths) - rust-lang/rust#155097 (Make `rustc_attr_parsing::SharedContext::emit_lint` take a `MultiSpan` instead of a `Span`)
This commit is contained in:
@@ -9,7 +9,6 @@ annotate-snippets = { version = "0.12.15", features = ["simd"] }
|
||||
anstream = "0.6.20"
|
||||
anstyle = "1.0.13"
|
||||
derive_setters = "0.1.6"
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_error_codes = { path = "../rustc_error_codes" }
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use rustc_abi::TargetDataLayoutErrors;
|
||||
use rustc_error_messages::{DiagArgValue, IntoDiagArg};
|
||||
use rustc_macros::Subdiagnostic;
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
use crate::diagnostic::DiagLocation;
|
||||
use crate::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, Subdiagnostic, msg};
|
||||
use crate::{Diag, EmissionGuarantee, Subdiagnostic};
|
||||
|
||||
impl IntoDiagArg for DiagLocation {
|
||||
fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
|
||||
@@ -37,55 +36,6 @@ fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
|
||||
}
|
||||
}
|
||||
|
||||
impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetDataLayoutErrors<'_> {
|
||||
fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
|
||||
match self {
|
||||
TargetDataLayoutErrors::InvalidAddressSpace { addr_space, err, cause } => {
|
||||
Diag::new(dcx, level, msg!("invalid address space `{$addr_space}` for `{$cause}` in \"data-layout\": {$err}"))
|
||||
.with_arg("addr_space", addr_space)
|
||||
.with_arg("cause", cause)
|
||||
.with_arg("err", err)
|
||||
}
|
||||
TargetDataLayoutErrors::InvalidBits { kind, bit, cause, err } => {
|
||||
Diag::new(dcx, level, msg!("invalid {$kind} `{$bit}` for `{$cause}` in \"data-layout\": {$err}"))
|
||||
.with_arg("kind", kind)
|
||||
.with_arg("bit", bit)
|
||||
.with_arg("cause", cause)
|
||||
.with_arg("err", err)
|
||||
}
|
||||
TargetDataLayoutErrors::MissingAlignment { cause } => {
|
||||
Diag::new(dcx, level, msg!("missing alignment for `{$cause}` in \"data-layout\""))
|
||||
.with_arg("cause", cause)
|
||||
}
|
||||
TargetDataLayoutErrors::InvalidAlignment { cause, err } => {
|
||||
Diag::new(dcx, level, msg!(
|
||||
"invalid alignment for `{$cause}` in \"data-layout\": {$err}"
|
||||
))
|
||||
.with_arg("cause", cause)
|
||||
.with_arg("err", err.to_string())
|
||||
}
|
||||
TargetDataLayoutErrors::InconsistentTargetArchitecture { dl, target } => {
|
||||
Diag::new(dcx, level, msg!(
|
||||
"inconsistent target specification: \"data-layout\" claims architecture is {$dl}-endian, while \"target-endian\" is `{$target}`"
|
||||
))
|
||||
.with_arg("dl", dl).with_arg("target", target)
|
||||
}
|
||||
TargetDataLayoutErrors::InconsistentTargetPointerWidth { pointer_size, target } => {
|
||||
Diag::new(dcx, level, msg!(
|
||||
"inconsistent target specification: \"data-layout\" claims pointers are {$pointer_size}-bit, while \"target-pointer-width\" is `{$target}`"
|
||||
)).with_arg("pointer_size", pointer_size).with_arg("target", target)
|
||||
}
|
||||
TargetDataLayoutErrors::InvalidBitsSize { err } => {
|
||||
Diag::new(dcx, level, msg!("{$err}")).with_arg("err", err)
|
||||
}
|
||||
TargetDataLayoutErrors::UnknownPointerSpecification { err } => {
|
||||
Diag::new(dcx, level, msg!("unknown pointer specification `{$err}` in datalayout string"))
|
||||
.with_arg("err", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Utility struct used to apply a single label while highlighting multiple spans
|
||||
pub struct SingleLabelManySpans {
|
||||
pub spans: Vec<Span>,
|
||||
|
||||
Reference in New Issue
Block a user