Commit Graph

321 Commits

Author SHA1 Message Date
bors
faf4c939fb auto merge of #10670 : eddyb/rust/node-u32, r=alexcrichton
### Rationale
There is no reason to support more than 2³² nodes or names at this moment, as compiling something that big (even without considering the quadratic space usage of some analysis passes) would take at least **64GB**.
Meanwhile, some can't (or barely can) compile rustc because it requires almost **1.5GB**.

### Potential problems
Can someone confirm this doesn't affect metadata (de)serialization? I can't tell myself, I know nothing about it.

### Results
Some structures have a size reduction of 25% to 50%: [before](https://gist.github.com/luqmana/3a82a51fa9c86d9191fa) - [after](https://gist.github.com/eddyb/5a75f8973d3d8018afd3).
Sadly, there isn't a massive change in the memory used for compiling stage2 librustc (it doesn't go over **1.4GB** as [before](http://huonw.github.io/isrustfastyet/mem/), but I can barely see the difference).
However, my own testcase (previously peaking at **1.6GB** in typeck) shows a reduction of **200**-**400MB**.
2013-11-26 22:07:44 -08:00
Eduard Burtescu
7ed27b5531 Shink NodeId, CrateNum, Name and Mrk down to 32 bits on x64. 2013-11-27 07:02:25 +02:00
Patrick Walton
efc512362b libsyntax: Remove all non-proc do syntax. 2013-11-26 08:24:18 -08:00
Patrick Walton
9e610573ba librustc: Remove remaining uses of &fn() in favor of ||. 2013-11-26 08:20:58 -08:00
Seo Sanghyeon
9028330f39 Take &Pat in visit_pat 2013-11-26 03:22:21 +09:00
Seo Sanghyeon
eb5cbfebfd Take &Pat 2013-11-25 23:37:03 +09:00
Patrick Walton
492677ec1e libsyntax: Change all uses of &fn to ||. 2013-11-19 12:40:19 -08:00
Brian Anderson
85f107d8cb Use '..' as slice wildcard in vectors 2013-11-18 16:19:48 -08:00
Niko Matsakis
1f4faaee40 Generalize AST and ty::Generics to accept multiple lifetimes. 2013-11-08 19:42:46 -05:00
Luqman Aden
12308db3d2 libsyntax/librustc: Allow mut qualifier in patterns. 2013-10-25 01:21:07 -04:00
Alex Crichton
61ed2cfb55 Remove even more of std::io
Big fish fried here:

    extra::json
    most of the compiler
    extra::io_util removed
    extra::fileinput removed

Fish left to fry

    extra::ebml
2013-10-24 14:21:57 -07:00
Luqman Aden
5754848f8c libsyntax/librustc: Allow specifying mut on by-value self. 2013-10-22 21:21:21 -04:00
Alex Crichton
daf5f5a4d1 Drop the '2' suffix from logging macros
Who doesn't like a massive renaming?
2013-10-22 08:09:56 -07:00
Daniel Micay
6a90e80b62 option: rewrite the API to use composition 2013-10-09 09:17:29 -04:00
Alex Crichton
de7d143176 Fix existing privacy/visibility violations
This commit fixes all of the fallout of the previous commit which is an attempt
to refine privacy. There were a few unfortunate leaks which now must be plugged,
and the most horrible one is the current `shouldnt_be_public` module now inside
`std::rt`. I think that this either needs a slight reorganization of the
runtime, or otherwise it needs to just wait for the external users of these
modules to get replaced with their `rt` implementations.

Other fixes involve making things pub which should be pub, and otherwise
updating error messages that now reference privacy instead of referencing an
"unresolved name" (yay!).
2013-10-07 13:00:52 -07:00
Alex Crichton
439e2770be Extract privacy checking from name resolution
This commit is the culmination of my recent effort to refine Rust's notion of
privacy and visibility among crates. The major goals of this commit were to
remove privacy checking from resolve for the sake of sane error messages, and to
attempt a much more rigid and well-tested implementation of visibility
throughout rust. The implemented rules for name visibility are:

1. Everything pub from the root namespace is visible to anyone
2. You may access any private item of your ancestors.

"Accessing a private item" depends on what the item is, so for a function this
means that you can call it, but for a module it means that you can look inside
of it. Once you look inside a private module, any accessed item must be "pub
from the root" where the new root is the private module that you looked into.
These rules required some more analysis results to get propagated from trans to
privacy in the form of a few hash tables.

I added a new test in which my goal was to showcase all of the privacy nuances
of the language, and I hope to place any new bugs into this file to prevent
regressions.

Overall, I was unable to completely remove the notion of privacy from resolve.
One use of privacy is for dealing with glob imports. Essentially a glob import
can only import *public* items from the destination, and because this must be
done at namespace resolution time, resolve must maintain the notion of "what
items are public in a module". There are some sad approximations of privacy, but
I unfortunately can't see clear methods to extract them outside.

The other use case of privacy in resolve now is one that must stick around
regardless of glob imports. When dealing with privacy, checking a private path
needs to know "what the last private thing was" when looking at a path. Resolve
is the only compiler pass which knows the answer to this question, so it
maintains the answer on a per-path resolution basis (works similarly to the
def_map generated).

Closes #8215
2013-10-07 13:00:52 -07:00
Alex Crichton
c0388cd691 Rewrite lint passes with less visitor cruft
This purges about 500 lines of visitor cruft from lint passes. All lints are
handled in a much more sane way at this point. The other huge bonus of this
commit is that there are no more @-boxes in the lint passes, fixing the 500MB
memory regression seen when the lint passes were refactored.

Closes #8589
2013-10-03 10:25:14 -07:00
bors
d00c9269dc auto merge of #9665 : alexcrichton/rust/snapshot, r=brson
Uses the new snapshots to kill the old `loop` and introduce the new `continue`.
2013-10-02 02:31:29 -07:00
Alex Crichton
4f67dcb24a Migrate users of 'loop' to 'continue'
Closes #9467
2013-10-01 15:53:13 -07:00
bors
fe4e7478c5 auto merge of #9560 : pcwalton/rust/xc-tuple-structs, r=pcwalton
r? @thestinger
2013-10-01 15:06:25 -07:00
Patrick Walton
76d92c5472 librustc: Inline cross-crate tuple struct constructors 2013-10-01 14:24:34 -07:00
Daniel Micay
c9d4ad07c4 remove the float type
It is simply defined as `f64` across every platform right now.

A use case hasn't been presented for a `float` type defined as the
highest precision floating point type implemented in hardware on the
platform. Performance-wise, using the smallest precision correct for the
use case greatly saves on cache space and allows for fitting more
numbers into SSE/AVX registers.

If there was a use case, this could be implemented as simply a type
alias or a struct thanks to `#[cfg(...)]`.

Closes #6592

The mailing list thread, for reference:

https://mail.mozilla.org/pipermail/rust-dev/2013-July/004632.html
2013-10-01 14:54:10 -04:00
Alex Crichton
af3b132285 syntax: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
John Clements
0322832763 renumbered due to bug shuffling 2013-09-24 14:48:04 -07:00
Patrick Walton
6ecbd75843 librustc: Change the ID visitor to use traits instead of garbage-collected functions. 2013-09-23 18:23:20 -07:00
Patrick Walton
3e5de06135 librustc: Change fold to use traits instead of @fn. 2013-09-23 18:23:17 -07:00
Alex Crichton
817576ee70 Register new snapshots 2013-09-18 11:07:22 -07:00
bors
b05dccacae auto merge of #9187 : lkuper/rust/no-simplevisitor, r=catamorphism
We don't seem to be using `SimpleVisitor` anywhere in rustc.  Is there any reason to keep it around?

r? anyone
2013-09-16 00:15:52 -07:00
Lindsey Kuper
653ffa845d Kill off method impls made redundant by default methods. 2013-09-14 19:38:22 -04:00
Lindsey Kuper
940a86b760 Get rid of unused SimpleVisitor stuff. 2013-09-14 02:00:04 -04:00
SiegeLord
8c5402fd36 Properly encode/decode structural variants. 2013-09-11 14:49:09 -04:00
bors
753d8c226c auto merge of #9088 : nikomatsakis/rust/issue-6304-AST-tree-not-DAG, r=catamorphism
Ensures that each AST node has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two
representative tests.

Fixes #7971
Fixes #6304
Fixes #8367
Fixes #8754
Fixes #8852
Fixes #2543
Fixes #7654
2013-09-10 03:10:59 -07:00
Niko Matsakis
a5ad4c3794 Delay assignment of node ids until after expansion. Ensures that each AST node
has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two
representative tests.

Fixes #7971
Fixes #6304
Fixes #8367
Fixes #8754
Fixes #8852
Fixes #2543
Fixes #7654
2013-09-10 05:45:12 -04:00
Tim Chevalier
02a0fb94ee rustpkg: Use workcache
rustpkg now uses the workcache library to avoid recompilation.
Hooray!
2013-09-08 20:05:12 -07:00
John Clements
fe1d21caec add display_sctable fn to ast_util 2013-09-06 13:35:13 -07:00
John Clements
fddc815ada WIP: adding mark-cancelling for macro_rules 2013-09-06 13:35:13 -07:00
John Clements
7b548e7180 expose mtwt_marksof for testing 2013-09-06 13:35:12 -07:00
John Clements
60562ac9f8 whitespace, reindentation, and comments only 2013-09-06 13:35:12 -07:00
John Clements
ec0a64def5 memoization for resolve 2013-09-06 13:35:12 -07:00
John Clements
0954e66442 uncomment mtwt_resolve calls 2013-09-06 13:35:11 -07:00
John Clements
9ab2cfdae6 added utility function 2013-09-06 13:35:11 -07:00
John Clements
98a6cbdba3 comments only 2013-09-06 13:35:08 -07:00
John Clements
fa6c981606 add hygiene support fns, move them around.
also adds test cases
2013-09-06 13:35:06 -07:00
John Clements
e1734f6d38 rename resolve to mtwt_resolve 2013-09-06 13:35:06 -07:00
Daniel Micay
62a3434529 stop treating char as an integer type
Closes #7609
2013-09-04 08:07:56 -04:00
Marvin Löbel
7419085337 Modernized a few more types in syntax::ast 2013-09-03 14:45:06 +02:00
Marvin Löbel
857f867320 Renamed syntax::ast::ident -> Ident 2013-09-02 02:51:21 +02:00
Marvin Löbel
539f37925c Modernized a few type names in rustc and syntax 2013-09-01 14:43:26 +02:00
Patrick Walton
3b6314c39b librustc: Add support for type parameters in the middle of paths.
For example, `foo::<T>::bar::<U>`.

This doesn't enforce that the type parameters are in the right
positions, however.
2013-08-27 18:46:51 -07:00
Niko Matsakis
8c09865b66 Remove remnants of implicit self 2013-08-27 16:49:06 -04:00