Skip to content

Inference regression in nightly affecting Pin::set and futures #56237

Description

@withoutboats

futures-util-preview does not build on the current nightly because the compiler is unable to infer that a type is Sized. This is a regression in the latest nightly.

The line that errors is here.

Error message:

error[E0277]: the size for values of type `<&mut future::maybe_done::MaybeDone<Fut> as std::ops::Deref>::Target` cannot be known at compilation time
   --> futures-util/src/future/maybe_done.rs:110:9
    |
110 |         Pin::set(self, MaybeDone::Done(res));
    |         ^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `<&mut future::maybe_done::MaybeDone<Fut> as std::ops::Deref>::Target`

Relevant commits: edaac35...6acbb5b

cc rust-lang/futures-rs#1350

Activity

  1. hcpl commented on Nov 26, 2018

    @hcpl
    Contributor

    Minimized example without Pin and external dependencies:

    use std::ops::{Deref, DerefMut};
    
    fn foo<P>(_value: <P as Deref>::Target)
    where
        P: DerefMut,
        <P as Deref>::Target: Sized,
    {}
    
    fn main() {
        foo::<&mut u32>(2);
    }

    Playground.

  2. oli-obk commented on Nov 26, 2018

    @oli-obk
    Contributor

    Possibly caused by #56045

    cc @qnighy

  3. cramertj commented on Nov 26, 2018

    @cramertj
    Member

    Enabling the unsized_locals feature fixes this, so this is being caused by the gate here.

  4. qnighy commented on Nov 27, 2018

    @qnighy
    Contributor

    Perhaps do I need some normalization before doing deferred Sizedness checking?

  5. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Dec 3, 2018
  6. pnkfelix commented on Dec 6, 2018

    @pnkfelix
    Contributor

    triage. This is now a stable-to-beta regression. P-high.

  7. added and removed on Dec 6, 2018
  8. pnkfelix commented on Dec 6, 2018

    @pnkfelix
    Contributor

    assigning to @nikomatsakis to either r+ PR #56282, come up with a new fix, or delegate those options to someone else.

  9. added a commit that references this issue on Dec 6, 2018
    cd48ce1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions