Skip to content

Rollup of 11 pull requests #103670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
770538e
Add fix suggestions for E0199, E0200, and E0569
nbarrios1337 Oct 20, 2022
641bf08
Don't merge inline doc comments for impl blocks
GuillaumeGomez Oct 25, 2022
a4279a1
Add regression test for inlined doc comment on impl block
GuillaumeGomez Oct 25, 2022
b205a5a
diagnostics: do not suggest static candidates as traits to import
notriddle Oct 25, 2022
8cf9ad6
diagnostics: add test case for issue 102354
notriddle Oct 25, 2022
b1cc95d
Remap early bound lifetimes too
compiler-errors Oct 24, 2022
0185be2
Migrate line numbers CSS to CSS variables
GuillaumeGomez Oct 27, 2022
71e824d
Add tests for source line numbers colors
GuillaumeGomez Oct 26, 2022
f4ac137
add test for issue 36007
Rageking8 Oct 27, 2022
dce44fa
Revert "Make ClosureOutlivesRequirement not rely on an unresolved type"
compiler-errors Oct 27, 2022
4e0c27b
Erase regions from CallArgument, add test + bless
compiler-errors Oct 27, 2022
dd912ad
rustdoc: stop hiding focus outlines on non-rustdoc-toggle details tags
notriddle Oct 27, 2022
4d9114f
Update cargo
weihanglo Oct 27, 2022
c00ff9c
DoIt
BoxyUwU Oct 27, 2022
ca5a6e4
use proper spans
BoxyUwU Oct 27, 2022
b342558
tidy + move logic to fn
BoxyUwU Oct 27, 2022
97423d3
Add tests for static async functions in traits
bryangarza Oct 4, 2022
8a0ebca
Update static AFIT tests based on feedback
bryangarza Oct 4, 2022
11b1439
Update tests based on feedback
bryangarza Oct 7, 2022
9a05081
Add additional tests for static AFIT
bryangarza Oct 7, 2022
0b3b046
Update src/test/ui/async-await/in-trait/async-example.rs
bryangarza Oct 27, 2022
bfdefdb
Update tests based on feedback
bryangarza Oct 27, 2022
9f2b7b4
Rollup merge of #102642 - bryangarza:afit-tests, r=compiler-errors
matthiaskrgr Oct 28, 2022
20188a5
Rollup merge of #103283 - nbarrios1337:unsafe-impl-suggestions, r=cjg…
matthiaskrgr Oct 28, 2022
1073bdc
Rollup merge of #103523 - GuillaumeGomez:inline-doc-comment-impl-bloc…
matthiaskrgr Oct 28, 2022
7121569
Rollup merge of #103550 - notriddle:notriddle/no-suggest-static-candi…
matthiaskrgr Oct 28, 2022
cfa2234
Rollup merge of #103585 - GuillaumeGomez:source-line-css, r=notriddle
matthiaskrgr Oct 28, 2022
e7fdac5
Rollup merge of #103608 - compiler-errors:rpitit-early-lt, r=cjgillot
matthiaskrgr Oct 28, 2022
5bdefdb
Rollup merge of #103609 - BoxyUwU:fix_impl_self_cycle, r=compiler-errors
matthiaskrgr Oct 28, 2022
cdf284d
Rollup merge of #103631 - Rageking8:Add-test-for-issue-36007, r=compi…
matthiaskrgr Oct 28, 2022
774b952
Rollup merge of #103641 - compiler-errors:issue-103624, r=cjgillot
matthiaskrgr Oct 28, 2022
2bb6a49
Rollup merge of #103643 - notriddle:notriddle/summary-focus-visible, …
matthiaskrgr Oct 28, 2022
82e8a9a
Rollup merge of #103645 - weihanglo:update-cargo, r=weihanglo
matthiaskrgr Oct 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add additional tests for static AFIT
  • Loading branch information
bryangarza committed Oct 27, 2022
commit 9a05081d5fb13b3bee9d41b43692c9f38d521c96
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// edition: 2021

#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]

use std::future::Future;
use std::pin::Pin;

trait MyTrait {
fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
}

impl MyTrait for i32 {
async fn foo(&self) -> i32 {
//~^ ERROR method `foo` has an incompatible type for trait
*self
}
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
error[E0053]: method `foo` has an incompatible type for trait
--> $DIR/async-example-desugared-boxed-in-trait.rs:15:28
|
LL | async fn foo(&self) -> i32 {
| ^^^ expected struct `Pin`, found opaque type
|
note: type in trait
--> $DIR/async-example-desugared-boxed-in-trait.rs:11:22
|
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected fn pointer `fn(&i32) -> Pin<Box<dyn Future<Output = i32>>>`
found fn pointer `fn(&i32) -> impl Future<Output = i32>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0053`.
23 changes: 23 additions & 0 deletions src/test/ui/async-await/in-trait/async-example-desugared-boxed.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// check-pass
// edition: 2021

#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]

use std::future::Future;
use std::pin::Pin;

trait MyTrait {
async fn foo(&self) -> i32;
}

impl MyTrait for i32 {
fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>> {
Box::pin(async {
*self
})
}
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// check-pass
// edition: 2021

#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]

use std::future::Future;

trait MyTrait {
fn foo(&self) -> impl Future<Output = i32> + '_;
}

impl MyTrait for i32 {
async fn foo(&self) -> i32 {
*self
}
}

fn main() {}
22 changes: 22 additions & 0 deletions src/test/ui/async-await/in-trait/async-example-desugared.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// check-pass
// edition: 2021

#![feature(async_fn_in_trait)]
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]

use std::future::Future;

trait MyTrait {
async fn foo(&self) -> i32;
}

impl MyTrait for i32 {
fn foo(&self) -> impl Future<Output = i32> + '_ {
async {
*self
}
}
}

fn main() {}
21 changes: 21 additions & 0 deletions src/test/ui/async-await/in-trait/async-recursive-generic.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// edition: 2021

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]

trait MyTrait<T> {
async fn foo_recursive(&self, n: usize) -> T;
}

impl<T> MyTrait<T> for T where T: Copy {
async fn foo_recursive(&self, n: usize) -> T {
//~^ ERROR recursion in an `async fn` requires boxing
if n > 0 {
self.foo_recursive(n - 1).await
} else {
*self
}
}
}

fn main() {}
12 changes: 12 additions & 0 deletions src/test/ui/async-await/in-trait/async-recursive-generic.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0733]: recursion in an `async fn` requires boxing
--> $DIR/async-recursive-generic.rs:11:48
|
LL | async fn foo_recursive(&self, n: usize) -> T {
| ^ recursive `async fn`
|
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion

error: aborting due to previous error

For more information about this error, try `rustc --explain E0733`.
21 changes: 21 additions & 0 deletions src/test/ui/async-await/in-trait/async-recursive.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// edition: 2021

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]

trait MyTrait {
async fn foo_recursive(&self, n: usize) -> i32;
}

impl MyTrait for i32 {
async fn foo_recursive(&self, n: usize) -> i32 {
//~^ ERROR recursion in an `async fn` requires boxing
if n > 0 {
self.foo_recursive(n - 1).await
} else {
*self
}
}
}

fn main() {}
12 changes: 12 additions & 0 deletions src/test/ui/async-await/in-trait/async-recursive.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0733]: recursion in an `async fn` requires boxing
--> $DIR/async-recursive.rs:11:48
|
LL | async fn foo_recursive(&self, n: usize) -> i32 {
| ^^^ recursive `async fn`
|
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion

error: aborting due to previous error

For more information about this error, try `rustc --explain E0733`.