Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 11 pull requests #99567

Merged
merged 27 commits into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f7ae92c
std: use futex-based locks on Fuchsia
joboet Jun 30, 2022
0d91b08
std: fix issue with perma-locked mutexes on Fuchsia
joboet Jul 12, 2022
f357926
std: panic instead of deadlocking in mutex implementation on Fuchsia
joboet Jul 18, 2022
110fdb6
Add `PhantomData` marker for dropck to `BTreeMap`
steffahn Jul 18, 2022
611bbcb
clippy::perf fixes
matthiaskrgr Jul 20, 2022
c72a77e
owner is not micro (correct typo)
joboet Jul 20, 2022
bd0474d
Fix the stable version of `AsFd for Arc<T>` and `Box<T>`
cuviper Jul 20, 2022
1993a5f
Add map_continue and continue_value combinators to ControlFlow
benluelo Jul 19, 2022
cd3204d
Normalize the arg spans to be within the call span
compiler-errors Jul 20, 2022
5249183
Add regression test for #52304
JohnTitor Jul 21, 2022
7d0a182
orphan check: opaque types are an error
lcnr Jul 21, 2022
84c3fcd
rewrite the orphan check to use a type visitor
lcnr Jul 21, 2022
8ba02f1
remove unused import
joboet Jul 21, 2022
aad1aa3
Edit `rustc_index::vec::IndexVec::pick3_mut` docs
pierwill Jul 21, 2022
b7de175
Fix `remap_constness`
fee1-dead Jul 21, 2022
8e15081
Remove unused field in ItemKind::KeywordItem
GuillaumeGomez Jul 21, 2022
c5df2f0
Rollup merge of #98707 - joboet:fuchsia_locks, r=m-ou-se
matthiaskrgr Jul 21, 2022
43783b8
Rollup merge of #99413 - steffahn:btree_dropck, r=m-ou-se
matthiaskrgr Jul 21, 2022
9610c71
Rollup merge of #99454 - benluelo:control-flow/continue-combinators, …
matthiaskrgr Jul 21, 2022
84a7b23
Rollup merge of #99523 - cuviper:asfd_ptrs-1.64, r=jyn514
matthiaskrgr Jul 21, 2022
da18bd1
Rollup merge of #99526 - compiler-errors:normalize-arg-spans, r=oli-obk
matthiaskrgr Jul 21, 2022
230b775
Rollup merge of #99528 - matthiaskrgr:2022_07_perf, r=estebank
matthiaskrgr Jul 21, 2022
d425fe8
Rollup merge of #99549 - JohnTitor:issue-52304, r=compiler-errors
matthiaskrgr Jul 21, 2022
31284d2
Rollup merge of #99552 - lcnr:orphan_check-rework, r=oli-obk
matthiaskrgr Jul 21, 2022
14c385d
Rollup merge of #99557 - pierwill:patch-6, r=tmiasko
matthiaskrgr Jul 21, 2022
b068dc7
Rollup merge of #99558 - fee1-dead-contrib:remap_constness_fix, r=oli…
matthiaskrgr Jul 21, 2022
af64d93
Rollup merge of #99559 - GuillaumeGomez:rm-unused-field-keyword, r=no…
matthiaskrgr Jul 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_error_messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ impl DiagnosticMessage {
/// - If `self` is non-translatable then return `self`'s message.
pub fn with_subdiagnostic_message(&self, sub: SubdiagnosticMessage) -> Self {
let attr = match sub {
SubdiagnosticMessage::Str(s) => return DiagnosticMessage::Str(s.clone()),
SubdiagnosticMessage::Str(s) => return DiagnosticMessage::Str(s),
SubdiagnosticMessage::FluentIdentifier(id) => {
return DiagnosticMessage::FluentIdentifier(id, None);
}
Expand Down
8 changes: 6 additions & 2 deletions compiler/rustc_index/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ impl<I: Idx, T> IndexVec<I, T> {
self.raw.get_mut(index.index())
}

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

/// Returns mutable references to three distinct elements or panics otherwise.
/// Returns mutable references to three distinct elements.
///
/// Panics if the elements are not distinct.
#[inline]
pub fn pick3_mut(&mut self, a: I, b: I, c: I) -> (&mut T, &mut T, &mut T) {
let (ai, bi, ci) = (a.index(), b.index(), c.index());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl DiagnosticDeriveBuilder {
}
NestedMeta::Meta(meta @ Meta::NameValue(_))
if !is_help_note_or_warn
&& meta.path().segments.last().unwrap().ident.to_string() == "code" =>
&& meta.path().segments.last().unwrap().ident == "code" =>
{
// don't error for valid follow-up attributes
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_macros/src/diagnostics/fluent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
let snake_name = Ident::new(
// FIXME: should probably trim prefix, not replace all occurrences
&name
.replace(&format!("{}-", res.ident).replace("_", "-"), "")
.replace("-", "_"),
.replace(&format!("{}-", res.ident).replace('_', "-"), "")
.replace('-', "_"),
span,
);
constants.extend(quote! {
Expand All @@ -207,7 +207,7 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
});

for Attribute { id: Identifier { name: attr_name }, .. } in attributes {
let snake_name = Ident::new(&attr_name.replace("-", "_"), span);
let snake_name = Ident::new(&attr_name.replace('-', "_"), span);
if !previous_attrs.insert(snake_name.clone()) {
continue;
}
Expand Down
10 changes: 4 additions & 6 deletions compiler/rustc_middle/src/ty/consts/valtree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,17 @@ impl<'tcx> ValTree<'tcx> {
let leafs = self
.unwrap_branch()
.into_iter()
.map(|v| v.unwrap_leaf().try_to_u8().unwrap())
.collect::<Vec<_>>();
.map(|v| v.unwrap_leaf().try_to_u8().unwrap());

return Some(tcx.arena.alloc_from_iter(leafs.into_iter()));
return Some(tcx.arena.alloc_from_iter(leafs));
}
ty::Slice(slice_ty) if *slice_ty == tcx.types.u8 => {
let leafs = self
.unwrap_branch()
.into_iter()
.map(|v| v.unwrap_leaf().try_to_u8().unwrap())
.collect::<Vec<_>>();
.map(|v| v.unwrap_leaf().try_to_u8().unwrap());

return Some(tcx.arena.alloc_from_iter(leafs.into_iter()));
return Some(tcx.arena.alloc_from_iter(leafs));
}
_ => {}
},
Expand Down
13 changes: 3 additions & 10 deletions compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,22 +790,15 @@ pub struct TraitPredicate<'tcx> {
pub type PolyTraitPredicate<'tcx> = ty::Binder<'tcx, TraitPredicate<'tcx>>;

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

/// Remap the constness of this predicate before emitting it for diagnostics.
pub fn remap_constness_diag(&mut self, param_env: ParamEnv<'tcx>) {
// this is different to `remap_constness` that callees want to print this predicate
// in case of selection errors. `T: ~const Drop` bounds cannot end up here when the
// param_env is not const because we it is always satisfied in non-const contexts.
// param_env is not const because it is always satisfied in non-const contexts.
if let hir::Constness::NotConst = param_env.constness() {
self.constness = ty::BoundConstness::NotConst;
}
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_privacy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,6 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> {
|| self.in_assoc_ty
|| self.tcx.resolutions(()).has_pub_restricted
{
let descr = descr.to_string();
let vis_span =
self.tcx.sess.source_map().guess_head_span(self.tcx.def_span(def_id));
if kind == "trait" {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2608,7 +2608,7 @@ fn show_candidates(
"item"
};
let plural_descr =
if descr.ends_with("s") { format!("{}es", descr) } else { format!("{}s", descr) };
if descr.ends_with('s') { format!("{}es", descr) } else { format!("{}s", descr) };

let mut msg = format!("{}these {} exist but are inaccessible", prefix, plural_descr);
let mut has_colon = false;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ mod parse {
) -> bool {
match v {
Some(s) => {
for s in s.split(",") {
for s in s.split(',') {
let Some(pass_name) = s.strip_prefix(&['+', '-'][..]) else { return false };
slot.push((pass_name.to_string(), &s[..1] == "+"));
}
Expand Down
Loading