Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #137607

Closed
wants to merge 21 commits into from
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
812727e
Teach structured errors to display short `Ty`
estebank Feb 18, 2025
9884f7b
Add tests
estebank Feb 18, 2025
8413388
Make E0529 a structured error
estebank Feb 18, 2025
2970cd3
Make E0614 a structured error
estebank Feb 18, 2025
ce259e2
Make E0609 a structured error
estebank Feb 18, 2025
2dcd85f
add doc comment detail
estebank Feb 18, 2025
e4ca11f
downgrade bootstrap `cc`
onur-ozkan Feb 23, 2025
62f5a55
Use `as_chunks` in `analyze_source_file_sse2`
real-eren Feb 20, 2025
fb5f804
Update `compiler-builtins` to 0.1.148
tgross35 Feb 24, 2025
37b18f8
add explicit stage fields to `Config`
onur-ozkan Feb 24, 2025
cf6dc74
add coverage for explicit stage fields
onur-ozkan Feb 24, 2025
9ad6011
use stage 2 on cargo and clippy tests when possible
onur-ozkan Feb 24, 2025
ffc955b
Don't require method impls for methods with `Self:Sized` bounds for i…
oli-obk Jan 14, 2025
6cd0721
Revert accidental cargo submodule update
oli-obk Feb 25, 2025
bb15d94
Rollup merge of #135480 - oli-obk:sized-method-on-unsized-impl, r=lcnr
fmease Feb 25, 2025
6b7103f
Rollup merge of #137201 - estebank:structured-errors-long-ty, r=oli-obk
fmease Feb 25, 2025
1a26cc6
Rollup merge of #137360 - real-eren:rustc_span/use-chunks-exact, r=No…
fmease Feb 25, 2025
e40c521
Rollup merge of #137460 - onur-ozkan:downgrade-cc, r=jieyouxu
fmease Feb 25, 2025
662f228
Rollup merge of #137515 - tgross35:update-builtins, r=tgross35
fmease Feb 25, 2025
8e4d6e7
Rollup merge of #137522 - onur-ozkan:137215-follow-ups, r=Kobzol
fmease Feb 25, 2025
d30ed07
Rollup merge of #137597 - oli-obk:push-unkusxkoqrus, r=Kobzol
fmease Feb 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compiler/rustc_ast_passes/src/errors.rs
Original file line number Diff line number Diff line change
@@ -535,7 +535,6 @@ pub(crate) struct WhereClauseBeforeTypeAlias {
}

#[derive(Subdiagnostic)]

pub(crate) enum WhereClauseBeforeTypeAliasSugg {
#[suggestion(ast_passes_remove_suggestion, applicability = "machine-applicable", code = "")]
Remove {
1 change: 0 additions & 1 deletion compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
@@ -287,7 +287,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
None => "value".to_owned(),
};
if needs_note {
let ty = self.infcx.tcx.short_string(ty, err.long_ty_path());
if let Some(local) = place.as_local() {
let span = self.body.local_decls[local].source_info.span;
err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label {
9 changes: 3 additions & 6 deletions compiler/rustc_borrowck/src/diagnostics/move_errors.rs
Original file line number Diff line number Diff line change
@@ -596,10 +596,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
self.suggest_cloning(err, place_ty, expr, None);
}

let ty = self.infcx.tcx.short_string(place_ty, err.long_ty_path());
err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label {
is_partial_move: false,
ty,
ty: place_ty,
place: &place_desc,
span,
});
@@ -629,10 +628,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
self.suggest_cloning(err, place_ty, expr, Some(use_spans));
}

let ty = self.infcx.tcx.short_string(place_ty, err.long_ty_path());
err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label {
is_partial_move: false,
ty,
ty: place_ty,
place: &place_desc,
span: use_span,
});
@@ -833,10 +831,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
self.suggest_cloning(err, bind_to.ty, expr, None);
}

let ty = self.infcx.tcx.short_string(bind_to.ty, err.long_ty_path());
err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label {
is_partial_move: false,
ty,
ty: bind_to.ty,
place: place_desc,
span: binding_span,
});
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/region_name.rs
Original file line number Diff line number Diff line change
@@ -194,8 +194,8 @@ impl Display for RegionName {
}

impl rustc_errors::IntoDiagArg for RegionName {
fn into_diag_arg(self) -> rustc_errors::DiagArgValue {
self.to_string().into_diag_arg()
fn into_diag_arg(self, path: &mut Option<std::path::PathBuf>) -> rustc_errors::DiagArgValue {
self.to_string().into_diag_arg(path)
}
}

6 changes: 3 additions & 3 deletions compiler/rustc_borrowck/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
@@ -459,17 +459,17 @@ pub(crate) enum OnClosureNote<'a> {
}

#[derive(Subdiagnostic)]
pub(crate) enum TypeNoCopy<'a> {
pub(crate) enum TypeNoCopy<'a, 'tcx> {
#[label(borrowck_ty_no_impl_copy)]
Label {
is_partial_move: bool,
ty: String,
ty: Ty<'tcx>,
place: &'a str,
#[primary_span]
span: Span,
},
#[note(borrowck_ty_no_impl_copy)]
Note { is_partial_move: bool, ty: String, place: &'a str },
Note { is_partial_move: bool, ty: Ty<'tcx>, place: &'a str },
}

#[derive(Diagnostic)]
Original file line number Diff line number Diff line change
@@ -16,8 +16,8 @@ index 7165c3e48af..968552ad435 100644

[dependencies]
core = { path = "../core", public = true }
-compiler_builtins = { version = "=0.1.147", features = ['rustc-dep-of-std'] }
+compiler_builtins = { version = "=0.1.147", features = ['rustc-dep-of-std', 'no-f16-f128'] }
-compiler_builtins = { version = "=0.1.148", features = ['rustc-dep-of-std'] }
+compiler_builtins = { version = "=0.1.148", features = ['rustc-dep-of-std', 'no-f16-f128'] }

[dev-dependencies]
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/assert_module_sources.rs
Original file line number Diff line number Diff line change
@@ -211,7 +211,7 @@ impl fmt::Display for CguReuse {
}

impl IntoDiagArg for CguReuse {
fn into_diag_arg(self) -> DiagArgValue {
fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
DiagArgValue::Str(Cow::Owned(self.to_string()))
}
}
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/errors.rs
Original file line number Diff line number Diff line change
@@ -161,7 +161,7 @@ impl<'a> CopyPath<'a> {
struct DebugArgPath<'a>(pub &'a Path);

impl IntoDiagArg for DebugArgPath<'_> {
fn into_diag_arg(self) -> rustc_errors::DiagArgValue {
fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> rustc_errors::DiagArgValue {
DiagArgValue::Str(Cow::Owned(format!("{:?}", self.0)))
}
}
@@ -1087,7 +1087,7 @@ pub enum ExpectedPointerMutability {
}

impl IntoDiagArg for ExpectedPointerMutability {
fn into_diag_arg(self) -> DiagArgValue {
fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
match self {
ExpectedPointerMutability::Mut => DiagArgValue::Str(Cow::Borrowed("*mut")),
ExpectedPointerMutability::Not => DiagArgValue::Str(Cow::Borrowed("*_")),
8 changes: 4 additions & 4 deletions compiler/rustc_const_eval/src/const_eval/error.rs
Original file line number Diff line number Diff line change
@@ -49,10 +49,10 @@ impl MachineStopType for ConstEvalErrKind {
| WriteThroughImmutablePointer => {}
AssertFailure(kind) => kind.add_args(adder),
Panic { msg, line, col, file } => {
adder("msg".into(), msg.into_diag_arg());
adder("file".into(), file.into_diag_arg());
adder("line".into(), line.into_diag_arg());
adder("col".into(), col.into_diag_arg());
adder("msg".into(), msg.into_diag_arg(&mut None));
adder("file".into(), file.into_diag_arg(&mut None));
adder("line".into(), line.into_diag_arg(&mut None));
adder("col".into(), col.into_diag_arg(&mut None));
}
}
}
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/errors.rs
Original file line number Diff line number Diff line change
@@ -967,7 +967,7 @@ impl ReportErrorExt for ResourceExhaustionInfo {
}

impl rustc_errors::IntoDiagArg for InternKind {
fn into_diag_arg(self) -> DiagArgValue {
fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
DiagArgValue::Str(Cow::Borrowed(match self {
InternKind::Static(Mutability::Not) => "static",
InternKind::Static(Mutability::Mut) => "static_mut",
12 changes: 9 additions & 3 deletions compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
@@ -148,11 +148,17 @@ where
/// converted rather than on `DiagArgValue`, which enables types from other `rustc_*` crates to
/// implement this.
pub trait IntoDiagArg {
fn into_diag_arg(self) -> DiagArgValue;
/// Convert `Self` into a `DiagArgValue` suitable for rendering in a diagnostic.
///
/// It takes a `path` where "long values" could be written to, if the `DiagArgValue` is too big
/// for displaying on the terminal. This path comes from the `Diag` itself. When rendering
/// values that come from `TyCtxt`, like `Ty<'_>`, they can use `TyCtxt::short_string`. If a
/// value has no shortening logic that could be used, the argument can be safely ignored.
fn into_diag_arg(self, path: &mut Option<std::path::PathBuf>) -> DiagArgValue;
}

impl IntoDiagArg for DiagArgValue {
fn into_diag_arg(self) -> DiagArgValue {
fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
self
}
}
@@ -395,7 +401,7 @@ impl DiagInner {
}

pub(crate) fn arg(&mut self, name: impl Into<DiagArgName>, arg: impl IntoDiagArg) {
self.args.insert(name.into(), arg.into_diag_arg());
self.args.insert(name.into(), arg.into_diag_arg(&mut self.long_ty_path));
}

/// Fields used for Hash, and PartialEq trait.
Loading