Skip to content

Rollup of 19 pull requests #145589

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

Merged
merged 54 commits into from
Aug 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
aab1563
`impl PartialEq<{str,String}> for {Path,PathBuf}`
Kixunil Dec 18, 2022
964eb82
Stabilize `ip_from`
GrigorenkoPV May 29, 2025
06ae1be
Make doc for transpose api better
chenyukang Jun 22, 2025
a067c6a
refactor `unreachable/expr_cast.rs` test
WaffleLapkin Jun 1, 2025
d2e133d
don't warn on explicit casts of never to any
WaffleLapkin Jun 1, 2025
3a993a6
Ignore sleep_until test on SGX
raoulstrackx Aug 5, 2025
4e2d420
avoid duplicate error string
lcnr Aug 7, 2025
d62e857
also consider HR bounds
lcnr Aug 7, 2025
a95a2ac
rework `add_placeholder_from_predicate_note`
lcnr Aug 7, 2025
5c716bd
add comment
lcnr Aug 7, 2025
3ebf611
it's not a borrow checker limitation :<
lcnr Aug 13, 2025
8d0a049
Declare module `rustc_codegen_llvm::back` in the normal way
Zalathar Aug 15, 2025
44f5ec7
Avoid an explicit cast from `*const c_uchar` to `*const c_char`
Zalathar Aug 15, 2025
61932e1
Avoid an unnecessary intermediate `&mut` reference
Zalathar Aug 15, 2025
9e7d066
Simplify the `args_cstr_buff` assertion
Zalathar Aug 15, 2025
8511e40
rustdoc-search: search backend with partitioned suffix tree
notriddle Nov 22, 2024
cf8ec67
Remove `LlvmArchiveBuilder` and supporting code/bindings
Zalathar Aug 16, 2025
ddf39ca
Avoid copying rustc rmeta artifacts into the build compiler sysroot
Kobzol Aug 16, 2025
70e26c1
take attr style into account in attr diagnostics
jdonszelmann Aug 11, 2025
814b8e6
Only check std in cross-compilation instead of building it
Kobzol Aug 16, 2025
4335405
overhaul `&mut` suggestions in borrowck errors
fee1-dead Aug 6, 2025
e78b417
refactor return type of `suggest_ampmut` into an enum
fee1-dead Aug 16, 2025
3ef065b
Implement the #[sanitize(..)] attribute
1c3t3a Jun 18, 2025
95bdb34
Remove the no_sanitize attribute in favor of sanitize
1c3t3a Jun 18, 2025
22519d3
Do not overwrite the value of `RUSTC_ADDITIONAL_SYSROOT_PATHS`
Kobzol Aug 18, 2025
4668751
Print what bootstrap invocation failed when an error happens in CI
Kobzol Aug 18, 2025
a1f5bbe
Provide more useful command creation spans
Kobzol Aug 18, 2025
a6a760e
Remove the `From` derive macro from prelude
Kobzol Aug 18, 2025
c6db6f2
comment style changes
fee1-dead Aug 18, 2025
79a40c9
rustdoc: add rustdoc top bar web component
notriddle Aug 18, 2025
704cb8f
interpret: avoid forcing all integer newtypes into memory during clea…
RalfJung Aug 18, 2025
79d3006
cleanup: make run-make test use run_in_tmpdir
durin42 Aug 14, 2025
9d08596
tests: fix RISC-V failures and adjust transmute-scalar.rs target
Jul 28, 2025
4c21251
Fix uplifting in `Assemble` step
Kobzol Aug 18, 2025
533ecdb
Assume UTF-8 in sysroot paths
Kobzol Aug 18, 2025
2beb54c
Rollup merge of #140956 - Kixunil:impl-partialeq-str-for-path, r=Amanieu
Zalathar Aug 19, 2025
027c7a5
Rollup merge of #141744 - GrigorenkoPV:ip_from, r=Amanieu
Zalathar Aug 19, 2025
633cc0c
Rollup merge of #142681 - 1c3t3a:sanitize-off-on, r=rcvalle
Zalathar Aug 19, 2025
0671b2f
Rollup merge of #142871 - chenyukang:yukang-fix-doc-for-transpose, r=…
Zalathar Aug 19, 2025
b9fdc6b
Rollup merge of #144252 - Kobzol:rmeta-sysroot, r=jieyouxu
Zalathar Aug 19, 2025
d6645f7
Rollup merge of #144476 - notriddle:notriddle/stringdex, r=lolbinaryc…
Zalathar Aug 19, 2025
3a03bb9
Rollup merge of #144567 - CaiWeiran:transmute-scalar_test, r=nikic
Zalathar Aug 19, 2025
cff7ed1
Rollup merge of #144804 - WaffleLapkin:reach-for-the-casts, r=compile…
Zalathar Aug 19, 2025
d0fa5c7
Rollup merge of #144960 - raoulstrackx:raoul/rte-513-disable_sleep_te…
Zalathar Aug 19, 2025
181480d
Rollup merge of #145013 - fee1-dead-contrib:push-vwvsqsqnrxqm, r=nnet…
Zalathar Aug 19, 2025
f3f1847
Rollup merge of #145041 - lcnr:borrowck-limitations-error, r=BoxyUwU
Zalathar Aug 19, 2025
11c6d89
Rollup merge of #145243 - jdonszelmann:inner-attr-errors, r=petrochenkov
Zalathar Aug 19, 2025
02848e7
Rollup merge of #145405 - durin42:test-cleanup-tmpdir, r=lqd
Zalathar Aug 19, 2025
8945924
Rollup merge of #145432 - Zalathar:target-machine, r=wesleywiser
Zalathar Aug 19, 2025
8748d8e
Rollup merge of #145484 - Zalathar:archive-builder, r=bjorn3
Zalathar Aug 19, 2025
cf2f50e
Rollup merge of #145557 - Kobzol:rustc-link-fix, r=jieyouxu
Zalathar Aug 19, 2025
f44f963
Rollup merge of #145563 - Kobzol:remove-from-from-prelude, r=petroche…
Zalathar Aug 19, 2025
3ced940
Rollup merge of #145565 - Kobzol:bootstrap-ci-print-error, r=jieyouxu
Zalathar Aug 19, 2025
531ec85
Rollup merge of #145584 - RalfJung:interpret-clear-provenance, r=comp…
Zalathar Aug 19, 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
10 changes: 10 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4812,6 +4812,7 @@ dependencies = [
"serde_json",
"sha2",
"smallvec",
"stringdex",
"tempfile",
"threadpool",
"tracing",
Expand Down Expand Up @@ -5225,6 +5226,15 @@ dependencies = [
"quote",
]

[[package]]
name = "stringdex"
version = "0.0.1-alpha4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2841fd43df5b1ff1b042e167068a1fe9b163dc93041eae56ab2296859013a9a0"
dependencies = [
"stacker",
]

[[package]]
name = "strsim"
version = "0.11.1"
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ impl<S: Stage> SingleAttributeParser<S> for InlineParser {
}
}
ArgParser::NameValue(_) => {
let suggestions =
<Self as SingleAttributeParser<S>>::TEMPLATE.suggestions(false, "inline");
let suggestions = <Self as SingleAttributeParser<S>>::TEMPLATE
.suggestions(cx.attr_style, "inline");
let span = cx.attr_span;
cx.emit_lint(AttributeLintKind::IllFormedAttributeInput { suggestions }, span);
return None;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl<S: Stage> AttributeParser<S> for MacroUseParser {
}
}
ArgParser::NameValue(_) => {
let suggestions = MACRO_USE_TEMPLATE.suggestions(false, sym::macro_use);
let suggestions = MACRO_USE_TEMPLATE.suggestions(cx.attr_style, sym::macro_use);
cx.emit_err(session_diagnostics::IllFormedAttributeInputLint {
num_suggestions: suggestions.len(),
suggestions: DiagArgValue::StrListSepByAnd(
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/must_use.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ impl<S: Stage> SingleAttributeParser<S> for MustUseParser {
Some(value_str)
}
ArgParser::List(_) => {
let suggestions =
<Self as SingleAttributeParser<S>>::TEMPLATE.suggestions(false, "must_use");
let suggestions = <Self as SingleAttributeParser<S>>::TEMPLATE
.suggestions(cx.attr_style, "must_use");
cx.emit_err(session_diagnostics::IllFormedAttributeInputLint {
num_suggestions: suggestions.len(),
suggestions: DiagArgValue::StrListSepByAnd(
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_attr_parsing/src/attributes/test_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl<S: Stage> SingleAttributeParser<S> for IgnoreParser {
ArgParser::NameValue(name_value) => {
let Some(str_value) = name_value.value_as_str() else {
let suggestions = <Self as SingleAttributeParser<S>>::TEMPLATE
.suggestions(false, "ignore");
.suggestions(cx.attr_style, "ignore");
let span = cx.attr_span;
cx.emit_lint(
AttributeLintKind::IllFormedAttributeInput { suggestions },
Expand All @@ -40,8 +40,8 @@ impl<S: Stage> SingleAttributeParser<S> for IgnoreParser {
Some(str_value)
}
ArgParser::List(_) => {
let suggestions =
<Self as SingleAttributeParser<S>>::TEMPLATE.suggestions(false, "ignore");
let suggestions = <Self as SingleAttributeParser<S>>::TEMPLATE
.suggestions(cx.attr_style, "ignore");
let span = cx.attr_span;
cx.emit_lint(AttributeLintKind::IllFormedAttributeInput { suggestions }, span);
return None;
Expand Down
18 changes: 17 additions & 1 deletion compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::sync::LazyLock;

use itertools::Itertools;
use private::Sealed;
use rustc_ast::{self as ast, LitKind, MetaItemLit, NodeId};
use rustc_ast::{self as ast, AttrStyle, LitKind, MetaItemLit, NodeId};
use rustc_errors::{DiagCtxtHandle, Diagnostic};
use rustc_feature::{AttributeTemplate, Features};
use rustc_hir::attrs::AttributeKind;
Expand Down Expand Up @@ -315,6 +315,7 @@ pub struct AcceptContext<'f, 'sess, S: Stage> {
/// The span of the attribute currently being parsed
pub(crate) attr_span: Span,

pub(crate) attr_style: AttrStyle,
/// The expected structure of the attribute.
///
/// Used in reporting errors to give a hint to users what the attribute *should* look like.
Expand Down Expand Up @@ -396,6 +397,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
i.kind.is_bytestr().then(|| self.sess().source_map().start_point(i.span))
}),
},
attr_style: self.attr_style,
})
}

Expand All @@ -406,6 +408,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
template: self.template.clone(),
attribute: self.attr_path.clone(),
reason: AttributeParseErrorReason::ExpectedIntegerLiteral,
attr_style: self.attr_style,
})
}

Expand All @@ -416,6 +419,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
template: self.template.clone(),
attribute: self.attr_path.clone(),
reason: AttributeParseErrorReason::ExpectedList,
attr_style: self.attr_style,
})
}

Expand All @@ -426,6 +430,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
template: self.template.clone(),
attribute: self.attr_path.clone(),
reason: AttributeParseErrorReason::ExpectedNoArgs,
attr_style: self.attr_style,
})
}

Expand All @@ -437,6 +442,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
template: self.template.clone(),
attribute: self.attr_path.clone(),
reason: AttributeParseErrorReason::ExpectedIdentifier,
attr_style: self.attr_style,
})
}

Expand All @@ -449,6 +455,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
template: self.template.clone(),
attribute: self.attr_path.clone(),
reason: AttributeParseErrorReason::ExpectedNameValue(name),
attr_style: self.attr_style,
})
}

Expand All @@ -460,6 +467,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
template: self.template.clone(),
attribute: self.attr_path.clone(),
reason: AttributeParseErrorReason::DuplicateKey(key),
attr_style: self.attr_style,
})
}

Expand All @@ -472,6 +480,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
template: self.template.clone(),
attribute: self.attr_path.clone(),
reason: AttributeParseErrorReason::UnexpectedLiteral,
attr_style: self.attr_style,
})
}

Expand All @@ -482,6 +491,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
template: self.template.clone(),
attribute: self.attr_path.clone(),
reason: AttributeParseErrorReason::ExpectedSingleArgument,
attr_style: self.attr_style,
})
}

Expand All @@ -492,6 +502,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
template: self.template.clone(),
attribute: self.attr_path.clone(),
reason: AttributeParseErrorReason::ExpectedAtLeastOneArgument,
attr_style: self.attr_style,
})
}

Expand All @@ -510,6 +521,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
strings: false,
list: false,
},
attr_style: self.attr_style,
})
}

Expand All @@ -528,6 +540,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
strings: false,
list: true,
},
attr_style: self.attr_style,
})
}

Expand All @@ -546,6 +559,7 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
strings: true,
list: false,
},
attr_style: self.attr_style,
})
}

Expand Down Expand Up @@ -804,6 +818,7 @@ impl<'sess> AttributeParser<'sess, Early> {
},
},
attr_span: attr.span,
attr_style: attr.style,
template,
attr_path: path.get_attribute_path(),
};
Expand Down Expand Up @@ -914,6 +929,7 @@ impl<'sess, S: Stage> AttributeParser<'sess, S> {
emit_lint: &mut emit_lint,
},
attr_span: lower_span(attr.span),
attr_style: attr.style,
template: &accept.template,
attr_path: path.get_attribute_path(),
};
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_attr_parsing/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::num::IntErrorKind;

use rustc_ast as ast;
use rustc_ast::{self as ast, AttrStyle};
use rustc_errors::codes::*;
use rustc_errors::{
Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level,
Expand Down Expand Up @@ -579,6 +579,7 @@ pub(crate) enum AttributeParseErrorReason {
pub(crate) struct AttributeParseError {
pub(crate) span: Span,
pub(crate) attr_span: Span,
pub(crate) attr_style: AttrStyle,
pub(crate) template: AttributeTemplate,
pub(crate) attribute: AttrPath,
pub(crate) reason: AttributeParseErrorReason,
Expand Down Expand Up @@ -717,7 +718,8 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError {
if let Some(link) = self.template.docs {
diag.note(format!("for more information, visit <{link}>"));
}
let suggestions = self.template.suggestions(false, &name);
let suggestions = self.template.suggestions(self.attr_style, &name);

diag.span_suggestions(
self.attr_span,
if suggestions.len() == 1 {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ borrowck_lifetime_constraints_error =
lifetime may not live long enough

borrowck_limitations_implies_static =
due to current limitations in the borrow checker, this implies a `'static` lifetime
due to a current limitation of the type system, this implies a `'static` lifetime

borrowck_move_closure_suggestion =
consider adding 'move' keyword before the nested closure
Expand Down
61 changes: 52 additions & 9 deletions compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ use rustc_abi::{FieldIdx, VariantIdx};
use rustc_data_structures::fx::FxIndexMap;
use rustc_errors::{Applicability, Diag, EmissionGuarantee, MultiSpan, listify};
use rustc_hir::def::{CtorKind, Namespace};
use rustc_hir::{self as hir, CoroutineKind, LangItem};
use rustc_hir::{
self as hir, CoroutineKind, GenericBound, LangItem, WhereBoundPredicate, WherePredicateKind,
};
use rustc_index::{IndexSlice, IndexVec};
use rustc_infer::infer::{BoundRegionConversionTime, NllRegionVariableOrigin};
use rustc_infer::traits::SelectionError;
Expand Down Expand Up @@ -658,25 +660,66 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {

/// Add a note to region errors and borrow explanations when higher-ranked regions in predicates
/// implicitly introduce an "outlives `'static`" constraint.
///
/// This is very similar to `fn suggest_static_lifetime_for_gat_from_hrtb` which handles this
/// note for failed type tests instead of outlives errors.
fn add_placeholder_from_predicate_note<G: EmissionGuarantee>(
&self,
err: &mut Diag<'_, G>,
diag: &mut Diag<'_, G>,
path: &[OutlivesConstraint<'tcx>],
) {
let predicate_span = path.iter().find_map(|constraint| {
let tcx = self.infcx.tcx;
let Some((gat_hir_id, generics)) = path.iter().find_map(|constraint| {
let outlived = constraint.sub;
if let Some(origin) = self.regioncx.definitions.get(outlived)
&& let NllRegionVariableOrigin::Placeholder(_) = origin.origin
&& let ConstraintCategory::Predicate(span) = constraint.category
&& let NllRegionVariableOrigin::Placeholder(placeholder) = origin.origin
&& let Some(id) = placeholder.bound.kind.get_id()
&& let Some(placeholder_id) = id.as_local()
&& let gat_hir_id = tcx.local_def_id_to_hir_id(placeholder_id)
&& let Some(generics_impl) =
tcx.parent_hir_node(tcx.parent_hir_id(gat_hir_id)).generics()
{
Some(span)
Some((gat_hir_id, generics_impl))
} else {
None
}
});
}) else {
return;
};

if let Some(span) = predicate_span {
err.span_note(span, "due to current limitations in the borrow checker, this implies a `'static` lifetime");
// Look for the where-bound which introduces the placeholder.
// As we're using the HIR, we need to handle both `for<'a> T: Trait<'a>`
// and `T: for<'a> Trait`<'a>.
for pred in generics.predicates {
let WherePredicateKind::BoundPredicate(WhereBoundPredicate {
bound_generic_params,
bounds,
..
}) = pred.kind
else {
continue;
};
if bound_generic_params
.iter()
.rfind(|bgp| tcx.local_def_id_to_hir_id(bgp.def_id) == gat_hir_id)
.is_some()
{
diag.span_note(pred.span, fluent::borrowck_limitations_implies_static);
return;
}
for bound in bounds.iter() {
if let GenericBound::Trait(bound) = bound {
if bound
.bound_generic_params
.iter()
.rfind(|bgp| tcx.local_def_id_to_hir_id(bgp.def_id) == gat_hir_id)
.is_some()
{
diag.span_note(bound.span, fluent::borrowck_limitations_implies_static);
return;
}
}
}
}
}

Expand Down
Loading
Loading