Skip to content

Rollup of 7 pull requests #139634

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 29 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
92e6f08
Refactor `Handle` slightly
CraftSpider Dec 2, 2024
6f55015
fix "still mutable" ice while metrics are enabled
yaahc Apr 7, 2025
209ce59
Implement trivial file operations - opening and closing handles. Just…
CraftSpider Dec 2, 2024
6c619bb
Merge pull request #4067 from CraftSpider/windows-metadata
RalfJung Apr 9, 2025
57c2a02
triagebot: enable `[canonicalize-issue-links]` and `[no-mentions]`
Urgau Apr 9, 2025
d0ea07e
Merge pull request #4259 from Urgau/triagebot-new-feat
oli-obk Apr 9, 2025
1b3fc58
Rename some `name` variables as `ident`.
nnethercote Apr 8, 2025
663a317
Address review comments.
nnethercote Apr 9, 2025
4f7c02d
compiletest: don't use stringly paths for `compose_and_run`
jieyouxu Apr 10, 2025
3cb9966
Add a HIR pretty printing test for delegation.
nnethercote Apr 10, 2025
9bb1008
Avoid empty identifiers for delegate params and args.
nnethercote Apr 10, 2025
726e33f
path: add more Windows tests
RalfJung Apr 10, 2025
59a1f33
compiletest: update to Edition 2024
jieyouxu Apr 10, 2025
88a82be
feature: implement WAIT & WAKE operations of FreeBSD _umtx_op syscall…
LorrensP-2158466 Feb 25, 2025
fb30824
Merge pull request #4209 from LorrensP-2158466/freebsd_futex
RalfJung Apr 10, 2025
95613e3
Remove unnecessary `mut`.
m-ou-se Apr 10, 2025
dc3843b
make GetFullPathNameW more correct on non-Windows hosts
RalfJung Apr 10, 2025
7da4440
Merge pull request #4262 from RalfJung/win-path
RalfJung Apr 10, 2025
830c58b
Preparing for merge from rustc
RalfJung Apr 10, 2025
f69ea4d
Merge from rustc
RalfJung Apr 10, 2025
1347cc8
Merge pull request #4264 from RalfJung/rustup
RalfJung Apr 10, 2025
955d92f
update lockfile
RalfJung Apr 10, 2025
0e9c4fb
Rollup merge of #139502 - yaahc:still-mutable-ice, r=bjorn3
matthiaskrgr Apr 10, 2025
79f357e
Rollup merge of #139510 - nnethercote:name-to-ident, r=fee1-dead
matthiaskrgr Apr 10, 2025
af3b892
Rollup merge of #139606 - jieyouxu:compiletest-edition2024, r=compile…
matthiaskrgr Apr 10, 2025
362c0f2
Rollup merge of #139609 - jieyouxu:compiletest-path-misc, r=Kobzol
matthiaskrgr Apr 10, 2025
7fbd7bd
Rollup merge of #139614 - nnethercote:fix-139512, r=oli-obk
matthiaskrgr Apr 10, 2025
9b9d098
Rollup merge of #139626 - m-ou-se:mut, r=lqd
matthiaskrgr Apr 10, 2025
c9613f8
Rollup merge of #139630 - RalfJung:miri-sync, r=RalfJung
matthiaskrgr Apr 10, 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: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2312,6 +2312,7 @@ name = "miri"
version = "0.1.0"
dependencies = [
"aes",
"bitflags",
"chrono",
"chrono-tz",
"colored",
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast/src/expand/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ pub mod typetree;
#[derive(Debug, Clone, Encodable, Decodable, HashStable_Generic)]
pub struct StrippedCfgItem<ModId = DefId> {
pub parent_module: ModId,
pub name: Ident,
pub ident: Ident,
pub cfg: MetaItem,
}

impl<ModId> StrippedCfgItem<ModId> {
pub fn map_mod_id<New>(self, f: impl FnOnce(ModId) -> New) -> StrippedCfgItem<New> {
StrippedCfgItem { parent_module: f(self.parent_module), name: self.name, cfg: self.cfg }
StrippedCfgItem { parent_module: f(self.parent_module), ident: self.ident, cfg: self.cfg }
}
}
15 changes: 8 additions & 7 deletions compiler/rustc_ast_lowering/src/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use rustc_errors::ErrorGuaranteed;
use rustc_hir::def_id::DefId;
use rustc_middle::span_bug;
use rustc_middle::ty::{Asyncness, ResolverAstLowering};
use rustc_span::{Ident, Span};
use rustc_span::{Ident, Span, Symbol};
use {rustc_ast as ast, rustc_hir as hir};

use super::{GenericArgsMode, ImplTraitContext, LoweringContext, ParamMode};
Expand Down Expand Up @@ -234,22 +234,23 @@ impl<'hir> LoweringContext<'_, 'hir> {
hir::FnSig { decl, header, span }
}

fn generate_param(&mut self, span: Span) -> (hir::Param<'hir>, NodeId) {
fn generate_param(&mut self, idx: usize, span: Span) -> (hir::Param<'hir>, NodeId) {
let pat_node_id = self.next_node_id();
let pat_id = self.lower_node_id(pat_node_id);
let ident = Ident::with_dummy_span(Symbol::intern(&format!("arg{idx}")));
let pat = self.arena.alloc(hir::Pat {
hir_id: pat_id,
kind: hir::PatKind::Binding(hir::BindingMode::NONE, pat_id, Ident::empty(), None),
kind: hir::PatKind::Binding(hir::BindingMode::NONE, pat_id, ident, None),
span,
default_binding_modes: false,
});

(hir::Param { hir_id: self.next_id(), pat, ty_span: span, span }, pat_node_id)
}

fn generate_arg(&mut self, param_id: HirId, span: Span) -> hir::Expr<'hir> {
fn generate_arg(&mut self, idx: usize, param_id: HirId, span: Span) -> hir::Expr<'hir> {
let segments = self.arena.alloc_from_iter(iter::once(hir::PathSegment {
ident: Ident::empty(),
ident: Ident::with_dummy_span(Symbol::intern(&format!("arg{idx}"))),
hir_id: self.next_id(),
res: Res::Local(param_id),
args: None,
Expand All @@ -273,7 +274,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let mut args: Vec<hir::Expr<'_>> = Vec::with_capacity(param_count);

for idx in 0..param_count {
let (param, pat_node_id) = this.generate_param(span);
let (param, pat_node_id) = this.generate_param(idx, span);
parameters.push(param);

let arg = if let Some(block) = block
Expand All @@ -289,7 +290,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
this.ident_and_label_to_local_id.insert(pat_node_id, param.pat.hir_id.local_id);
this.lower_target_expr(&block)
} else {
this.generate_arg(param.pat.hir_id, span)
this.generate_arg(idx, param.pat.hir_id, span)
};
args.push(arg);
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
(
// Disallow `impl Trait` in foreign items.
this.lower_fn_decl(fdec, i.id, sig.span, FnDeclKind::ExternFn, None),
this.lower_fn_params_to_names(fdec),
this.lower_fn_params_to_idents(fdec),
)
});

Expand Down Expand Up @@ -833,7 +833,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
}) => {
// FIXME(contracts): Deny contract here since it won't apply to
// any impl method or callees.
let names = self.lower_fn_params_to_names(&sig.decl);
let idents = self.lower_fn_params_to_idents(&sig.decl);
let (generics, sig) = self.lower_method_sig(
generics,
sig,
Expand All @@ -851,7 +851,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
(
*ident,
generics,
hir::TraitItemKind::Fn(sig, hir::TraitFn::Required(names)),
hir::TraitItemKind::Fn(sig, hir::TraitFn::Required(idents)),
false,
)
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
safety: self.lower_safety(f.safety, hir::Safety::Safe),
abi: self.lower_extern(f.ext),
decl: self.lower_fn_decl(&f.decl, t.id, t.span, FnDeclKind::Pointer, None),
param_names: self.lower_fn_params_to_names(&f.decl),
param_idents: self.lower_fn_params_to_idents(&f.decl),
}))
}
TyKind::UnsafeBinder(f) => {
Expand Down Expand Up @@ -1494,7 +1494,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
}))
}

fn lower_fn_params_to_names(&mut self, decl: &FnDecl) -> &'hir [Option<Ident>] {
fn lower_fn_params_to_idents(&mut self, decl: &FnDecl) -> &'hir [Option<Ident>] {
self.arena.alloc_from_iter(decl.inputs.iter().map(|param| match param.pat.kind {
PatKind::Missing => None,
PatKind::Ident(_, ident, _) => Some(self.lower_ident(ident)),
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_pretty/src/pprust/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use super::*;
fn fun_to_string(
decl: &ast::FnDecl,
header: ast::FnHeader,
name: Ident,
ident: Ident,
generics: &ast::Generics,
) -> String {
to_string(|s| {
s.head("");
s.print_fn(decl, header, Some(name), generics);
s.print_fn(decl, header, Some(ident), generics);
s.end(); // Close the head box.
s.end(); // Close the outer box.
})
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2500,11 +2500,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
);
let ty::Tuple(params) = tupled_params.kind() else { return };

// Find the first argument with a matching type, get its name
let Some(this_name) = params.iter().zip(tcx.hir_body_param_names(closure.body)).find_map(
|(param_ty, name)| {
// Find the first argument with a matching type and get its identifier.
let Some(this_name) = params.iter().zip(tcx.hir_body_param_idents(closure.body)).find_map(
|(param_ty, ident)| {
// FIXME: also support deref for stuff like `Rc` arguments
if param_ty.peel_refs() == local_ty { name } else { None }
if param_ty.peel_refs() == local_ty { ident } else { None }
},
) else {
return;
Expand Down Expand Up @@ -3774,7 +3774,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
method_args,
*fn_span,
call_source.from_hir_call(),
self.infcx.tcx.fn_arg_names(method_did)[0],
self.infcx.tcx.fn_arg_idents(method_did)[0],
)
{
err.note(format!("borrow occurs due to deref coercion to `{deref_target_ty}`"));
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
method_args,
*fn_span,
call_source.from_hir_call(),
self.infcx.tcx.fn_arg_names(method_did)[0],
self.infcx.tcx.fn_arg_idents(method_did)[0],
);

return FnSelfUse {
Expand Down
24 changes: 12 additions & 12 deletions compiler/rustc_builtin_macros/src/proc_macro_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ use crate::errors;
struct ProcMacroDerive {
id: NodeId,
trait_name: Symbol,
function_name: Ident,
function_ident: Ident,
span: Span,
attrs: Vec<Symbol>,
}

struct ProcMacroDef {
id: NodeId,
function_name: Ident,
function_ident: Ident,
span: Span,
}

Expand Down Expand Up @@ -95,7 +95,7 @@ impl<'a> CollectProcMacros<'a> {
fn collect_custom_derive(
&mut self,
item: &'a ast::Item,
function_name: Ident,
function_ident: Ident,
attr: &'a ast::Attribute,
) {
let Some((trait_name, proc_attrs)) =
Expand All @@ -109,7 +109,7 @@ impl<'a> CollectProcMacros<'a> {
id: item.id,
span: item.span,
trait_name,
function_name,
function_ident,
attrs: proc_attrs,
}));
} else {
Expand All @@ -123,12 +123,12 @@ impl<'a> CollectProcMacros<'a> {
}
}

fn collect_attr_proc_macro(&mut self, item: &'a ast::Item, function_name: Ident) {
fn collect_attr_proc_macro(&mut self, item: &'a ast::Item, function_ident: Ident) {
if self.in_root && item.vis.kind.is_pub() {
self.macros.push(ProcMacro::Attr(ProcMacroDef {
id: item.id,
span: item.span,
function_name,
function_ident,
}));
} else {
let msg = if !self.in_root {
Expand All @@ -141,12 +141,12 @@ impl<'a> CollectProcMacros<'a> {
}
}

fn collect_bang_proc_macro(&mut self, item: &'a ast::Item, function_name: Ident) {
fn collect_bang_proc_macro(&mut self, item: &'a ast::Item, function_ident: Ident) {
if self.in_root && item.vis.kind.is_pub() {
self.macros.push(ProcMacro::Bang(ProcMacroDef {
id: item.id,
span: item.span,
function_name,
function_ident,
}));
} else {
let msg = if !self.in_root {
Expand Down Expand Up @@ -303,7 +303,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
ProcMacro::Derive(m) => m.span,
ProcMacro::Attr(m) | ProcMacro::Bang(m) => m.span,
};
let local_path = |cx: &ExtCtxt<'_>, name| cx.expr_path(cx.path(span, vec![name]));
let local_path = |cx: &ExtCtxt<'_>, ident| cx.expr_path(cx.path(span, vec![ident]));
let proc_macro_ty_method_path = |cx: &ExtCtxt<'_>, method| {
cx.expr_path(cx.path(
span.with_ctxt(harness_span.ctxt()),
Expand All @@ -327,7 +327,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
.map(|&s| cx.expr_str(span, s))
.collect::<ThinVec<_>>(),
),
local_path(cx, cd.function_name),
local_path(cx, cd.function_ident),
],
)
}
Expand All @@ -345,8 +345,8 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
harness_span,
proc_macro_ty_method_path(cx, ident),
thin_vec![
cx.expr_str(span, ca.function_name.name),
local_path(cx, ca.function_name),
cx.expr_str(span, ca.function_ident.name),
local_path(cx, ca.function_ident),
],
)
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/main_shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub(crate) fn maybe_create_entry_wrapper(
let termination_trait = tcx.require_lang_item(LangItem::Termination, None);
let report = tcx
.associated_items(termination_trait)
.find_by_name_and_kind(
.find_by_ident_and_kind(
tcx,
Ident::from_str("report"),
AssocKind::Fn,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/src/sync/freeze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl<T> FreezeLock<T> {
#[inline]
#[track_caller]
pub fn write(&self) -> FreezeWriteGuard<'_, T> {
self.try_write().expect("still mutable")
self.try_write().expect("data should not be frozen if we're still attempting to mutate it")
}

#[inline]
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,6 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
// Make sure name resolution and macro expansion is run.
let _ = tcx.resolver_for_lowering();

if let Some(metrics_dir) = &sess.opts.unstable_opts.metrics_dir {
dump_feature_usage_metrics(tcx, metrics_dir);
}

if callbacks.after_expansion(compiler, tcx) == Compilation::Stop {
return early_exit();
}
Expand All @@ -370,6 +366,10 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))

tcx.ensure_ok().analysis(());

if let Some(metrics_dir) = &sess.opts.unstable_opts.metrics_dir {
dump_feature_usage_metrics(tcx, metrics_dir);
}

if callbacks.after_analysis(compiler, tcx) == Compilation::Stop {
return early_exit();
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ pub trait ResolverExpand {
/// HIR proc macros items back to their harness items.
fn declare_proc_macro(&mut self, id: NodeId);

fn append_stripped_cfg_item(&mut self, parent_node: NodeId, name: Ident, cfg: ast::MetaItem);
fn append_stripped_cfg_item(&mut self, parent_node: NodeId, ident: Ident, cfg: ast::MetaItem);

/// Tools registered with `#![register_tool]` and used by tool attributes and lints.
fn registered_tools(&self) -> &RegisteredTools;
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_expand/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1169,9 +1169,9 @@ trait InvocationCollectorNode: HasAttrs + HasNodeId + Sized {
collector.cx.dcx().emit_err(RemoveNodeNotSupported { span, descr: Self::descr() });
}

/// All of the names (items) declared by this node.
/// All of the identifiers (items) declared by this node.
/// This is an approximation and should only be used for diagnostics.
fn declared_names(&self) -> Vec<Ident> {
fn declared_idents(&self) -> Vec<Ident> {
vec![]
}
}
Expand Down Expand Up @@ -1306,7 +1306,7 @@ impl InvocationCollectorNode for P<ast::Item> {
res
}

fn declared_names(&self) -> Vec<Ident> {
fn declared_idents(&self) -> Vec<Ident> {
if let ItemKind::Use(ut) = &self.kind {
fn collect_use_tree_leaves(ut: &ast::UseTree, idents: &mut Vec<Ident>) {
match &ut.kind {
Expand Down Expand Up @@ -2061,10 +2061,10 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
}

if let Some(meta_item) = meta_item {
for name in node.declared_names() {
for ident in node.declared_idents() {
self.cx.resolver.append_stripped_cfg_item(
self.cx.current_expansion.lint_node_id,
name,
ident,
meta_item.clone(),
)
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3399,9 +3399,9 @@ pub struct BareFnTy<'hir> {
pub abi: ExternAbi,
pub generic_params: &'hir [GenericParam<'hir>],
pub decl: &'hir FnDecl<'hir>,
// `Option` because bare fn parameter names are optional. We also end up
// `Option` because bare fn parameter identifiers are optional. We also end up
// with `None` in some error cases, e.g. invalid parameter patterns.
pub param_names: &'hir [Option<Ident>],
pub param_idents: &'hir [Option<Ident>],
}

#[derive(Debug, Clone, Copy, HashStable_Generic)]
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_hir/src/intravisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,10 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(
try_visit!(visitor.visit_ident(foreign_item.ident));

match foreign_item.kind {
ForeignItemKind::Fn(ref sig, param_names, ref generics) => {
ForeignItemKind::Fn(ref sig, param_idents, ref generics) => {
try_visit!(visitor.visit_generics(generics));
try_visit!(visitor.visit_fn_decl(sig.decl));
for ident in param_names.iter().copied() {
for ident in param_idents.iter().copied() {
visit_opt!(visitor, visit_ident, ident);
}
}
Expand Down Expand Up @@ -1169,9 +1169,9 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(
try_visit!(visitor.visit_ty_unambig(ty));
visit_opt!(visitor, visit_nested_body, default);
}
TraitItemKind::Fn(ref sig, TraitFn::Required(param_names)) => {
TraitItemKind::Fn(ref sig, TraitFn::Required(param_idents)) => {
try_visit!(visitor.visit_fn_decl(sig.decl));
for ident in param_names.iter().copied() {
for ident in param_idents.iter().copied() {
visit_opt!(visitor, visit_ident, ident);
}
}
Expand Down
Loading
Loading