Commit Graph

1064 Commits

Author SHA1 Message Date
John Clements
fdf8543cf6 add nonempty encoding for spans
Before this change, encoding an object containing a codemap::span
using the JSON encodeng produced invalid JSON, for instance:
[{"span":,"global":false,"idents":["abc"]}]
Since the decoder for codemap::span's ignores its argument, I
conjecture that this will not damage decoding, and should improve
it for many decoders.
2013-03-15 08:44:21 -07:00
Patrick Walton
50d99e0194 libsyntax: Remove a use of deprecated Encodable from libsyntax. rs=burningtree 2013-03-13 21:54:51 -07:00
Patrick Walton
58f248d923 test: Fix tests. rs=tests 2013-03-13 20:08:35 -07:00
Patrick Walton
2ccc6e0a57 librustc: Don't require the "static" keyword to define a static method 2013-03-13 20:07:11 -07:00
Patrick Walton
8fa66e8e07 librustc: Remove implicit self from the language, except for old-style drop blocks. 2013-03-13 20:07:10 -07:00
Patrick Walton
a410652bc9 librustc: Remove "base types" from the language. 2013-03-13 20:07:09 -07:00
Patrick Walton
b85158e23a librustc: Remove overloaded operator autoderef. 2013-03-13 20:07:09 -07:00
Patrick Walton
b1c699815d librustc: Don't accept as Trait anymore; fix all occurrences of it. 2013-03-13 20:07:09 -07:00
Niko Matsakis
852619d5d7 Remove ++ mode from the compiler (it is parsed as + mode)
and obsolete `-` mode altogether (it *was* parsed as `+` mode).
2013-03-13 17:00:09 -04:00
bors
695e9fd13c auto merge of #5293 : brson/rust/logging, r=brson
r? @graydon

This removes `log` from the language. Because we can't quite implement it as a syntax extension (probably need globals at the least) it simply renames the keyword to `__log` and hides it behind macros.

After this the only way to log is with `debug!`, `info!`, etc. I figure that if there is demand for `log!` we can add it back later.

I am not sure that we ever agreed on this course of action, though I *think* there is consensus that `log` shouldn't be a statement.
2013-03-13 10:40:07 -07:00
bors
a9643d39f8 auto merge of #5320 : apasel422/rust/metaderive, r=graydon
This is the first in a series of patches I'm working on to clean up the code related to `deriving`. This patch allows

```
#[deriving_eq]
#[deriving_iter_bytes]
#[deriving_clone]
struct Foo { bar: uint }
```
to be replaced with:
```
#[deriving(Eq, IterBytes, Clone)]
struct Foo { bar: uint }
```
It leaves the old attributes alone for the time being.

Eventually I'd like to incorporate the new closest-match-suggestion infrastructure for mistyped trait names, and also pass the sub-attributes to the deriving code, so that the following will be possible:
```
#[deriving(TotalOrd(qux, bar))]
struct Foo { bar: uint, baz: char, qux: int }
```
This says to derive an `impl` in which the objects' `qux` fields are compared first, followed by `bar`, while `baz` is ignored in the comparison. If no fields are specified explicitly, all fields will be compared in the order they're defined in the `struct`. This might also be useful for `Eq`. Coming soon.
2013-03-12 10:09:55 -07:00
Andrew Paseltiner
24efea7208 syntax: implement #[deriving] meta-attribute 2013-03-12 12:52:39 -04:00
Luqman Aden
18b71a7831 Add alignstack option for inline asm. 2013-03-12 01:03:35 -07:00
Luqman Aden
7f500ab4c1 Keep everything tidy. 2013-03-12 01:03:34 -07:00
Luqman Aden
5aa734d6a1 Parse operands properly and add a way to indicate volatile asm. 2013-03-12 01:03:34 -07:00
Luqman Aden
885d0d3d33 Stop parsing __asm__. 2013-03-12 01:03:34 -07:00
Luqman Aden
666e1b4636 Create asm! syntax extension. 2013-03-12 01:03:34 -07:00
Luqman Aden
ecccc0d649 Parse inline assembly. 2013-03-12 01:03:34 -07:00
Brian Anderson
9c7e16e48d Remove the log keyword (by renaming it to __log)
We can't quite remove logging from the language, but this hides the
keyword.
2013-03-11 23:19:42 -07:00
Brian Anderson
cb37d09f50 core: Remove logging constants 2013-03-11 23:19:42 -07:00
Brian Anderson
82f190355b Remove uses of log 2013-03-11 23:19:42 -07:00
bors
9b9ffd5b41 auto merge of #5304 : jld/rust/const-adjustments, r=graydon
These changes make const translation use adjustments (autodereference, autoreference, bare-fn-to-closure), like normal code does, replacing some ad-hoc logic that wasn't always right.

As a convenient side-effect, explicit dereference (both of pointers and of newtypes) is also supported in const expressions.

There is also a “bonus fix” for a bug in the pretty-printer exposed by one of the added tests.
2013-03-11 21:12:43 -07:00
Patrick Walton
08c840205e librustc: Lint the old drop destructor notation off 2013-03-11 09:36:00 -07:00
Patrick Walton
a34749c289 libsyntax: Stop parsing newtype enums 2013-03-11 09:36:00 -07:00
Patrick Walton
7538450b8d libsyntax: Remove newtype enums from libsyntax. rs=deenum 2013-03-11 09:35:59 -07:00
Patrick Walton
bd2d17e4a1 libsyntax: Stop parsing bare functions in preparation for switching them over 2013-03-11 09:35:58 -07:00
Patrick Walton
d18f785457 librustc: Replace all uses of fn() with &fn(). rs=defun 2013-03-11 09:35:58 -07:00
Seo Sanghyeon
9e85589ad3 Implement vector destructuring from tail 2013-03-11 19:01:51 +09:00
Jed Davis
5066bc9ff4 Don't print addr_of(addr_of(e)) as &&e, which means something else. 2013-03-09 17:40:59 -08:00
Niko Matsakis
7cbd4b20ee Remove @ast::Region and replace with @ast::Lifetime.
Modify pretty-printer to emit lifetimes and fix a few minor
parser bugs that this uncovered.
2013-03-09 19:43:59 -05:00
bors
eaed16cea6 auto merge of #5278 : brson/rust/logplusplus, r=brson
r?

`log` can  polymorphically log anything, but debug!, etc. requires a format string. With this patch you can equivalently write `debug!(foo)` or `debug!("%?", foo)`.

I'm doing this because I was trying to remove `log` (replacing it with nothing, at least temporarily), but there are a number of logging statements that just want to print an arbitrary value and don't care about the format string.

I'm not entirely convinced this is a good change, since it overloads the implementation of these macros and makes their usage slightly more nuanced.
2013-03-08 12:27:39 -08:00
Alex Crichton
62651df2b4 Fix dvec-related fallout in tests 2013-03-08 09:56:52 -05:00
Alex Crichton
7f99a02ddb syntax: Remove uses of DVec 2013-03-08 09:54:20 -05:00
Patrick Walton
d661711cc2 test: Fix tests. 2013-03-07 22:37:58 -08:00
Patrick Walton
9a17ef9b52 librustc: Stop parsing assert. 2013-03-07 22:37:57 -08:00
Patrick Walton
d7e74b5e91 librustc: Convert all uses of assert over to fail_unless! 2013-03-07 22:37:57 -08:00
Patrick Walton
0ea031bcb8 librustc: Remove record patterns from the compiler 2013-03-07 22:37:03 -08:00
Patrick Walton
954ae9c975 libsyntax: Remove struct literal expressions from the compiler 2013-03-07 22:32:55 -08:00
Patrick Walton
4e3dbfe052 librustc: Remove structural record types from the compiler 2013-03-07 22:32:54 -08:00
Patrick Walton
239e64242c libsyntax: Stop parsing structural record types 2013-03-07 22:32:52 -08:00
Brian Anderson
dd4d45062d Make debug!, etc. macros not require a format string
The one thing `log` can still do is polymorphically log anything,
but debug!, etc. require a format string. With this patch
you can equivalently write `debug!(foo)` or `debug!("%?", foo)`
2013-03-07 18:45:22 -08:00
John Clements
a040b8005f add deriving_eq for tokens 2013-03-07 14:46:46 -08:00
bors
b269ce2782 auto merge of #5255 : jbclements/rust/remove-parse-value-ident, r=graydon
After the removal of the "restricted keyword" feature in 0c82c00dc4 , there's no longer any difference between parse_ident() and parse_value_ident(), and therefore no difference between parse parse_path_without_tps() and parse_value_path().  I've collapsed all of these, removing the redundant functions and eliminating the need for two higher-order arguments.
2013-03-06 17:48:39 -08:00
Niko Matsakis
7e4ed28fa5 patch up pretty printing of things with both lifetime and type parameters 2013-03-06 15:12:58 -05:00
Niko Matsakis
3280e5a33d Improve error messages when illegal lifetimes are used 2013-03-06 15:12:58 -05:00
Niko Matsakis
4077d7b8b7 Permit either foo/&self or foo<'self> 2013-03-06 15:12:57 -05:00
Niko Matsakis
3168fe06ff Add manual &self/ and &static/ and /&self declarations that
are currently inferred.  New rules are coming that will require
them to be explicit.  All add some explicit self declarations.
2013-03-06 15:12:57 -05:00
Niko Matsakis
704cd648ac Fix a bug with region-parameterized enums etc where trans considered
them to be non-monomorphic.  Merely having lifetime parameters
is not enough to qualify for that status.  Fixes #5243.
2013-03-06 13:01:16 -05:00
John Clements
8bb537e68d finish removing parse_value_ident 2013-03-06 09:41:52 -08:00
John Clements
88451878f8 removed unused abstraction over paths and value_paths 2013-03-06 09:41:47 -08:00