Skip to content

Commit 34fd20b

Browse files
committed
Auto merge of #158700 - JonathanBrouwer:rollup-HusuWnV, r=JonathanBrouwer
Rollup of 22 pull requests Successful merges: - #155429 (Support `u128`/`i128` c-variadic arguments) - #158100 (Emit retags in codegen to support BorrowSanitizer (part 4)) - #158494 (Improve E0277 diagnostics for conditionally implemented traits) - #158606 (use ProjectionPredicate instead of AliasRelate) - #158627 (Simplify option-iterator flattening in the compiler) - #158658 (Update LLVM submodule) - #158665 (Revert "Remove redundant dyn-compatibility check.") - #158021 (Remove old MinGW workaround) - #158473 (Add `riscv32imfc-unknown-none-elf` bare-metal target) - #158549 (process::exec: using appropriate exit code on vxworks.) - #158585 (Improve diagnostic for too many super keywords) - #158637 (hir_ty_lowering: avoid self type lookup for inherent aliases) - #158651 (ptr doc: reduce use of unsafe block to where needed) - #158669 (Remove `src/tools/test-float-parse/Cargo.lock`) - #158674 (library: Polish transmute's `split_at_stdlib` example) - #158677 (Add extra splat tests) - #158680 (Avoid ICE for `NonZero<char>` in improper_ctypes) - #158681 (Remove unnecessary `Hash` derives from MIR types) - #158682 (Avoid delayed bug for disabled on_type_error arguments) - #158684 (Add missing generic test coverage for ```#[splat]```) - #158687 (Streamline `MacEager`) - #158688 (Cleanup attribute docs and add links to other mentioned attributes)
2 parents c397dae + 89a420e commit 34fd20b

158 files changed

Lines changed: 3116 additions & 966 deletions

File tree

Some content is hidden

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

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
466466
let spans = sess.psess.gated_spans.spans.borrow();
467467
macro_rules! gate_all {
468468
($feature:ident, $explain:literal $(, $help:literal)?) => {
469-
for &span in spans.get(&sym::$feature).into_iter().flatten() {
469+
for &span in spans.get(&sym::$feature).into_flat_iter() {
470470
gate!(visitor, $feature, span, $explain $(, $help)?);
471471
}
472472
};
@@ -527,13 +527,13 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
527527
);
528528

529529
// `associated_const_equality` will be stabilized as part of `min_generic_const_args`.
530-
for &span in spans.get(&sym::associated_const_equality).into_iter().flatten() {
530+
for &span in spans.get(&sym::associated_const_equality).into_flat_iter() {
531531
gate!(visitor, min_generic_const_args, span, "associated const equality is incomplete");
532532
}
533533

534534
// `mgca_type_const_syntax` is part of `min_generic_const_args` so if
535535
// either or both are enabled we don't need to emit a feature error.
536-
for &span in spans.get(&sym::mgca_type_const_syntax).into_iter().flatten() {
536+
for &span in spans.get(&sym::mgca_type_const_syntax).into_flat_iter() {
537537
if visitor.features.min_generic_const_args()
538538
|| visitor.features.mgca_type_const_syntax()
539539
|| span.allows_unstable(sym::min_generic_const_args)
@@ -561,13 +561,13 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
561561
// it does **not** mean "`T` doesn't implement `Bound` (positively or negatively)"!
562562
// The latter would be a SemVer hazard!
563563
if !sess.opts.unstable_opts.internal_testing_features || !visitor.features.negative_bounds() {
564-
for &span in spans.get(&sym::negative_bounds).into_iter().flatten() {
564+
for &span in spans.get(&sym::negative_bounds).into_flat_iter() {
565565
sess.dcx().emit_err(diagnostics::NegativeBoundUnsupported { span });
566566
}
567567
}
568568

569569
if !visitor.features.never_patterns() {
570-
for &span in spans.get(&sym::never_patterns).into_iter().flatten() {
570+
for &span in spans.get(&sym::never_patterns).into_flat_iter() {
571571
if span.allows_unstable(sym::never_patterns) {
572572
continue;
573573
}
@@ -585,7 +585,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
585585
}
586586

587587
// Yield exprs can be enabled either by `yield_expr`, by `coroutines` or by `gen_blocks`.
588-
for &span in spans.get(&sym::yield_expr).into_iter().flatten() {
588+
for &span in spans.get(&sym::yield_expr).into_flat_iter() {
589589
if (!visitor.features.coroutines() && !span.allows_unstable(sym::coroutines))
590590
&& (!visitor.features.gen_blocks() && !span.allows_unstable(sym::gen_blocks))
591591
&& (!visitor.features.yield_expr() && !span.allows_unstable(sym::yield_expr))
@@ -607,7 +607,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
607607

608608
macro_rules! soft_gate_all_legacy_dont_use {
609609
($feature:ident, $explain:literal) => {
610-
for &span in spans.get(&sym::$feature).into_iter().flatten() {
610+
for &span in spans.get(&sym::$feature).into_flat_iter() {
611611
if !visitor.features.$feature() && !span.allows_unstable(sym::$feature) {
612612
feature_warn(&visitor.sess, sym::$feature, span, $explain);
613613
}
@@ -625,7 +625,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
625625
soft_gate_all_legacy_dont_use!(try_blocks, "`try` blocks are unstable");
626626
// tidy-alphabetical-end
627627

628-
for &span in spans.get(&sym::min_specialization).into_iter().flatten() {
628+
for &span in spans.get(&sym::min_specialization).into_flat_iter() {
629629
if !visitor.features.specialization()
630630
&& !visitor.features.min_specialization()
631631
&& !span.allows_unstable(sym::specialization)

compiler/rustc_ast_passes/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#![feature(deref_patterns)]
77
#![feature(iter_intersperse)]
88
#![feature(iter_is_partitioned)]
9+
#![feature(option_into_flat_iter)]
910
// tidy-alphabetical-end
1011

1112
pub mod ast_validation;

compiler/rustc_attr_parsing/src/attributes/diagnostic/on_type_error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ pub(crate) struct OnTypeErrorParser {
1818
impl OnTypeErrorParser {
1919
fn parse<'sess>(&mut self, cx: &mut AcceptContext<'_, 'sess>, args: &ArgParser, mode: Mode) {
2020
if !cx.features().diagnostic_on_type_error() {
21+
// `UnknownDiagnosticAttribute` is emitted in rustc_resolve/macros.rs
22+
args.ignore_args();
2123
return;
2224
}
2325

compiler/rustc_borrowck/src/dataflow.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,8 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
476476
.borrow_set
477477
.local_map
478478
.get(&place.local)
479-
.into_iter()
480-
.flat_map(|bs| bs.iter())
481-
.copied();
479+
.map(|bs| bs.iter().copied())
480+
.into_flat_iter();
482481

483482
// If the borrowed place is a local with no projections, all other borrows of this
484483
// local must conflict. This is purely an optimization so we don't have to call

compiler/rustc_borrowck/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#![feature(file_buffered)]
88
#![feature(negative_impls)]
99
#![feature(never_type)]
10+
#![feature(option_into_flat_iter)]
1011
#![feature(rustc_attrs)]
1112
#![feature(stmt_expr_attributes)]
1213
#![feature(try_blocks)]

compiler/rustc_borrowck/src/polonius/constraints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl LocalizedConstraintGraph {
152152
// The physical edges present at this node are:
153153
//
154154
// 1. the typeck edges that flow from region to region *at this point*.
155-
for &succ in self.edges.get(&node).into_iter().flatten() {
155+
for &succ in self.edges.get(&node).into_flat_iter() {
156156
let succ = LocalizedNode { region: succ, point: node.point };
157157
successor_found(succ);
158158
}
@@ -229,7 +229,7 @@ impl LocalizedConstraintGraph {
229229
}
230230

231231
// And finally, we have the logical edges, materialized at this point.
232-
for &logical_succ in self.logical_edges.get(&node.region).into_iter().flatten() {
232+
for &logical_succ in self.logical_edges.get(&node.region).into_flat_iter() {
233233
let succ = LocalizedNode { region: logical_succ, point: node.point };
234234
successor_found(succ);
235235
}

compiler/rustc_borrowck/src/region_infer/opaque_types/member_constraints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub(super) fn apply_member_constraints<'tcx>(
4949
rcx.scc_values.add_region(scc_a, scc_b);
5050
}
5151

52-
for defining_use in member_constraints.get(&scc_a).into_iter().flatten() {
52+
for defining_use in member_constraints.get(&scc_a).into_flat_iter() {
5353
apply_member_constraint(rcx, scc_a, &defining_use.arg_regions);
5454
}
5555
}

compiler/rustc_borrowck/src/region_infer/values.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ impl LivenessValues {
178178

179179
/// Returns an iterator of all the points where `region` is live.
180180
fn live_points(&self, region: RegionVid) -> impl Iterator<Item = PointIndex> {
181-
self.point_liveness(region).into_iter().flat_map(|set| set.iter())
181+
self.point_liveness(region).map(|set| set.iter()).into_flat_iter()
182182
}
183183

184184
/// For debugging purposes, returns a pretty-printed string of the points where the `region` is
@@ -348,13 +348,13 @@ impl<'tcx, N: Idx> RegionValues<'tcx, N> {
348348
pub(crate) fn locations_outlived_by(&self, r: N) -> impl Iterator<Item = Location> {
349349
self.points
350350
.row(r)
351-
.into_iter()
352-
.flat_map(move |set| set.iter().map(move |p| self.location_map.to_location(p)))
351+
.map(move |set| set.iter().map(move |p| self.location_map.to_location(p)))
352+
.into_flat_iter()
353353
}
354354

355355
/// Returns just the universal regions that are contained in a given region's value.
356356
pub(crate) fn universal_regions_outlived_by(&self, r: N) -> impl Iterator<Item = RegionVid> {
357-
self.free_regions.row(r).into_iter().flat_map(|set| set.iter())
357+
self.free_regions.row(r).map(|set| set.iter()).into_flat_iter()
358358
}
359359

360360
/// Returns all the elements contained in a given region's value.
@@ -364,8 +364,8 @@ impl<'tcx, N: Idx> RegionValues<'tcx, N> {
364364
) -> impl Iterator<Item = ty::PlaceholderRegion<'tcx>> {
365365
self.placeholders
366366
.row(r)
367-
.into_iter()
368-
.flat_map(|set| set.iter())
367+
.map(|set| set.iter())
368+
.into_flat_iter()
369369
.map(move |p| self.placeholder_indices.lookup_placeholder(p))
370370
}
371371

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
928928
self.super_local_decl(local, local_decl);
929929

930930
for user_ty in
931-
local_decl.user_ty.as_deref().into_iter().flat_map(UserTypeProjections::projections)
931+
local_decl.user_ty.as_deref().map(UserTypeProjections::projections).into_flat_iter()
932932
{
933933
let span = self.user_type_annotations[user_ty.base].span;
934934

compiler/rustc_borrowck/src/type_check/relate_tys.rs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -597,27 +597,7 @@ impl<'b, 'tcx> PredicateEmittingRelation<InferCtxt<'tcx>> for NllTypeRelating<'_
597597
);
598598
}
599599

600-
fn register_alias_relate_predicate(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) {
601-
self.register_predicates([ty::Binder::dummy(match self.ambient_variance {
602-
ty::Covariant => ty::PredicateKind::AliasRelate(
603-
a.into(),
604-
b.into(),
605-
ty::AliasRelationDirection::Subtype,
606-
),
607-
// a :> b is b <: a
608-
ty::Contravariant => ty::PredicateKind::AliasRelate(
609-
b.into(),
610-
a.into(),
611-
ty::AliasRelationDirection::Subtype,
612-
),
613-
ty::Invariant => ty::PredicateKind::AliasRelate(
614-
a.into(),
615-
b.into(),
616-
ty::AliasRelationDirection::Equate,
617-
),
618-
ty::Bivariant => {
619-
unreachable!("cannot defer an alias-relate goal with Bivariant variance (yet?)")
620-
}
621-
})]);
600+
fn ambient_variance(&self) -> ty::Variance {
601+
self.ambient_variance
622602
}
623603
}

0 commit comments

Comments
 (0)