Skip to content

Rollup of 15 pull requests #145691

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

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9370440
stabilize `const_array_each_ref`
fee1-dead Jul 3, 2025
f4b3415
[Doc] Add links to the various collections
QnJ1c2kNCg Jul 31, 2025
e13e1e4
fix(debuginfo): handle false positives in overflow check
adwinwhite Aug 12, 2025
ee7627e
std_detect: RISC-V: implement implication to "C"
a4lg Aug 19, 2025
bfd5d59
Prevent impossible combinations in `ast::ModKind`.
nnethercote Aug 19, 2025
6a088fd
Defer tail call ret ty equality to check_tail_calls
compiler-errors Aug 19, 2025
555986d
Fix some doc typos
dns2utf8 Aug 19, 2025
5a451b8
Add new `--test-codegen-backend` bootstrap option
GuillaumeGomez Aug 11, 2025
e4cdc0f
Split compiletest `--codegen-backend` into two options `--default-cod…
GuillaumeGomez Aug 18, 2025
27e6726
Do not use effective_visibilities query for Adt types of a local trai…
xizheyin Aug 20, 2025
29f0d8b
Download CI GCC into the correct directory
Kobzol Aug 20, 2025
e1045c2
Fix JS search scripts path
GuillaumeGomez Aug 20, 2025
2da0ec3
Enforce correct number of arguments for `"x86-interrupt"` functions
GrigorenkoPV Aug 20, 2025
7d5c9ca
Consolidate panicking functions in `slice/index.rs`
Kmeakin Jul 25, 2025
992c025
Enable triagebot `[review-changes-since]` feature
Urgau Aug 20, 2025
f34fa22
fix: typo
ttajakka Aug 20, 2025
ecbb6c6
Rollup merge of #143383 - fee1-dead-contrib:push-mstmlwuskxyy, r=dtolnay
jhpratt Aug 21, 2025
9c48c72
Rollup merge of #144758 - QnJ1c2kNCg:master, r=Noratrieb
jhpratt Aug 21, 2025
389b96b
Rollup merge of #144915 - compiler-errors:tail-call-ret-ty-equality, …
jhpratt Aug 21, 2025
f1af532
Rollup merge of #145137 - Kmeakin:km/optimize-slice-index-panicking, …
jhpratt Aug 21, 2025
89fd59a
Rollup merge of #145256 - GuillaumeGomez:bootstrap-test-codegen-backe…
jhpratt Aug 21, 2025
e030808
Rollup merge of #145297 - adwinwhite:recursive-debuginfo, r=wesleywiser
jhpratt Aug 21, 2025
7eb8cd3
Rollup merge of #145415 - a4lg:riscv-implication-to-c, r=Amanieu
jhpratt Aug 21, 2025
dbc1e5c
Rollup merge of #145590 - nnethercote:ModKind-Inline, r=petrochenkov
jhpratt Aug 21, 2025
526686a
Rollup merge of #145621 - dns2utf8:fix_some_typos, r=petrochenkov
jhpratt Aug 21, 2025
6b2615e
Rollup merge of #145642 - xizheyin:145611, r=lcnr
jhpratt Aug 21, 2025
a885918
Rollup merge of #145650 - GuillaumeGomez:fix-js-search-scripts-path, …
jhpratt Aug 21, 2025
2d4db3c
Rollup merge of #145654 - Kobzol:gcc-ci-root, r=jieyouxu
jhpratt Aug 21, 2025
3e77b04
Rollup merge of #145662 - GrigorenkoPV:x86-interrupt, r=compiler-errors
jhpratt Aug 21, 2025
424180d
Rollup merge of #145674 - Urgau:triagebot-review-changes-since, r=Kobzol
jhpratt Aug 21, 2025
f250b8e
Rollup merge of #145678 - ttajakka:master, r=estebank
jhpratt Aug 21, 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
2 changes: 1 addition & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@ Language
- [Undeprecate lint `unstable_features` and make use of it in the compiler.](https://github.com/rust-lang/rust/pull/118639/)
- [Make inductive cycles in coherence ambiguous always.](https://github.com/rust-lang/rust/pull/118649/)
- [Get rid of type-driven traversal in const-eval interning](https://github.com/rust-lang/rust/pull/119044/),
only as a [future compatiblity lint](https://github.com/rust-lang/rust/pull/122204) for now.
only as a [future compatibility lint](https://github.com/rust-lang/rust/pull/122204) for now.
- [Deny braced macro invocations in let-else.](https://github.com/rust-lang/rust/pull/119062/)

<a id="1.77.0-Compiler"></a>
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3137,7 +3137,7 @@ impl FnRetTy {
#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, Walkable)]
pub enum Inline {
Yes,
No,
No { had_parse_error: Result<(), ErrorGuaranteed> },
}

/// Module item kind.
Expand All @@ -3147,7 +3147,7 @@ pub enum ModKind {
/// or with definition outlined to a separate file `mod foo;` and already loaded from it.
/// The inner span is from the first token past `{` to the last token until `}`,
/// or from the first to the last token in the loaded file.
Loaded(ThinVec<Box<Item>>, Inline, ModSpans, Result<(), ErrorGuaranteed>),
Loaded(ThinVec<Box<Item>>, Inline, ModSpans),
/// Module with definition outlined to a separate file `mod foo;` but not yet loaded from it.
Unloaded,
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
ItemKind::Mod(_, ident, mod_kind) => {
let ident = self.lower_ident(*ident);
match mod_kind {
ModKind::Loaded(items, _, spans, _) => {
ModKind::Loaded(items, _, spans) => {
hir::ItemKind::Mod(ident, self.lower_mod(items, spans))
}
ModKind::Unloaded => panic!("`mod` items should have been loaded by now"),
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_ast_passes/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ ast_passes_abi_must_not_have_return_type=
.note = functions with the {$abi} ABI cannot have a return type
.help = remove the return type
ast_passes_abi_x86_interrupt =
invalid signature for `extern "x86-interrupt"` function
.note = functions with the "x86-interrupt" ABI must be have either 1 or 2 parameters (but found {$param_count})
ast_passes_assoc_const_without_body =
associated constant in `impl` without body
.suggestion = provide a definition for the constant
Expand Down
13 changes: 12 additions & 1 deletion compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,17 @@ impl<'a> AstValidator<'a> {
if let InterruptKind::X86 = interrupt_kind {
// "x86-interrupt" is special because it does have arguments.
// FIXME(workingjubilee): properly lint on acceptable input types.
let inputs = &sig.decl.inputs;
let param_count = inputs.len();
if !matches!(param_count, 1 | 2) {
let mut spans: Vec<Span> =
inputs.iter().map(|arg| arg.span).collect();
if spans.is_empty() {
spans = vec![sig.span];
}
self.dcx().emit_err(errors::AbiX86Interrupt { spans, param_count });
}

if let FnRetTy::Ty(ref ret_ty) = sig.decl.output
&& match &ret_ty.kind {
TyKind::Never => false,
Expand Down Expand Up @@ -1169,7 +1180,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
self.dcx().emit_err(errors::UnsafeItem { span, kind: "module" });
}
// Ensure that `path` attributes on modules are recorded as used (cf. issue #35584).
if !matches!(mod_kind, ModKind::Loaded(_, Inline::Yes, _, _))
if !matches!(mod_kind, ModKind::Loaded(_, Inline::Yes, _))
&& !attr::contains_name(&item.attrs, sym::path)
{
self.check_mod_file_item_asciionly(*ident);
Expand Down
9 changes: 9 additions & 0 deletions compiler/rustc_ast_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -891,3 +891,12 @@ pub(crate) struct AbiMustNotHaveReturnType {
pub span: Span,
pub abi: ExternAbi,
}

#[derive(Diagnostic)]
#[diag(ast_passes_abi_x86_interrupt)]
#[note]
pub(crate) struct AbiX86Interrupt {
#[primary_span]
pub spans: Vec<Span>,
pub param_count: usize,
}
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1895,7 +1895,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
if !output_ty
.is_privately_uninhabited(self.tcx(), self.infcx.typing_env(self.infcx.param_env))
{
span_mirbug!(self, term, "call to converging function {:?} w/o dest", sig);
span_mirbug!(self, term, "call to non-diverging function {:?} w/o dest", sig);
}
} else {
let dest_ty = destination.ty(self.body, tcx).ty;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/test_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl<'a> MutVisitor for TestHarnessGenerator<'a> {
if let ast::ItemKind::Mod(
_,
_,
ModKind::Loaded(.., ast::ModSpans { inner_span: span, .. }, _),
ModKind::Loaded(.., ast::ModSpans { inner_span: span, .. }),
) = item.kind
{
let prev_tests = mem::take(&mut self.tests);
Expand Down
54 changes: 38 additions & 16 deletions compiler/rustc_codegen_llvm/src/debuginfo/metadata/type_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub(super) fn build_type_with_children<'ll, 'tcx>(
&& let ty::Adt(adt_def, args) = ty.kind()
{
let def_id = adt_def.did();
// If any sub type reference the original type definition and the sub type has a type
// If any child type references the original type definition and the child type has a type
// parameter that strictly contains the original parameter, the original type is a recursive
// type that can expanding indefinitely. Example,
// ```
Expand All @@ -285,21 +285,43 @@ pub(super) fn build_type_with_children<'ll, 'tcx>(
// Item(T),
// }
// ```
let is_expanding_recursive = adt_def.is_enum()
&& debug_context(cx).adt_stack.borrow().iter().any(|(parent_def_id, parent_args)| {
if def_id == *parent_def_id {
args.iter().zip(parent_args.iter()).any(|(arg, parent_arg)| {
if let (Some(arg), Some(parent_arg)) = (arg.as_type(), parent_arg.as_type())
{
arg != parent_arg && arg.contains(parent_arg)
} else {
false
}
})
} else {
false
}
});
let is_expanding_recursive = {
let stack = debug_context(cx).adt_stack.borrow();
stack
.iter()
.enumerate()
.rev()
.skip(1)
.filter(|(_, (ancestor_def_id, _))| def_id == *ancestor_def_id)
.any(|(ancestor_index, (_, ancestor_args))| {
args.iter()
.zip(ancestor_args.iter())
.filter_map(|(arg, ancestor_arg)| arg.as_type().zip(ancestor_arg.as_type()))
.any(|(arg, ancestor_arg)|
// Strictly contains.
(arg != ancestor_arg && arg.contains(ancestor_arg))
// Check all types between current and ancestor use the
// ancestor_arg.
// Otherwise, duplicate wrappers in normal recursive type may be
// regarded as expanding.
// ```
// struct Recursive {
// a: Box<Box<Recursive>>,
// }
// ```
// It can produce an ADT stack like this,
// - Box<Recursive>
// - Recursive
// - Box<Box<Recursive>>
&& stack[ancestor_index + 1..stack.len()].iter().all(
|(_, intermediate_args)|
intermediate_args
.iter()
.filter_map(|arg| arg.as_type())
.any(|mid_arg| mid_arg.contains(ancestor_arg))
))
})
};
if is_expanding_recursive {
// FIXME: indicate that this is an expanding recursive type in stub metadata?
return DINodeCreationResult::new(stub_info.metadata, false);
Expand Down
11 changes: 6 additions & 5 deletions compiler/rustc_expand/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,8 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
ItemKind::Mod(
_,
_,
ModKind::Unloaded | ModKind::Loaded(_, Inline::No, _, _),
ModKind::Unloaded
| ModKind::Loaded(_, Inline::No { .. }, _),
)
) =>
{
Expand Down Expand Up @@ -1035,7 +1036,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
fn visit_item(&mut self, item: &'ast ast::Item) {
match &item.kind {
ItemKind::Mod(_, _, mod_kind)
if !matches!(mod_kind, ModKind::Loaded(_, Inline::Yes, _, _)) =>
if !matches!(mod_kind, ModKind::Loaded(_, Inline::Yes, _)) =>
{
feature_err(
self.sess,
Expand Down Expand Up @@ -1346,7 +1347,7 @@ impl InvocationCollectorNode for Box<ast::Item> {
let ItemKind::Mod(_, ident, ref mut mod_kind) = node.kind else { unreachable!() };
let ecx = &mut collector.cx;
let (file_path, dir_path, dir_ownership) = match mod_kind {
ModKind::Loaded(_, inline, _, _) => {
ModKind::Loaded(_, inline, _) => {
// Inline `mod foo { ... }`, but we still need to push directories.
let (dir_path, dir_ownership) = mod_dir_path(
ecx.sess,
Expand All @@ -1360,7 +1361,7 @@ impl InvocationCollectorNode for Box<ast::Item> {
// This lets `parse_external_mod` catch cycles if it's self-referential.
let file_path = match inline {
Inline::Yes => None,
Inline::No => mod_file_path_from_attr(ecx.sess, &attrs, &dir_path),
Inline::No { .. } => mod_file_path_from_attr(ecx.sess, &attrs, &dir_path),
};
node.attrs = attrs;
(file_path, dir_path, dir_ownership)
Expand Down Expand Up @@ -1396,7 +1397,7 @@ impl InvocationCollectorNode for Box<ast::Item> {
);
}

*mod_kind = ModKind::Loaded(items, Inline::No, spans, had_parse_error);
*mod_kind = ModKind::Loaded(items, Inline::No { had_parse_error }, spans);
node.attrs = attrs;
if node.attrs.len() > old_attrs_len {
// If we loaded an out-of-line module and added some inner attributes,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub(crate) fn mod_dir_path(

(dir_path, dir_ownership)
}
Inline::No => {
Inline::No { .. } => {
// FIXME: This is a subset of `parse_external_mod` without actual parsing,
// check whether the logic for unloaded, loaded and inline modules can be unified.
let file_path = mod_file_path(sess, ident, attrs, &module.dir_path, dir_ownership)
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3097,7 +3097,7 @@ impl EarlyLintPass for SpecialModuleName {
if let ast::ItemKind::Mod(
_,
ident,
ast::ModKind::Unloaded | ast::ModKind::Loaded(_, ast::Inline::No, _, _),
ast::ModKind::Unloaded | ast::ModKind::Loaded(_, ast::Inline::No { .. }, _),
) = item.kind
{
if item.attrs.iter().any(|a| a.has_name(sym::path)) {
Expand Down
41 changes: 17 additions & 24 deletions compiler/rustc_mir_build/src/check_tail_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,30 +135,23 @@ impl<'tcx> TailCallCkVisitor<'_, 'tcx> {
self.report_abi_mismatch(expr.span, caller_sig.abi, callee_sig.abi);
}

// FIXME(explicit_tail_calls): this currently fails for cases where opaques are used.
// e.g.
// ```
// fn a() -> impl Sized { become b() } // ICE
// fn b() -> u8 { 0 }
// ```
// we should think what is the expected behavior here.
// (we should probably just accept this by revealing opaques?)
if caller_sig.inputs_and_output != callee_sig.inputs_and_output {
if caller_sig.inputs() != callee_sig.inputs() {
self.report_arguments_mismatch(
expr.span,
self.tcx.liberate_late_bound_regions(
CRATE_DEF_ID.to_def_id(),
self.caller_ty.fn_sig(self.tcx),
),
self.tcx
.liberate_late_bound_regions(CRATE_DEF_ID.to_def_id(), ty.fn_sig(self.tcx)),
);
}

// FIXME(explicit_tail_calls): this currently fails for cases where opaques are used.
// e.g.
// ```
// fn a() -> impl Sized { become b() } // ICE
// fn b() -> u8 { 0 }
// ```
// we should think what is the expected behavior here.
// (we should probably just accept this by revealing opaques?)
if caller_sig.output() != callee_sig.output() {
span_bug!(expr.span, "hir typeck should have checked the return type already");
}
self.report_signature_mismatch(
expr.span,
self.tcx.liberate_late_bound_regions(
CRATE_DEF_ID.to_def_id(),
self.caller_ty.fn_sig(self.tcx),
),
self.tcx.liberate_late_bound_regions(CRATE_DEF_ID.to_def_id(), ty.fn_sig(self.tcx)),
);
}

{
Expand Down Expand Up @@ -365,7 +358,7 @@ impl<'tcx> TailCallCkVisitor<'_, 'tcx> {
self.found_errors = Err(err);
}

fn report_arguments_mismatch(
fn report_signature_mismatch(
&mut self,
sp: Span,
caller_sig: ty::FnSig<'_>,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/parser/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<'a> Parser<'a> {
self.expect(exp!(OpenBrace))?;
let (inner_attrs, items, inner_span) = self.parse_mod(exp!(CloseBrace))?;
attrs.extend(inner_attrs);
ModKind::Loaded(items, Inline::Yes, inner_span, Ok(()))
ModKind::Loaded(items, Inline::Yes, inner_span)
};
Ok(ItemKind::Mod(safety, ident, mod_kind))
}
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_resolve/src/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::sync::Arc;
use rustc_ast::visit::{self, AssocCtxt, Visitor, WalkItemKind};
use rustc_ast::{
self as ast, AssocItem, AssocItemKind, Block, ConstItem, Delegation, Fn, ForeignItem,
ForeignItemKind, Item, ItemKind, NodeId, StaticItem, StmtKind, TyAlias,
ForeignItemKind, Inline, Item, ItemKind, NodeId, StaticItem, StmtKind, TyAlias,
};
use rustc_attr_parsing as attr;
use rustc_attr_parsing::AttributeParser;
Expand Down Expand Up @@ -813,7 +813,8 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
ItemKind::Mod(_, ident, ref mod_kind) => {
self.r.define_local(parent, ident, TypeNS, res, vis, sp, expansion);

if let ast::ModKind::Loaded(_, _, _, Err(_)) = mod_kind {
if let ast::ModKind::Loaded(_, Inline::No { had_parse_error: Err(_) }, _) = mod_kind
{
self.r.mods_with_parse_errors.insert(def_id);
}
self.parent_scope.module = self.r.new_local_module(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3410,7 +3410,7 @@ impl<'tcx> visit::Visitor<'tcx> for UsePlacementFinder {

fn visit_item(&mut self, item: &'tcx ast::Item) {
if self.target_module == item.id {
if let ItemKind::Mod(_, _, ModKind::Loaded(items, _inline, mod_spans, _)) = &item.kind {
if let ItemKind::Mod(_, _, ModKind::Loaded(items, _inline, mod_spans)) = &item.kind {
let inject = mod_spans.inject_use_span;
if is_span_suitable_for_use_injection(inject) {
self.first_legal_span = Some(inject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2878,7 +2878,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
// we check if `TraitB` can be reachable from `S`
// to determine whether to note `TraitA` is sealed trait.
if let ty::Adt(adt, _) = ty.kind() {
let visibilities = tcx.effective_visibilities(());
let visibilities = &tcx.resolutions(()).effective_visibilities;
visibilities.effective_vis(local).is_none_or(|v| {
v.at_level(Level::Reexported)
.is_accessible_from(adt.did(), tcx)
Expand Down
8 changes: 4 additions & 4 deletions library/core/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,11 +621,11 @@ impl<T, const N: usize> [T; N] {
/// assert_eq!(strings.len(), 3);
/// ```
#[stable(feature = "array_methods", since = "1.77.0")]
#[rustc_const_unstable(feature = "const_array_each_ref", issue = "133289")]
#[rustc_const_stable(feature = "const_array_each_ref", since = "CURRENT_RUSTC_VERSION")]
pub const fn each_ref(&self) -> [&T; N] {
let mut buf = [null::<T>(); N];

// FIXME(const-hack): We would like to simply use iterators for this (as in the original implementation), but this is not allowed in constant expressions.
// FIXME(const_trait_impl): We would like to simply use iterators for this (as in the original implementation), but this is not allowed in constant expressions.
let mut i = 0;
while i < N {
buf[i] = &raw const self[i];
Expand All @@ -652,11 +652,11 @@ impl<T, const N: usize> [T; N] {
/// assert_eq!(floats, [0.0, 2.7, -1.0]);
/// ```
#[stable(feature = "array_methods", since = "1.77.0")]
#[rustc_const_unstable(feature = "const_array_each_ref", issue = "133289")]
#[rustc_const_stable(feature = "const_array_each_ref", since = "CURRENT_RUSTC_VERSION")]
pub const fn each_mut(&mut self) -> [&mut T; N] {
let mut buf = [null_mut::<T>(); N];

// FIXME(const-hack): We would like to simply use iterators for this (as in the original implementation), but this is not allowed in constant expressions.
// FIXME(const_trait_impl): We would like to simply use iterators for this (as in the original implementation), but this is not allowed in constant expressions.
let mut i = 0;
while i < N {
buf[i] = &raw mut self[i];
Expand Down
Loading
Loading