-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #75127 - jyn514:impl-trait, r=pnkfelix
Fix async-std by special-casing rustdoc in typeck #75100
- Loading branch information
Showing
23 changed files
with
126 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
// edition:2018 | ||
// check-pass | ||
|
||
/// 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. | ||
/// Should compile fine | ||
pub async fn a() -> u32 { | ||
error::_in::async_fn() | ||
//~^ ERROR failed to resolve | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// check-pass | ||
// manually desugared version of an `async fn` (but with a closure instead of a generator) | ||
pub fn a() -> impl Fn() -> u32 { | ||
|| content::doesnt::matter() | ||
//~^ ERROR failed to resolve | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// check-pass | ||
trait ValidTrait {} | ||
|
||
/// This has docs | ||
pub fn f() -> impl ValidTrait { | ||
Vec::<DoesNotExist>::new() | ||
//~^ ERROR failed to resolve | ||
} |
12 changes: 0 additions & 12 deletions
12
src/test/rustdoc-ui/error-in-impl-trait/generic-argument.stderr
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/test/rustdoc-ui/error-in-impl-trait/impl-keyword-closure.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// check-pass | ||
pub trait ValidTrait {} | ||
/// This returns impl trait | ||
pub fn g() -> impl ValidTrait { | ||
(|| error::_in::impl_trait::alias::nested::closure())() | ||
//~^ ERROR failed to resolve | ||
} |
12 changes: 0 additions & 12 deletions
12
src/test/rustdoc-ui/error-in-impl-trait/impl-keyword-closure.stderr
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// check-pass | ||
pub trait ValidTrait {} | ||
/// This returns impl trait | ||
pub fn g() -> impl ValidTrait { | ||
error::_in::impl_trait() | ||
//~^ ERROR failed to resolve | ||
} |
12 changes: 0 additions & 12 deletions
12
src/test/rustdoc-ui/error-in-impl-trait/impl-keyword.stderr
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
src/test/rustdoc-ui/error-in-impl-trait/realistic-async.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// edition:2018 | ||
// check-pass | ||
|
||
mod windows { | ||
pub trait WinFoo { | ||
fn foo(&self) {} | ||
} | ||
|
||
impl WinFoo for () {} | ||
} | ||
|
||
#[cfg(any(windows, doc))] | ||
use windows::*; | ||
|
||
mod unix { | ||
pub trait UnixFoo { | ||
fn foo(&self) {} | ||
} | ||
|
||
impl UnixFoo for () {} | ||
} | ||
|
||
#[cfg(any(unix, doc))] | ||
use unix::*; | ||
|
||
async fn bar() { | ||
().foo() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
src/test/rustdoc-ui/error-in-impl-trait/trait-alias-closure.stderr
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
src/test/rustdoc-ui/error-in-impl-trait/trait-alias.stderr
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
src/test/rustdoc-ui/infinite-recursive-type-impl-trait-return.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// normalize-stderr-test: "`.*`" -> "`DEF_ID`" | ||
// normalize-stdout-test: "`.*`" -> "`DEF_ID`" | ||
// edition:2018 | ||
|
||
pub async fn f() -> impl std::fmt::Debug { | ||
#[derive(Debug)] | ||
enum E { | ||
//~^ ERROR recursive type `f::{{closure}}#0::E` has infinite size | ||
This(E), | ||
Unit, | ||
} | ||
E::Unit | ||
} | ||
|
||
fn main() {} |
17 changes: 17 additions & 0 deletions
17
src/test/rustdoc-ui/infinite-recursive-type-impl-trait-return.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
error[E0072]: recursive type `DEF_ID` has infinite size | ||
--> $DIR/infinite-recursive-type-impl-trait-return.rs:7:5 | ||
| | ||
LL | enum E { | ||
| ^^^^^^ recursive type has infinite size | ||
LL | | ||
LL | This(E), | ||
| - recursive without indirection | ||
| | ||
help: insert some indirection (e.g., a `DEF_ID` representable | ||
| | ||
LL | This(Box<E>), | ||
| ^^^^ ^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `DEF_ID`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
fn f() -> impl Sized { | ||
enum E { | ||
//~^ ERROR recursive type `f::E` has infinite size | ||
V(E), | ||
} | ||
unimplemented!() | ||
} |
17 changes: 17 additions & 0 deletions
17
src/test/rustdoc-ui/infinite-recursive-type-impl-trait.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
error[E0072]: recursive type `f::E` has infinite size | ||
--> $DIR/infinite-recursive-type-impl-trait.rs:2:5 | ||
| | ||
LL | enum E { | ||
| ^^^^^^ recursive type has infinite size | ||
LL | | ||
LL | V(E), | ||
| - recursive without indirection | ||
| | ||
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `f::E` representable | ||
| | ||
LL | V(Box<E>), | ||
| ^^^^ ^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0072`. |