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

Regression from nightly to nightly in type_alias_impl_trait #89952

Closed
iliakonnov opened this issue Oct 16, 2021 · 1 comment · Fixed by #96686
Closed

Regression from nightly to nightly in type_alias_impl_trait #89952

iliakonnov opened this issue Oct 16, 2021 · 1 comment · Fixed by #96686
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@iliakonnov
Copy link

Code

I tried this code:

#![feature(type_alias_impl_trait)]

trait SomeTrait {}
impl SomeTrait for () {}

trait MyFuture {
    type Output;
}
impl<T> MyFuture for T {
    type Output = T;
}

trait ReturnsFuture {
    type Output: SomeTrait;
    type Future: MyFuture<Output=Result<Self::Output, ()>>;
    fn func() -> Self::Future;
}

struct Foo;

impl ReturnsFuture for Foo {
    type Output = impl SomeTrait;
    type Future = impl MyFuture<Output=Result<Self::Output, ()>>;
    fn func() -> Self::Future {
        Result::<(), ()>::Err(())
    }
}

I expected to see this happen: code compiles successfully

Instead, this happened:

error[E0271]: type mismatch resolving `<Result<(), ()> as MyFuture>::Output == Result<impl SomeTrait, ()>`
  --> ./demo.rs:24:18
   |
22 |     type Output = impl SomeTrait;
   |                   -------------- the expected opaque type
23 |     type Future = impl MyFuture<Output=Result<Self::Output, ()>>;
24 |     fn func() -> Self::Future {
   |                  ^^^^^^^^^^^^ expected opaque type, found `()`
   |
   = note: expected enum `Result<impl SomeTrait, _>`
              found enum `Result<(), _>`

error: could not find defining uses
  --> ./demo.rs:22:19
   |
22 |     type Output = impl SomeTrait;
   |                   ^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

Version it worked on

rustc --version --verbose:

rustc 1.57.0-nightly (5ecc8ad84 2021-09-19)
binary: rustc
commit-hash: 5ecc8ad8462574354a55162a0c16b10eb95e3e70
commit-date: 2021-09-19
host: x86_64-unknown-linux-gnu
release: 1.57.0-nightly
LLVM version: 13.0.0

Version with regression

rustc --version --verbose:

rustc 1.57.0-nightly (ac2d9fc50 2021-09-21)
binary: rustc
commit-hash: ac2d9fc509e36d1b32513744adf58c34bcc4f43c
commit-date: 2021-09-21
host: x86_64-unknown-linux-gnu
release: 1.57.0-nightly
LLVM version: 13.0.0

@rustbot modify labels: +requires-nightly +F-type_alias_impl_trait

@iliakonnov iliakonnov added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Oct 16, 2021
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` requires-nightly This issue requires a nightly compiler in some way. and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Oct 16, 2021
@camelid camelid added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed regression-untriaged Untriaged performance or correctness regression. labels Oct 16, 2021
@oli-obk oli-obk self-assigned this Oct 17, 2021
iliakonnov added a commit to iliakonnov/colbak that referenced this issue Dec 21, 2021
@oli-obk oli-obk removed their assignment May 3, 2022
@oli-obk oli-obk added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label May 3, 2022
@oli-obk
Copy link
Contributor

oli-obk commented May 3, 2022

This is fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Development

Successfully merging a pull request may close this issue.

4 participants