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

Type inference results in overflow evaluating the requirement #127411

Open
sgdxbc opened this issue Jul 6, 2024 · 5 comments
Open

Type inference results in overflow evaluating the requirement #127411

sgdxbc opened this issue Jul 6, 2024 · 5 comments
Labels
C-bug Category: This is a bug.

Comments

@sgdxbc
Copy link

sgdxbc commented Jul 6, 2024

The full reproducible case is here. Before committing further efforts on reducing it I would like to learn about maintainer's opinion on such issues. Whether it should be considered as bug? If so, will it be fixed straight way or need to go through some formalization first?

The skeleton is like this

f() {
    let (sender, mut receiver) = unbounded_channel();
    let (crypto_sender, mut crypto_receiver) = unbounded_channel();

    let crypto_task = run_worker(..., sender, crypto_receiver);

    let mut context = Context::<Of<_>, _> { ..., crypto_sender, ... };
    let client_task = run_with_schedule(..., context, receiver, ...);
    // let crypto_task = run_worker(..., sender, crypto_receiver);
}

If compiled like this it will fail with

error[E0275]: overflow evaluating the requirement `_: Sized`

(By the way, a minor issue here is that the trace does not properly fold the repeating steps. It also results in outputting hundreds of "long type" files (and even more if increasing recursion limit).)

If switch to define crypto_task at the commented location, it just compiles. The crypto_task and client_task are independent definitions so it is semantically same to define in either order (in my original case they are futures so even nothing executed effectively by this two definitions).

Giving annotation to the first unbounded_channel() call with at least ::<ErasedEvent<State<()>, _> makes it compile in the original order.

It has always been the case where type inference does not work in some definition order, but most of the time a "type annotation required" error is reported. Should we fix this case to the extent that at least a less confusing error is reported? On the other hand I am actually curious about the internal mechanism here:

  • As shown later in the error message compiler starts by checking for Send, but eventually get stuck in checking Sized, what's happening here?
  • How does the extra information provided by the alternative definition order help compiler bypass an infinite loop? The two seems unrelated to me, if there is supposed to be an infinite check, there will always be.

Thanks for any clarification!

Meta

rustc --version --verbose:

rustc 1.79.0 (129f3b996 2024-06-10)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: x86_64-unknown-linux-gnu
release: 1.79.0
LLVM version: 18.1.7

Also reproduced on nightly

rustc 1.81.0-nightly (524d806c6 2024-07-05)
binary: rustc
commit-hash: 524d806c62a82ecc0cf8634b94997ae506f4d6f9
commit-date: 2024-07-05
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7
Backtrace

<backtrace>

@sgdxbc sgdxbc added the C-bug Category: This is a bug. label Jul 6, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 6, 2024
@GrigorenkoPV
Copy link
Contributor

@rustbot label fixed-by-next-solver

@rustbot
Copy link
Collaborator

rustbot commented Jul 6, 2024

Error: Label fixed-by-next-solver can only be set by Rust team members

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

@theemathas
Copy link
Contributor

Somewhat minimized:

Code
fn conjure<T>() -> T {
    unimplemented!()
}

fn conjure_two<T>() -> (T, T) {
    unimplemented!()
}

fn f() {
    let (crypto_sender, crypto_receiver) = conjure_two();

    run_worker(crypto_receiver);

    let mut context = Context::<State<_>> {
        schedule: conjure::<Erase<_, _, ScheduleState<_>>>(),
        crypto_worker: crypto_sender,
    };
}

fn run_worker<S, C: Send, E>(_: ErasedEvent<(), Erase<S, C, E>>) {}

struct State<A>(A);

struct Context<O: On> {
    schedule: O::Schedule,
    crypto_worker: O::CryptoWorker,
}

trait On {
    type Schedule;
    type CryptoWorker;
}

impl<A> On for State<A> {
    type Schedule =
        Erase<State<A>, Context<State<A>>, ScheduleState<ErasedEvent<State<A>, Context<State<A>>>>>;
    type CryptoWorker = ErasedEvent<
        (),
        Erase<State<A>, Context<State<A>>, ErasedEvent<State<A>, Context<State<A>>>>,
    >;
}

struct ScheduleState<M>(M);

type ErasedEvent<S, C> = Box<dyn FnOnce(&mut S, &mut C) + Send>;

struct Erase<S, C, E>(S, C, E);

@sgdxbc
Copy link
Author

sgdxbc commented Jul 7, 2024

Thanks a lot for the further minimization @theemathas! You really saved me a day :)

@Noratrieb Noratrieb removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 7, 2024
@theemathas
Copy link
Contributor

Minimized:

use std::marker::PhantomData;

struct Wrap<U>(U);

trait Trait {
    type InContext;
}

impl<U> Trait for Wrap<U> {
    type InContext = Context<Wrap<U>>;
}

struct Context<T: Trait> {
    // this is PhantomData<Self>
    phantom: PhantomData<T::InContext>,
}

fn require_send<T: Send>() {}

fn f() {
    require_send::<Context::<Wrap<_>>>();
}

Annotating the type as Context::<Wrap<i32>> causes the error to go away.

The correct error should be "type annotation required".

Error output
   Compiling playground v0.0.1 (/playground)
error[E0275]: overflow evaluating the requirement `Wrap<_>: Trait`
   --> src/lib.rs:21:5
    |
21  |     require_send::<Context::<Wrap<_>>>();
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`playground`)
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required because it appears within the type `PhantomData<Context<Wrap<_>>>`
   --> /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
    |
740 | pub struct PhantomData<T: ?Sized>;
    |            ^^^^^^^^^^^
note: required because it appears within the type `Context<Wrap<_>>`
   --> src/lib.rs:13:8
    |
13  | struct Context<T: Trait> {
    |        ^^^^^^^
note: required by a bound in `require_send`
   --> src/lib.rs:18:20
    |
18  | fn require_send<T: Send>() {}
    |                    ^^^^ required by this bound in `require_send`

For more information about this error, try `rustc --explain E0275`.
error: could not compile `playground` (lib) due to 1 previous error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

5 participants