1
Fork 0

Don't ICE on errors in function returning impl trait

Instead, report the error.

This emits the errors on-demand, without special-casing `impl Trait`, so
it should catch all ICEs of this kind, including ones that haven't been
found yet.

Since the error is emitted during type-checking there is less info about
the error; see comments in the code for details.

- Add test case for -> impl Trait
- Add test for impl trait with alias
- Move EmitIgnoredResolutionErrors to rustdoc

This makes `fn typeck_item_bodies` public, which is not desired behavior.
That change should be removed once
https://github.com/rust-lang/rust/pull/74070 is merged.

- Don't visit nested closures twice
This commit is contained in:
Joshua Nelson 2020-07-03 18:41:23 -04:00
parent 14a8707cde
commit 768d6a4950
7 changed files with 162 additions and 2 deletions

View file

@ -0,0 +1,14 @@
#![feature(type_alias_impl_trait)]
trait MyTrait {}
impl MyTrait for i32 {}
// @has impl_trait_alias/type.Foo.html 'Foo'
/// debug type
pub type Foo = impl MyTrait;
// @has impl_trait_alias/fn.foo.html 'foo'
/// debug function
pub fn foo() -> Foo {
1
}