Commit Graph

267 Commits

Author SHA1 Message Date
Huon Wilson
513d2292e5 std: remove foldr and alli methods in vec 2013-06-09 02:22:23 +10:00
John Clements
91b652695b moved TLS of sctable to ast_util, hid parameter in hygiene calls 2013-06-05 12:01:40 -07:00
John Clements
8dad2bb281 removed unused imports (and one unused argument) 2013-06-05 12:01:39 -07:00
John Clements
3203595471 interner just uses uints, not idents with syntax context 2013-06-05 12:01:38 -07:00
John Clements
22d21ab4c2 rename repr to name 2013-06-05 12:01:37 -07:00
Patrick Walton
8114d0e950 librustc: Disallow multiple patterns from appearing in a "let" declaration.
You can still initialize multiple variables at once with "let (x, y) = (1, 2)".
2013-06-04 21:45:42 -07:00
bors
fc5debd8fd auto merge of #6807 : catamorphism/rust/rustpkg-extern-mod, r=catamorphism
r? @graydon Addresses #5681
2013-06-01 19:22:42 -07:00
Tim Chevalier
760c71dc4f syntax: Add an each_view_item method on traits 2013-06-01 18:48:07 -07:00
Erick Tryzelaar
23808efd11 syntax: move callee_id into the expr_ variants 2013-06-01 15:31:56 -07:00
Patrick Walton
5fb254695b Remove all uses of pub impl. rs=style 2013-06-01 09:18:27 -07:00
Niko Matsakis
7a1a40890d Remove copy bindings from patterns. 2013-05-30 15:20:36 -04:00
Patrick Walton
206ab89629 librustc: Stop reexporting the standard modules from prelude. 2013-05-29 19:04:53 -07:00
Niko Matsakis
5851d3242c Move checking for moves and initialization of local variables and patterns into
borrow checker and generalize what moves are allowed. Fixes a nasty
bug or two in the pattern move checking code. Unifies dataflow code
used for initialization and other things. First step towards
once fns. Everybody wins.

Fixes #4384. Fixes #4715. cc once fns (#2202), optimizing local moves (#5016).
2013-05-28 20:22:14 -04:00
Alex Crichton
ae7df57c5a Prevent refcount cycles during linting
Shaves off ~600MB of memory while compiling rustc
2013-05-27 22:22:09 -05:00
Erick Tryzelaar
1965d72957 core: remove iter_bytes helper functions 2013-05-23 17:48:16 -07:00
Patrick Walton
f3723cf7c4 libextra: Rename the actual metadata names of libcore to libstd and libstd to libextra 2013-05-22 21:57:07 -07:00
Alex Crichton
82fa0018c8 Remove all unnecessary allocations (as flagged by lint) 2013-05-20 16:10:40 -05:00
John Clements
fc4f304ef9 hygiene infrastructure.
- added a hash table to memoize rename and mark operations.
- added rename, mark, and resolve fold fns
2013-05-20 11:49:21 -07:00
Brian Anderson
66319b0278 Register snapshots 2013-05-19 23:34:32 -07:00
Alex Crichton
030c666cc1 Re-implement lint with less emphasis on item ids
This way it's much easier to add lints throughout compilation correctly, and
functions on impls can alter the way lints are emitted.
2013-05-17 00:49:16 -04:00
Huon Wilson
5dc5efefd4 syntax: deprecate #[auto_{en,de}code] in favour of #[deriving({En,De}codable)].
Replace all instances of #[auto_*code] with the appropriate #[deriving] attribute
and remove the majority of the actual code, leaving stubs to refer the user to
the new syntax.
2013-05-16 08:55:57 +10:00
Erick Tryzelaar
18f6a51d0a rustc: rename ast::self_ty and related fields to explicit_self 2013-05-14 20:10:46 -07:00
Alex Crichton
ffcc680f9c Fix test fallout from removing vecs_implicitly_copyable 2013-05-14 12:25:19 -04:00
Björn Steinbrink
bdc182cc41 Use static string with fail!() and remove fail!(fmt!())
fail!() used to require owned strings but can handle static strings
now. Also, it can pass its arguments to fmt!() on its own, no need for
the caller to call fmt!() itself.
2013-05-14 16:36:23 +02:00
Alex Crichton
5eb6d19803 syntax: Use the new for protocol 2013-05-10 02:46:18 -04:00
Youngmin Yoo
841f4ceaf4 libsyntax: rename vec::each(var) to var.each 2013-05-09 14:20:04 +09:00
Patrick Walton
db4573a776 librustc: Remove mutable fields from the language.
They're still parsed though, to get through bootstrapping.
2013-05-08 17:04:00 -07:00
Niko Matsakis
4300d4d2fa Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freeze
Conflicts:
	src/libcore/core.rc
	src/libcore/hashmap.rs
	src/libcore/num/f32.rs
	src/libcore/num/f64.rs
	src/libcore/num/float.rs
	src/libcore/num/int-template.rs
	src/libcore/num/num.rs
	src/libcore/num/strconv.rs
	src/libcore/num/uint-template.rs
	src/libcore/ops.rs
	src/libcore/os.rs
	src/libcore/prelude.rs
	src/libcore/rt/mod.rs
	src/libcore/unstable/lang.rs
	src/librustc/driver/session.rs
	src/librustc/middle/astencode.rs
	src/librustc/middle/borrowck/check_loans.rs
	src/librustc/middle/borrowck/gather_loans.rs
	src/librustc/middle/borrowck/loan.rs
	src/librustc/middle/borrowck/preserve.rs
	src/librustc/middle/liveness.rs
	src/librustc/middle/mem_categorization.rs
	src/librustc/middle/region.rs
	src/librustc/middle/trans/base.rs
	src/librustc/middle/trans/inline.rs
	src/librustc/middle/trans/reachable.rs
	src/librustc/middle/typeck/check/_match.rs
	src/librustc/middle/typeck/check/regionck.rs
	src/librustc/util/ppaux.rs
	src/libstd/arena.rs
	src/libstd/ebml.rs
	src/libstd/json.rs
	src/libstd/serialize.rs
	src/libstd/std.rc
	src/libsyntax/ast_map.rs
	src/libsyntax/parse/parser.rs
	src/test/compile-fail/borrowck-uniq-via-box.rs
	src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
	src/test/run-pass/borrowck-nested-calls.rs
