Skip to content

Commit 41301c3

Browse files
committed
Auto merge of rust-lang#90966 - matthiaskrgr:rollup-4akzcrh, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#90733 (Build musl dist artifacts with debuginfo enabled) - rust-lang#90787 (Add `#[inline]`s to `SortedIndexMultiMap`) - rust-lang#90920 (:arrow_up: rust-analyzer) - rust-lang#90933 (Fix await suggestion on non-future type) - rust-lang#90935 (Alphabetize language features) - rust-lang#90949 (update miri) - rust-lang#90958 (Mark `<*const _>::align_offset` and `<*mut _>::align_offset` as `const fn`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents d914f17 + 0c3a662 commit 41301c3

File tree

17 files changed

+885
-837
lines changed

17 files changed

+885
-837
lines changed

compiler/rustc_data_structures/src/sorted_map/index_map.rs

+10
Original file line numberDiff line numberDiff line change
@@ -34,39 +34,47 @@ pub struct SortedIndexMultiMap<I: Idx, K, V> {
3434
}
3535

3636
impl<I: Idx, K: Ord, V> SortedIndexMultiMap<I, K, V> {
37+
#[inline]
3738
pub fn new() -> Self {
3839
SortedIndexMultiMap { items: IndexVec::new(), idx_sorted_by_item_key: Vec::new() }
3940
}
4041

42+
#[inline]
4143
pub fn len(&self) -> usize {
4244
self.items.len()
4345
}
4446

47+
#[inline]
4548
pub fn is_empty(&self) -> bool {
4649
self.items.is_empty()
4750
}
4851

4952
/// Returns an iterator over the items in the map in insertion order.
53+
#[inline]
5054
pub fn into_iter(self) -> impl DoubleEndedIterator<Item = (K, V)> {
5155
self.items.into_iter()
5256
}
5357

5458
/// Returns an iterator over the items in the map in insertion order along with their indices.
59+
#[inline]
5560
pub fn into_iter_enumerated(self) -> impl DoubleEndedIterator<Item = (I, (K, V))> {
5661
self.items.into_iter_enumerated()
5762
}
5863

5964
/// Returns an iterator over the items in the map in insertion order.
65+
#[inline]
6066
pub fn iter(&self) -> impl '_ + DoubleEndedIterator<Item = (&K, &V)> {
6167
self.items.iter().map(|(ref k, ref v)| (k, v))
6268
}
6369

6470
/// Returns an iterator over the items in the map in insertion order along with their indices.
71+
#[inline]
6572
pub fn iter_enumerated(&self) -> impl '_ + DoubleEndedIterator<Item = (I, (&K, &V))> {
6673
self.items.iter_enumerated().map(|(i, (ref k, ref v))| (i, (k, v)))
6774
}
6875

6976
/// Returns the item in the map with the given index.
77+
#[inline]
7078
pub fn get(&self, idx: I) -> Option<&(K, V)> {
7179
self.items.get(idx)
7280
}
@@ -75,6 +83,7 @@ impl<I: Idx, K: Ord, V> SortedIndexMultiMap<I, K, V> {
7583
///
7684
/// If there are multiple items that are equivalent to `key`, they will be yielded in
7785
/// insertion order.
86+
#[inline]
7887
pub fn get_by_key(&'a self, key: K) -> impl 'a + Iterator<Item = &'a V> {
7988
self.get_by_key_enumerated(key).map(|(_, v)| v)
8089
}
@@ -84,6 +93,7 @@ impl<I: Idx, K: Ord, V> SortedIndexMultiMap<I, K, V> {
8493
///
8594
/// If there are multiple items that are equivalent to `key`, they will be yielded in
8695
/// insertion order.
96+
#[inline]
8797
pub fn get_by_key_enumerated(&'a self, key: K) -> impl '_ + Iterator<Item = (I, &V)> {
8898
let lower_bound = self.idx_sorted_by_item_key.partition_point(|&i| self.items[i].0 < key);
8999
self.idx_sorted_by_item_key[lower_bound..].iter().map_while(move |&i| {

compiler/rustc_feature/src/accepted.rs

+226-220
Large diffs are not rendered by default.

compiler/rustc_feature/src/active.rs

+330-485
Large diffs are not rendered by default.

compiler/rustc_feature/src/removed.rs

+94-96
Original file line numberDiff line numberDiff line change
@@ -45,132 +45,130 @@ declare_features! (
4545
// feature-group-start: removed features
4646
// -------------------------------------------------------------------------
4747

48-
(removed, import_shadowing, "1.0.0", None, None, None),
49-
(removed, managed_boxes, "1.0.0", None, None, None),
50-
/// Allows use of unary negate on unsigned integers, e.g., -e for e: u8
51-
(removed, negate_unsigned, "1.0.0", Some(29645), None, None),
52-
(removed, reflect, "1.0.0", Some(27749), None, None),
53-
/// A way to temporarily opt out of opt in copy. This will *never* be accepted.
54-
(removed, opt_out_copy, "1.0.0", None, None, None),
55-
(removed, quad_precision_float, "1.0.0", None, None, None),
56-
(removed, struct_inherit, "1.0.0", None, None, None),
57-
(removed, test_removed_feature, "1.0.0", None, None, None),
58-
(removed, visible_private_types, "1.0.0", None, None, None),
59-
(removed, unsafe_no_drop_flag, "1.0.0", None, None, None),
60-
/// Allows using items which are missing stability attributes
61-
(removed, unmarked_api, "1.0.0", None, None, None),
62-
(removed, allocator, "1.0.0", None, None, None),
63-
(removed, simd, "1.0.0", Some(27731), None,
64-
Some("removed in favor of `#[repr(simd)]`")),
6548
(removed, advanced_slice_patterns, "1.0.0", Some(62254), None,
6649
Some("merged into `#![feature(slice_patterns)]`")),
67-
(removed, macro_reexport, "1.0.0", Some(29638), None,
68-
Some("subsumed by `pub use`")),
50+
(removed, allocator, "1.0.0", None, None, None),
51+
(removed, await_macro, "1.38.0", Some(50547), None,
52+
Some("subsumed by `.await` syntax")),
53+
/// Allows comparing raw pointers during const eval.
54+
(removed, const_compare_raw_pointers, "1.46.0", Some(53020), None,
55+
Some("cannot be allowed in const eval in any meaningful way")),
56+
/// Allows non-trivial generic constants which have to be manually propagated upwards.
57+
(removed, const_evaluatable_checked, "1.48.0", Some(76560), None, Some("renamed to `generic_const_exprs`")),
58+
/// Allows the definition of `const` functions with some advanced features.
59+
(removed, const_fn, "1.54.0", Some(57563), None,
60+
Some("split into finer-grained feature gates")),
61+
/// Allows const generic types (e.g. `struct Foo<const N: usize>(...);`).
62+
(removed, const_generics, "1.34.0", Some(44580), None,
63+
Some("removed in favor of `#![feature(adt_const_params)]` and `#![feature(generic_const_exprs)]`")),
64+
/// Allows `[x; N]` where `x` is a constant (RFC 2203).
65+
(removed, const_in_array_repeat_expressions, "1.37.0", Some(49147), None,
66+
Some("removed due to causing promotable bugs")),
67+
/// Allows casting raw pointers to `usize` during const eval.
68+
(removed, const_raw_ptr_to_usize_cast, "1.55.0", Some(51910), None,
69+
Some("at compile-time, pointers do not have an integer value, so these casts cannot be properly supported")),
70+
/// Allows `T: ?const Trait` syntax in bounds.
71+
(removed, const_trait_bound_opt_out, "1.42.0", Some(67794), None,
72+
Some("Removed in favor of `~const` bound in #![feature(const_trait_impl)]")),
6973
/// Allows using custom attributes (RFC 572).
7074
(removed, custom_attribute, "1.0.0", Some(29642), None,
7175
Some("removed in favor of `#![register_tool]` and `#![register_attr]`")),
72-
/// Allows features specific to OIBIT (now called auto traits).
73-
/// Renamed to `auto_traits`.
74-
(removed, optin_builtin_traits, "1.0.0", Some(13231), None,
75-
Some("renamed to `auto_traits`")),
76-
(removed, pushpop_unsafe, "1.2.0", None, None, None),
77-
(removed, needs_allocator, "1.4.0", Some(27389), None,
78-
Some("subsumed by `#![feature(allocator_internals)]`")),
79-
/// Allows identifying crates that contain sanitizer runtimes.
80-
(removed, sanitizer_runtime, "1.17.0", None, None, None),
76+
/// Allows the use of `#[derive(Anything)]` as sugar for `#[derive_Anything]`.
77+
(removed, custom_derive, "1.32.0", Some(29644), None,
78+
Some("subsumed by `#[proc_macro_derive]`")),
8179
/// Allows `#[doc(spotlight)]`.
8280
/// The attribute was renamed to `#[doc(notable_trait)]`
8381
/// and the feature to `doc_notable_trait`.
8482
(removed, doc_spotlight, "1.22.0", Some(45040), None,
8583
Some("renamed to `doc_notable_trait`")),
86-
(removed, proc_macro_mod, "1.27.0", Some(54727), None,
87-
Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
88-
(removed, proc_macro_expr, "1.27.0", Some(54727), None,
89-
Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
90-
(removed, proc_macro_non_items, "1.27.0", Some(54727), None,
91-
Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
92-
(removed, proc_macro_gen, "1.27.0", Some(54727), None,
93-
Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
94-
(removed, panic_implementation, "1.28.0", Some(44489), None,
95-
Some("subsumed by `#[panic_handler]`")),
96-
/// Allows the use of `#[derive(Anything)]` as sugar for `#[derive_Anything]`.
97-
(removed, custom_derive, "1.32.0", Some(29644), None,
98-
Some("subsumed by `#[proc_macro_derive]`")),
99-
/// Paths of the form: `extern::foo::bar`
100-
(removed, extern_in_paths, "1.33.0", Some(55600), None,
101-
Some("subsumed by `::foo::bar` paths")),
102-
(removed, quote, "1.33.0", Some(29601), None, None),
103-
/// Allows const generic types (e.g. `struct Foo<const N: usize>(...);`).
104-
(removed, const_generics, "1.34.0", Some(44580), None,
105-
Some("removed in favor of `#![feature(adt_const_params)]` and `#![feature(generic_const_exprs)]`")),
106-
/// Allows `[x; N]` where `x` is a constant (RFC 2203).
107-
(removed, const_in_array_repeat_expressions, "1.37.0", Some(49147), None,
108-
Some("removed due to causing promotable bugs")),
10984
/// Allows using `#[unsafe_destructor_blind_to_params]` (RFC 1238).
11085
(removed, dropck_parametricity, "1.38.0", Some(28498), None, None),
111-
(removed, await_macro, "1.38.0", Some(50547), None,
112-
Some("subsumed by `.await` syntax")),
11386
/// Allows defining `existential type`s.
11487
(removed, existential_type, "1.38.0", Some(63063), None,
11588
Some("removed in favor of `#![feature(type_alias_impl_trait)]`")),
116-
/// Allows using the macros:
117-
/// + `__diagnostic_used`
118-
/// + `__register_diagnostic`
119-
/// +`__build_diagnostic_array`
120-
(removed, rustc_diagnostic_macros, "1.38.0", None, None, None),
121-
/// Allows using `#[on_unimplemented(..)]` on traits.
122-
/// (Moved to `rustc_attrs`.)
123-
(removed, on_unimplemented, "1.40.0", None, None, None),
124-
/// Allows overlapping impls of marker traits.
125-
(removed, overlapping_marker_traits, "1.42.0", Some(29864), None,
126-
Some("removed in favor of `#![feature(marker_trait_attr)]`")),
127-
/// Allows `T: ?const Trait` syntax in bounds.
128-
(removed, const_trait_bound_opt_out, "1.42.0", Some(67794), None,
129-
Some("Removed in favor of `~const` bound in #![feature(const_trait_impl)]")),
130-
/// Allows `#[no_debug]`.
131-
(removed, no_debug, "1.43.0", Some(29721), None, Some("removed due to lack of demand")),
89+
/// Paths of the form: `extern::foo::bar`
90+
(removed, extern_in_paths, "1.33.0", Some(55600), None,
91+
Some("subsumed by `::foo::bar` paths")),
92+
/// Allows `#[doc(include = "some-file")]`.
93+
(removed, external_doc, "1.54.0", Some(44732), None,
94+
Some("use #[doc = include_str!(\"filename\")] instead, which handles macro invocations")),
95+
/// Allows `impl Trait` in bindings (`let`, `const`, `static`).
96+
(removed, impl_trait_in_bindings, "1.55.0", Some(63065), None,
97+
Some("the implementation was not maintainable, the feature may get reintroduced once the current refactorings are done")),
98+
(removed, import_shadowing, "1.0.0", None, None, None),
13299
/// Lazily evaluate constants. This allows constants to depend on type parameters.
133100
(removed, lazy_normalization_consts, "1.46.0", Some(72219), None, Some("superseded by `generic_const_exprs`")),
134-
/// Allows comparing raw pointers during const eval.
135-
(removed, const_compare_raw_pointers, "1.46.0", Some(53020), None,
136-
Some("cannot be allowed in const eval in any meaningful way")),
137-
/// Allows non-trivial generic constants which have to be manually propagated upwards.
138-
(removed, const_evaluatable_checked, "1.48.0", Some(76560), None, Some("renamed to `generic_const_exprs`")),
139101
/// Allows using the `#[link_args]` attribute.
140102
(removed, link_args, "1.53.0", Some(29596), None,
141103
Some("removed in favor of using `-C link-arg=ARG` on command line, \
142104
which is available from cargo build scripts with `cargo:rustc-link-arg` now")),
105+
(removed, macro_reexport, "1.0.0", Some(29638), None,
106+
Some("subsumed by `pub use`")),
143107
/// Allows using `#[main]` to replace the entrypoint `#[lang = "start"]` calls.
144108
(removed, main, "1.53.0", Some(29634), None, None),
145-
(removed, pub_macro_rules, "1.53.0", Some(78855), None,
146-
Some("removed due to being incomplete, in particular it does not work across crates")),
147-
/// Allows the definition of `const` functions with some advanced features.
148-
(removed, const_fn, "1.54.0", Some(57563), None,
149-
Some("split into finer-grained feature gates")),
150-
/// Allows using `#[plugin_registrar]` on functions.
151-
(removed, plugin_registrar, "1.54.0", Some(29597), None,
152-
Some("a __rustc_plugin_registrar symbol must now be defined instead")),
153-
154-
/// Allows `#[doc(include = "some-file")]`.
155-
(removed, external_doc, "1.54.0", Some(44732), None,
156-
Some("use #[doc = include_str!(\"filename\")] instead, which handles macro invocations")),
157-
158-
/// Allows casting raw pointers to `usize` during const eval.
159-
(removed, const_raw_ptr_to_usize_cast, "1.55.0", Some(51910), None,
160-
Some("at compile-time, pointers do not have an integer value, so these casts cannot be properly supported")),
161-
162-
/// Allows `impl Trait` in bindings (`let`, `const`, `static`).
163-
(removed, impl_trait_in_bindings, "1.55.0", Some(63065), None,
164-
Some("the implementation was not maintainable, the feature may get reintroduced once the current refactorings are done")),
165-
109+
(removed, managed_boxes, "1.0.0", None, None, None),
166110
/// Allows the use of type alias impl trait in function return positions
167111
(removed, min_type_alias_impl_trait, "1.56.0", Some(63063), None,
168112
Some("removed in favor of full type_alias_impl_trait")),
169-
113+
(removed, needs_allocator, "1.4.0", Some(27389), None,
114+
Some("subsumed by `#![feature(allocator_internals)]`")),
115+
/// Allows use of unary negate on unsigned integers, e.g., -e for e: u8
116+
(removed, negate_unsigned, "1.0.0", Some(29645), None, None),
117+
/// Allows `#[no_debug]`.
118+
(removed, no_debug, "1.43.0", Some(29721), None, Some("removed due to lack of demand")),
119+
/// Allows using `#[on_unimplemented(..)]` on traits.
120+
/// (Moved to `rustc_attrs`.)
121+
(removed, on_unimplemented, "1.40.0", None, None, None),
122+
/// A way to temporarily opt out of opt in copy. This will *never* be accepted.
123+
(removed, opt_out_copy, "1.0.0", None, None, None),
124+
/// Allows features specific to OIBIT (now called auto traits).
125+
/// Renamed to `auto_traits`.
126+
(removed, optin_builtin_traits, "1.0.0", Some(13231), None,
127+
Some("renamed to `auto_traits`")),
128+
/// Allows overlapping impls of marker traits.
129+
(removed, overlapping_marker_traits, "1.42.0", Some(29864), None,
130+
Some("removed in favor of `#![feature(marker_trait_attr)]`")),
131+
(removed, panic_implementation, "1.28.0", Some(44489), None,
132+
Some("subsumed by `#[panic_handler]`")),
133+
/// Allows using `#[plugin_registrar]` on functions.
134+
(removed, plugin_registrar, "1.54.0", Some(29597), None,
135+
Some("a __rustc_plugin_registrar symbol must now be defined instead")),
136+
(removed, proc_macro_expr, "1.27.0", Some(54727), None,
137+
Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
138+
(removed, proc_macro_gen, "1.27.0", Some(54727), None,
139+
Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
140+
(removed, proc_macro_mod, "1.27.0", Some(54727), None,
141+
Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
142+
(removed, proc_macro_non_items, "1.27.0", Some(54727), None,
143+
Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
144+
(removed, pub_macro_rules, "1.53.0", Some(78855), None,
145+
Some("removed due to being incomplete, in particular it does not work across crates")),
146+
(removed, pushpop_unsafe, "1.2.0", None, None, None),
147+
(removed, quad_precision_float, "1.0.0", None, None, None),
148+
(removed, quote, "1.33.0", Some(29601), None, None),
149+
(removed, reflect, "1.0.0", Some(27749), None, None),
150+
/// Allows using the macros:
151+
/// + `__diagnostic_used`
152+
/// + `__register_diagnostic`
153+
/// +`__build_diagnostic_array`
154+
(removed, rustc_diagnostic_macros, "1.38.0", None, None, None),
155+
/// Allows identifying crates that contain sanitizer runtimes.
156+
(removed, sanitizer_runtime, "1.17.0", None, None, None),
157+
(removed, simd, "1.0.0", Some(27731), None,
158+
Some("removed in favor of `#[repr(simd)]`")),
159+
(removed, struct_inherit, "1.0.0", None, None, None),
160+
(removed, test_removed_feature, "1.0.0", None, None, None),
161+
/// Allows using items which are missing stability attributes
162+
(removed, unmarked_api, "1.0.0", None, None, None),
163+
(removed, unsafe_no_drop_flag, "1.0.0", None, None, None),
170164
/// Allows `#[unwind(..)]`.
171165
///
172166
/// Permits specifying whether a function should permit unwinding or abort on unwind.
173167
(removed, unwind_attributes, "1.56.0", Some(58760), None, Some("use the C-unwind ABI instead")),
168+
(removed, visible_private_types, "1.0.0", None, None, None),
169+
// !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!!
170+
// Features are listed in alphabetical order. Tidy will fail if you don't keep it this way.
171+
// !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!!
174172

175173
// -------------------------------------------------------------------------
176174
// feature-group-end: removed features

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+26-19
Original file line numberDiff line numberDiff line change
@@ -1794,31 +1794,38 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
17941794
}
17951795
},
17961796
(_, Some(ty)) if ty::TyS::same_type(exp_found.expected, ty) => {
1797-
let span = match cause.code {
1798-
// scrutinee's span
1799-
ObligationCauseCode::Pattern { span: Some(span), .. } => span,
1800-
_ => exp_span,
1801-
};
1802-
diag.span_suggestion_verbose(
1803-
span.shrink_to_hi(),
1804-
"consider `await`ing on the `Future`",
1805-
".await".to_string(),
1806-
Applicability::MaybeIncorrect,
1807-
);
1808-
}
1809-
(Some(ty), _) if ty::TyS::same_type(ty, exp_found.found) => {
1810-
let span = match cause.code {
1811-
// scrutinee's span
1812-
ObligationCauseCode::Pattern { span: Some(span), .. } => span,
1813-
_ => exp_span,
1814-
};
18151797
diag.span_suggestion_verbose(
1816-
span.shrink_to_hi(),
1798+
exp_span.shrink_to_hi(),
18171799
"consider `await`ing on the `Future`",
18181800
".await".to_string(),
18191801
Applicability::MaybeIncorrect,
18201802
);
18211803
}
1804+
(Some(ty), _) if ty::TyS::same_type(ty, exp_found.found) => match cause.code {
1805+
ObligationCauseCode::Pattern { span: Some(span), .. }
1806+
| ObligationCauseCode::IfExpression(box IfExpressionCause { then: span, .. }) => {
1807+
diag.span_suggestion_verbose(
1808+
span.shrink_to_hi(),
1809+
"consider `await`ing on the `Future`",
1810+
".await".to_string(),
1811+
Applicability::MaybeIncorrect,
1812+
);
1813+
}
1814+
ObligationCauseCode::MatchExpressionArm(box MatchExpressionArmCause {
1815+
ref prior_arms,
1816+
..
1817+
}) => {
1818+
diag.multipart_suggestion_verbose(
1819+
"consider `await`ing on the `Future`",
1820+
prior_arms
1821+
.iter()
1822+
.map(|arm| (arm.shrink_to_hi(), ".await".to_string()))
1823+
.collect(),
1824+
Applicability::MaybeIncorrect,
1825+
);
1826+
}
1827+
_ => {}
1828+
},
18221829
_ => {}
18231830
}
18241831
}

library/core/src/ptr/const_ptr.rs

+18-3
Original file line numberDiff line numberDiff line change
@@ -879,15 +879,30 @@ impl<T: ?Sized> *const T {
879879
/// # } }
880880
/// ```
881881
#[stable(feature = "align_offset", since = "1.36.0")]
882-
pub fn align_offset(self, align: usize) -> usize
882+
#[rustc_const_unstable(feature = "const_align_offset", issue = "90962")]
883+
pub const fn align_offset(self, align: usize) -> usize
883884
where
884885
T: Sized,
885886
{
886887
if !align.is_power_of_two() {
887888
panic!("align_offset: align is not a power-of-two");
888889
}
889-
// SAFETY: `align` has been checked to be a power of 2 above
890-
unsafe { align_offset(self, align) }
890+
891+
fn rt_impl<T>(p: *const T, align: usize) -> usize {
892+
// SAFETY: `align` has been checked to be a power of 2 above
893+
unsafe { align_offset(p, align) }
894+
}
895+
896+
const fn ctfe_impl<T>(_: *const T, _: usize) -> usize {
897+
usize::MAX
898+
}
899+
900+
// SAFETY:
901+
// It is permisseble for `align_offset` to always return `usize::MAX`,
902+
// algorithm correctness can not depend on `align_offset` returning non-max values.
903+
//
904+
// As such the behaviour can't change after replacing `align_offset` with `usize::MAX`, only performance can.
905+
unsafe { intrinsics::const_eval_select((self, align), ctfe_impl, rt_impl) }
891906
}
892907
}
893908

0 commit comments

Comments
 (0)