summary refs log tree commit diff
path: root/src/libsyntax/ast_map.rs
AgeCommit message (Collapse)AuthorLines
2014-03-28Rename Pod into CopyFlavio Percoco-1/+1
Summary: So far, we've used the term POD "Plain Old Data" to refer to types that can be safely copied. However, this term is not consistent with the other built-in bounds that use verbs instead. This patch renames the Pod kind into Copy. RFC: 0003-opt-in-builtin-traits Test Plan: make check Reviewers: cmr Differential Revision: http://phabricator.octayn.net/D3
2014-03-22syntax: Fix fallout of removing get()Alex Crichton-7/+6
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-1/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-1/+1
Closes #12771
2014-03-20rename std::vec -> std::sliceDaniel Micay-3/+3
Closes #12702
2014-03-15log: Introduce liblog, the old std::loggingAlex Crichton-2/+1
This commit moves all logging out of the standard library into an external crate. This crate is the new crate which is responsible for all logging macros and logging implementation. A few reasons for this change are: * The crate map has always been a bit of a code smell among rust programs. It has difficulty being loaded on almost all platforms, and it's used almost exclusively for logging and only logging. Removing the crate map is one of the end goals of this movement. * The compiler has a fair bit of special support for logging. It has the __log_level() expression as well as generating a global word per module specifying the log level. This is unfairly favoring the built-in logging system, and is much better done purely in libraries instead of the compiler itself. * Initialization of logging is much easier to do if there is no reliance on a magical crate map being available to set module log levels. * If the logging library can be written outside of the standard library, there's no reason that it shouldn't be. It's likely that we're not going to build the highest quality logging library of all time, so third-party libraries should be able to provide just as high-quality logging systems as the default one provided in the rust distribution. With a migration such as this, the change does not come for free. There are some subtle changes in the behavior of liblog vs the previous logging macros: * The core change of this migration is that there is no longer a physical log-level per module. This concept is still emulated (it is quite useful), but there is now only a global log level, not a local one. This global log level is a reflection of the maximum of all log levels specified. The previously generated logging code looked like: if specified_level <= __module_log_level() { println!(...) } The newly generated code looks like: if specified_level <= ::log::LOG_LEVEL { if ::log::module_enabled(module_path!()) { println!(...) } } Notably, the first layer of checking is still intended to be "super fast" in that it's just a load of a global word and a compare. The second layer of checking is executed to determine if the current module does indeed have logging turned on. This means that if any module has a debug log level turned on, all modules with debug log levels get a little bit slower (they all do more expensive dynamic checks to determine if they're turned on or not). Semantically, this migration brings no change in this respect, but runtime-wise, this will have a perf impact on some code. * A `RUST_LOG=::help` directive will no longer print out a list of all modules that can be logged. This is because the crate map will no longer specify the log levels of all modules, so the list of modules is not known. Additionally, warnings can no longer be provided if a malformed logging directive was supplied. The new "hello world" for logging looks like: #[phase(syntax, link)] extern crate log; fn main() { debug!("Hello, world!"); }
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-1/+6
2014-03-01libsyntax: Mechanically change `~[T]` to `Vec<T>`Patrick Walton-4/+4
2014-02-26Replace callee_id with information stored in method_map.Eduard Burtescu-13/+0
2014-02-23Remove all ToStr impls, add Show implsAlex Crichton-3/+5
This commit changes the ToStr trait to: impl<T: fmt::Show> ToStr for T { fn to_str(&self) -> ~str { format!("{}", *self) } } The ToStr trait has been on the chopping block for quite awhile now, and this is the final nail in its coffin. The trait and the corresponding method are not being removed as part of this commit, but rather any implementations of the `ToStr` trait are being forbidden because of the generic impl. The new way to get the `to_str()` method to work is to implement `fmt::Show`. Formatting into a `&mut Writer` (as `format!` does) is much more efficient than `ToStr` when building up large strings. The `ToStr` trait forces many intermediate allocations to be made while the `fmt::Show` trait allows incremental buildup in the same heap allocated buffer. Additionally, the `fmt::Show` trait is much more extensible in terms of interoperation with other `Writer` instances and in more situations. By design the `ToStr` trait requires at least one allocation whereas the `fmt::Show` trait does not require any allocations. Closes #8242 Closes #9806
2014-02-14Refactored ast_map and friends, mainly to have Paths without storing them.Eduard Burtescu-336/+442
2014-02-13Replace `crate` usage with `krate`Flavio Percoco-2/+2
This patch replaces all `crate` usage with `krate` before introducing the new keyword. This ensures that after introducing the keyword, there won't be any compilation errors. krate might not be the most expressive substitution for crate but it's a very close abbreviation for it. `module` was already used in several places already.
2014-02-07moved collections from libextra into libcollectionsHeroesGrave-1/+1
2014-02-02libsyntax: Remove `@str` from the internerPatrick Walton-8/+18
2014-01-27Demote self to an (almost) regular argument and remove the env param.Eduard Burtescu-21/+6
Fixes #10667 and closes #10259.
2014-01-26Removed all instances of XXX in preparation for relaxing of FIXME ruleSalem Talha-1/+1
2014-01-21[std::vec] Rename .pop_opt() to .pop(), drop the old .pop() behaviorSimon Sapin-1/+1
2014-01-21[std::vec] Rename .last_opt() to .last(), drop the old .last() behaviorSimon Sapin-2/+2
2014-01-19syntax: convert ast_map to use a SmallIntMap.Huon Wilson-37/+79
NodeIds are sequential integers starting at zero, so we can achieve some memory savings by just storing the items all in a line in a vector. The occupancy for typical crates seems to be 75-80%, so we're already more efficient than a HashMap (maximum occupancy 75%), not even counting the extra book-keeping that HashMap does.
2014-01-13librustc: Remove `@` pointer patterns from the languagePatrick Walton-2/+6
2014-01-09libsyntax: Renamed types, traits and enum variants to CamelCase.Eduard Burtescu-165/+158
2014-01-06Disowned the Visitor.Eduard Burtescu-215/+150
2014-01-03librustc: Remove `@mut` support from the typechecker and borrow checkerPatrick Walton-1/+1
2014-01-03libsyntax: De-`@mut` (and de-`@`) the AST mapping contextPatrick Walton-4/+4
2014-01-03libsyntax: De-`@mut` the path in the AST mapping contextPatrick Walton-12/+25
2014-01-03librustc: De-`@mut` the AST mapPatrick Walton-33/+61
2014-01-03librustc: De-`@mut` the span handlerPatrick Walton-3/+3
2014-01-01auto merge of #11255 : klutzy/rust/small-cleanup, r=pcwaltonbors-4/+4
This patchset removes some `@`s and unnecessary traits, and replaces a function (`dummy_sp()`) returning constant value by static variable.
2014-01-02syntax: expand impl_pretty_name to handle more cases.Huon Wilson-16/+61
The resulting symbol names aren't very pretty at all: trait Trait { fn method(&self); } impl<'a> Trait for ~[(&'a int, fn())] { fn method(&self) {} } gives Trait$$UP$$VEC$$TUP_2$$BP$int$$FN$$::method::...hash...::v0.0 However, at least it contain some reference to the Self type, unlike `Trait$__extensions__::method:...`, which is what the symbol name used to be for anything other than `impl Trait for foo::bar::Baz` (which became, and still becomes, `Trait$Baz::method`).
2014-01-01syntax::diagnostic: Remove unnecessary traitsklutzy-4/+4
This removes trait `handler` and `span_handler`, and renames `HandlerT` to `Handler`, `CodemapT` to `SpanHandler`.
2013-12-19Generalize item_span into node_span, which works on more types.Edward Z. Yang-5/+14
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2013-12-01Box Block, fn_decl, variant and Ty in the AST, as they were inflating ↵Eduard Burtescu-15/+11
critical enum sizes.
2013-11-28Register new snapshotsAlex Crichton-13/+13
2013-11-26libsyntax: Remove all non-`proc` `do` syntax.Patrick Walton-2/+2
2013-11-26Take &Pat in visit_patSeo Sanghyeon-2/+2
2013-11-24Add comments to ast, ast_map, ty, and pat_utilKiet Tran-0/+6
2013-11-19libsyntax: Change all uses of `&fn` to `||`.Patrick Walton-4/+3
2013-11-08Generalize AST and ty::Generics to accept multiple lifetimes.Niko Matsakis-0/+12
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-2/+2
Who doesn't like a massive renaming?
2013-10-10Remove named extern blocks from the ASTAlex Crichton-7/+1
There's currently a fair amount of code which is being ignored on unnamed blocks (which are the default now), and I opted to leave it commented out for now. I intend on very soon revisiting on how we perform linking with extern crates in an effort to support static linking.
2013-10-01librustc: Inline cross-crate tuple struct constructorsPatrick Walton-2/+2
2013-09-30syntax: Remove usage of fmt!Alex Crichton-17/+17
2013-09-15debuginfo: Basic support for trait objects.Michael Woerister-0/+10
2013-09-13Refactor libsyntax Visitor impls to use default methods.Lindsey Kuper-77/+1
2013-09-06Remove even more usage of clownshoes in symbolsAlex Crichton-23/+23
This removes another large chunk of this odd 'clownshoes' identifier showing up in symbol names. These all originated from external crates because the encoded items were encoded independently of the paths calculated in ast_map. The encoding of these paths now uses the helper function in ast_map to calculate the "pretty name" for an impl block. Unfortunately there is still no information about generics in the symbol name, but it's certainly vastly better than before hash::__extensions__::write::_version::v0.8 becomes hash::Writer$SipState::write::hversion::v0.8 This also fixes bugs in which lots of methods would show up as `meth_XXX`, they now only show up as `meth` and throw some extra characters onto the version string.
2013-09-04auto merge of #8875 : alexcrichton/rust/fix-inner-static-library-bug, r=huonwbors-13/+63
These commits fix bugs related to identically named statics in functions of implementations in various situations. The commit messages have most of the information about what bugs are being fixed and why. As a bonus, while I was messing around with name mangling, I improved the backtraces we'll get in gdb by removing `__extensions__` for the trait/type being implemented and by adding the method name as well. Yay!
2013-09-04Improve name mangling for gdbAlex Crichton-29/+40
Remove __extensions__ from method symbols as well as the meth_XXX. The XXX is now used to append a few characters at the end of the name of the symbol. Closes #6602
2013-09-04debuginfo: Fixed some merge falloutMichael Woerister-1/+1
2013-09-04debuginfo: Support for variables captured in closures and closure type ↵Michael Woerister-4/+4
descriptions.
2013-09-04Implement support for indicating the stability of items.Huon Wilson-0/+20
There are 6 new compiler recognised attributes: deprecated, experimental, unstable, stable, frozen, locked (these levels are taken directly from Node's "stability index"[1]). These indicate the stability of the item to which they are attached; e.g. `#[deprecated] fn foo() { .. }` says that `foo` is deprecated. This comes with 3 lints for the first 3 levels (with matching names) that will detect the use of items marked with them (the `unstable` lint includes items with no stability attribute). The attributes can be given a short text note that will be displayed by the lint. An example: #[warn(unstable)]; // `allow` by default #[deprecated="use `bar`"] fn foo() { } #[stable] fn bar() { } fn baz() { } fn main() { foo(); // "warning: use of deprecated item: use `bar`" bar(); // all fine baz(); // "warning: use of unmarked item" } The lints currently only check the "edges" of the AST: i.e. functions, methods[2], structs and enum variants. Any stability attributes on modules, enums, traits and impls are not checked. [1]: http://nodejs.org/api/documentation.html [2]: the method check is currently incorrect and doesn't work.