Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7029337
move .auto settings into miri.toml file
RalfJung Aug 26, 2026
4924c57
add `./miri toolchain --name` to configure which toolchain to install…
RalfJung Aug 26, 2026
937d7a2
miri.toml: allow configuring the default toolchain name
RalfJung Aug 26, 2026
c28b273
miri.toml: allow configuring toolchain components
RalfJung Aug 26, 2026
9630065
fix quadratic naming of duplicate sidebar links
xonx4l Sep 18, 2026
8955f77
Add `std_or_core` helper for crate-qualified rustfix paths
lapla-cogito Sep 14, 2026
4238ee3
Use `std_or_core` in `undropped_manually_drops` rustfix
lapla-cogito Sep 14, 2026
1875276
simplify get_next_url to a single counter map
xonx4l Sep 21, 2026
447bb32
RA settings: disable diagnostics as RA shows many false positives
RalfJung Sep 21, 2026
e4ad05b
Mark std::os::wasip2 with correct doc-cfgs, mark as unstable
clarfonthey Sep 21, 2026
1f28dfc
Merge pull request #5338 from RalfJung/vscode-settings
RalfJung Sep 21, 2026
5a61e9c
Prepare for merging from rust-lang/rust
Sep 22, 2026
d8b6ee3
Merge ref '88638df1e741' from rust-lang/rust
Sep 22, 2026
fd49fb3
Merge pull request #5340 from rust-lang/rustup-2026-09-22
RalfJung Sep 22, 2026
c85e050
Merge pull request #5289 from RalfJung/miri.toml
oli-obk Sep 22, 2026
3e06823
add test for #[path] in doctest
RalfJung Sep 22, 2026
e53b292
forward rustdoc env vars to doctests
RalfJung Sep 22, 2026
b2e7048
Merge pull request #5342 from RalfJung/doctest-path
RalfJung Sep 22, 2026
4858117
Use `std_or_core` in `integer_to_ptr_transmutes` rustfix
lapla-cogito Sep 14, 2026
711d861
Use `std_or_core` in `ambiguous_wide_pointer_comparisons` rustfix
lapla-cogito Sep 14, 2026
ed84ade
Use `std_or_core` in `unpredictable_function_pointer_comparisons` rus…
lapla-cogito Sep 14, 2026
e31fb47
Skip `panic_any` rustfix in `non_fmt_panics` when it is unavailable
lapla-cogito Sep 14, 2026
b7dc072
revert r14 register names for arm
malezjaa Sep 23, 2026
2b022a3
Export `std_or_core`
lapla-cogito Sep 23, 2026
494b3f8
Enable EII tests for cg_gcc
AsakuraMizu Sep 23, 2026
e9824e4
properly decrement available_depth on cycles and provisional cache hits
sjwang05 Sep 22, 2026
1e185bd
Remove `StashKey::AssociatedTypeSuggestion`
nnethercote Sep 18, 2026
f4524e7
Rollup merge of #162976 - xonx4l:rustdoc-sidebar-quadratic, r=lolbina…
jhpratt Sep 23, 2026
f10b845
Rollup merge of #163222 - AsakuraMizu:eii-gcc, r=BoxyUwU,GuillaumeGomez
jhpratt Sep 23, 2026
804e65b
Rollup merge of #162942 - nnethercote:rm-StashKey-AssociatedTypeSugge…
jhpratt Sep 23, 2026
ee37303
Rollup merge of #163096 - lapla-cogito:std_or_core, r=oli-obk
jhpratt Sep 23, 2026
1cf2967
Rollup merge of #163110 - clarfonthey:wasip2-module, r=alexcrichton
jhpratt Sep 23, 2026
bfc1523
Rollup merge of #163185 - sjwang05:depth-budget-fix, r=lcnr
jhpratt Sep 23, 2026
b398101
Rollup merge of #163214 - malezjaa:revert-r14-register-name, r=folker…
jhpratt Sep 23, 2026
aa2955d
Rollup merge of #163226 - RalfJung:miri, r=RalfJung
jhpratt Sep 23, 2026
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
6 changes: 2 additions & 4 deletions compiler/rustc_codegen_llvm/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,12 +791,10 @@ fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'_>>) ->
} else if let Some(idx) = hexagon_vreg_pair_index(reg) {
// LLVM uses `wN` for Hexagon HVX vector pair registers.
format!("{{w{}}}", idx)
} else if reg == InlineAsmReg::Arm(ArmInlineAsmReg::r14)
&& llvm_util::get_version() < (23, 0, 0)
{
} else if reg == InlineAsmReg::Arm(ArmInlineAsmReg::r14) {
// FIXME(llvm): LLVM <23 does not recognize `r14` as a register name
// in inline assembly.
// This workaround can be removed when support for LLVM 22 is dropped.
// We can make this branch fallthrough again for LLVM 23+ when https://github.com/llvm/llvm-project/pull/225746 gets released.
"{lr}".to_string()
} else if let InlineAsmReg::Sparc(reg) = reg
&& let Some(num) = reg.dreg_number()
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ pub enum StashKey {
/// FRU syntax
MaybeFruTypo,
CallAssocMethod,
AssociatedTypeSuggestion,
UndeterminedMacroResolution,
/// Used by `Parser::maybe_recover_trailing_expr`
ExprInPat,
Expand Down
21 changes: 9 additions & 12 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ use rustc_ast::TraitObjectSyntax;
use rustc_attr_ir::lang_items::LangItem;
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
use rustc_errors::codes::*;
use rustc_errors::{
Applicability, Diag, DiagCtxtHandle, Diagnostic, Level, StashKey, Suggestions,
struct_span_code_err,
};
use rustc_errors::{Applicability, Diag, DiagCtxtHandle, Diagnostic, Level, struct_span_code_err};
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::DefId;
use rustc_hir::{self as hir, HirId};
Expand All @@ -17,6 +14,7 @@ use rustc_middle::ty::{
};
use rustc_span::edit_distance::find_best_match_for_name;
use rustc_span::{ErrorGuaranteed, Span};
use rustc_trait_selection::diagnostics::AssocTypeWithSameName;
use rustc_trait_selection::error_reporting::traits::report_dyn_incompatibility;
use rustc_trait_selection::error_reporting::traits::suggestions::NextTypeParamName;
use rustc_trait_selection::traits;
Expand Down Expand Up @@ -655,15 +653,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
poly_trait_ref.trait_ref.trait_def_id(),
&mut diag,
);
// In case there is an associated type with the same name
// Add the suggestion to this error
if let Some(mut sugg) =
self.dcx().steal_non_err(span, StashKey::AssociatedTypeSuggestion)
&& let Suggestions::Enabled(ref mut s1) = diag.suggestions
&& let Suggestions::Enabled(ref mut s2) = sugg.suggestions
// If there is an associated type with the same name, add the suggestion to this error.
if self
.tcx()
.resolutions(())
.paths_matching_assoc_types
.contains(&span.with_parent(None))
{
s1.append(s2);
sugg.cancel();
diag.subdiagnostic(AssocTypeWithSameName { span: span.shrink_to_lo() });
}
Some(diag.emit_err())
} else {
Expand Down
69 changes: 45 additions & 24 deletions compiler/rustc_lint/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1040,9 +1040,10 @@ pub(crate) struct ForgetCopyDiag<'a> {

#[derive(Diagnostic)]
#[diag(
"calls to `std::mem::drop` with `std::mem::ManuallyDrop` instead of the inner value does nothing"
"calls to `{$krate}::mem::drop` with `{$krate}::mem::ManuallyDrop` instead of the inner value does nothing"
)]
pub(crate) struct UndroppedManuallyDropsDiag<'a> {
pub krate: &'static str,
pub arg_ty: Ty<'a>,
#[label("argument has type `{$arg_ty}`")]
pub label: Span,
Expand All @@ -1052,21 +1053,23 @@ pub(crate) struct UndroppedManuallyDropsDiag<'a> {

#[derive(Subdiagnostic)]
#[multipart_suggestion(
"use `std::mem::ManuallyDrop::into_inner` to get the inner value",
"use `{$krate}::mem::ManuallyDrop::into_inner` to get the inner value",
applicability = "machine-applicable"
)]
pub(crate) struct UndroppedManuallyDropsSuggestion {
#[suggestion_part(code = "std::mem::ManuallyDrop::into_inner(")]
pub krate: &'static str,
#[suggestion_part(code = "{krate}::mem::ManuallyDrop::into_inner(")]
pub start_span: Span,
#[suggestion_part(code = ")")]
pub end_span: Span,
}

#[derive(Diagnostic)]
#[diag(
"calls to `drop_in_place` with a pointer to a `std::mem::ManuallyDrop` instead of the inner value does nothing"
"calls to `drop_in_place` with a pointer to a `{$krate}::mem::ManuallyDrop` instead of the inner value does nothing"
)]
pub(crate) struct UndroppedManuallyDropsInPlaceDiag<'a> {
pub krate: &'static str,
pub arg_ty: Ty<'a>,
#[label("argument has type `{$arg_ty}`")]
pub label: Span,
Expand All @@ -1076,11 +1079,12 @@ pub(crate) struct UndroppedManuallyDropsInPlaceDiag<'a> {

#[derive(Subdiagnostic)]
#[multipart_suggestion(
"use `std::mem::ManuallyDrop::drop` to drop the inner value",
"use `{$krate}::mem::ManuallyDrop::drop` to drop the inner value",
applicability = "maybe-incorrect"
)]
pub(crate) struct UndroppedManuallyDropsInPlaceSuggestion {
#[suggestion_part(code = "std::mem::ManuallyDrop::drop(&mut *")]
pub krate: &'static str,
#[suggestion_part(code = "{krate}::mem::ManuallyDrop::drop(&mut *")]
pub start_span: Span,
#[suggestion_part(code = ")")]
pub end_span: Span,
Expand Down Expand Up @@ -2074,44 +2078,53 @@ impl<'a> Diagnostic<'a> for DropGlue<'_> {
#[note(
"exposed provenance semantics can be used to create a pointer based on some previously exposed provenance"
)]
#[help(
"if you truly mean to create a pointer without provenance, use `std::ptr::without_provenance_mut`"
)]
#[help(
"for more information about transmute, see <https://doc.rust-lang.org/std/mem/fn.transmute.html#transmutation-between-pointers-and-integers>"
)]
#[help(
"for more information about exposed provenance, see <https://doc.rust-lang.org/std/ptr/index.html#exposed-provenance>"
)]
pub(crate) struct IntegerToPtrTransmutes<'tcx> {
#[subdiagnostic]
pub without_prov: Option<IntegerToPtrWithoutProvHelp>,
#[subdiagnostic]
pub suggestion: Option<IntegerToPtrTransmutesSuggestion<'tcx>>,
}

#[derive(Subdiagnostic)]
#[help(
"if you truly mean to create a pointer without provenance, use `{$krate}::ptr::without_provenance_mut`"
)]
pub(crate) struct IntegerToPtrWithoutProvHelp {
pub krate: &'static str,
}

#[derive(Subdiagnostic)]
pub(crate) enum IntegerToPtrTransmutesSuggestion<'tcx> {
#[multipart_suggestion(
"use `std::ptr::with_exposed_provenance{$suffix}` instead to use a previously exposed provenance",
"use `{$krate}::ptr::with_exposed_provenance{$suffix}` instead to use a previously exposed provenance",
applicability = "machine-applicable",
style = "verbose"
)]
ToPtr {
krate: &'static str,
dst: Ty<'tcx>,
suffix: &'static str,
#[suggestion_part(code = "std::ptr::with_exposed_provenance{suffix}::<{dst}>(")]
#[suggestion_part(code = "{krate}::ptr::with_exposed_provenance{suffix}::<{dst}>(")]
start_call: Span,
},
#[multipart_suggestion(
"use `std::ptr::with_exposed_provenance{$suffix}` instead to use a previously exposed provenance",
"use `{$krate}::ptr::with_exposed_provenance{$suffix}` instead to use a previously exposed provenance",
applicability = "machine-applicable",
style = "verbose"
)]
ToRef {
krate: &'static str,
dst: Ty<'tcx>,
suffix: &'static str,
ref_mutbl: &'static str,
#[suggestion_part(
code = "&{ref_mutbl}*std::ptr::with_exposed_provenance{suffix}::<{dst}>("
code = "&{ref_mutbl}*{krate}::ptr::with_exposed_provenance{suffix}::<{dst}>("
)]
start_call: Span,
},
Expand Down Expand Up @@ -2348,25 +2361,30 @@ pub(crate) enum AmbiguousWidePointerComparisons<'a> {
#[diag(
"ambiguous wide pointer comparison, the comparison includes metadata which may not be expected"
)]
#[help("use explicit `std::ptr::eq` method to compare metadata and addresses")]
#[help("use `std::ptr::addr_eq` or untyped pointers to only compare their addresses")]
Spanless,
#[help("use explicit `{$krate}::ptr::eq` method to compare metadata and addresses")]
#[help("use `{$krate}::ptr::addr_eq` or untyped pointers to only compare their addresses")]
Spanless { krate: &'static str },
#[diag(
"ambiguous wide pointer comparison, the comparison includes metadata which may not be expected"
)]
Warn,
}

#[derive(Subdiagnostic)]
#[multipart_suggestion(
"use explicit `std::ptr::eq` method to compare metadata and addresses",
"use explicit `{$krate}::ptr::eq` method to compare metadata and addresses",
style = "verbose",
// FIXME(#53934): make machine-applicable again
applicability = "maybe-incorrect"
)]
pub(crate) struct AmbiguousWidePointerComparisonsAddrMetadataSuggestion<'a> {
pub krate: &'static str,
pub ne: &'a str,
pub deref_left: &'a str,
pub deref_right: &'a str,
pub l_modifiers: &'a str,
pub r_modifiers: &'a str,
#[suggestion_part(code = "{ne}std::ptr::eq({deref_left}")]
#[suggestion_part(code = "{ne}{krate}::ptr::eq({deref_left}")]
pub left: Span,
#[suggestion_part(code = "{l_modifiers}, {deref_right}")]
pub middle: Span,
Expand All @@ -2376,18 +2394,19 @@ pub(crate) struct AmbiguousWidePointerComparisonsAddrMetadataSuggestion<'a> {

#[derive(Subdiagnostic)]
#[multipart_suggestion(
"use `std::ptr::addr_eq` or untyped pointers to only compare their addresses",
"use `{$krate}::ptr::addr_eq` or untyped pointers to only compare their addresses",
style = "verbose",
// FIXME(#53934): make machine-applicable again
applicability = "maybe-incorrect"
)]
pub(crate) struct AmbiguousWidePointerComparisonsAddrSuggestion<'a> {
pub(crate) krate: &'static str,
pub(crate) ne: &'a str,
pub(crate) deref_left: &'a str,
pub(crate) deref_right: &'a str,
pub(crate) l_modifiers: &'a str,
pub(crate) r_modifiers: &'a str,
#[suggestion_part(code = "{ne}std::ptr::addr_eq({deref_left}")]
#[suggestion_part(code = "{ne}{krate}::ptr::addr_eq({deref_left}")]
pub(crate) left: Span,
#[suggestion_part(code = "{l_modifiers}, {deref_right}")]
pub(crate) middle: Span,
Expand Down Expand Up @@ -2470,32 +2489,34 @@ pub(crate) enum UnpredictableFunctionPointerComparisons<'a, 'tcx> {
#[derive(Subdiagnostic)]
pub(crate) enum UnpredictableFunctionPointerComparisonsSuggestion<'a, 'tcx> {
#[multipart_suggestion(
"refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint",
"refactor your code, or use `{$krate}::ptr::fn_addr_eq` to suppress the lint",
style = "verbose",
applicability = "maybe-incorrect"
)]
FnAddrEq {
krate: &'static str,
ne: &'a str,
deref_left: &'a str,
deref_right: &'a str,
#[suggestion_part(code = "{ne}std::ptr::fn_addr_eq({deref_left}")]
#[suggestion_part(code = "{ne}{krate}::ptr::fn_addr_eq({deref_left}")]
left: Span,
#[suggestion_part(code = ", {deref_right}")]
middle: Span,
#[suggestion_part(code = ")")]
right: Span,
},
#[multipart_suggestion(
"refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint",
"refactor your code, or use `{$krate}::ptr::fn_addr_eq` to suppress the lint",
style = "verbose",
applicability = "maybe-incorrect"
)]
FnAddrEqWithCast {
krate: &'static str,
ne: &'a str,
deref_left: &'a str,
deref_right: &'a str,
fn_sig: rustc_middle::ty::PolyFnSig<'tcx>,
#[suggestion_part(code = "{ne}std::ptr::fn_addr_eq({deref_left}")]
#[suggestion_part(code = "{ne}{krate}::ptr::fn_addr_eq({deref_left}")]
left: Span,
#[suggestion_part(code = ", {deref_right}")]
middle: Span,
Expand Down
11 changes: 9 additions & 2 deletions compiler/rustc_lint/src/drop_forget_useless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::diagnostics::{
UndroppedManuallyDropsInPlaceSuggestion, UndroppedManuallyDropsSuggestion,
UseLetUnderscoreIgnoreSuggestion,
};
use crate::utils::std_or_core;
use crate::{LateContext, LateLintPass, LintContext};

declare_lint! {
Expand Down Expand Up @@ -252,15 +253,18 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
}
sym::mem_drop
if let ty::Adt(adt, _) = arg_ty.kind()
&& adt.is_manually_drop() =>
&& adt.is_manually_drop()
&& let Some(krate) = std_or_core(cx) =>
{
cx.emit_span_lint(
UNDROPPED_MANUALLY_DROPS,
expr.span,
UndroppedManuallyDropsDiag {
krate,
arg_ty,
label: arg.span,
suggestion: UndroppedManuallyDropsSuggestion {
krate,
start_span: arg.span.shrink_to_lo(),
end_span: arg.span.shrink_to_hi(),
},
Expand All @@ -270,15 +274,18 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
sym::ptr_drop_in_place | sym::ptr_drop_in_place_self
if let &ty::RawPtr(inner_ty, _mutbl) = arg_ty.kind()
&& let ty::Adt(adt, _) = inner_ty.kind()
&& adt.is_manually_drop() =>
&& adt.is_manually_drop()
&& let Some(krate) = std_or_core(cx) =>
{
cx.emit_span_lint(
UNDROPPED_MANUALLY_DROPS,
expr.span,
UndroppedManuallyDropsInPlaceDiag {
krate,
arg_ty,
label: arg.span,
suggestion: UndroppedManuallyDropsInPlaceSuggestion {
krate,
start_span: expr.span.shrink_to_lo().until(arg.span.shrink_to_lo()),
end_span: arg.span.shrink_to_hi().until(expr.span.shrink_to_hi()),
},
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ pub use rustc_lint_defs::{
Applicability, FutureIncompatibleInfo, Lint, LintId, LintPass, LintVec, declare_lint,
declare_lint_pass, declare_tool_lint, impl_lint_pass,
};
pub use utils::std_or_core;

pub fn provide(providers: &mut Providers) {
levels::provide(providers);
Expand Down
9 changes: 8 additions & 1 deletion compiler/rustc_lint/src/non_fmt_panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,14 @@ impl<'a, 'b, 'tcx> Diagnostic<'a> for PanicMessageNotLiteral<'b, 'tcx> {
.get_diagnostic_item(sym::Debug)
.is_some_and(|t| infcx.type_implements_trait(t, [ty], param_env).may_apply());

let suggest_panic_any = !is_str && panic == Some(sym::std_panic_macro);
let suggest_panic_any = !is_str
&& panic == Some(sym::std_panic_macro)
&& cx
.tcx
.all_diagnostic_items(())
.name_to_id
.keys()
.any(|name| name.as_str() == "panic_any");

let fmt_applicability = if suggest_panic_any {
// If we can use panic_any, use that as the MachineApplicable suggestion.
Expand Down
Loading
Loading