2013-05-05 15:11:04 -04:00
Tim Chevalier
13df2ea69c rustc: Handle struct patterns where the expected type is an enum
Previously, rustc would ICE if you matched on an enum-typed thing
with a structure pattern. Error out correctly.
2013-05-03 13:03:53 -07:00
Brendan Zabarauskas
e596128bd8 Remove 'Local Variable' comments 2013-05-02 13:22:04 +10:00
bors
55fbc47af1 auto merge of #6148 : erickt/rust/remove-drop, r=pcwalton
The drop block has been deprecated for quite some time. This patch series removes support for parsing it and all the related machinery that made drop work.

As a side feature of all this, I also added the ability to annote fields in structs. This allows comments to be properly associated with an individual field. However, I didn't update `rustdoc` to integrate these comment blocks into the documentation it generates.
2013-05-01 09:18:59 -07:00
Erick Tryzelaar
e9688fcfe3 remove some warnings 2013-05-01 07:49:41 -07:00
Erick Tryzelaar
c2e1f47955 rustc: remove the rest of drop
Removes:

ast::struct_def::dtor
syntax::ast::ii_dtor
syntax::visit::fk_dtor
syntax::ast_map::node_dtor
syntax:struct_dtor
2013-05-01 07:49:41 -07:00
Brendan Zabarauskas
ee26c7c433 Revert rename of Div to Quot 2013-05-01 15:40:05 +10:00
Niko Matsakis
a896440ca1 new borrow checker (mass squash) 2013-04-30 06:59:32 -04:00
Patrick Walton
f30f54e9d0 librustc: Remove the concept of modes from the compiler.
This commit does not remove `ty::arg`, although that should be
possible to do now.
2013-04-29 14:30:55 -07:00
John Clements
1b4ced8bcb get rid of prec.rs
prec.rs no longer had much to do with precedence; the token->binop
function fits better in token.rs, and the one-liner defining the
precedence of 'as' can go next to the other precedence stuff in
ast_util.rs
2013-04-28 09:51:14 -07:00
John Clements
71c0bd5c5d simplify, based on invariant that items_allowed != foreign_items_allowed 2013-04-28 09:49:20 -07:00
Daniel Micay
f792baba42 only use #[no_core] in libcore 2013-04-27 21:34:24 -04:00
Patrick Walton
25129ee81c librustc: Remove use mod from the language 2013-04-22 12:32:59 -07:00
Brendan Zabarauskas
01eb5e8ad3 Rename Div operator trait to Quot and Modulo operator trait to Rem 2013-04-22 01:58:53 +10:00
Alex Crichton
3c7aea3a6a syntax: de-mode and prepare for de-modeing rustc 2013-04-19 23:21:52 -04:00
John Clements
7e4cd09e2e added MTWT functions 2013-04-16 10:06:06 -07:00
John Clements
48e7bda826 path -> Path 2013-04-10 09:15:04 -07:00
Niko Matsakis
007abe9352 Rather than storing a list of ty::method per trait, store one ty::method
per method and list of def-ids per trait.
2013-04-05 05:36:02 -04:00
Niko Matsakis
6965fe4bce Add AbiSet and integrate it into the AST.
I believe this patch incorporates all expected syntax changes from extern
function reform (#3678). You can now write things like:

    extern "<abi>" fn foo(s: S) -> T { ... }
    extern "<abi>" mod { ... }
    extern "<abi>" fn(S) -> T

The ABI for foreign functions is taken from this syntax (rather than from an
annotation).  We support the full ABI specification I described on the mailing
list.  The correct ABI is chosen based on the target architecture.

Calls by pointer to C functions are not yet supported, and the Rust type of
crust fns is still *u8.
2013-03-29 18:36:20 -07:00
Alex Crichton
be57d745d2 Removing unused imports 2013-03-28 23:56:46 -04:00
Patrick Walton
e7c60c141b librustc: Remove pure from libsyntax and librustc. 2013-03-22 12:57:27 -07:00
Andrew Paseltiner
e2abecd3ab syntax: replace uses of old deriving attribute with new one 2013-03-22 06:30:59 -04: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
Patrick Walton
0ea031bcb8 librustc: Remove record patterns from the compiler 2013-03-07 22:37:03 -08:00
Erick Tryzelaar
743cfce703 core: convert vec::{last,last_opt} to return references 2013-03-05 19:39:18 -08:00
bors
eddefbc893 auto merge of #5212 : thestinger/rust/iter, r=graydon
A small step towards fixing #2827
2013-03-05 02:06:50 -08:00
Alex Crichton
dfb5c10dea Remove unused imports throughout src/ 2013-03-04 12:27:01 -05:00
Daniel Micay
af645e8487 replace option::iter with a BaseIter impl 2013-03-03 11:01:17 -05:00
Patrick Walton
256afb8a10 libsyntax: Remove fn@, fn~, and fn& from libsyntax. rs=defun 2013-03-02 16:49:31 -08:00
Erick Tryzelaar
85fecd0ba7 Merge remote-tracking branch 'remotes/origin/incoming' into incoming 2013-03-01 07:01:48 -08:00
Alex Crichton
2df07ddc25 Fix implicit leaks of imports throughout libraries
Also touch up use of 'pub' and move some tests around so the tested functions
don't have to be 'pub'
2013-02-28 18:00:34 -05:00
Erick Tryzelaar
3953bdd812 Merge remote-tracking branch 'remotes/origin/incoming' into incoming 2013-02-28 07:25:31 -08:00
bors
d0a12347de auto merge of #5141 : nikomatsakis/rust/region-syntax-expl-lifetimes, r=nikomatsakis
Major changes are:
- replace ~[ty_param] with Generics structure, which includes
  both OptVec<TyParam> and OptVec<Lifetime>;
- the use of syntax::opt_vec to avoid allocation for empty lists;

cc #4846

r? @graydon
2013-02-27 17:36:41 -08:00
Niko Matsakis
c623d21e38 Introduce lifetime declarations into the lists of type parameters.
Major changes are:
- replace ~[ty_param] with Generics structure, which includes
  both OptVec<TyParam> and OptVec<Lifetime>;
- the use of syntax::opt_vec to avoid allocation for empty lists;

cc #4846
2013-02-27 19:42:09 -05:00
Erick Tryzelaar
7d0ec86c4a Merge remote-tracking branch 'remotes/origin/incoming' into incoming 2013-02-27 11:03:21 -08:00
Patrick Walton
07c3f5c0de librustc: Forbid pub or priv before trait implementations 2013-02-27 09:40:16 -08:00
Erick Tryzelaar
bff22cf166 libsyntax: add some explicit copies 2013-02-25 23:37:45 -08:00
Erick Tryzelaar
f14409c528 libsyntax: progress on making syntax::visit vecs_implicitly_copyable-free 2013-02-25 07:49:34 -08:00
Erick Tryzelaar
9ac5262bdf libsyntax: convert visit to pass ty_params by reference 2013-02-25 07:27:01 -08:00
Luqman Aden
cd82c4566b librustc: Get rid of structural records save for front/test.rs. 2013-02-20 18:45:50 -08:00
Erick Tryzelaar
bc62bd3782 libsyntax: make enum variants take refs 2013-02-19 10:02:51 -08:00
Luqman Aden
0f09c106f0 libsyntax: Update view_item_use/import to reflect actual usage 2013-02-17 21:45:00 -05:00
Patrick Walton
bb833ca0f0 librustc: Stop parsing impl Type : Trait and fix several declarations that slipped through. r=tjc 2013-02-15 16:59:56 -08:00
Nick Desaulniers
4445b38df2 Remove die!, raplace invocations with fail! Issue #4524 pt 3 2013-02-13 17:01:32 -08:00
Patrick Walton
31f6534952 libsyntax: Add explicit self to ast_util. rs=explicit-selfing 2013-02-04 09:07:00 -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
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
Patrick Walton
49472ec4c9 librustc: Remove legacy exports from the language. r=brson 2013-01-30 18:11:43 -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
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
Seo Sanghyeon
d10b5c725b Add is_mutbl field to def_arg 2013-01-22 23:34:34 -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
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
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
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
cfa62cd5ee Make ast_util::path_name_i take a slice vector, eliminate a bad copy 2013-01-11 15:19:05 -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
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
Erick Tryzelaar
8650c6f683 Switch from serialization to std::serialize. (snapshot) 2012-12-17 20:00:36 -08:00