do not lower patterns in impl Trait
This commit is contained in:
parent
8f13705e3b
commit
5ac268c435
2 changed files with 19 additions and 0 deletions
|
@ -538,6 +538,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||||
}
|
}
|
||||||
self.visit_fn_ret_ty(&f.decl.output)
|
self.visit_fn_ret_ty(&f.decl.output)
|
||||||
}
|
}
|
||||||
|
TyKind::ImplTrait(_, ref bounds) => {
|
||||||
|
self.with_hir_id_owner(None, |this| {
|
||||||
|
walk_list!(this, visit_param_bound, bounds);
|
||||||
|
});
|
||||||
|
}
|
||||||
_ => visit::walk_ty(self, t),
|
_ => visit::walk_ty(self, t),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
14
src/test/ui/impl-trait/closure-in-impl-trait.rs
Normal file
14
src/test/ui/impl-trait/closure-in-impl-trait.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// run-pass
|
||||||
|
#![allow(unused_must_use)]
|
||||||
|
fn bug<T>() -> impl Iterator<Item = [(); { |x: u32| { x }; 4 }]> {
|
||||||
|
std::iter::empty()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ok<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> {
|
||||||
|
Box::new(std::iter::empty())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
for _item in ok::<u32>() {}
|
||||||
|
for _item in bug::<u32>() {}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue