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

Nightly regression around HRTBs, likely connected to wf changes #28934

Closed
aturon opened this issue Oct 9, 2015 · 11 comments
Closed

Nightly regression around HRTBs, likely connected to wf changes #28934

aturon opened this issue Oct 9, 2015 · 11 comments
Assignees
Labels
A-lifetimes Area: lifetime related P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@aturon
Copy link
Member

aturon commented Oct 9, 2015

The following code:

struct Parser<'i: 't, 't>(&'i u8, &'t u8);

impl<'i, 't> Parser<'i, 't> {
    fn parse_nested_block<F, T>(&mut self, parse: F) -> Result<T, ()>
        where for<'tt> F: FnOnce(&mut Parser<'i, 'tt>) -> T { panic!() }

    fn expect_exhausted(&mut self) -> Result<(), ()> { Ok(()) }
}

fn main() {
    let x = 0u8;
    Parser(&x, &x).parse_nested_block(|input| input.expect_exhausted()).unwrap();
}

compiles on 1.3 stable and 1.4 beta, but not on nightly. This seems likely related to wf changes.

@aturon
Copy link
Member Author

aturon commented Oct 9, 2015

cc @SimonSapin @nikomatsakis

@aturon aturon added A-lifetimes Area: lifetime related I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Oct 9, 2015
@aturon
Copy link
Member Author

aturon commented Oct 9, 2015

cc @arielb1

@SimonSapin
Copy link
Contributor

The above is a reduction of servo/rust-cssparser@29f757d

@SimonSapin
Copy link
Contributor

I can reproduce in rustc 1.5.0-nightly (d0cae14 2015-10-08) but not in rustc 1.5.0-dev (168a23e 2015-10-01). (The latter is what Servo uses at the moment.)

@aturon
Copy link
Member Author

aturon commented Oct 9, 2015

A quick scan of the intervening commits suggests 603a75c may be related.

bors-servo pushed a commit to servo/rust-cssparser that referenced this issue Oct 9, 2015
Treat url(<string>) as a normal functions, per spec change.

Only unquoted URLs are special tokens now. Use `Parser::expect_url`.

This is a [breaking-change]. The version number was incremented accordingly.

This change will help with servo/servo#7767

This triggers rust-lang/rust#28934 and fails to build in the current Rust nightly, but works fine in the Rust version that Servo currently use. Hopefully that rustc bug will be fixed before we need to upgrade Rust in Servo.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/90)
<!-- Reviewable:end -->
@arielb1
Copy link
Contributor

arielb1 commented Oct 10, 2015

The eta-reduced version fails on all versions of rustc:

struct Parser<'i: 't, 't>(&'i u8, &'t u8);

impl<'i, 't> Parser<'i, 't> {
    fn parse_nested_block<F, T>(&mut self, parse: F) -> Result<T, ()>
        where for<'tt> F: FnOnce(&mut Parser<'i, 'tt>) -> T { panic!() }

    fn expect_exhausted(&mut self) -> Result<(), ()> { Ok(()) }
}

fn main() {
    let x = 0u8;
    Parser(&x, &x).parse_nested_block(Parser::expect_exhausted).unwrap();
}
<anon>:12:20: 12:64 error: type mismatch: the type `fn(&mut Parser<'_, '_>) -> core::result::Result<(), ()> {Parser<'i, 't>::expect_exhausted}` implements the trait `for<'r> core::ops::FnOnce<(&'r mut Parser<'_, '_>,)>`, but the trait `for<'r, 'tt> core::ops::FnOnce<(&'r mut Parser<'_, 'tt>,)>` is required (expected concrete lifetime, found bound lifetime parameter 'tt) [E0281]
<anon>:12     Parser(&x, &x).parse_nested_block(Parser::expect_exhausted).unwrap();
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:12:20: 12:64 error: type mismatch resolving `for<'r, 'tt> <fn(&mut Parser<'_, '_>) -> core::result::Result<(), ()> {Parser<'i, 't>::expect_exhausted} as core::ops::FnOnce<(&'r mut Parser<'_, 'tt>,)>>::Output == _`:
 expected bound lifetime parameter 'tt,
    found concrete lifetime [E0271]
<anon>:12     Parser(&x, &x).parse_nested_block(Parser::expect_exhausted).unwrap();
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

<anon>:12:20: 12:64 help: see the detailed explanation for E0271
error: aborting due to 2 previous errors

The wf fixes just bought it in line.

@arielb1
Copy link
Contributor

arielb1 commented Oct 10, 2015

The UFCS version fails on 1.4+, but succeeds if you annotate the parameter type - this looks like a closure inference issue.

@arielb1
Copy link
Contributor

arielb1 commented Oct 15, 2015

This was not fixed by #29006

@nikomatsakis nikomatsakis self-assigned this Oct 15, 2015
@nikomatsakis
Copy link
Contributor

triage: P-high

@rust-highfive rust-highfive added P-high High priority and removed I-nominated labels Oct 15, 2015
@nikomatsakis
Copy link
Contributor

/me investigating THIS now

@nikomatsakis
Copy link
Contributor

This seems to boil down to a bug in the givens list for region inference. It is fixed by #29188 (at least, it is with the latest commit).

bors-servo pushed a commit to servo/rust-cssparser that referenced this issue Nov 2, 2015
Treat url(<string>) as a normal functions, per spec change.

Only unquoted URLs are special tokens now. Use `Parser::expect_url`.

This is a [breaking-change]. The version number was incremented accordingly.

This change will help with servo/servo#7767

This triggers rust-lang/rust#28934 and fails to build in the current Rust nightly, but works fine in the Rust version that Servo currently use. Hopefully that rustc bug will be fixed before we need to upgrade Rust in Servo.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/90)
<!-- Reviewable:end -->
brson pushed a commit to brson/rust that referenced this issue Nov 4, 2015
expansion already by growing the RHS to be bigger than LHS (all the way
to `'static` if necessary). This is needed because contraction doesn't
handle givens. Fixes rust-lang#28934.
bors-servo pushed a commit to servo/rust-cssparser that referenced this issue Nov 5, 2015
Treat url(<string>) as a normal functions, per spec change.

Only unquoted URLs are special tokens now. Use `Parser::expect_url`.

This is a [breaking-change]. The version number was incremented accordingly.

This change will help with servo/servo#7767

This triggers rust-lang/rust#28934 and fails to build in the current Rust nightly, but works fine in the Rust version that Servo currently use. Hopefully that rustc bug will be fixed before we need to upgrade Rust in Servo.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/90)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: lifetime related P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. 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

5 participants