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

ICE: Unable to fulfill trait #54705

Closed
ghost opened this issue Sep 30, 2018 · 2 comments
Closed

ICE: Unable to fulfill trait #54705

ghost opened this issue Sep 30, 2018 · 2 comments
Labels
A-synthetic-impls Area: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@ghost
Copy link

ghost commented Sep 30, 2018

Rust version: rustc 1.30.0-nightly (bb0896af1 2018-09-29)

How to reproduce:

git clone https://github.com/rayon-rs/rayon.git
cd rayon/rayon-futures
git checkout df8644
RUSTFLAGS="--cfg rayon_unstable" cargo doc --open -p rayon-futures

Error:

 Documenting rayon-futures v0.1.0 (/home/stjepan/tmp/rayon/rayon-futures)
thread '<unnamed>' panicked at 'Unable to fulfill trait DefId(2/0:829 ~ core[3330]::marker[0]::Send[0]) for 'ScopeFutureContents<'scope, F, S>': [FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<S as rayon_core::internal::task::ScopeHandle<'_>>)),depth=5),Ambiguity), FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<S as rayon_core::internal::task::ScopeHandle<'_>>)),depth=5),Ambiguity)]', librustc/traits/auto_trait.rs:218:17
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.30.0-nightly (bb0896af1 2018-09-29) running on x86_64-unknown-linux-gnu

error: Could not document `rayon-futures`.
@zackmdavis zackmdavis added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Sep 30, 2018
@Aaron1011 Aaron1011 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Oct 28, 2018
@Aaron1011
Copy link
Member

Minimized reproduction:

pub trait ScopeHandle<'scope> {}

pub struct ScopeFutureContents<'scope, S>
    where S: ScopeHandle<'scope>,
{
    dummy: &'scope S,
    this: Box<ScopeFuture<'scope, S>>,
}


struct ScopeFuture<'scope, S>
    where S: ScopeHandle<'scope>,
{
    contents: ScopeFutureContents<'scope, S>,
}

unsafe impl<'scope, S> Send for ScopeFuture<'scope, S>
    where S: ScopeHandle<'scope>,
{}
unsafe impl<'scope, S> Sync for ScopeFuture<'scope, S>
    where S: ScopeHandle<'scope>,
{}

@Aaron1011
Copy link
Member

I'd like to work on this.

Aaron1011 added a commit to Aaron1011/rust that referenced this issue Oct 28, 2018
Fixes rust-lang#54705

When constructing synthetic auto trait impls, we may come across
multiple predicates involving the same type, trait, and substitutions.
Since we can only display one of these, we pick the one with the 'most
strict' lifetime paramters. This ensures that the impl we render the
user is actually valid (that is, a struct matching that impl will
actually implement the auto trait in question).

This commit exapnds the definition of 'more strict' to take into account
inference variables. We always choose a predicate without inference
variables over a predicate with inference variables.
@QuietMisdreavus QuietMisdreavus added the A-synthetic-impls Area: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls label Nov 6, 2018
kennytm added a commit to kennytm/rust that referenced this issue Nov 7, 2018
…nkfelix

Choose predicates without inference variables over those with them

Fixes rust-lang#54705

When constructing synthetic auto trait impls, we may come across
multiple predicates involving the same type, trait, and substitutions.
Since we can only display one of these, we pick the one with the 'most
strict' lifetime paramters. This ensures that the impl we render the
user is actually valid (that is, a struct matching that impl will
actually implement the auto trait in question).

This commit exapnds the definition of 'more strict' to take into account
inference variables. We always choose a predicate without inference
variables over a predicate with inference variables.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-synthetic-impls Area: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants