Skip to content

1.93 regression satisfying send obligation #151748

Description

@conradludgate

I cannot share a reproduction right at this moment (closed source), I will work to minimise the error sometime soon. I will describe the error that I am seeing though, incase someone can figure out a minimum repro by the error and regression alone.

  • With 1.92, my code compiles.
  • With 1.93 dev profile, my code compiles.
  • With 1.93 release profile, my code no longer compiles.
  • With 1.93 release and debug-assertions, my code still doesn't compile.

I see the following (truncated) error:

error: cannot check whether the hidden type of opaque type satisfies auto traits
   --> proxy/src/pglb/local_proxy.rs:115:14
    |
115 |             .boxed()
    |              ^^^^^
    |
    = note: fetching the hidden types of an opaque inside of the defining scope is not supported. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
note: opaque type is declared here
   --> proxy/src/pqproto.rs:155:1
    |
155 | / pub async fn read_startup<S>(stream: &mut S) -> io::Result<FeStartupPacket>
156 | | where
157 | |     S: AsyncRead + Unpin,
    | |_________________________^
...
note: required by a bound in `futures::FutureExt::boxed`
   --> /Users/conrad.ludgate/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-util-0.3.31/src/future/future/mod.rs:516:23
    |
514 |     fn boxed<'a>(self) -> BoxFuture<'a, Self::Output>
    |        ----- required by a bound in this associated function
515 |     where
516 |         Self: Sized + Send + 'a,
    |                       ^^^^ required by this bound in `FutureExt::boxed`

I bisected this to the following commit f37aa99 (#147890).

I've been told that there is a post-mono trait solver pass that can be influenced by mir transforms, which would explain why I see this issue only with --release.

I was able to fix the issue with the following modifications

before:

pub async fn read_startup<S>(stream: &mut S) -> io::Result<FeStartupPacket>
where
    S: AsyncRead + Unpin,
{
    ...
}

after:

pub fn read_startup<S>(
    stream: &mut S,
) -> impl Future<Output = io::Result<FeStartupPacket>> + Send + '_
where
    S: AsyncRead + Unpin + Send,
{
    read_startup_inner(stream)
}

async fn read_startup_inner<S>(stream: &mut S) -> io::Result<FeStartupPacket>
where
    S: AsyncRead + Unpin + Send,
{
    ...
}

I know there's not a lot to go off of here, I apologise for this. As I say, I hope to have some time eventually to minimise this regression.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-closures`async || {}`A-auto-traitsArea: auto traits (e.g., `auto trait Send {}`)A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)A-cratesArea: Crates and their interactions (like crate loading)A-patternsRelating to patterns and pattern matchingC-bugCategory: This is a bug.I-cycleIssue: A query cycle occurred while none was expectedP-highHigh priorityS-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.T-typesRelevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions