Skip to content

nightly 2022-06-29 rejects previously compiling code with missing trait implementations #99536

Closed
@hawkw

Description

@hawkw

Code

The linkerd2-proxy project fails to compile on nighty 2022-06-29 and later due to a "missing" implementation of a trait in an impl Trait return value. The same code compiles successfully on stable and on prior nightlies. The error occurs when using impl Trait as an associated type of a return value that is itself an impl Trait, when the associated type has trait bounds placed on it by the outer impl Trait.

An error like this is generated:

error[E0277]: the trait bound `impl std::marker::Send + Unpin: linkerd_app_core::linkerd_io::AsyncRead` is not satisfied
   --> linkerd/app/inbound/src/lib.rs:158:9
    |
158 | /         impl svc::MakeConnection<
159 | |                 T,
160 | |                 Connection = impl Send + Unpin,
161 | |                 Metadata = impl Send + Unpin,
162 | |                 Error = Error,
163 | |                 Future = impl Send,
164 | |             > + Clone,
    | |_____________________^ the trait `linkerd_app_core::linkerd_io::AsyncRead` is not implemented for `impl std::marker::Send + Unpin`
    |
    = help: the following other types implement trait `linkerd_app_core::linkerd_io::AsyncRead`:
              &[u8]
              &mut T
              Box<T>
              BoxedIo
              BufStream<RW>
              DuplexStream
              EitherIo<L, R>
              Pin<P>
            and 38 others
    = note: required because of the requirements on the impl of `linkerd_app_core::svc::MakeConnection<T>` for `linkerd_app_core::svc::Filter<linkerd_app_core::svc::MapErr<linkerd_app_core::svc::linkerd_stack::Timeout<ConnectTcp>, impl (FnOnce(Box<(dyn std::error::Error + Sync + std::marker::Send + 'static)>) -> Box<(dyn std::error::Error + Sync + std::marker::Send + 'static)>) + Clone>, [closure@linkerd/app/inbound/src/lib.rs:186:38: 193:18]>`

error[E0277]: the trait bound `impl std::marker::Send + Unpin: linkerd_app_core::linkerd_io::AsyncWrite` is not satisfied
   --> linkerd/app/inbound/src/lib.rs:158:9
    |
158 | /         impl svc::MakeConnection<
159 | |                 T,
160 | |                 Connection = impl Send + Unpin,
161 | |                 Metadata = impl Send + Unpin,
162 | |                 Error = Error,
163 | |                 Future = impl Send,
164 | |             > + Clone,
    | |_____________________^ the trait `linkerd_app_core::linkerd_io::AsyncWrite` is not implemented for `impl std::marker::Send + Unpin`
    |
    = help: the following other types implement trait `linkerd_app_core::linkerd_io::AsyncWrite`:
              &mut T
              Box<T>
              BoxedIo
              BufStream<RW>
              DuplexStream
              EitherIo<L, R>
              Pin<P>
              PrefixedIo<I>
            and 38 others
    = note: required because of the requirements on the impl of `linkerd_app_core::svc::MakeConnection<T>` for `linkerd_app_core::svc::Filter<linkerd_app_core::svc::MapErr<linkerd_app_core::svc::linkerd_stack::Timeout<ConnectTcp>, impl (FnOnce(Box<(dyn std::error::Error + Sync + std::marker::Send + 'static)>) -> Box<(dyn std::error::Error + Sync + std::marker::Send + 'static)>) + Clone>, [closure@linkerd/app/inbound/src/lib.rs:186:38: 193:18]>`

error[E0277]: the trait bound `impl std::marker::Send + Unpin: linkerd_app_core::linkerd_io::AsyncRead` is not satisfied
  --> linkerd/app/outbound/src/tcp/connect.rs:39:9
   |
39 | /         impl svc::MakeConnection<
40 | |                 T,
41 | |                 Connection = impl Send + Unpin,
42 | |                 Metadata = ConnectMeta,
43 | |                 Error = Error,
44 | |                 Future = impl Send,
45 | |             > + Clone,
   | |_____________________^ the trait `linkerd_app_core::linkerd_io::AsyncRead` is not implemented for `impl std::marker::Send + Unpin`
   |
   = help: the following other types implement trait `linkerd_app_core::linkerd_io::AsyncRead`:
             &[u8]
             &mut T
             Box<T>
             BoxedIo
             DuplexStream
             EitherIo<L, R>
             Pin<P>
             PrefixedIo<I>
           and 38 others
   = note: required because of the requirements on the impl of `MakeConnection<T>` for `linkerd_app_core::transport::linkerd_transport_metrics::Client<linkerd_app_core::transport::Metrics, BoxFuture<linkerd_app_core::svc::MapErr<linkerd_app_core::svc::linkerd_stack::Timeout<OpaqueTransport<linkerd_app_core::linkerd_tls::Client<linkerd_app_core::identity::NewClient, C>>>, impl (FnOnce(Box<(dyn std::error::Error + Sync + std::marker::Send + 'static)>) -> Box<(dyn std::error::Error + Sync + std::marker::Send + 'static)>) + Clone>>>`

error[E0277]: the trait bound `impl std::marker::Send + Unpin: linkerd_app_core::linkerd_io::AsyncWrite` is not satisfied
  --> linkerd/app/outbound/src/tcp/connect.rs:39:9
   |
39 | /         impl svc::MakeConnection<
40 | |                 T,
41 | |                 Connection = impl Send + Unpin,
42 | |                 Metadata = ConnectMeta,
43 | |                 Error = Error,
44 | |                 Future = impl Send,
45 | |             > + Clone,
   | |_____________________^ the trait `linkerd_app_core::linkerd_io::AsyncWrite` is not implemented for `impl std::marker::Send + Unpin`
   |
   = help: the following other types implement trait `linkerd_app_core::linkerd_io::AsyncWrite`:
             &mut T
             Box<T>
             BoxedIo
             DuplexStream
             EitherIo<L, R>
             Pin<P>
             PrefixedIo<I>
             ScopedIo<I>
           and 38 others
   = note: required because of the requirements on the impl of `MakeConnection<T>` for `linkerd_app_core::transport::linkerd_transport_metrics::Client<linkerd_app_core::transport::Metrics, BoxFuture<linkerd_app_core::svc::MapErr<linkerd_app_core::svc::linkerd_stack::Timeout<OpaqueTransport<linkerd_app_core::linkerd_tls::Client<linkerd_app_core::identity::NewClient, C>>>, impl (FnOnce(Box<(dyn std::error::Error + Sync + std::marker::Send + 'static)>) -> Box<(dyn std::error::Error + Sync + std::marker::Send + 'static)>) + Clone>>>`

For more information about this error, try `rustc --explain E0277`.

Unfortunately, I don't have a minimal reproducer yet; I'd like to find one, but for now, checking out linkerd/linkerd2-proxy@0288b9c and running cargo +nigihtly-2022-06-29 build will fail with this error.

Version it worked on

The most recent nightly that can compile the linkerd2-proxy codebase successfully is 2022-06-28. Successful CI build: https://github.com/linkerd/linkerd2-proxy/runs/7088482069?check_suite_focus=true

Version with regression

Nightly 2022-06-29 and later fails to compile the same codebase. Failing CI build: https://github.com/linkerd/linkerd2-proxy/runs/7107925369?check_suite_focus=true

We ran cargo bisect-rustc and it appears that commit 00ebeb8 introduced the regression.

searched nightlies: from nightly-2022-06-28 to nightly-2022-06-30
regressed nightly: nightly-2022-06-29
searched commit range: 2f3ddd9...8308806
regressed commit: 00ebeb8

bisected with cargo-bisect-rustc v0.6.3

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start 2022-06-28 --end 2022-06-30 --test-dir ../linkerd2-proxy -- build 

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.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