Skip to content

Cannot parse global type constraints #5572

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

Closed
erickt opened this issue Mar 27, 2013 · 0 comments
Closed

Cannot parse global type constraints #5572

erickt opened this issue Mar 27, 2013 · 0 comments

Comments

@erickt
Copy link
Contributor

erickt commented Mar 27, 2013

This code:

fn foo<T: ::cmp::Eq>(t: T) { }

fn main() { }

Errors with:

foo.rs:1:10: 1:12 error: expected `,` but found `::`
foo.rs:1 fn foo<T: ::cmp::Eq>(t: T) { }
bors added a commit that referenced this issue Mar 28, 2013
Hey folks,

This patch series does some work on the json decoder, specifically with auto decoding of enums. Previously, we would take this code:

```
enum A {
    B,
    C(~str, uint)
}
```

and would encode a value of this enum to either `["B", []]` or `["C", ["D", 123]]`. I've changed this to `"B"` or `["C", "D", 123]`. This matches the style of the O'Caml json library [json-wheel](http://mjambon.com/json-wheel.html). I've added tests to make sure all this work.

In order to make this change, I added passing a `&[&str]` vec to `Decode::emit_enum_variant` so the json decoder can convert the name of a variant into it's position. I also changed the impl of `Encodable` for `Option<T>` to have the right upper casing.

I also did some work on the parser, which allows for `fn foo<T: ::cmp::Eq>() { ... }` statements (#5572), fixed the pretty printer properly expanding `debug!("...")` expressions, and removed `ast::expr_vstore_fixed`, which doesn't appear to be used anymore.
@erickt erickt closed this as completed in b26ae28 Mar 30, 2013
calebcartwright pushed a commit to calebcartwright/rust that referenced this issue Jun 20, 2023
* Remove old CI config

Signed-off-by: Yuki Okushi <jtitor@2k36.org>

* Replace outdated badges

Signed-off-by: Yuki Okushi <jtitor@2k36.org>

---------

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
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