-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Properly consider APITs for never type fallback ascription fix #134144
Conversation
r? WaffleLapkin or maybe re-roll if you're busy :> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me after minor nit
// We filter out APITs, which are not turbofished. | ||
let n_tys = args | ||
.iter() | ||
.filter(|arg| matches!(arg.unpack(), ty::GenericArgKind::Type(_))) | ||
.clone() | ||
.filter(|(_, param)| { | ||
matches!(param.kind, ty::GenericParamDefKind::Type { synthetic: false, .. }) | ||
}) | ||
.count(); | ||
for (idx, arg) in args | ||
.iter() | ||
.filter(|arg| matches!(arg.unpack(), ty::GenericArgKind::Type(_))) | ||
for (idx, (arg, _)) in args | ||
.filter(|(_, param)| { | ||
matches!(param.kind, ty::GenericParamDefKind::Type { synthetic: false, .. }) | ||
}) | ||
.enumerate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create an iterator and then clone it instead? i.e. let args = args.filter()
and then args.clone().count()
+ for ... in args.enumarate()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, can deduplicate the filtering
0570821
to
2caada1
Compare
@bors r=WaffleLapkin rollup |
…affleLapkin Properly consider APITs for never type fallback ascription fix Fixes rust-lang#133842
Rollup of 13 pull requests Successful merges: - rust-lang#122003 (link libunwind dynamically and allow controlling it via `crt-static` on gnullvm targets) - rust-lang#133122 (Add unpolished, experimental support for AFIDT (async fn in dyn trait)) - rust-lang#133859 (Move some alloc tests to the alloctests crate) - rust-lang#134070 (Some asm! diagnostic adjustments and a papercut fix) - rust-lang#134095 ([CI] Use a lockfile for installing the `datadog` package) - rust-lang#134144 (Properly consider APITs for never type fallback ascription fix) - rust-lang#134152 (Simplify `rustc_mir_dataflow::abs_domain`.) - rust-lang#134154 (suppress field expr with generics error message if it's a method) - rust-lang#134155 (Forbid `unsafe_op_in_unsafe_fn` for Hurd) - rust-lang#134173 (allow `symbol_intern_string_literal` lint in test modules) - rust-lang#134178 (Stabilize the Rust 2024 prelude) - rust-lang#134179 (Remove outdated consteval note from `<*mut T>::align_offset` docs.) - rust-lang#134187 (Remove `PErr`.) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#122003 (link libunwind dynamically and allow controlling it via `crt-static` on gnullvm targets) - rust-lang#133859 (Move some alloc tests to the alloctests crate) - rust-lang#134070 (Some asm! diagnostic adjustments and a papercut fix) - rust-lang#134144 (Properly consider APITs for never type fallback ascription fix) - rust-lang#134152 (Simplify `rustc_mir_dataflow::abs_domain`.) - rust-lang#134154 (suppress field expr with generics error message if it's a method) - rust-lang#134155 (Forbid `unsafe_op_in_unsafe_fn` for Hurd) - rust-lang#134173 (allow `symbol_intern_string_literal` lint in test modules) - rust-lang#134178 (Stabilize the Rust 2024 prelude) - rust-lang#134179 (Remove outdated consteval note from `<*mut T>::align_offset` docs.) - rust-lang#134187 (Remove `PErr`.) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#134144 - compiler-errors:fallback-apit, r=WaffleLapkin Properly consider APITs for never type fallback ascription fix Fixes rust-lang#133842
Fixes #133842