Commit Graph

1064 Commits

Author SHA1 Message Date
John Clements
25c4676dfa Commenting, test cases, cleanup 2013-02-13 15:08:27 -08:00
bors
5e6d7871c6 auto merge of #4840 : jbclements/rust/add-json-enum-encoding, r=catamorphism
r?

I added code to the JSON encoder to support the serialization of enums.  Before this, the JSON serializer only handled Option, and encoded None as 'null'. Following this change, all enums are encoded as arrays containing the enum name followed by the encoded fields. This appears consistent with the unstated invariant that the resulting output can be mapped back to the input *if* there's a decoder around that knows the types that were in existence when the serialization occurred.

Also, added test cases.
2013-02-13 13:18:38 -08:00
John Clements
9df11ae83f retabbing 2013-02-13 10:49:36 -08:00
Kang Seonghoon
6d98ca94cc libsyntax: don't parse ////, /***/ as doc comments 2013-02-13 11:39:13 +09:00
John Clements
46d2be1bd4 added rather elaborate test framework 2013-02-12 17:18:29 -08:00
Brian Anderson
8ed1c15845 Fix license block 2013-02-11 15:01:24 -08:00
Mikko Perttunen
ca030b4fc8 Update copyright years 2013-02-11 21:02:36 +02:00
Mikko Perttunen
f2a8a71266 Use topmost span for macro expansion location. Fixes behaviour of file!, line! and col! 2013-02-11 20:23:40 +02:00
bors
9d7014e55c auto merge of #4861 : sethpink/rust/incoming, r=catamorphism
Fix for issue #4830.
2013-02-09 18:37:02 -08:00
bors
d6442e97a5 auto merge of #4854 : thestinger/rust/oldmap, r=catamorphism 2013-02-09 15:02:51 -08:00
John Clements
394f8eeb7e tidy 2013-02-09 13:37:04 -08:00
John Clements
765961438d fix typos in sample code, add enum to json encoder, add test case 2013-02-09 13:37:04 -08:00
Seth Pink
8ebdb3d0ab Issue #4830 fix 2013-02-09 23:00:55 +10:00
Daniel Micay
d30fdbb357 libsyntax/attr.rs: switch from oldmap to LinearSet 2013-02-08 20:57:14 -05:00
Daniel Micay
a32c5c73ee oldmap: get rid of legacy _ref suffixes 2013-02-08 19:12:51 -05:00
Matthijs Hofstra
8d0c1cb406 Added related FIXME for 3260 2013-02-09 01:01:39 +01:00
Matthijs Hofstra
fd98ea8129 Fix for issue 2174
The function that formats and prints the squigly line that hilights
errors counted tabs as spaces, which resulted in incorrect error
messages when tabs were used for indentation. This change compares
the highlight line with the previous line and inserts a tab instead
of a space whenever such a tab exists on the previous line. Note
that error messages will still highlight incorrectly when the
previous line include characters that require more than one utf8
code point, as mentioned in issue 3260.
2013-02-09 00:57:39 +01:00
Niko Matsakis
14930fbffe Add and lex LIFETIME tokens
cc #4846
2013-02-08 06:02:35 -08:00
Patrick Walton
472797b04a librustc: Lots of de-muting. rs=demuting 2013-02-07 16:17:39 -08:00
bors
4272765830 auto merge of #4791 : jbclements/rust/demodeing-and-deGCing, r=jbclements,brson
r?

It looks to me like the string_reader and tt_reader structs are
GC pointers only because they predate the modern borrow system.
This commit leaves the type names string_reader and tt_reader alone
(they still refer to GC-ed pointers), but internally the functions
now use borrowed pointers to refer to these structures. My guess
would be that it's possible to move this change outward and not
use the GCed pointers at all, but that change looks like it could be
a larger one. Actually, I'm delighted at how quick this change was.
2013-02-07 13:58:32 -08:00
Niko Matsakis
a32498d846 Make ~fn non-copyable, make &fn copyable, split barefn/closure types,
correct handling of moves for struct-record update.

Part of #3678.  Fixes #2828, #3904, #4719.
2013-02-07 05:53:30 -08:00
Kang Seonghoon
01cc9ecafe libsyntax: no binary/hex float literals 2013-02-06 16:49:24 +09:00
Patrick Walton
801f3225b2 oldmap: use &K instead of K in find and get
This reverts commit a4250a96fd.

