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

where clauses in --pretty printer mishandle >1 lifetime bound #34527

Closed
pnkfelix opened this issue Jun 28, 2016 · 0 comments
Closed

where clauses in --pretty printer mishandle >1 lifetime bound #34527

pnkfelix opened this issue Jun 28, 2016 · 0 comments

Comments

@pnkfelix
Copy link
Member

Consider the following:

fn f1<'a, 'b, 'c>(_x: &'a u32, _y: &'b u32, _z: &'c u32) where 'c: 'a + 'b { }

fn f2<'a, 'b, 'c: 'a + 'b>(_x: &'a u32, _y: &'b u32, _z:&'c u32) { }

fn f3<'a, 'b, T: 'a + 'b>(_x: &'a u32, _y: &'b u32, _z: T) { }

fn f4<'a, 'b, T>(_x: &'a u32, _y: &'b u32, _z: T) where T: 'a + 'b { }

struct S1<'a, 'b, 'c: 'a + 'b>(&'a u32, &'b u32, &'c u32);

struct S2<'a, 'b, T: 'a + 'b>(&'a u32, &'b u32, T);

struct S3<'a, 'b, T>(&'a u32, &'b u32, T) where T: 'a + 'b;

fn main() { }

struct S4<'a, 'b, 'c>(&'a u32, &'b u32, &'c u32) where 'c: 'a + 'b;

If I feed the above to rustc --pretty -Z unstable-options, it prints out (note the first and last lines in particular):

fn f1<'a, 'b, 'c>(_x: &'a u32, _y: &'b u32, _z: &'c u32) where 'c:'a'b: { }

fn f2<'a, 'b, 'c:'a+'b>(_x: &'a u32, _y: &'b u32, _z: &'c u32) { }

fn f3<'a, 'b, T: 'a + 'b>(_x: &'a u32, _y: &'b u32, _z: T) { }

fn f4<'a, 'b, T>(_x: &'a u32, _y: &'b u32, _z: T) where T: 'a + 'b { }

struct S1<'a, 'b, 'c:'a+'b>(&'a u32, &'b u32, &'c u32);

struct S2<'a, 'b, T: 'a + 'b>(&'a u32, &'b u32, T);

struct S3<'a, 'b, T>(&'a u32, &'b u32, T) where T: 'a + 'b;

fn main() { }

struct S4<'a, 'b, 'c>(&'a u32, &'b u32, &'c u32) where 'c:'a'b:;

In the first and last lines, we are printing out 'c: 'a'b:, when we should be printing 'c: 'a + 'b.

So we are:

  1. Missing an infix +, and
  2. Adding an erroneous : to the end.
jseyfried added a commit to jseyfried/rust that referenced this issue Jun 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant