Skip to content

Commit 8e3b6f6

Browse files
committed
Auto merge of rust-lang#138337 - jieyouxu:rollup-bcp7xvg, r=jieyouxu
Rollup of 18 pull requests Successful merges: - rust-lang#126856 (remove deprecated tool `rls`) - rust-lang#137314 (change definitely unproductive cycles to error) - rust-lang#137504 (Move methods from Map to TyCtxt, part 4.) - rust-lang#137701 (Convert `ShardedHashMap` to use `hashbrown::HashTable`) - rust-lang#137967 ([AIX] Fix hangs during testing) - rust-lang#138002 (Disable CFI for weakly linked syscalls) - rust-lang#138052 (strip `-Wlinker-messages` wrappers from `rust-lld` rmake test) - rust-lang#138063 (Improve `-Zunpretty=hir` for parsed attrs) - rust-lang#138109 (make precise capturing args in rustdoc Json typed) - rust-lang#138147 (Add maintainers for powerpc64le-unknown-linux-gnu) - rust-lang#138245 (stabilize `ci_rustc_if_unchanged_logic` test for local environments) - rust-lang#138296 (Remove `AdtFlags::IS_ANONYMOUS` and `Copy`/`Clone` condition for anonymous ADT) - rust-lang#138300 (add tracking issue for unqualified_local_imports) - rust-lang#138307 (Allow specifying glob patterns for try jobs) - rust-lang#138313 (Update books) - rust-lang#138315 (use next_back() instead of last() on DoubleEndedIterator) - rust-lang#138318 (Rustdoc: remove a bunch of `@ts-expect-error` from main.js) - rust-lang#138330 (Remove unnecessary `[lints.rust]` sections.) Failed merges: - rust-lang#137147 (Add exclude to config.toml) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 374ce1f + a6bf2ae commit 8e3b6f6

File tree

226 files changed

+1498
-1296
lines changed

Some content is hidden

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

226 files changed

+1498
-1296
lines changed

Cargo.lock

+2-7
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,7 @@ version = "0.15.2"
14911491
source = "registry+https://github.com/rust-lang/crates.io-index"
14921492
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
14931493
dependencies = [
1494+
"allocator-api2",
14941495
"foldhash",
14951496
"serde",
14961497
]
@@ -3044,13 +3045,6 @@ dependencies = [
30443045
"serde",
30453046
]
30463047

3047-
[[package]]
3048-
name = "rls"
3049-
version = "2.0.0"
3050-
dependencies = [
3051-
"serde_json",
3052-
]
3053-
30543048
[[package]]
30553049
name = "run_make_support"
30563050
version = "0.2.0"
@@ -3492,6 +3486,7 @@ dependencies = [
34923486
"either",
34933487
"elsa",
34943488
"ena",
3489+
"hashbrown 0.15.2",
34953490
"indexmap",
34963491
"jobserver",
34973492
"libc",

Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ members = [
2424
"src/tools/remote-test-server",
2525
"src/tools/rust-installer",
2626
"src/tools/rustdoc",
27-
"src/tools/rls",
2827
"src/tools/rustfmt",
2928
"src/tools/miri",
3029
"src/tools/miri/cargo-miri",

compiler/rustc_attr_data_structures/src/lib.rs

+30-22
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,39 @@ pub trait HashStableContext: rustc_ast::HashStableContext + rustc_abi::HashStabl
3535
/// like [`Span`]s and empty tuples, are gracefully skipped so they don't clutter the
3636
/// representation much.
3737
pub trait PrintAttribute {
38-
fn print_something(&self) -> bool;
38+
/// Whether or not this will render as something meaningful, or if it's skipped
39+
/// (which will force the containing struct to also skip printing a comma
40+
/// and the field name).
41+
fn should_render(&self) -> bool;
42+
3943
fn print_attribute(&self, p: &mut Printer);
4044
}
4145

4246
impl<T: PrintAttribute> PrintAttribute for &T {
43-
fn print_something(&self) -> bool {
44-
T::print_something(self)
47+
fn should_render(&self) -> bool {
48+
T::should_render(self)
4549
}
4650

4751
fn print_attribute(&self, p: &mut Printer) {
4852
T::print_attribute(self, p)
4953
}
5054
}
5155
impl<T: PrintAttribute> PrintAttribute for Option<T> {
52-
fn print_something(&self) -> bool {
53-
self.as_ref().is_some_and(|x| x.print_something())
56+
fn should_render(&self) -> bool {
57+
self.as_ref().is_some_and(|x| x.should_render())
5458
}
59+
5560
fn print_attribute(&self, p: &mut Printer) {
5661
if let Some(i) = self {
5762
T::print_attribute(i, p)
5863
}
5964
}
6065
}
6166
impl<T: PrintAttribute> PrintAttribute for ThinVec<T> {
62-
fn print_something(&self) -> bool {
63-
self.is_empty() || self[0].print_something()
67+
fn should_render(&self) -> bool {
68+
self.is_empty() || self[0].should_render()
6469
}
70+
6571
fn print_attribute(&self, p: &mut Printer) {
6672
let mut last_printed = false;
6773
p.word("[");
@@ -70,15 +76,15 @@ impl<T: PrintAttribute> PrintAttribute for ThinVec<T> {
7076
p.word_space(",");
7177
}
7278
i.print_attribute(p);
73-
last_printed = i.print_something();
79+
last_printed = i.should_render();
7480
}
7581
p.word("]");
7682
}
7783
}
7884
macro_rules! print_skip {
7985
($($t: ty),* $(,)?) => {$(
8086
impl PrintAttribute for $t {
81-
fn print_something(&self) -> bool { false }
87+
fn should_render(&self) -> bool { false }
8288
fn print_attribute(&self, _: &mut Printer) { }
8389
})*
8490
};
@@ -87,7 +93,7 @@ macro_rules! print_skip {
8793
macro_rules! print_disp {
8894
($($t: ty),* $(,)?) => {$(
8995
impl PrintAttribute for $t {
90-
fn print_something(&self) -> bool { true }
96+
fn should_render(&self) -> bool { true }
9197
fn print_attribute(&self, p: &mut Printer) {
9298
p.word(format!("{}", self));
9399
}
@@ -97,7 +103,7 @@ macro_rules! print_disp {
97103
macro_rules! print_debug {
98104
($($t: ty),* $(,)?) => {$(
99105
impl PrintAttribute for $t {
100-
fn print_something(&self) -> bool { true }
106+
fn should_render(&self) -> bool { true }
101107
fn print_attribute(&self, p: &mut Printer) {
102108
p.word(format!("{:?}", self));
103109
}
@@ -106,37 +112,39 @@ macro_rules! print_debug {
106112
}
107113

108114
macro_rules! print_tup {
109-
(num_print_something $($ts: ident)*) => { 0 $(+ $ts.print_something() as usize)* };
115+
(num_should_render $($ts: ident)*) => { 0 $(+ $ts.should_render() as usize)* };
110116
() => {};
111117
($t: ident $($ts: ident)*) => {
112118
#[allow(non_snake_case, unused)]
113119
impl<$t: PrintAttribute, $($ts: PrintAttribute),*> PrintAttribute for ($t, $($ts),*) {
114-
fn print_something(&self) -> bool {
120+
fn should_render(&self) -> bool {
115121
let ($t, $($ts),*) = self;
116-
print_tup!(num_print_something $t $($ts)*) != 0
122+
print_tup!(num_should_render $t $($ts)*) != 0
117123
}
118124

119125
fn print_attribute(&self, p: &mut Printer) {
120126
let ($t, $($ts),*) = self;
121-
let parens = print_tup!(num_print_something $t $($ts)*) > 1;
127+
let parens = print_tup!(num_should_render $t $($ts)*) > 1;
122128
if parens {
123-
p.word("(");
129+
p.popen();
124130
}
125131

126-
let mut printed_anything = $t.print_something();
132+
let mut printed_anything = $t.should_render();
127133

128134
$t.print_attribute(p);
129135

130136
$(
131-
if printed_anything && $ts.print_something() {
132-
p.word_space(",");
137+
if $ts.should_render() {
138+
if printed_anything {
139+
p.word_space(",");
140+
}
133141
printed_anything = true;
134142
}
135143
$ts.print_attribute(p);
136144
)*
137145

138146
if parens {
139-
p.word(")");
147+
p.pclose();
140148
}
141149
}
142150
}
@@ -147,8 +155,8 @@ macro_rules! print_tup {
147155

148156
print_tup!(A B C D E F G H);
149157
print_skip!(Span, ());
150-
print_disp!(Symbol, u16, bool, NonZero<u32>);
151-
print_debug!(UintTy, IntTy, Align, AttrStyle, CommentKind, Transparency);
158+
print_disp!(u16, bool, NonZero<u32>);
159+
print_debug!(Symbol, UintTy, IntTy, Align, AttrStyle, CommentKind, Transparency);
152160

153161
/// Finds attributes in sequences of attributes by pattern matching.
154162
///

compiler/rustc_borrowck/src/diagnostics/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
505505
let var_id =
506506
self.infcx.tcx.closure_captures(def_id)[field.index()].get_root_variable();
507507

508-
Some(self.infcx.tcx.hir().name(var_id).to_string())
508+
Some(self.infcx.tcx.hir_name(var_id).to_string())
509509
}
510510
_ => {
511511
// Might need a revision when the fields in trait RFC is implemented
@@ -1124,7 +1124,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
11241124
def_id, target_place, places
11251125
);
11261126
let hir_id = self.infcx.tcx.local_def_id_to_hir_id(def_id);
1127-
let expr = &self.infcx.tcx.hir().expect_expr(hir_id).kind;
1127+
let expr = &self.infcx.tcx.hir_expect_expr(hir_id).kind;
11281128
debug!("closure_span: hir_id={:?} expr={:?}", hir_id, expr);
11291129
if let &hir::ExprKind::Closure(&hir::Closure { kind, fn_decl_span, .. }) = expr {
11301130
for (captured_place, place) in

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
698698
if !matches!(k, hir::AssocItemKind::Fn { .. }) {
699699
continue;
700700
}
701-
if self.infcx.tcx.hir().name(hi) != self.infcx.tcx.hir().name(my_hir) {
701+
if self.infcx.tcx.hir_name(hi) != self.infcx.tcx.hir_name(my_hir) {
702702
continue;
703703
}
704704
f_in_trait_opt = Some(hi);

compiler/rustc_borrowck/src/diagnostics/opaque_suggestions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
105105

106106
if let Some(opaque_def_id) = opaque_def_id.as_local()
107107
&& let hir::OpaqueTyOrigin::FnReturn { parent, .. } =
108-
tcx.hir().expect_opaque_ty(opaque_def_id).origin
108+
tcx.hir_expect_opaque_ty(opaque_def_id).origin
109109
{
110110
if let Some(sugg) = impl_trait_overcapture_suggestion(
111111
tcx,

compiler/rustc_borrowck/src/diagnostics/region_name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
343343
}
344344
};
345345
let hir::ExprKind::Closure(&hir::Closure { fn_decl_span, .. }) =
346-
tcx.hir().expect_expr(self.mir_hir_id()).kind
346+
tcx.hir_expect_expr(self.mir_hir_id()).kind
347347
else {
348348
bug!("Closure is not defined by a closure expr");
349349
};

compiler/rustc_borrowck/src/diagnostics/var_name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
6969
let upvar_hir_id = upvars[upvar_index].get_root_variable();
7070
debug!("get_upvar_name_and_span_for_region: upvar_hir_id={upvar_hir_id:?}");
7171

72-
let upvar_name = tcx.hir().name(upvar_hir_id);
72+
let upvar_name = tcx.hir_name(upvar_hir_id);
7373
let upvar_span = tcx.hir().span(upvar_hir_id);
7474
debug!(
7575
"get_upvar_name_and_span_for_region: upvar_name={upvar_name:?} upvar_span={upvar_span:?}",

compiler/rustc_builtin_macros/Cargo.toml

-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ name = "rustc_builtin_macros"
33
version = "0.0.0"
44
edition = "2024"
55

6-
7-
[lints.rust]
8-
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(llvm_enzyme)'] }
9-
106
[lib]
117
doctest = false
128

compiler/rustc_codegen_ssa/src/assert_module_sources.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn assert_module_sources(tcx: TyCtxt<'_>, set_reuse: &dyn Fn(&mut CguReuseTr
6363
},
6464
};
6565

66-
for attr in tcx.hir().attrs(rustc_hir::CRATE_HIR_ID) {
66+
for attr in tcx.hir_attrs(rustc_hir::CRATE_HIR_ID) {
6767
ams.check_attr(attr);
6868
}
6969

compiler/rustc_codegen_ssa/src/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ pub(crate) fn start_async_codegen<B: ExtraBackendMethods>(
475475
) -> OngoingCodegen<B> {
476476
let (coordinator_send, coordinator_receive) = channel();
477477

478-
let crate_attrs = tcx.hir().attrs(rustc_hir::CRATE_HIR_ID);
478+
let crate_attrs = tcx.hir_attrs(rustc_hir::CRATE_HIR_ID);
479479
let no_builtins = attr::contains_name(crate_attrs, sym::no_builtins);
480480

481481
let crate_info = CrateInfo::new(tcx, target_cpu);

compiler/rustc_codegen_ssa/src/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ impl CrateInfo {
876876
let linked_symbols =
877877
crate_types.iter().map(|&c| (c, crate::back::linker::linked_symbols(tcx, c))).collect();
878878
let local_crate_name = tcx.crate_name(LOCAL_CRATE);
879-
let crate_attrs = tcx.hir().attrs(rustc_hir::CRATE_HIR_ID);
879+
let crate_attrs = tcx.hir_attrs(rustc_hir::CRATE_HIR_ID);
880880
let subsystem =
881881
ast::attr::first_attr_value_str_by_name(crate_attrs, sym::windows_subsystem);
882882
let windows_subsystem = subsystem.map(|subsystem| {

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
6262
);
6363
}
6464

65-
let attrs = tcx.hir().attrs(tcx.local_def_id_to_hir_id(did));
65+
let attrs = tcx.hir_attrs(tcx.local_def_id_to_hir_id(did));
6666
let mut codegen_fn_attrs = CodegenFnAttrs::new();
6767
if tcx.should_inherit_track_caller(did) {
6868
codegen_fn_attrs.flags |= CodegenFnAttrFlags::TRACK_CALLER;
@@ -77,7 +77,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
7777

7878
// When `no_builtins` is applied at the crate level, we should add the
7979
// `no-builtins` attribute to each function to ensure it takes effect in LTO.
80-
let crate_attrs = tcx.hir().attrs(rustc_hir::CRATE_HIR_ID);
80+
let crate_attrs = tcx.hir_attrs(rustc_hir::CRATE_HIR_ID);
8181
let no_builtins = attr::contains_name(crate_attrs, sym::no_builtins);
8282
if no_builtins {
8383
codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_BUILTINS;

compiler/rustc_const_eval/src/check_consts/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub fn rustc_allow_const_fn_unstable(
8181
def_id: LocalDefId,
8282
feature_gate: Symbol,
8383
) -> bool {
84-
let attrs = tcx.hir().attrs(tcx.local_def_id_to_hir_id(def_id));
84+
let attrs = tcx.hir_attrs(tcx.local_def_id_to_hir_id(def_id));
8585

8686
find_attr!(attrs, AttributeKind::AllowConstFnUnstable(syms) if syms.contains(&feature_gate))
8787
}

compiler/rustc_data_structures/Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ thin-vec = "0.2.12"
2929
tracing = "0.1"
3030
# tidy-alphabetical-end
3131

32+
[dependencies.hashbrown]
33+
version = "0.15.2"
34+
default-features = false
35+
features = ["nightly"] # for may_dangle
36+
3237
[dependencies.parking_lot]
3338
version = "0.12"
3439

compiler/rustc_data_structures/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#![feature(dropck_eyepatch)]
2525
#![feature(extend_one)]
2626
#![feature(file_buffered)]
27-
#![feature(hash_raw_entry)]
2827
#![feature(macro_metavar_expr)]
2928
#![feature(map_try_insert)]
3029
#![feature(min_specialization)]

compiler/rustc_data_structures/src/marker.rs

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ impl_dyn_send!(
7676
[crate::sync::RwLock<T> where T: DynSend]
7777
[crate::tagged_ptr::TaggedRef<'a, P, T> where 'a, P: Sync, T: Send + crate::tagged_ptr::Tag]
7878
[rustc_arena::TypedArena<T> where T: DynSend]
79+
[hashbrown::HashTable<T> where T: DynSend]
7980
[indexmap::IndexSet<V, S> where V: DynSend, S: DynSend]
8081
[indexmap::IndexMap<K, V, S> where K: DynSend, V: DynSend, S: DynSend]
8182
[thin_vec::ThinVec<T> where T: DynSend]
@@ -153,6 +154,7 @@ impl_dyn_sync!(
153154
[crate::tagged_ptr::TaggedRef<'a, P, T> where 'a, P: Sync, T: Sync + crate::tagged_ptr::Tag]
154155
[parking_lot::lock_api::Mutex<R, T> where R: DynSync, T: ?Sized + DynSend]
155156
[parking_lot::lock_api::RwLock<R, T> where R: DynSync, T: ?Sized + DynSend + DynSync]
157+
[hashbrown::HashTable<T> where T: DynSync]
156158
[indexmap::IndexSet<V, S> where V: DynSync, S: DynSync]
157159
[indexmap::IndexMap<K, V, S> where K: DynSync, V: DynSync, S: DynSync]
158160
[smallvec::SmallVec<A> where A: smallvec::Array + DynSync]

0 commit comments

Comments
 (0)