This is not the cause of the nonexhaustive-match failure.
2013-02-05 19:41:45 -08:00
Graydon Hoare
a4250a96fd Revert "oldmap: use &K instead of K in find and get"
This reverts commit 8e643525d4.
2013-02-05 14:30:53 -08:00
Tim Chevalier
33e2c979ce Merge branch 'incoming' into removing 2013-02-05 10:33:35 -08:00
John Clements
61827a7020 lines too long 2013-02-04 21:00:17 -08:00
John Clements
b4138c1151 demodeing, un-gc-ing
It looks to me like the string_reader and tt_reader structs are
GC pointers only because they predate the modern borrow system.
This commit leaves the type names string_reader and tt_reader alone
(they still refer to GC-ed pointers), but internally the functions
now use borrowed pointers to refer to these structures. My guess
would be that it's possible to move this change outward and not
use the GCed pointers at all, but that change looks like it could be
a larger one. Actually, I'm delighted at how quick this change was.
2013-02-04 21:00:17 -08:00
Tim Chevalier
2f46b763da core/syntax: Staging fixes 2013-02-04 17:42:19 -08:00
bors
bffe3088c7 auto merge of pull req #4777 from thestinger/rust, r=graydon 2013-02-04 17:24:40 -08:00
Tim Chevalier
4e45d7111c syntax: Make the pipe compiler stop generating set_buffer_ calls 2013-02-04 15:18:53 -08:00
Tim Chevalier
e22aa029fb core/syntax: Add transitional code for pipes 2013-02-04 15:18:53 -08:00
Brian Anderson
e08a805b30 Merge remote-tracking branch 'bstrie/rimov' into incoming
Conflicts:
	src/libsyntax/parse/parser.rs
	src/test/bench/graph500-bfs.rs
	src/test/bench/sudoku.rs
	src/test/run-pass/borrowck-mut-vec-as-imm-slice.rs
	src/test/run-pass/empty-mutable-vec.rs
	src/test/run-pass/foreach-nested.rs
	src/test/run-pass/swap-2.rs
2013-02-04 11:58:30 -08:00
Brian Anderson
27e1ac5bb9 Merge pull request #4684 from erickt/incoming
core: convert ToStr::to_str to take explicit &self
2013-02-04 10:15:02 -08:00
Patrick Walton
31f6534952 libsyntax: Add explicit self to ast_util. rs=explicit-selfing 2013-02-04 09:07:00 -08:00
Erick Tryzelaar
9adfa59d8e core: convert ToStr::to_str to take explicit &self 2013-02-03 20:47:26 -08:00
Daniel Micay
8e643525d4 oldmap: use &K instead of K in find and get 2013-02-03 23:30:56 -05:00
Brian Anderson
3b396d17d6 Merge remote-tracking branch 'thestinger/old_map' into incoming
Conflicts:
	src/test/bench/core-map.rs
2013-02-03 17:56:49 -08:00
Marvin Löbel
eb19462104 Converted libcore/uint-template.rs to the new string functions.
- Moved ToStr implementation of unsigned integers to uint-template.rs.
- Marked the `str()` function as deprecated.
- Forwarded all conversion functions to `core::num::to_str_common()`
  and `core::num::from_str_common()`.
- Fixed most places in the codebase where `to_str()` is being used.
- Added uint-template to_str and from_str overflow tests.
2013-02-03 15:37:24 -08:00
Daniel Micay
2e496818a5 oldmap: get rid of the legacy each_key method 2013-02-03 15:55:10 -05:00
Daniel Micay
f4a27b2c7d oldmap: get rid of the legacy contains_key method 2013-02-03 15:55:10 -05:00
Daniel Micay
319eeb1c79 rename map -> oldmap and mark it as deprecated
LinearMap is quite a bit faster, and is fully owned/sendable without
requiring copies. The older std::map also doesn't use explicit self and
relies on mutable fields.
2013-02-03 15:55:10 -05:00
Brian Anderson
04f93be158 Fix breakage 2013-02-01 15:24:16 -08:00
Brian Anderson
9dc6938292 Merge remote-tracking branch 'nickdesaulniers/issue4524' into nocomm1 2013-02-01 11:18:58 -08:00
Nick Desaulniers
7868b6bf55 Remove fail keyword from lexer & parser and clean up remaining calls to
fail

Fix merge conflicts - Issue 4524
2013-02-01 00:15:42 -08:00
John Clements
a2839246be cleanup for make check 2013-01-31 23:05:12 -08:00
John Clements
4af7c643f2 more cleanup 2013-01-31 23:05:12 -08:00
John Clements
53688addaa test cases, cleanup 2013-01-31 23:05:12 -08:00
Nick Desaulniers
aee7929469 Replace most invocations of fail keyword with die! macro 2013-01-31 20:12:49 -08:00
Niko Matsakis
71478f9ce3 Workaround for #4717: pad contents of ast. rs=breakage 2013-01-31 16:56:12 -08:00
Niko Matsakis
0682ad0eb9 Finalize moves-based-on-type implementation.
Changes:

- Refactor move mode computation
- Removes move mode arguments, unary move, capture clauses
  (though they still parse for backwards compatibility)
- Simplify how moves are handled in trans
- Fix a number of illegal copies that cropped up
- Workaround for bug involving def-ids in params
  (see details below)

Future work (I'll open bugs for these...):

- Improve error messages for moves that are due
  to bindings
- Add support for moving owned content like a.b.c
  to borrow check, test in trans (but I think it'll
  "just work")
- Proper fix for def-ids in params

Def ids in params:

Move captures into a map instead of recomputing.

This is a workaround for a larger bug having to do with the def-ids associated
with ty_params, which are not always properly preserved when inlining.  I am
not sure of my preferred fix for the larger bug yet.  This current fix removes
the only code in trans that I know of which relies on ty_param def-ids, but
feels fragile.
2013-01-31 12:09:00 -08:00
Ben Striegel
13076eb3b0 Fix RIMOV damage to libsyntax 2013-01-30 23:21:16 -05:00
Ben Striegel
0336a8633f RIMOV, round 10
find ./ -type f -name "*.rs" -exec sed -i "s/~\[mut /~\[/g" {} \;
2013-01-30 23:19:08 -05:00
Ben Striegel
3e95a13577 RIMOV, round 8
find ./ -type f -name "*.rs" -exec sed -i "s/  \([a-zA-Z_]\+\): ~\[mut /
mut \1: ~\[/g" {} \;
2013-01-30 23:19:08 -05:00
Ben Striegel
b4f47eca2a RIMOV, round 7
find ./ -type f -name "*.rs" -exec sed -i "s/ mut \([a-zA-Z_]\+\):
~\[mut / mut \1: ~\[/g" {} \;
2013-01-30 23:18:08 -05:00
Ben Striegel
1c9b5a83b2 RIMOV, round 6.
This gets rid of `mut` inside bare vectors. It's going to cause some
problems later.
2013-01-30 23:18:08 -05:00
Ben Striegel
5577ce635f RIMOV, round 3
find ./ -type f -name "*.rs" -exec sed -i "s/let \(.*\)\[mut[ ]\?/let
mut \1\[/g" {} \;
2013-01-30 23:16:56 -05:00
Patrick Walton
366812a5c3 librustc: Change self as a type to Self everywhere. r=brson 2013-01-30 19:52:45 -08:00
Patrick Walton
49472ec4c9 librustc: Remove legacy exports from the language. r=brson 2013-01-30 18:11:43 -08:00
Tim Chevalier
0aef28dd6d De-capitalize "note" to get rid of spurious tidy warnings 2013-01-29 19:26:55 -08:00
Patrick Walton
b070590564 libsyntax: De-export libsyntax. rs=deexporting 2013-01-29 14:42:23 -08:00
Patrick Walton
95b892c8a7 libsyntax: De-export a lot of libsyntax. rs=deëxporting 2013-01-29 13:55:30 -08:00
Patrick Walton
4ead38bae7 libsyntax: Implement the impl Trait for Type syntax 2013-01-29 11:48:21 -08:00
Patrick Walton
226cd68f13 librustc: De-implicit-self the visitor. r=graydon 2013-01-29 10:43:12 -08:00
Patrick Walton
6ce74460e6 librustc: Disallow trait bounds in types, enumerations, and structure definitions. r=tjc 2013-01-29 10:42:58 -08:00
Patrick Walton
eb4d39e1fe libstd: Remove "dual impls" from the language and enforce coherence rules. r=brson
"Dual impls" are impls that are both type implementations and trait
implementations. They can lead to ambiguity and so this patch removes them
from the language.

This also enforces coherence rules. Without this patch, records can implement
traits not defined in the current crate. This patch fixes this, and updates
all of rustc to adhere to the new enforcement. Most of this patch is fixing
rustc to obey the coherence rules, which involves converting a bunch of records
to structs.
2013-01-29 10:42:45 -08:00
Tim Chevalier
91676f3fa6 syntax: Don't add an extra space before the last comma...
...when printing struct update expressions.
2013-01-28 19:41:56 -08:00
Tim Chevalier
31d78b2f07 Add #[legacy_records] crate attribute
In rustc, rustdoc, rusti, syntax, and std.
2013-01-28 19:41:56 -08:00
Niko Matsakis
19e015c44a Add to_str() definitions for some AST types
r=brson
2013-01-28 10:01:59 -08:00
Niko Matsakis
d4fd30c6ac Link the lifetimes of regions resulting from borrows of the
contents of other borrowed pointers to the lifetimes of the
borrowed value.  Fixes #3148.

r=catamorphism
2013-01-28 10:00:23 -08:00
Daniel Micay
e4337a9def remove remaining is_not_empty functions/methods 2013-01-24 23:24:57 -05:00
Daniel Micay
d95c9cbe38 replace ConstVector trait with the Container trait 2013-01-24 23:02:44 -05:00
Tim Chevalier
9898485d4f Merge pull request #4613 from erickt/incoming
convert most of libcore and libstd to structs, work around tzset race
2013-01-24 17:24:45 -08:00
Tim Chevalier
f19e16881e syntax/rustc: Less copy 2013-01-24 16:45:20 -08:00
Erick Tryzelaar
5085eb3c28 Convert pipes::Buffer into a struct 2013-01-24 16:24:31 -08:00
Erick Tryzelaar
90734a0d33 Convert extfmt::rt::Conv into a struct 2013-01-24 16:24:31 -08:00
Erick Tryzelaar
6e2ae2c2c1 remove support for records from auto_encode 2013-01-24 16:24:30 -08:00
John Clements
cb504f5404 unit test cases now pass, added a few to the interner 2013-01-24 14:20:57 -08:00
Tim Chevalier
f3ec278e46 Merge pull request #4609 from sonwow/keyword-super
Make `super` a keyword
2013-01-24 11:17:52 -08:00
Tim Chevalier
5b64c796a4 syntax/rustc: Improve error message for misuse of for loop
Print out a clearer error message when a `for` gets
used with the wrong type of iterator. Also fix spans on `for` loop
bodies, and suppress some more derived errors.

r=brson

Closes #3651
2013-01-24 11:04:54 -08:00
Youngsoo Son
4b2aa286d8 Make super a keyword 2013-01-24 16:07:04 +09:00
John Clements
b635f1e63a fix trailing whitepace 2013-01-23 17:42:05 -08:00
John Clements
8716005581 cleaning up, adding tests 2013-01-23 17:31:12 -08:00
Patrick Walton
d9c842847d libsyntax: Fix parsing of pub unsafe fn inside extern blocks. rs=bugfix 2013-01-23 15:14:12 -08:00
Patrick Walton
154488df19 libsyntax: Implement assert as a macro (called fail_unless! on a transitionary basis to avoid conflicting with the keyword right now). r=brson 2013-01-23 14:46:24 -08:00
Patrick Walton
54b2cad8b3 libsyntax: Remove fn() unsafe { ... }. r=graydon 2013-01-23 14:41:08 -08:00
Tim Chevalier
d77f8d5554 Long lines 2013-01-23 13:34:22 -08:00
John Clements
0b958e74ac renaming to adhere to conventions 2013-01-23 11:46:19 -08:00
Patrick Walton
778aec998b libsyntax: Implement the + syntax for multiple trait bounds. r=tjc 2013-01-23 11:15:10 -08:00
Tim Chevalier
995ccc0d82 Merge pull request #4596 from Trinick/tomutrename
core: Rename to_mut and from_mut to cast_to_mut and cast_from_mut
2013-01-23 10:56:08 -08:00
Trinick
9dc8e96c5f core: Rename to_mut and from_mut to cast_to_mut and cast_from_mut 2013-01-23 10:09:45 +00:00
Tim Chevalier
83ddb55e8f syntax: Pretty-print mut qualifiers on args 2013-01-22 23:34:35 -08:00
Tim Chevalier
a7eaa1f5e4 syntax: Allow closure args to be mutable 2013-01-22 23:34:34 -08:00
Seo Sanghyeon
d10b5c725b Add is_mutbl field to def_arg 2013-01-22 23:34:34 -08:00
Seo Sanghyeon
4dd29dee57 Parse mut in arguments 2013-01-22 23:34:33 -08:00
Seo Sanghyeon
9a5d617092 Add is_mutbl field to arg 2013-01-22 23:34:33 -08:00
Tim Chevalier
10260bee38 Change debuginfo to not use an option for the output type...
...now without a random libuv change.
2013-01-22 15:13:23 -08:00
Tim Chevalier
a36eacc4f9 Revert "Clean up previous commit to not require an Option"
I made a mistake and included some submodule weirdness.
About to re-push the patch without that.

This reverts commit 17ea548275.
2013-01-22 15:12:35 -08:00
Tim Chevalier
17ea548275 Clean up previous commit to not require an Option 2013-01-22 14:28:05 -08:00
Tim Chevalier
a8d076d2de syntax/rustc: Make some metadata-related functions take slices, kill bad copies
Too small to review.
2013-01-22 11:58:08 -08:00
Erick Tryzelaar
7f2c399f3a Convert many libsyntax records into structs
Specifically:

ast_map::ctx
ast_util::id_range
diagnostic::{handler_t,codemap_t}
auto_encode::field
ext::base::{macro_def,syntax_expander_tt,syntax_expander_tt_item}
ext::pipes::proto::next_state
2013-01-20 14:08:18 -08:00
Erick Tryzelaar
d5d77b9351 convert the remaining ast record types into structs
These are: region,arg,fn_decl,method,_mod,foreign_mod,
variant_arg,enum_def_,variant_,trait_ref.
2013-01-20 14:08:18 -08:00
Erick Tryzelaar
5ba7e55a4c convert ast::{ty_field_,ty_method} into a struct 2013-01-20 14:08:18 -08:00
Erick Tryzelaar
8cdc3fda11 convert ast::ty into a struct 2013-01-20 14:08:18 -08:00
Erick Tryzelaar
8a3a1fc148 convert ast::expr into a struct 2013-01-20 14:08:18 -08:00
Patrick Walton
f405e41d7a librustc: Implement write guards for borrowing @mut to & or &mut. r=nmatsakis 2013-01-17 11:50:20 -08:00
Graydon Hoare
84825ee310 librustc: Make the default sigil for block lambdas & instead of @. 2013-01-15 17:57:45 -08:00
Erick Tryzelaar
293cd3480c convert ast::{field_,capture_item_,mt} and middle::ty::mt into structs 2013-01-14 21:36:27 -08:00
Erick Tryzelaar
4bcd19f6be Convert ast::{pat,field_pat,local_,arm} into structs 2013-01-14 20:52:28 -08:00
Erick Tryzelaar
3ea3136e84 convert ast::blk_ into a struct 2013-01-14 19:35:08 -08:00
Erick Tryzelaar
0b9e23146b convert ast::crate_ into a struct. 2013-01-14 19:06:59 -08:00
Erick Tryzelaar
eb8fd119c6 convert ast::pat_list_ident_ to a struct 2013-01-14 18:15:54 -08:00
Erick Tryzelaar
4b0f702608 convert ast::attribute_ and ast::view_item to a struct 2013-01-14 18:15:54 -08:00
Erick Tryzelaar
eafed93d72 convert ast::struct_field_ into a struct 2013-01-14 18:15:54 -08:00
Erick Tryzelaar
1f5e9ff362 convert ast::struct_def to a struct 2013-01-14 18:15:54 -08:00
Erick Tryzelaar
530a113bfa convert ast::item into a struct 2013-01-14 18:15:53 -08:00
Erick Tryzelaar
ebea895d02 convert ast::struct_dtor_ into a struct 2013-01-14 18:14:17 -08:00
Erick Tryzelaar
5c0d674a45 convert ast::foreign_item to a struct 2013-01-14 18:14:16 -08:00
Erick Tryzelaar
e1f1a1204a change ast::ty_param into a struct. 2013-01-14 18:14:16 -08:00
Erick Tryzelaar
df7d376d25 Convert ast::def_id into a struct. 2013-01-14 18:14:16 -08:00
Erick Tryzelaar
bea67bde21 Change ast::path into a struct. 2013-01-14 18:14:16 -08:00
Tim Chevalier
1be4bfb8cc Merge pull request #4491 from jbclements/removed-ast-self-import
removed self-import (minor cleanup)
2013-01-14 17:35:12 -08:00
John Clements
dd621bd58d removed self-import (minor cleanup) 2013-01-14 17:26:56 -08:00
Tim Chevalier
a4dc65baa1 syntax/rustc: Eliminate some bad copies
r=pcwalton
2013-01-14 15:49:53 -08:00
Brian Anderson
fc582bcfce Merge remote-tracking branch 'mneumann/f-serialize' 2013-01-14 12:56:31 -08:00
Andrew Paseltiner
92810089b5 libsyntax: Fix name generation in condition! macro 2013-01-11 21:32:10 -05:00
Tim Chevalier
cfa62cd5ee Make ast_util::path_name_i take a slice vector, eliminate a bad copy 2013-01-11 15:19:05 -08:00
Patrick Walton
a0c2a9b743 librustc: Implement a #[no_mangle] attribute to suppress name mangling. r=brson
This is very helpful for SDL, as SDL wants you to define a function named
`SDL_main`.
2013-01-10 21:44:59 -08:00
Patrick Walton
2a1b6c4de9 librustc: Implement &static as the replacement for Durable. r=nmatsakis 2013-01-10 11:16:54 -08:00
Patrick Walton
982830c836 librustc: Allow the type parameter version of Self to be spelled with a capital S 2013-01-10 10:37:22 -08:00
Niko Matsakis
2b92962aa2 A collection of refactorings that I found it hard/tiresome to divide:
- Make `extern fn()` assignable to any closure type, rather than
  a subtype.
- Remove unused int_ty_set and float_ty_set
- Refactor variable unification and make it more DRY
- Do fn sub/lub/glb on the level of fn_sig
- Rename infer::to_str::ToStr to infer::to_str::InferStr
- Capitalize names of various types
- Correct hashing of FnMeta
- Convert various records-of-fns into structs-of-fns.  This is both
  eliminating use of deprecated features and more forwards compatible
  with fn reform.

r=pcwalton
2013-01-09 14:59:07 -08:00
Erick Tryzelaar
2891a49f0d core: rename vec.filter to vec.filtered 2013-01-09 08:55:37 -08:00
Erick Tryzelaar
93c2ebf994 syntax: convert ast::spanned into a struct 2013-01-09 08:55:36 -08:00
Patrick Walton
2db3abddcd librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc 2013-01-08 22:02:35 -08:00
Patrick Walton
44ab00ee37 Revert "librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc"
This reverts commit a8d37af247.
2013-01-08 19:29:16 -08:00
Patrick Walton
a8d37af247 librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc 2013-01-08 19:27:57 -08:00
Niko Matsakis
c3a74d87bd Implement GLB algorithm. (Issue #2263)
r=brson
2013-01-08 15:41:53 -08:00
Lindsey Kuper
816cb8c535 Rename identifiers that still use 'alt' to use 'match'
This'll be less confusing for anyone who works on match in future.
2013-01-08 14:31:58 -05:00
Patrick Walton
fa96740923 librustc: Remove some string allocations. rs=perf 2013-01-05 19:33:37 -08:00
Tim Chevalier
89acd1f57f Rename option::get_default => get_or_default, get_zero => get_or_zero 2013-01-04 16:01:26 -08:00
Patrick Walton
e26ca35b08 librustc: Fix the test runner, the condition system, and core test. rs=bustage 2012-12-27 17:53:04 -08:00
Patrick Walton
57c599914a librustc: Terminate name searches at the nearest module scope for paths that contain at least two components. r=graydon 2012-12-27 10:02:54 -08:00
Michael Neumann
2b6c456bf6 Enhance auto_encode to take number of struct fields
emit_struct and read_struct takes an additional len:uint parameter which tells
us how many fields the struct we are working on has.

This is required to implement an Encoder for the msgpack [1] serialization
format. To serialize a struct with msgpack you have to use arrays and the size
of the array has to be know before each of the elements are written out. JSON
as an example doesn't have this problem as it uses '[' and ']' delimiters for
arrays.

[1]: www.msgpack.org
2012-12-27 06:16:16 -06:00
Graydon Hoare
329316ce15 bump 0.5 => 0.6, redirect some URLs in docs. 2012-12-24 18:29:01 -08:00
Graydon Hoare
dbd36111fe bump 0.5 => 0.6, redirect some URLs in docs. 2012-12-21 15:35:49 -08:00
Erick Tryzelaar
c14105bb8a Remove serialize::traits submodule. 2012-12-19 18:16:20 -08:00
Erick Tryzelaar
9c673b246c Remove the old serialization code
Closes #3713.
2012-12-19 18:16:20 -08:00
Brian Anderson
dac88fa7e6 Remove transitional path2 attribute 2012-12-19 14:23:53 -08:00
Graydon Hoare
8e28f23c60 core: add macro_rules! for "condition! { c: in -> out; }". 2012-12-18 17:22:27 -08:00
Brian Anderson
9057e98a01 Make #[path] work with absolute paths again. Fix check-fast 2012-12-18 17:00:26 -08:00
Brian Anderson
a59747cd7f Another tweak to auto_encode to only use trait-qualified static methods 2012-12-18 15:38:34 -08:00
Brian Anderson
b46e25bdc8 Merge commit 'erickt/incoming^' into kind-names 2012-12-18 12:22:59 -08:00
Brian Anderson
c704d26c8c Change auto_encode to call 'std::serialize::traits::Decode::decode' 2012-12-18 12:04:26 -08:00
Erick Tryzelaar
85bb1fc2c4 Change iter::find's closure to take a ref 2012-12-17 22:01:38 -08:00
Erick Tryzelaar
8650c6f683 Switch from serialization to std::serialize. (snapshot) 2012-12-17 20:00:36 -08:00
Brian Anderson
33a8f855c2 Make the path and path2 attributes equivalent. Remove some uses 2012-12-17 18:06:52 -08:00
Jakub Wieczorek
1968cb315a Add support for destructuring vectors in match expressions 2012-12-17 16:50:40 -08:00
Erick Tryzelaar
786c143a70 Begin renaming serialization to std::serialize. (snapshot) 2012-12-13 18:16:31 -08:00
Patrick Walton
cd120736cb librustc: Allow moves out of self. r=nmatsakis 2012-12-13 15:49:07 -08:00
Patrick Walton
9d23029648 libsyntax: Implement deriving for struct-like enum variants. r=brson 2012-12-13 14:55:11 -08:00
Patrick Walton
4c2e4c37ce librustc: Make use statements crate-relative by default. r=brson 2012-12-13 13:05:22 -08:00
Graydon Hoare
3c8dca429a syntax: normalize paths when parsing, close #4173. 2012-12-13 12:04:27 -08:00
Graydon Hoare
9a4c669867 syntax: remove remaining #syntaxext machinery. Close #3516. 2012-12-12 17:08:09 -08:00
Graydon Hoare
e24ae85025 syntax: remove most code handling old-style syntax extensions. 2012-12-12 15:02:47 -08:00
Graydon Hoare
9cced55b93 syntax: remove all remaining uses of #ast, and #ast / qquote itself. 2012-12-12 15:02:47 -08:00
Tim Chevalier
b0a01f2563 re-fix typo 2012-12-11 19:22:45 -08:00
Graydon Hoare
35209cb9ec fix long line, r=tidypolice. 2012-12-11 16:04:58 -08:00
Brian Anderson
7d556e18b0 Fix deriving for single-variant enums 2012-12-11 15:41:16 -08:00
Brian Anderson
6e38e334de Relate the module hierarchy to directory paths in the parser
Introduces a temporary 'path2' attribute that will replace 'path' after
a snapshot
2012-12-11 15:00:23 -08:00
Tim Chevalier
94a76843f4 Revert "Merge pull request #4144 from luqmana/deprecated-attribute"
This reverts commit f675b97ddc, reversing
changes made to e7dd3af970.
2012-12-11 12:28:30 -08:00
Tim Chevalier
f675b97ddc Merge pull request #4144 from luqmana/deprecated-attribute
Add deprecated attribute.
2012-12-10 21:16:20 -08:00
Tim Chevalier
0046ed9462 Remove un-needed code for obsolete classes
and rename "class" to "struct" everywhere possible (except local
vars, I was too lazy for that) -- that is why this commit is so
big.

No review, just dead code removal and renaming.

Closes #3515
2012-12-10 18:45:01 -08:00
Brian Anderson
3fcdb7d6a7 Adjust the die macro to only accept ~str and to work in statement position 2012-12-10 18:16:22 -08:00
Graydon Hoare
12c32e944d Add license boilerplate to more files. 2012-12-10 17:32:58 -08:00
Brian Anderson
9723d3ac2f Remove transitional code 2012-12-09 17:59:21 -08:00
Luqman Aden
4b4c8331bb Add deprecated attribute. 2012-12-09 02:26:12 -05:00
Patrick Walton
98fdcb0b9d librustc: De-mode pattern bindings. r=nmatsakis 2012-12-07 19:34:57 -08:00
Patrick Walton
184f5102b3 libsyntax: Fix parsing of module-qualified structure patterns. rs=bugfix 2012-12-07 19:10:16 -08:00
Patrick Walton
ab3b752906 librustc: Implement "&mut [T]" as an expression. r=brson 2012-12-07 18:29:10 -08:00
Brian Anderson
87f3ea7705 Fix pretty-printing of trait constraints 2012-12-07 17:55:34 -08:00
Brian Anderson
10c9d7921d Trait constraints are separated by space, not comma 2012-12-07 15:54:17 -08:00
Brian Anderson
ecdc8aae41 Remove impl_id from trait_ref. Unused 2012-12-07 15:54:17 -08:00
Graydon Hoare
d78053ecb0 syntax: try to fix pattern printing yet again, r=burningtree. 2012-12-07 14:39:47 -08:00
Graydon Hoare
28cce241dc syntax: try to fix pattern printing harder, r=burningtree. 2012-12-07 12:52:01 -08:00
Graydon Hoare
5bdbfa41e6 syntax: pretty print bind_by_value patterns as "copy", r=burningtree. 2012-12-07 12:29:46 -08:00
Graydon Hoare
09573ea8cf syntax: stage0-guard uses of #ast, rewrite as quote_foo! in stage1,2. 2012-12-07 11:21:14 -08:00
Graydon Hoare
a6fcfd726b syntax: fix missing push in item macro expansion 2012-12-07 11:21:14 -08:00
Graydon Hoare
70e0c6e27d syntax: Permit splicing anything into a quote that implements ToTokens. 2012-12-07 11:21:14 -08:00
Graydon Hoare
7e9872058e syntax: fix quote_type! to quote_ty! 2012-12-07 11:21:14 -08:00
Graydon Hoare
d45cb27901 syntax: point quote tokens at the site of quote-using-extension invocation. 2012-12-07 11:21:14 -08:00
Graydon Hoare
9f27bf7deb syntax: fix the accidental binding of interner state between parse and quote. 2012-12-07 11:21:14 -08:00
Graydon Hoare
65db4315ab syntax: fix a pp bug on foreign mods. 2012-12-07 11:21:14 -08:00
Tim Chevalier
58a4a3700d Revert "Print copy patterns correctly"
This reverts commit ea6819637382e7f8979766b954dd2a1922d0dee0.
2012-12-06 22:36:32 -08:00
Tim Chevalier
f070e22360 Print copy patterns correctly 2012-12-06 21:53:25 -08:00
Brian Anderson
4ab1c8805a Convert Num to explicit self 2012-12-05 19:23:13 -08:00
Patrick Walton
1282fc8074 librustc: Hook borrow check loan checking up to the moves-based-on-type infrastructure. rs=helps-unbreak-the-build 2012-12-05 15:07:48 -08:00
Patrick Walton
b8cfd5c414 librustc: Long lines. rs=rustbot 2012-12-04 21:13:02 -08:00
Patrick Walton
33c1e47c1b librustc: Implement moves based on type. r=nmatsakis 2012-12-04 15:38:04 -08:00
Patrick Walton
56ece46f7d librustc: Remove all legacy pattern bindings from libsyntax and librustc. rs=refactoring 2012-12-04 14:19:19 -08:00
Graydon Hoare
94be145169 core: rename box to managed. Close #4079. 2012-12-03 17:45:19 -08:00
Graydon Hoare
00c856c0b1 Update license, add license boilerplate to most files. Remainder will follow. 2012-12-03 17:12:14 -08:00
Patrick Walton
f34833abfc librustc: Make a.b() always a method call. r=nmatsakis 2012-11-30 20:41:46 -08:00
Tim Chevalier
daf28a421a Disallow dereferencing enum types when the variant is private
If an enum type's only variant is private, disallow dereferencing
values of its type.

Due to #4082, this only applies to enums that are in the same crate.

r=pcwalton

Closes #818
2012-11-30 12:45:10 -08:00
Graydon Hoare
d783f4d7bb libs: Remove transitionary material on iter_bytes, add workcache to build. 2012-11-30 10:33:16 -08:00
Brian Anderson
3ed9fbd63c impls of traits cannot define methods on the anonymous trait 2012-11-29 22:07:49 -08:00
Patrick Walton
a0617eae68 librustc: Eliminate most expressions of the form a.b() that are not method calls. rs=refactoring 2012-11-29 17:51:56 -08:00
Graydon Hoare
ce24d37759 syntax: slight improvement in fidelity of printing tokens. Still not great. 2012-11-29 12:09:11 -08:00
Paul Stansifer
7051d622c0 Properly sync macro_parser.rs after it escapes out to the Rust parser. Closes #3201. 2012-11-29 12:09:11 -08:00
Paul Stansifer
9ff8d18766 Fix trace_macros so that it works. 2012-11-29 12:09:11 -08:00
Paul Stansifer
15e03e1e5e Forbid attrs on macros, since we don't handle them properly yet. 2012-11-29 12:09:11 -08:00
Paul Stansifer
6174a30d7c Respect semicolons always when expanding statments. 2012-11-29 12:09:11 -08:00
Paul Stansifer
45bcb10204 Forbid item macros from occuring where statement macros might occur, and allow item macros to look like statement/expr macros. 2012-11-29 12:09:10 -08:00
Paul Stansifer
0f707f42c8 Distinguish stmt_macs that are followed by semicolons and those that aren't. 2012-11-29 12:09:10 -08:00
Paul Stansifer
e77491bd87 Make the parser handle stmt macros that might be exprs at the end of blocks. 2012-11-29 12:09:10 -08:00
Paul Stansifer
bd92499c5e Allow parsing of macros in statement position. 2012-11-29 12:09:10 -08:00
Paul Stansifer
9814e58815 No longer parse the delimiters of the RHS of a macro as part of the expansion. 2012-11-29 12:09:10 -08:00
Paul Stansifer
ba354b1726 Allow the expansion of old-style expr macros in stmt position. 2012-11-29 12:09:10 -08:00
Paul Stansifer
b7fcc9b52e Use biased_match! to avoid over-deep indentation in expand.rs. 2012-11-29 12:09:10 -08:00
Paul Stansifer
cf26a7d7b9 Make it possible to expand stmt macros. 2012-11-29 12:09:10 -08:00
Paul Stansifer
ee076f63f9 Allow for macros to occur in statement position. 2012-11-29 12:09:10 -08:00
Paul Stansifer
fca52554e7 Make it possible to invoke item macros without passing identifier arguments. 2012-11-29 12:09:10 -08:00
Paul Stansifer
cafea5ecb6 Grammaticalinate an error message. 2012-11-29 12:09:10 -08:00
Paul Stansifer
9845a4be5a Allow macro_rules! macros to expand to expressions or items. 2012-11-29 12:09:10 -08:00
Patrick Walton
c946c87b6f libsyntax: Remove the "by-mutable-ref" obsolete syntax error; it blocks useful function argument patterns. Add a test for the latter. r=brson 2012-11-29 12:06:36 -08:00
Brian Anderson
5a282ec26f core: Convert some records to structs 2012-11-28 21:50:09 -08:00
Brian Anderson
65bd40e300 Remove uses of #[merge] 2012-11-28 17:09:26 -08:00
Brian Anderson
16f72df704 Merge remote-tracking branch 'erickt/time'
Conflicts:
	src/libstd/time.rs
2012-11-28 14:49:58 -08:00
Brian Anderson
42c2c2ab2f Remove parser hack 2012-11-28 14:39:48 -08:00
Brian Anderson
fc06114ddf Merge remote-tracking branch 'brson/companion' into incoming
Conflicts:
	src/compiletest/compiletest.rs
	src/libcargo/cargo.rs
	src/libcore/core.rs
	src/librustc/rustc.rs
	src/librustdoc/rustdoc.rc
2012-11-28 13:17:33 -08:00
Brian Anderson
8179e268ef Register snapshots 2012-11-28 12:33:00 -08:00
Patrick Walton
669fbddc44 librustc: Add explicit self to IterBytes. r=nmatsakis 2012-11-28 11:36:04 -08:00
Patrick Walton
07f4031bb4 libsyntax: Implement a macro die! to replace the fail expression. r=brson 2012-11-28 11:28:56 -08:00
Patrick Walton
61cfec3c52 librustc: Parse extern "C" { ... }. r=brson 2012-11-28 11:28:16 -08:00
Patrick Walton
1c348e6e38 librustc: Implement @mut [T] as the new replacement for @[mut T] 2012-11-27 09:23:31 -08:00
Erick Tryzelaar
32763caa60 auto_serialize should use explicit refs (fixes #4044) 2012-11-26 22:31:48 -08:00
Brian Anderson
be6613e048 Remove the crate language 2012-11-26 18:13:54 -08:00
Brian Anderson
81a79603c0 Add a temporary hack to divert the parser to an alternate file 2012-11-26 18:13:54 -08:00
Brian Anderson
58e26243a7 syntax: Add a hack to support the int-template pattern 2012-11-26 18:13:54 -08:00
Patrick Walton
e6d87a3ef4 libsyntax: Implement deriving correctly for type-parameterized structs and enums. r=brson 2012-11-21 10:27:37 -08:00
Patrick Walton
57588edf3b libsyntax: Implement deriving via a syntax extension for the IterBytes trait. r=brson 2012-11-21 10:27:34 -08:00
Patrick Walton
b053f0b5e6 libsyntax: Fix duplication of items that occurs if #[deriving_eq] is applied to a non-enum/non-struct. r=brson 2012-11-21 10:27:30 -08:00
Patrick Walton
e0876fdfc1 libsyntax: Implement deriving for enums with N-ary variants. r=brson 2012-11-21 10:27:13 -08:00
Graydon Hoare
497a8b54b5 syntax: switch tt quoter to emit ~[tt], not tt. 2012-11-20 16:08:05 -08:00
Patrick Walton
ba01cd7fb0 libsyntax: Long line. rs=make-tidy 2012-11-20 11:59:20 -08:00
Patrick Walton
a7aecc46a5 rustc: Implement "deriving" for monomorphic structs via a syntax extension. r=brson 2012-11-20 11:58:19 -08:00
Patrick Walton
318e534895 rustc: Implement explicit self for Eq and Ord. r=graydon 2012-11-19 15:33:11 -08:00
Brian Anderson
9bed0ddb0e Fix parsing of interpolated paths 2012-11-19 14:00:39 -08:00
Brian Anderson
371be3c6c4 Remove unused file_type enum from the parser 2012-11-18 18:09:41 -08:00
Brian Anderson
74b2e99797 Report errors better when failing to open files for sub-parsers 2012-11-18 18:09:41 -08:00
Brian Anderson
72cc1aca17 Parse file mods from .rs files 2012-11-18 18:09:41 -08:00
Brian Anderson
ddbff6fd2a syntax: Remove cdir_syntax. Unused 2012-11-18 18:09:41 -08:00