Commit Graph

925 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
Felix S. Klock II 3b158b3e42 Silence various warnings in bootstrap build. 2013-07-18 09:35:12 +02:00
Patrick Walton 66a9b7d5bd libsyntax: Remove some multi-gigabyte clones that were preventing bootstrapping on Windows. 2013-07-17 14:57:56 -07:00
Patrick Walton d57e8f8419 librustc: Change repeated vector expressions to use implicit copyability. 2013-07-17 14:57:54 -07:00
Patrick Walton e20549ff19 librustc: Remove all uses of the Copy bound. 2013-07-17 14:57:53 -07: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
Alex Crichton 9fd2ac7428 Make TLS keys actually take up space
If the TLS key is 0-sized, then the linux linker is apparently smart enough to
put everything at the same pointer. OSX on the other hand, will reserve some
space for all of them. To get around this, the TLS key now actuall consumes
space to ensure that it gets a unique pointer
2013-07-14 10:15:07 -07:00
Alex Crichton e3211fa1f1 Purge the last remnants of the old TLS api
Closes #3273
2013-07-14 09:29:12 -07:00
bors 07183ea6e7 auto merge of #7677 : alexcrichton/rust/tls-gc, r=pcwalton
cc #6004 and #3273

This is a rewrite of TLS to get towards not requiring `@` when using task local storage. Most of the rewrite is straightforward, although there are two caveats:

1. Changing `local_set` to not require `@` is blocked on #7673
2. The code in `local_pop` is some of the most unsafe code I've written. A second set of eyes should definitely scrutinize it...

The public-facing interface currently hasn't changed, although it will have to change because `local_data::get` cannot return `Option<T>`, nor can it return `Option<&T>` (the lifetime isn't known). This will have to be changed to be given a closure which yield `&T` (or as an Option). I didn't do this part of the api rewrite in this pull request as I figured that it could wait until when `@` is fully removed.

This also doesn't deal with the issue of using something other than functions as keys, but I'm looking into using static slices (as mentioned in the issues).
2013-07-11 19:52:37 -07:00
Alex Crichton f9bf69d253 Remove all external requirements of @ from TLS
Closes #6004
2013-07-11 00:37:13 -07:00
Brendan Cully 202fcb29bd unnecessarily mutable variables 2013-07-10 22:12:30 -07:00
Alex Crichton cb5b9a477c Rename local_data methods/types for less keystrokes 2013-07-09 17:39:49 -07:00
John Barker 56d1987575 Don't use static default method
- also removed redundant assignment to is_mutbl
 - updated copyright
2013-07-09 10:21:25 -04:00
John Barker eaaf3f67ab Always eat up mut when parsing general args, fixes #7483 2013-07-09 09:03:16 -04:00
Niko Matsakis 0c6d02f391 Correct merge errors 2013-07-08 13:55:11 -04:00
Daniel Micay 641aec7407 remove some method resolve workarounds 2013-07-07 19:51:13 -04:00
bors 0f2515583d auto merge of #7615 : Aatch/rust/syntax-deshare, r=graydon
In an ideal world, the AST would be completely sendable, this gets us a step closer.

It removes the local heap allocations for `view_item`, `Path`, `Lifetime` `trait_ref` `OptVec<TyParamBounds>` and `Ty`. There are also a few other smaller changes I made as things went along.
2013-07-07 05:22:56 -07:00
James Miller 1fd735d3c1 Fix broken tests 2013-07-07 22:51:10 +12: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
bors d91ac39cd5 auto merge of #7585 : Blei/rust/fix-circular-modules, r=huonw
Fixes #7276
2013-07-07 03:40:59 -07:00
Seo Sanghyeon 30fca57f17 Change spans for sugary call expressions 2013-07-05 13:03:25 +09:00
Philipp Brüschweiler 3c5cfdf2e7 libsyntax: fix infinite loop when recursively including modules
Fixes #7276
2013-07-04 19:51:11 +02:00
Alex Crichton 8fe6fc11de Change char::escape_{default,unicode} to take callbacks instead of allocating
strings
2013-06-30 09:19:02 -07:00
bors 6fcd8bf567 auto merge of #7468 : cmr/rust/great_renaming, r=pcwalton 2013-06-30 01:19:38 -07:00
Alex Crichton 3bad7129eb Remove mutability from unique boxes in the AST 2013-06-29 08:36:25 -07:00
Corey Richardson 71b1c6ab60 Warning cleanup 2013-06-29 11:20:04 -04:00
Ben Blum 75b80bad63 Use more deriving(IterBytes) in libsyntax. 2013-06-29 03:58:50 -04:00
Ben Blum 5784c0912f Change taskgroup key type to fn:Copy in prep for noncopyable stack closures. 2013-06-29 03:58:50 -04:00
Patrick Walton bb830558d1 librustc: Fix merge fallout and test cases. 2013-06-28 10:44:17 -04:00
Patrick Walton 89eb995195 librustc: Fix merge fallout. 2013-06-28 10:44:16 -04:00
Patrick Walton 03ab6351cc librustc: Rewrite reachability and forbid duplicate methods in type implementations.
This should allow fewer symbols to be exported.
2013-06-28 10:44:16 -04:00
Patrick Walton a1531ed946 librustc: Remove the broken overloaded assign-ops from the language.
They evaluated the receiver twice. They should be added back with
`AddAssign`, `SubAssign`, etc., traits.
2013-06-28 10:44:16 -04:00
Patrick Walton 3fcd4dca30 libsyntax: Remove "copy" pattern bindings from the language 2013-06-28 10:44:16 -04:00
Patrick Walton 90ad444287 libsyntax: Fix merge fallout 2013-06-28 10:44:15 -04:00
Patrick Walton f9b54541ee librustc: Disallow "mut" from distributing over bindings.
This is the backwards-incompatible part of per-binding-site "mut".
2013-06-28 10:44:15 -04:00
Patrick Walton 1eec3bba13 librustc: Rename Const to Freeze 2013-06-28 10:44:15 -04:00
Ben Blum 7b968783d7 Infer default static/Owned bounds for unbounded heap fns/traits (#7264) 2013-06-26 18:14:43 -04:00
bors 22408d9ad5 auto merge of #7269 : luqmana/rust/drop, r=thestinger
Finally rename finalize to drop.
Closes #4332.
2013-06-25 20:29:06 -07:00
Luqman Aden ca2966c6d0 Change finalize -> drop. 2013-06-25 21:14:39 -04:00
Corey Richardson 0d471d310d great renaming propagation: syntax 2013-06-25 16:15:07 -04:00
bors 7aee5da08d auto merge of #7254 : Blei/rust/intrinsic-overhaul, r=cmr
This sets the `get_tydesc()` return type correctly and removes the intrinsic module. See #3730, #3475.

Update: this now also removes the unused shape fields in tydescs.
2013-06-25 04:38:06 -07:00
bors b11346bb5d auto merge of #7291 : alexcrichton/rust/static-mut, r=huonw
This adds both `static mut` items and `static mut` foreign items. This involved changing far less code than I thought it was going to, but the tests seem to pass and the variables seem functional.

I'm more than willing to write more tests, so suggestions are welcome!

Closes #553
2013-06-25 01:59:05 -07:00