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

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

Closed
withoutboats opened this issue Nov 26, 2018 · 6 comments · Fixed by #56282
Closed

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

withoutboats opened this issue Nov 26, 2018 · 6 comments · Fixed by #56282
Assignees
Labels
P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@withoutboats
Copy link
Contributor

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

@hcpl
Copy link

hcpl commented Nov 26, 2018

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.

@oli-obk
Copy link
Contributor

oli-obk commented Nov 26, 2018

Possibly caused by #56045

cc @qnighy

@cramertj
Copy link
Member

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

@qnighy
Copy link
Contributor

qnighy commented Nov 27, 2018

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

@arielb1 arielb1 added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 3, 2018
@pnkfelix
Copy link
Member

pnkfelix commented Dec 6, 2018

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

@oli-obk oli-obk added regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Dec 6, 2018
@pnkfelix pnkfelix added the P-high High priority label Dec 6, 2018
@pnkfelix
Copy link
Member

pnkfelix commented Dec 6, 2018

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

bors added a commit that referenced this issue Dec 6, 2018
Fix #56237: normalize type before deferred sizedness checking.

This seems to fix #56237, which was introduced by #56045. I don't thoroughly understand how this works, but the problem seemed to be a lack of normalization.

r? @cramertj
bors added a commit that referenced this issue Dec 18, 2018
[beta] Rollup backports

PRs accepted for backport:

* #56781: Update LLVM submodule
* #56615: Update the book to fix some edition-related bugs
* #56562: Update libc version required by rustc
* #56282: Fix #56237: normalize type before deferred sizedness checking.
* Release notes for Rust 1.31.1

Approved PRs targeting beta:

* #56819: [beta] rustdoc: fix line numbers display for [src] pages
* #56893: [beta] Revert "Update CI-clang to 7.0.0 for Linux dists."

r? @ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants