Auto merge of #132697 - compiler-errors:async-closure-sugar, r=fmease
Clean middle generics using paren sugar if trait has `#[rustc_paren_sugar]` That is to say, generalize the `Fn()` paren sugar handling to *any* trait that is marked with `rustc_paren_sugar`. This means that `AsyncFn` is also covered here. r? fmease
This commit is contained in:
commit
116fc31c5c
@ -206,7 +206,7 @@ fn clean_middle_generic_args_with_constraints<'tcx>(
|
|||||||
) -> GenericArgs {
|
) -> GenericArgs {
|
||||||
let args = clean_middle_generic_args(cx, ty_args.map_bound(|args| &args[..]), has_self, did);
|
let args = clean_middle_generic_args(cx, ty_args.map_bound(|args| &args[..]), has_self, did);
|
||||||
|
|
||||||
if cx.tcx.fn_trait_kind_from_def_id(did).is_some() {
|
if cx.tcx.is_trait(did) && cx.tcx.trait_def(did).paren_sugar {
|
||||||
let ty = ty_args
|
let ty = ty_args
|
||||||
.iter()
|
.iter()
|
||||||
.nth(if has_self { 1 } else { 0 })
|
.nth(if has_self { 1 } else { 0 })
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
//@ has - '//*[@id="associatedtype.Out12"]' "type Out12: for<'w> Helper<B<'w> = Cow<'w, str>, A<'w> = bool>"
|
//@ has - '//*[@id="associatedtype.Out12"]' "type Out12: for<'w> Helper<B<'w> = Cow<'w, str>, A<'w> = bool>"
|
||||||
//@ has - '//*[@id="associatedtype.Out13"]' "type Out13: for<'fst, 'snd> Aid<'snd, Result<'fst> = &'fst mut str>"
|
//@ has - '//*[@id="associatedtype.Out13"]' "type Out13: for<'fst, 'snd> Aid<'snd, Result<'fst> = &'fst mut str>"
|
||||||
//@ has - '//*[@id="associatedtype.Out14"]' "type Out14<P: Copy + Eq, Q: ?Sized>"
|
//@ has - '//*[@id="associatedtype.Out14"]' "type Out14<P: Copy + Eq, Q: ?Sized>"
|
||||||
|
//@ has - '//*[@id="associatedtype.Out15"]' "type Out15: AsyncFnMut(i32) -> bool"
|
||||||
//
|
//
|
||||||
// Snapshots:
|
// Snapshots:
|
||||||
// Check that we don't render any where-clauses for the following associated types since
|
// Check that we don't render any where-clauses for the following associated types since
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
#![feature(async_closure)]
|
||||||
|
|
||||||
|
use std::ops::AsyncFnMut;
|
||||||
|
|
||||||
pub trait Main {
|
pub trait Main {
|
||||||
type Item;
|
type Item;
|
||||||
|
|
||||||
@ -16,6 +20,7 @@ pub trait Main {
|
|||||||
type Out12: for<'w> Helper<B<'w> = std::borrow::Cow<'w, str>, A<'w> = bool>;
|
type Out12: for<'w> Helper<B<'w> = std::borrow::Cow<'w, str>, A<'w> = bool>;
|
||||||
type Out13: for<'fst, 'snd> Aid<'snd, Result<'fst> = &'fst mut str>;
|
type Out13: for<'fst, 'snd> Aid<'snd, Result<'fst> = &'fst mut str>;
|
||||||
type Out14<P: Copy + Eq, Q: ?Sized>;
|
type Out14<P: Copy + Eq, Q: ?Sized>;
|
||||||
|
type Out15: AsyncFnMut(i32) -> bool;
|
||||||
|
|
||||||
fn make<F>(_: F, _: impl FnMut(&str) -> bool)
|
fn make<F>(_: F, _: impl FnMut(&str) -> bool)
|
||||||
where
|
where
|
||||||
|
Loading…
Reference in New Issue
Block a user