Skip to content

RPIT type parameters not checked for well-formedness #110925

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

Open
Jules-Bertholet opened this issue Apr 28, 2023 · 1 comment
Open

RPIT type parameters not checked for well-formedness #110925

Jules-Bertholet opened this issue Apr 28, 2023 · 1 comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@Jules-Bertholet
Copy link
Contributor

Jules-Bertholet commented Apr 28, 2023

I tried this code:

trait Test<T: ?Sized> {}

impl<T: ?Sized, U: ?Sized> Test<U> for T {}

fn foo() -> impl Test<(str, str)> {
    ()
}

fn main() {
    foo();
}

I expected to see this happen: Compile error, (str, str) is not well-formed

Instead, this happened: Compiles and runs successfully

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (1a6ae3d69 2023-04-27)
binary: rustc
commit-hash: 1a6ae3d692cfb52b21d0f45ba50b659486e53d6c
commit-date: 2023-04-27
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

@rustbot label +A-impl-trait +T-types

@Jules-Bertholet Jules-Bertholet added the C-bug Category: This is a bug. label Apr 28, 2023
@rustbot rustbot added A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. T-types Relevant to the types team, which will review and decide on the PR/issue. labels Apr 28, 2023
@Jules-Bertholet
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants