Skip to content
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

Stabilize async fn and return-position impl Trait in trait #115822

Merged
merged 3 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Test that RPITITs have RPIT scope and not impl-wide scope
  • Loading branch information
compiler-errors committed Oct 13, 2023
commit 3f2574e8bad436a01a2cb7ea1b054f457bba5f0d
21 changes: 21 additions & 0 deletions tests/ui/impl-trait/in-trait/sibling-function-constraint.rs
Original file line number Diff line number Diff line change
@@ -0,0 1,21 @@
// Checks that a sibling function (i.e. `foo`) cannot constrain
// an RPITIT from another function (`bar`).

trait Trait {
fn foo();

fn bar() -> impl Sized;
}

impl Trait for () {
fn foo() {
let _: String = Self::bar();
//~^ ERROR mismatched types
}

fn bar() -> impl Sized {
loop {}
}
}

fn main() {}
17 changes: 17 additions & 0 deletions tests/ui/impl-trait/in-trait/sibling-function-constraint.stderr
Original file line number Diff line number Diff line change
@@ -0,0 1,17 @@
error[E0308]: mismatched types
--> $DIR/sibling-function-constraint.rs:12:25
|
LL | let _: String = Self::bar();
| ------ ^^^^^^^^^^^ expected `String`, found opaque type
| |
| expected due to this
...
LL | fn bar() -> impl Sized {
| ---------- the found opaque type
|
= note: expected struct `String`
found opaque type `impl Sized`

error: aborting due to previous error

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