Skip to content

Commit af7ab34

Browse files
committed
Auto merge of #99567 - matthiaskrgr:rollup-08hh3r4, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - #98707 (std: use futex-based locks on Fuchsia) - #99413 (Add `PhantomData` marker for dropck to `BTreeMap`) - #99454 (Add map_continue and continue_value combinators to ControlFlow) - #99523 (Fix the stable version of `AsFd for Arc<T>` and `Box<T>`) - #99526 (Normalize the arg spans to be within the call span) - #99528 (couple of clippy::perf fixes) - #99549 (Add regression test for #52304) - #99552 (Rewrite `orphan_check_trait_ref` to use a `TypeVisitor`) - #99557 (Edit `rustc_index::vec::IndexVec::pick3_mut` docs) - #99558 (Fix `remap_constness`) - #99559 (Remove unused field in ItemKind::KeywordItem) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1673f14 + af64d93 commit af7ab34

File tree

41 files changed

+577
-344
lines changed

Some content is hidden

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

41 files changed

+577
-344
lines changed

compiler/rustc_error_messages/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl DiagnosticMessage {
299299
/// - If `self` is non-translatable then return `self`'s message.
300300
pub fn with_subdiagnostic_message(&self, sub: SubdiagnosticMessage) -> Self {
301301
let attr = match sub {
302-
SubdiagnosticMessage::Str(s) => return DiagnosticMessage::Str(s.clone()),
302+
SubdiagnosticMessage::Str(s) => return DiagnosticMessage::Str(s),
303303
SubdiagnosticMessage::FluentIdentifier(id) => {
304304
return DiagnosticMessage::FluentIdentifier(id, None);
305305
}

compiler/rustc_index/src/vec.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ impl<I: Idx, T> IndexVec<I, T> {
234234
self.raw.get_mut(index.index())
235235
}
236236

237-
/// Returns mutable references to two distinct elements, a and b. Panics if a == b.
237+
/// Returns mutable references to two distinct elements, `a` and `b`.
238+
///
239+
/// Panics if `a == b`.
238240
#[inline]
239241
pub fn pick2_mut(&mut self, a: I, b: I) -> (&mut T, &mut T) {
240242
let (ai, bi) = (a.index(), b.index());
@@ -249,7 +251,9 @@ impl<I: Idx, T> IndexVec<I, T> {
249251
}
250252
}
251253

252-
/// Returns mutable references to three distinct elements or panics otherwise.
254+
/// Returns mutable references to three distinct elements.
255+
///
256+
/// Panics if the elements are not distinct.
253257
#[inline]
254258
pub fn pick3_mut(&mut self, a: I, b: I, c: I) -> (&mut T, &mut T, &mut T) {
255259
let (ai, bi, ci) = (a.index(), b.index(), c.index());

compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl DiagnosticDeriveBuilder {
212212
}
213213
NestedMeta::Meta(meta @ Meta::NameValue(_))
214214
if !is_help_note_or_warn
215-
&& meta.path().segments.last().unwrap().ident.to_string() == "code" =>
215+
&& meta.path().segments.last().unwrap().ident == "code" =>
216216
{
217217
// don't error for valid follow-up attributes
218218
}

compiler/rustc_macros/src/diagnostics/fluent.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
194194
let snake_name = Ident::new(
195195
// FIXME: should probably trim prefix, not replace all occurrences
196196
&name
197-
.replace(&format!("{}-", res.ident).replace("_", "-"), "")
198-
.replace("-", "_"),
197+
.replace(&format!("{}-", res.ident).replace('_', "-"), "")
198+
.replace('-', "_"),
199199
span,
200200
);
201201
constants.extend(quote! {
@@ -207,7 +207,7 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
207207
});
208208

209209
for Attribute { id: Identifier { name: attr_name }, .. } in attributes {
210-
let snake_name = Ident::new(&attr_name.replace("-", "_"), span);
210+
let snake_name = Ident::new(&attr_name.replace('-', "_"), span);
211211
if !previous_attrs.insert(snake_name.clone()) {
212212
continue;
213213
}

compiler/rustc_middle/src/ty/consts/valtree.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,17 @@ impl<'tcx> ValTree<'tcx> {
8888
let leafs = self
8989
.unwrap_branch()
9090
.into_iter()
91-
.map(|v| v.unwrap_leaf().try_to_u8().unwrap())
92-
.collect::<Vec<_>>();
91+
.map(|v| v.unwrap_leaf().try_to_u8().unwrap());
9392

94-
return Some(tcx.arena.alloc_from_iter(leafs.into_iter()));
93+
return Some(tcx.arena.alloc_from_iter(leafs));
9594
}
9695
ty::Slice(slice_ty) if *slice_ty == tcx.types.u8 => {
9796
let leafs = self
9897
.unwrap_branch()
9998
.into_iter()
100-
.map(|v| v.unwrap_leaf().try_to_u8().unwrap())
101-
.collect::<Vec<_>>();
99+
.map(|v| v.unwrap_leaf().try_to_u8().unwrap());
102100

103-
return Some(tcx.arena.alloc_from_iter(leafs.into_iter()));
101+
return Some(tcx.arena.alloc_from_iter(leafs));
104102
}
105103
_ => {}
106104
},

compiler/rustc_middle/src/ty/mod.rs

+3-10
Original file line numberDiff line numberDiff line change
@@ -790,22 +790,15 @@ pub struct TraitPredicate<'tcx> {
790790
pub type PolyTraitPredicate<'tcx> = ty::Binder<'tcx, TraitPredicate<'tcx>>;
791791

792792
impl<'tcx> TraitPredicate<'tcx> {
793-
pub fn remap_constness(&mut self, tcx: TyCtxt<'tcx>, param_env: &mut ParamEnv<'tcx>) {
794-
if std::intrinsics::unlikely(Some(self.trait_ref.def_id) == tcx.lang_items().drop_trait()) {
795-
// remap without changing constness of this predicate.
796-
// this is because `T: ~const Drop` has a different meaning to `T: Drop`
797-
// FIXME(fee1-dead): remove this logic after beta bump
798-
param_env.remap_constness_with(self.constness)
799-
} else {
800-
*param_env = param_env.with_constness(self.constness.and(param_env.constness()))
801-
}
793+
pub fn remap_constness(&mut self, param_env: &mut ParamEnv<'tcx>) {
794+
*param_env = param_env.with_constness(self.constness.and(param_env.constness()))
802795
}
803796

804797
/// Remap the constness of this predicate before emitting it for diagnostics.
805798
pub fn remap_constness_diag(&mut self, param_env: ParamEnv<'tcx>) {
806799
// this is different to `remap_constness` that callees want to print this predicate
807800
// in case of selection errors. `T: ~const Drop` bounds cannot end up here when the
808-
// param_env is not const because we it is always satisfied in non-const contexts.
801+
// param_env is not const because it is always satisfied in non-const contexts.
809802
if let hir::Constness::NotConst = param_env.constness() {
810803
self.constness = ty::BoundConstness::NotConst;
811804
}

compiler/rustc_privacy/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1754,7 +1754,6 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> {
17541754
|| self.in_assoc_ty
17551755
|| self.tcx.resolutions(()).has_pub_restricted
17561756
{
1757-
let descr = descr.to_string();
17581757
let vis_span =
17591758
self.tcx.sess.source_map().guess_head_span(self.tcx.def_span(def_id));
17601759
if kind == "trait" {

compiler/rustc_resolve/src/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2608,7 +2608,7 @@ fn show_candidates(
26082608
"item"
26092609
};
26102610
let plural_descr =
2611-
if descr.ends_with("s") { format!("{}es", descr) } else { format!("{}s", descr) };
2611+
if descr.ends_with('s') { format!("{}es", descr) } else { format!("{}s", descr) };
26122612

26132613
let mut msg = format!("{}these {} exist but are inaccessible", prefix, plural_descr);
26142614
let mut has_colon = false;

compiler/rustc_session/src/options.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ mod parse {
535535
) -> bool {
536536
match v {
537537
Some(s) => {
538-
for s in s.split(",") {
538+
for s in s.split(',') {
539539
let Some(pass_name) = s.strip_prefix(&['+', '-'][..]) else { return false };
540540
slot.push((pass_name.to_string(), &s[..1] == "+"));
541541
}

0 commit comments

Comments
 (0)