Recurse into function bodies, but don't typeck closures

Previously, rustdoc would issue a delay_span_bug ICE on the following code:

```rust
pub fn a() -> impl Fn() -> u32 {
    || content::doesnt::matter()
}
```

This wasn't picked up earlier because having `type Alias = impl Trait;`
in the same module caused _all closures_ to be typechecked, even if they
wouldn't normally. Additionally, if _any_ error was emitted, no
delay_span_bug would be emitted. So as part of this commit all of the
tests were separated out into different files.
This commit is contained in:
Joshua Nelson 2020-07-09 09:13:59 -04:00
parent 768d6a4950
commit a93bcc9a7b
16 changed files with 145 additions and 76 deletions

View file

@ -0,0 +1,10 @@
// edition:2018
/// This used to work with ResolveBodyWithLoop.
/// However now that we ignore type checking instead of modifying the function body,
/// the return type is seen as `impl Future<Output = u32>`, not a `u32`.
/// So it no longer allows errors in the function body.
pub async fn a() -> u32 {
error::_in::async_fn()
//~^ ERROR failed to resolve
}