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

[1.31 beta] Trait bound is not satisfied #54467

Closed
pietroalbini opened this issue Sep 22, 2018 · 14 comments
Closed

[1.31 beta] Trait bound is not satisfied #54467

pietroalbini opened this issue Sep 22, 2018 · 14 comments
Assignees
Labels
C-bug Category: This is a bug. P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@pietroalbini
Copy link
Member

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

@pietroalbini pietroalbini added I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. C-bug Category: This is a bug. labels Sep 22, 2018
@pietroalbini pietroalbini added this to the 1.30 milestone Sep 22, 2018
@Marwes
Copy link
Contributor

Marwes commented Sep 23, 2018

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`

@arielb1
Copy link
Contributor

arielb1 commented Sep 24, 2018

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() {}

@arielb1
Copy link
Contributor

arielb1 commented Sep 24, 2018

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.

@arielb1
Copy link
Contributor

arielb1 commented Sep 24, 2018

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

@arielb1
Copy link
Contributor

arielb1 commented Sep 24, 2018

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

@pnkfelix
Copy link
Member

visited at T-compiler. P-high.

@pnkfelix pnkfelix added P-high High priority and removed I-nominated labels Sep 27, 2018
arielb1 added a commit to arielb1/rust that referenced this issue Oct 1, 2018
The normalization of type-outlives predicates can depend on misc.
environment predicates, but not the other way around. Inferred lifetime
bounds can propagate type-outlives bounds far and wide, so their
normalization needs to work well.

Fixes rust-lang#54467
bors added a commit that referenced this issue Oct 2, 2018
normalize param-env type-outlives predicates last

The normalization of type-outlives predicates can depend on misc.
environment predicates, but not the other way around. Inferred lifetime
bounds can propagate type-outlives bounds far and wide, so their
normalization needs to work well.

Fixes #54467

r? @nikomatsakis
beta-nominating because this is required for inferred_outlives_bounds, which is in beta
@pietroalbini pietroalbini reopened this Oct 4, 2018
arielb1 added a commit to arielb1/rust that referenced this issue Oct 6, 2018
bors added a commit that referenced this issue Oct 9, 2018
[beta] back out #53793 - stabilize outlives requirements

Fixes #54467 for beta, looks like a less risky fix than #54701
@pnkfelix
Copy link
Member

My understanding is that this is resolved by #54877

@Mark-Simulacrum Mark-Simulacrum modified the milestones: 1.30, 1.31 Nov 9, 2018
@Mark-Simulacrum Mark-Simulacrum changed the title [1.30 beta] Trait bound is not satisfied [1.31 beta] Trait bound is not satisfied Nov 9, 2018
@Mark-Simulacrum
Copy link
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

@Mark-Simulacrum
Copy link
Member

cc @arielb1 @pnkfelix @rust-lang/compiler

@pnkfelix
Copy link
Member

pnkfelix commented Nov 9, 2018

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

@nikomatsakis
Copy link
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)

@nikomatsakis
Copy link
Contributor

Seems like postgis-0.6.0 simply wasn't fixed.

@nikomatsakis
Copy link
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..?)

@nikomatsakis
Copy link
Contributor

Found the problem. Fix coming shortly.

bors added a commit that referenced this issue Nov 16, 2018
…-and-trait-objects, r=eddyb

do not propagate inferred bounds on trait objects if they involve `Self`

Fixes #54467, which is a Rust 2018 Release blocking issue.

r? @eddyb
bors added a commit that referenced this issue Nov 17, 2018
…-and-trait-objects, r=eddyb

do not propagate inferred bounds on trait objects if they involve `Self`

Fixes #54467, which is a Rust 2018 Release blocking issue.

r? @eddyb
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. P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants