Skip to content

Commit 9f877c9

Browse files
committed
Auto merge of #127170 - bjorn3:no_specialize_index_borrowck, r=michaelwoerister
Stop using specialization in rustc_index and rustc_borrowck For rustc_borrowck the version with specialization isn't much more readable anyway IMO. For rustc_index it probably doesn't affect perf in any noticeable way anyway.
2 parents e2cf31a + 449581d commit 9f877c9

File tree

6 files changed

+29
-16
lines changed

6 files changed

+29
-16
lines changed

compiler/rustc_borrowck/src/facts.rs

+26-2
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,32 @@ trait FactCell {
213213
fn to_string(&self, location_table: &LocationTable) -> String;
214214
}
215215

216-
impl<A: Debug> FactCell for A {
217-
default fn to_string(&self, _location_table: &LocationTable) -> String {
216+
impl FactCell for BorrowIndex {
217+
fn to_string(&self, _location_table: &LocationTable) -> String {
218+
format!("{self:?}")
219+
}
220+
}
221+
222+
impl FactCell for Local {
223+
fn to_string(&self, _location_table: &LocationTable) -> String {
224+
format!("{self:?}")
225+
}
226+
}
227+
228+
impl FactCell for MovePathIndex {
229+
fn to_string(&self, _location_table: &LocationTable) -> String {
230+
format!("{self:?}")
231+
}
232+
}
233+
234+
impl FactCell for PoloniusRegionVid {
235+
fn to_string(&self, _location_table: &LocationTable) -> String {
236+
format!("{self:?}")
237+
}
238+
}
239+
240+
impl FactCell for RegionVid {
241+
fn to_string(&self, _location_table: &LocationTable) -> String {
218242
format!("{self:?}")
219243
}
220244
}

compiler/rustc_borrowck/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#![feature(box_patterns)]
88
#![feature(control_flow_enum)]
99
#![feature(let_chains)]
10-
#![feature(min_specialization)]
1110
#![feature(never_type)]
1211
#![feature(rustc_attrs)]
1312
#![feature(rustdoc_internals)]

compiler/rustc_index/src/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
// tidy-alphabetical-start
22
#![cfg_attr(all(feature = "nightly", test), feature(stmt_expr_attributes))]
3-
#![cfg_attr(
4-
feature = "nightly",
5-
feature(extend_one, min_specialization, new_uninit, step_trait, test)
6-
)]
73
#![cfg_attr(feature = "nightly", allow(internal_features))]
4+
#![cfg_attr(feature = "nightly", feature(extend_one, new_uninit, step_trait, test))]
85
// tidy-alphabetical-end
96

107
pub mod bit_set;

compiler/rustc_index_macros/src/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ mod newtype;
3434
/// optimizations. The default max value is 0xFFFF_FF00.
3535
/// - `#[gate_rustc_only]`: makes parts of the generated code nightly-only.
3636
#[proc_macro]
37-
#[cfg_attr(
38-
feature = "nightly",
39-
allow_internal_unstable(step_trait, rustc_attrs, trusted_step, min_specialization)
40-
)]
37+
#[cfg_attr(feature = "nightly", allow_internal_unstable(step_trait, rustc_attrs, trusted_step))]
4138
pub fn newtype_index(input: TokenStream) -> TokenStream {
4239
newtype::newtype(input)
4340
}

compiler/rustc_index_macros/src/newtype.rs

-4
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,6 @@ impl Parse for Newtype {
139139
Self::index(start).checked_sub(u).map(Self::from_usize)
140140
}
141141
}
142-
143-
// Safety: The implementation of `Step` upholds all invariants.
144-
#gate_rustc_only
145-
unsafe impl ::std::iter::TrustedStep for #name {}
146142
}
147143
} else {
148144
quote! {}

compiler/rustc_type_ir/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![allow(rustc::usage_of_ty_tykind)]
33
#![cfg_attr(
44
feature = "nightly",
5-
feature(associated_type_defaults, min_specialization, never_type, rustc_attrs, negative_impls)
5+
feature(associated_type_defaults, never_type, rustc_attrs, negative_impls)
66
)]
77
#![cfg_attr(feature = "nightly", allow(internal_features))]
88
// tidy-alphabetical-end

0 commit comments

Comments
 (0)