Commit Graph

102 Commits

Author SHA1 Message Date
Huon Wilson
cc760a647a syntax: modernise attribute handling in syntax::attr.
This does a number of things, but especially dramatically reduce the
number of allocations performed for operations involving attributes/
meta items:

- Converts ast::meta_item & ast::attribute and other associated enums
  to CamelCase.
- Converts several standalone functions in syntax::attr into methods,
  defined on two traits AttrMetaMethods & AttributeMethods. The former
  is common to both MetaItem and Attribute since the latter is a thin
  wrapper around the former.
- Deletes functions that are unnecessary due to iterators.
- Converts other standalone functions to use iterators and the generic
  AttrMetaMethods rather than allocating a lot of new vectors (e.g. the
  old code would have to allocate a new vector to use functions that
  operated on &[meta_item] on &[attribute].)
- Moves the core algorithm of the #[cfg] matching to syntax::attr,
  similar to find_inline_attr and find_linkage_metas.

This doesn't have much of an effect on the speed of #[cfg] stripping,
despite hugely reducing the number of allocations performed; presumably
most of the time is spent in the ast folder rather than doing attribute
checks.

Also fixes the Eq instance of MetaItem_ to correctly ignore spaces, so
that `rustc --cfg 'foo(bar)'` now works.
2013-07-20 01:06:16 +10:00
Patrick Walton
99d44d24c7 librustc: Remove copy expressions from the language. 2013-07-17 14:57:52 -07:00
Patrick Walton
99b33f7219 librustc: Remove all uses of "copy". 2013-07-17 14:57:51 -07:00
Patrick Walton
b4e674f6e6 librustc: Add a lint mode for unnecessary copy and remove a bunch of them. 2013-07-17 14:56:42 -07:00
Michael Woerister
0cc70743d2 Made ast::blk not use spanned<T> anymore. 2013-07-17 08:21:46 +02:00
James Miller
47eca2113c De-share ast::Ty 2013-07-07 22:51:10 +12:00
James Miller
46a1f54666 De-manage OptVec<TyParamBounds> 2013-07-07 22:51:10 +12:00
James Miller
97c5a44d3e De-share trait_ref
Also, makes the pretty-printer use & instead of @ as much as possible,
which will help with later changes, though in the interim has produced
some... interesting constructs.
2013-07-07 22:51:09 +12:00
James Miller
62c83bb17b De-manage Lifetime 2013-07-07 22:51:09 +12:00
James Miller
cd1b6c8979 De-managed ast::Path 2013-07-07 22:51:09 +12:00
James Miller
a69eb95233 Stop allocating view_items with @ 2013-07-07 22:51:09 +12:00
Ben Blum
7b968783d7 Infer default static/Owned bounds for unbounded heap fns/traits (#7264) 2013-06-26 18:14:43 -04:00
Corey Richardson
0d471d310d great renaming propagation: syntax 2013-06-25 16:15:07 -04:00
Ben Blum
ce857e3d60 Parse and typecheck (not kindcheck) bounds on trait paths. 2013-06-23 14:40:14 -04:00
Huon Wilson
096f6f56a8 Use @str instead of @~str in libsyntax and librustc. Fixes #5048.
This almost removes the StringRef wrapper, since all strings are
Equiv-alent now. Removes a lot of `/* bad */ copy *`'s, and converts
several things to be &'static str (the lint table and the intrinsics
table).

