Skip to content

[1.31 beta] Trait bound is not satisfied #54467

Closed

Description

@emilyalbini

The following crates fail to build on 1.30 due to trait bound errors.

Activity

  1. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    on Sep 22, 2018
  2. added this to the 1.30 milestone on Sep 22, 2018
  3. Marwes commented on Sep 23, 2018

    @Marwes
    Contributor

    For combine it seems like rustc no longer sees that I::Item == char despite that being specified in the where bound :/

    error[E0277]: the trait bound `<I as combine::StreamOnce>::Error: combine::ParseError<char, <I as combine::StreamOnce>::Range, <I as combine::StreamOnce>::Position>` is not satisfied
    Sep 21 16:12:45.476 INFO kablam!    --> src/lib.rs:163:1
    Sep 21 16:12:45.476 INFO kablam!     |
    Sep 21 16:12:45.476 INFO kablam! 163 | / pub struct Reserved<'a: 'b, 'b, I>
    Sep 21 16:12:45.476 INFO kablam! 164 | | where
    Sep 21 16:12:45.476 INFO kablam! 165 | |     I: Stream<Item = char> + 'b,
    Sep 21 16:12:45.476 INFO kablam! 166 | |     I::Error: ParseError<I::Item, I::Range, I::Position>,
    Sep 21 16:12:45.477 INFO kablam! 167 | | {
    Sep 21 16:12:45.477 INFO kablam! 168 | |     parser: Lex<'a, 'b, Try<Skip<Str<I>, NotFollowedBy<LanguageParser<'a, 'b, I, char>>>>>,
    Sep 21 16:12:45.477 INFO kablam! 169 | | }
    Sep 21 16:12:45.477 INFO kablam!     | |_^ the trait `combine::ParseError<char, <I as combine::StreamOnce>::Range, <I as combine::StreamOnce>::Position>` is not implemented for `<I as combine::StreamOnce>::Error`
    
  4. arielb1 commented on Sep 24, 2018

    @arielb1
    Contributor

    This looks like a "soft" deadlock on normalize_param_env_or_error caused by implied bounds.

    Minified:

    pub trait Stream {
        type Item;
        type Error;
    }
    
    pub trait ParseError<I> {
        type Output;
    }
    
    pub struct Lex<'a, I>
        where I: Stream,
              I::Error: ParseError<char>,
              <<I as Stream>::Error as ParseError<char>>::Output: 'a
    {
        x: &'a <I::Error as ParseError<char>>::Output
    }
    
    pub struct Reserved<'a, I> where
        I: Stream<Item=char> + 'a,
        I::Error: ParseError<I::Item>,
    // uncomment this to make it fail on stable too
    //    <<I as Stream>::Error as ParseError<char>>::Output: 'a
        
    {
        x: Lex<'a, I>
    }
    
    fn main() {}
  5. arielb1 commented on Sep 24, 2018

    @arielb1
    Contributor

    to detail: normalize_param_env_or_error does not try to normalize the param env in some sort of fixed-point computation - that would be hard without lazy normalization or some other major refactor of the trait system. Therefore, it normalizes the param env insided the unnormalized param env.

    This means that bounds such as <<I as Stream>::Error as ParseError<char>>::Output: 'a are normalized in the unnormalized param env, which contains I::Error: ParseError<I::Item>, instead of I::Error: ParseError<char>,.

    I think a possible hacky fix would be to normalize the implied outlives bounds (or maybe, all outlives bounds) in the normalized param env instead of the unnormalized param env.

  6. arielb1 commented on Sep 24, 2018

    @arielb1
    Contributor

    Note that this is broken even on older nightlies as long as #![feature(infer_outlives_requirements)] is enabled.

  7. arielb1 commented on Sep 24, 2018

    @arielb1
    Contributor

    I'll try to get a fix done later this week.

  8. pnkfelix commented on Sep 27, 2018

    @pnkfelix
    Contributor

    visited at T-compiler. P-high.

  9. 11 remaining items

  10. changed the title [-][1.30 beta] Trait bound is not satisfied[/-] [+][1.31 beta] Trait bound is not satisfied[/+] on Nov 9, 2018
  11. Mark-Simulacrum commented on Nov 9, 2018

    @Mark-Simulacrum
    Member

    Interestingly, this is not fixed on current beta (or perhaps re-regressed); I'm reopening and retagging.

    Specifically at least postgis is failing to build: https://crater-reports.s3.amazonaws.com/beta-1.31-1/beta-2018-10-30/reg/vectortile-0.2.2/log.txt

  12. Mark-Simulacrum commented on Nov 9, 2018

    @Mark-Simulacrum
    Member

    cc @arielb1 @pnkfelix @rust-lang/compiler

  13. pnkfelix commented on Nov 9, 2018

    @pnkfelix
    Contributor

    Maybe we need to reconsider backporting PR #54701 ... will investigate...

  14. nikomatsakis commented on Nov 15, 2018

    @nikomatsakis
    Contributor

    Test results

    postgis 0.6.0

    • ❌ nightly (2018-11-13)
    • ❌ beta (1.31.0-beta.9)
    • ✅ stable (1.30.1)

    combine-language 3.0.1:

    • ✅ nightly (2018-11-13)
    • ✅ beta (1.31.0-beta.9)
    • ✅ stable (1.30.1)
  15. nikomatsakis commented on Nov 15, 2018

    @nikomatsakis
    Contributor

    Seems like postgis-0.6.0 simply wasn't fixed.

  16. nikomatsakis commented on Nov 15, 2018

    @nikomatsakis
    Contributor

    Trying to investigate more deeply. (Also, I realize now that @Mark-Simulacrum this is likely the issue you were talking about when you were talking about re-regressing..?)

  17. nikomatsakis commented on Nov 16, 2018

    @nikomatsakis
    Contributor

    Found the problem. Fix coming shortly.

  18. added 3 commits that reference this issue on Nov 16, 2018
    72bca5e
    f37247f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions