Skip to content

Commit 96e9535

Browse files
committed
Auto merge of rust-lang#139838 - Zalathar:rollup-dxhgi8t, r=Zalathar
Rollup of 11 pull requests Successful merges: - rust-lang#139669 (Overhaul `AssocItem`) - rust-lang#139671 (Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file}) - rust-lang#139750 (std/thread: Use default stack size from menuconfig for NuttX) - rust-lang#139785 (Let CStrings be either 1 or 2 byte aligned.) - rust-lang#139797 (Allow (but don't require) `#[unsafe(naked)]` so that `compiler-builtins` can upgrade to it) - rust-lang#139798 (normalize: prefer `ParamEnv` over `AliasBound` candidates) - rust-lang#139799 (Specify `--print info=file` syntax in `--help`) - rust-lang#139811 (Use `newtype_index!`-generated types more idiomatically) - rust-lang#139813 (Miri subtree update) - rust-lang#139822 (Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix) - rust-lang#139836 (Basic tests of MPMC receiver cloning) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 2da29db + 55d9581 commit 96e9535

File tree

139 files changed

+944
-889
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+944
-889
lines changed

Diff for: Cargo.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -2038,19 +2038,19 @@ dependencies = [
20382038

20392039
[[package]]
20402040
name = "libffi"
2041-
version = "3.2.0"
2041+
version = "4.0.0"
20422042
source = "registry+https://github.com/rust-lang/crates.io-index"
2043-
checksum = "ce826c243048e3d5cec441799724de52e2d42f820468431fc3fceee2341871e2"
2043+
checksum = "4a9434b6fc77375fb624698d5f8c49d7e80b10d59eb1219afda27d1f824d4074"
20442044
dependencies = [
20452045
"libc",
20462046
"libffi-sys",
20472047
]
20482048

20492049
[[package]]
20502050
name = "libffi-sys"
2051-
version = "2.3.0"
2051+
version = "3.2.0"
20522052
source = "registry+https://github.com/rust-lang/crates.io-index"
2053-
checksum = "f36115160c57e8529781b4183c2bb51fdc1f6d6d1ed345591d84be7703befb3c"
2053+
checksum = "ead36a2496acfc8edd6cc32352110e9478ac5b9b5f5b9856ebd3d28019addb84"
20542054
dependencies = [
20552055
"cc",
20562056
]

Diff for: compiler/rustc_ast_lowering/src/delegation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
8585
.delegation_fn_sigs
8686
.get(&local_def_id)
8787
.is_some_and(|sig| sig.has_self),
88-
None => self.tcx.associated_item(def_id).fn_has_self_parameter,
88+
None => self.tcx.associated_item(def_id).is_method(),
8989
},
9090
_ => span_bug!(span, "unexpected DefKind for delegation item"),
9191
}

Diff for: compiler/rustc_ast_lowering/src/path.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
448448

449449
generic_args.args.insert_many(
450450
0,
451-
(start.as_u32()..end.as_u32()).map(|i| {
452-
let id = NodeId::from_u32(i);
451+
(start..end).map(|id| {
453452
let l = self.lower_lifetime_anon_in_path(id, elided_lifetime_span);
454453
GenericArg::Lifetime(l)
455454
}),

Diff for: compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
647647
&& tc.polarity() == ty::PredicatePolarity::Positive
648648
&& supertrait_def_ids(tcx, tc.def_id())
649649
.flat_map(|trait_did| tcx.associated_items(trait_did).in_definition_order())
650-
.any(|item| item.fn_has_self_parameter)
650+
.any(|item| item.is_method())
651651
})
652652
}) {
653653
return None;

Diff for: compiler/rustc_borrowck/src/region_infer/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,7 @@ fn sccs_info<'tcx>(infcx: &BorrowckInferCtxt<'tcx>, sccs: &ConstraintSccs) {
338338
let num_components = sccs.num_sccs();
339339
let mut components = vec![FxIndexSet::default(); num_components];
340340

341-
for (reg_var_idx, scc_idx) in sccs.scc_indices().iter().enumerate() {
342-
let reg_var = ty::RegionVid::from_usize(reg_var_idx);
341+
for (reg_var, scc_idx) in sccs.scc_indices().iter_enumerated() {
343342
let origin = var_to_origin.get(&reg_var).unwrap_or(&RegionCtxt::Unknown);
344343
components[scc_idx.as_usize()].insert((reg_var, *origin));
345344
}

Diff for: compiler/rustc_codegen_cranelift/src/main_shim.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
22
use rustc_hir::LangItem;
3-
use rustc_middle::ty::{AssocKind, GenericArg};
3+
use rustc_middle::ty::{AssocTag, GenericArg};
44
use rustc_session::config::EntryFnType;
55
use rustc_span::{DUMMY_SP, Ident};
66

@@ -107,7 +107,7 @@ pub(crate) fn maybe_create_entry_wrapper(
107107
.find_by_ident_and_kind(
108108
tcx,
109109
Ident::from_str("report"),
110-
AssocKind::Fn,
110+
AssocTag::Fn,
111111
termination_trait,
112112
)
113113
.unwrap();

Diff for: compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::collections::hash_map::Entry;
33
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext};
44
use rustc_codegen_ssa::traits::*;
55
use rustc_data_structures::fx::FxHashMap;
6-
use rustc_index::Idx;
76
use rustc_index::bit_set::DenseBitSet;
87
use rustc_middle::mir::{Body, SourceScope};
98
use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv};
@@ -43,8 +42,7 @@ pub(crate) fn compute_mir_scopes<'ll, 'tcx>(
4342
let mut instantiated = DenseBitSet::new_empty(mir.source_scopes.len());
4443
let mut discriminators = FxHashMap::default();
4544
// Instantiate all scopes.
46-
for idx in 0..mir.source_scopes.len() {
47-
let scope = SourceScope::new(idx);
45+
for scope in mir.source_scopes.indices() {
4846
make_mir_scope(
4947
cx,
5048
instance,

Diff for: compiler/rustc_expand/src/proc_macro_server.rs

+24-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::ops::{Bound, Range};
2-
use std::sync::Arc;
32

43
use ast::token::IdentIsRaw;
54
use pm::bridge::{
@@ -18,7 +17,7 @@ use rustc_parse::parser::Parser;
1817
use rustc_parse::{exp, new_parser_from_source_str, source_str_to_stream, unwrap_or_emit_fatal};
1918
use rustc_session::parse::ParseSess;
2019
use rustc_span::def_id::CrateNum;
21-
use rustc_span::{BytePos, FileName, Pos, SourceFile, Span, Symbol, sym};
20+
use rustc_span::{BytePos, FileName, Pos, Span, Symbol, sym};
2221
use smallvec::{SmallVec, smallvec};
2322

2423
use crate::base::ExtCtxt;
@@ -458,7 +457,6 @@ impl<'a, 'b> Rustc<'a, 'b> {
458457
impl server::Types for Rustc<'_, '_> {
459458
type FreeFunctions = FreeFunctions;
460459
type TokenStream = TokenStream;
461-
type SourceFile = Arc<SourceFile>;
462460
type Span = Span;
463461
type Symbol = Symbol;
464462
}
@@ -664,28 +662,6 @@ impl server::TokenStream for Rustc<'_, '_> {
664662
}
665663
}
666664

667-
impl server::SourceFile for Rustc<'_, '_> {
668-
fn eq(&mut self, file1: &Self::SourceFile, file2: &Self::SourceFile) -> bool {
669-
Arc::ptr_eq(file1, file2)
670-
}
671-
672-
fn path(&mut self, file: &Self::SourceFile) -> String {
673-
match &file.name {
674-
FileName::Real(name) => name
675-
.local_path()
676-
.expect("attempting to get a file path in an imported file in `proc_macro::SourceFile::path`")
677-
.to_str()
678-
.expect("non-UTF8 file path in `proc_macro::SourceFile::path`")
679-
.to_string(),
680-
_ => file.name.prefer_local().to_string(),
681-
}
682-
}
683-
684-
fn is_real(&mut self, file: &Self::SourceFile) -> bool {
685-
file.is_real_file()
686-
}
687-
}
688-
689665
impl server::Span for Rustc<'_, '_> {
690666
fn debug(&mut self, span: Self::Span) -> String {
691667
if self.ecx.ecfg.span_debug {
@@ -695,8 +671,29 @@ impl server::Span for Rustc<'_, '_> {
695671
}
696672
}
697673

698-
fn source_file(&mut self, span: Self::Span) -> Self::SourceFile {
699-
self.psess().source_map().lookup_char_pos(span.lo()).file
674+
fn file(&mut self, span: Self::Span) -> String {
675+
self.psess()
676+
.source_map()
677+
.lookup_char_pos(span.lo())
678+
.file
679+
.name
680+
.prefer_remapped_unconditionaly()
681+
.to_string()
682+
}
683+
684+
fn local_file(&mut self, span: Self::Span) -> Option<String> {
685+
self.psess()
686+
.source_map()
687+
.lookup_char_pos(span.lo())
688+
.file
689+
.name
690+
.clone()
691+
.into_local_path()
692+
.map(|p| {
693+
p.to_str()
694+
.expect("non-UTF8 file path in `proc_macro::SourceFile::path`")
695+
.to_string()
696+
})
700697
}
701698

702699
fn parent(&mut self, span: Self::Span) -> Option<Self::Span> {

Diff for: compiler/rustc_fluent_macro/src/fluent.rs

+3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ fn invocation_relative_path_to_absolute(span: Span, path: &str) -> PathBuf {
2525
path.to_path_buf()
2626
} else {
2727
// `/a/b/c/foo/bar.rs` contains the current macro invocation
28+
#[cfg(bootstrap)]
2829
let mut source_file_path = span.source_file().path();
30+
#[cfg(not(bootstrap))]
31+
let mut source_file_path = span.local_file().unwrap();
2932
// `/a/b/c/foo/`
3033
source_file_path.pop();
3134
// `/a/b/c/foo/../locales/en-US/example.ftl`

Diff for: compiler/rustc_hir/src/definitions.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,9 @@ impl DefPathTable {
4747
debug_assert_eq!(self.stable_crate_id, def_path_hash.stable_crate_id());
4848
let local_hash = def_path_hash.local_hash();
4949

50-
let index = {
51-
let index = DefIndex::from(self.index_to_key.len());
52-
debug!("DefPathTable::insert() - {:?} <-> {:?}", key, index);
53-
self.index_to_key.push(key);
54-
index
55-
};
50+
let index = self.index_to_key.push(key);
51+
debug!("DefPathTable::insert() - {key:?} <-> {index:?}");
52+
5653
self.def_path_hashes.push(local_hash);
5754
debug_assert!(self.def_path_hashes.len() == self.index_to_key.len());
5855

Diff for: compiler/rustc_hir_analysis/src/check/check.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -443,13 +443,13 @@ fn best_definition_site_of_opaque<'tcx>(
443443
let impl_def_id = tcx.local_parent(parent);
444444
for assoc in tcx.associated_items(impl_def_id).in_definition_order() {
445445
match assoc.kind {
446-
ty::AssocKind::Const | ty::AssocKind::Fn => {
446+
ty::AssocKind::Const { .. } | ty::AssocKind::Fn { .. } => {
447447
if let ControlFlow::Break(span) = locator.check(assoc.def_id.expect_local())
448448
{
449449
return Some(span);
450450
}
451451
}
452-
ty::AssocKind::Type => {}
452+
ty::AssocKind::Type { .. } => {}
453453
}
454454
}
455455

@@ -740,7 +740,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
740740

741741
for &assoc_item in assoc_items.in_definition_order() {
742742
match assoc_item.kind {
743-
ty::AssocKind::Type if assoc_item.defaultness(tcx).has_value() => {
743+
ty::AssocKind::Type { .. } if assoc_item.defaultness(tcx).has_value() => {
744744
let trait_args = GenericArgs::identity_for_item(tcx, def_id);
745745
let _: Result<_, rustc_errors::ErrorGuaranteed> = check_type_bounds(
746746
tcx,
@@ -942,7 +942,7 @@ fn check_impl_items_against_trait<'tcx>(
942942

943943
if res.is_ok() {
944944
match ty_impl_item.kind {
945-
ty::AssocKind::Fn => {
945+
ty::AssocKind::Fn { .. } => {
946946
compare_impl_item::refine::check_refining_return_position_impl_trait_in_trait(
947947
tcx,
948948
ty_impl_item,
@@ -952,8 +952,8 @@ fn check_impl_items_against_trait<'tcx>(
952952
.instantiate_identity(),
953953
);
954954
}
955-
ty::AssocKind::Const => {}
956-
ty::AssocKind::Type => {}
955+
ty::AssocKind::Const { .. } => {}
956+
ty::AssocKind::Type { .. } => {}
957957
}
958958
}
959959

0 commit comments

Comments
 (0)