There are many instances of .to_managed(), unfortunately.
2013-06-13 10:20:52 +10: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
Erick Tryzelaar
23808efd11 syntax: move callee_id into the expr_ variants 2013-06-01 15:31:56 -07:00
Niko Matsakis
7a1a40890d Remove copy bindings from patterns. 2013-05-30 15:20:36 -04:00
Patrick Walton
4e3d4b36dc libsyntax: Stop parsing mutable fields 2013-05-29 19:04:51 -07:00
Patrick Walton
3a66d732bb libsyntax: Fix more merge fallout. 2013-05-22 21:57:11 -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
Huon Wilson
a59bec43e3 syntax/ext: convert all AstBuilder methods to a uniform syntax. 2013-05-22 00:30:52 +10:00
Huon Wilson
6e50515530 syntax/ext: migrate build.rs functions to AstBuilder methods. 2013-05-22 00:15:36 +10:00
Huon Wilson
8c15a0ec4c syntax/ext: collect the ast building traits into a single trait. 2013-05-22 00:04:10 +10:00
Huon Wilson
4045da9f4f syntax/ext: modernise ext_ctxt to be CamelCase and use new. 2013-05-22 00:04:10 +10: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
Alex Crichton
92d39fe4d5 syntax: Remove #[allow(vecs_implicitly_copyable)] 2013-05-14 12:24:43 -04:00
Patrick Walton
5d3559e645 librustc: Make self and static into keywords 2013-05-12 16:35:18 -07:00
Björn Steinbrink
1393c3a3f4 Use a specialized string interner to reduce the need for owned strings
&str can be turned into @~str on demand, using to_owned(), so for
strings, we can create a specialized interner that accepts &str for
intern() and find() but stores and returns @~str.
2013-05-09 14:40:19 +02:00
Patrick Walton
72868450df libcore: Fix more merge fallout. 2013-05-08 17:04:03 -07:00
Huon Wilson
b20eb970e1 libsyntax: extend generic deriving code to handle almost all possible traits.
This adds support for static methods, and arguments of most types, traits with
type parameters, methods with type parameters (and lifetimes for both), as well
as making the code more robust to support deriving on types with lifetimes (i.e.
'self).
2013-05-07 01:33:54 +10: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
Daniel Micay
f792baba42 only use #[no_core] in libcore 2013-04-27 21:34:24 -04:00
Marvin Löbel
e1be9ae224 Made fail! and assert! accept both &'static str and ~str, as well as a fmt! like format list.
Unwinding through macros now happens as a call to the trait function `FailWithCause::fail_with()`, which consumes self, allowing to use a more generic failure object in the future.
2013-04-25 17:32:25 +02:00
Alex Crichton
3c7aea3a6a syntax: de-mode and prepare for de-modeing rustc 2013-04-19 23:21:52 -04:00
Erick Tryzelaar
441df26f5a syntax: add support for #[deriving(Decodable)] 2013-04-10 16:32:09 -07:00
Erick Tryzelaar
5841564bf9 syntax: add support for #[deriving(Encodable)] 2013-04-10 16:32:09 -07:00
John Clements
48e7bda826 path -> Path 2013-04-10 09:15:04 -07:00
Niko Matsakis
d28f734412 Refactor so that references to traits are not represented using a type with a
bare function store (which is not in fact a kind of value) but rather
ty::TraitRef.  Removes many uses of fail!() and other telltale signs of
type-semantic mismatch.

cc #4183 (not a fix, but related)
2013-04-05 05:36:02 -04:00
Erick Tryzelaar
83e831bc22 syntax: Remove deprecated expr_vstore_fixed 2013-03-27 07:04:16 -07:00
Niko Matsakis
e11d13f3de Rip out old code that still structured method calls as a
expr_call(expr_field(...)) rather than an expr_method_call.
There is probably more such code in trans that should be removed.
2013-03-26 15:16:58 -04:00
Alex Crichton
1a0d212dd9 Build up the result of fmt! in a buffer instead of a vector 2013-03-22 11:49:45 -04:00
Patrick Walton
b1c699815d librustc: Don't accept as Trait anymore; fix all occurrences of it. 2013-03-13 20:07:09 -07:00
Patrick Walton
954ae9c975 libsyntax: Remove struct literal expressions from the compiler 2013-03-07 22:32:55 -08:00
Alex Crichton
dfb5c10dea Remove unused imports throughout src/ 2013-03-04 12:27:01 -05:00
Erick Tryzelaar
3953bdd812 Merge remote-tracking branch 'remotes/origin/incoming' into incoming 2013-02-28 07:25:31 -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
5271464cc0 libsyntax: remove vecs_implicitly_copyable from the syntax extensions 2013-02-26 20:48:12 -08:00
Luqman Aden
b02f5c2090 Get rid of structural records in libsyntax and the last bit in librustc. 2013-02-21 00:19:15 -08:00