Skip to content

pin_ergonomics leads to bizarre "expected Pin<X> found Pin<X>" type errors #133222

Closed
@yotamofek

Description

@yotamofek

I know pin_ergonomics is in very early stages, but I was eager to try it out and ran into this somewhat fundamental issue.
cc #130494

I tried this code:

#![feature(pin_ergonomics)]

use std::pin::Pin;

pub fn foo() {
    let _: Pin<Box<()>> = Box::pin(());
}

I expected to see this happen: should compile

Instead, this happened: got a compilation error


error[E0308]: mismatched types
 --> src/lib.rs:6:27
  |
6 |     let _: Pin<Box<()>> = Box::pin(());
  |                           ^^^^^^^^^^^^ types differ
  |
  = note: expected struct `Pin<_>`
             found struct `Pin<_>`

Meta

rustc --version --verbose:

rustc 1.84.0-nightly (f2a35426b 2024-11-16)
binary: rustc
commit-hash: f2a35426b6586178c44b27cedae182502092e898
commit-date: 2024-11-16
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3

Metadata

Metadata

Labels

A-coercionsArea: implicit and explicit `expr as Type` coercionsC-bugCategory: This is a bug.F-pin_ergonomics`#![feature(pin_ergonomics)]`S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-incomplete-featuresThis issue requires the use of incomplete features.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions