about summary refs log tree commit diff
path: root/src/libsyntax/attr.rs
AgeCommit message (Collapse)AuthorLines
2014-05-22auto merge of #14348 : alexcrichton/rust/doc.rust-lang.org, r=huonwbors-1/+1
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-1/+2
2014-05-21doc: Fix some broken linksAlex Crichton-1/+1
2014-05-20Change std inject attributes to outer attributesKevin Ballard-2/+16
The #[phase(syntax,link)] attribute on `extern crate std` needs to be an outer attribute so it can pretty-print properly. Also add `#![no_std]` and `#[feature(phase)]` so compiling the pretty-printed source will work.
2014-05-08libsyntax: Remove uses of `~str` from libsyntax, and fix falloutPatrick Walton-1/+1
2014-04-28Deprecate the rev_iter pattern in all places where a DoubleEndedIterator is ↵Jonathan S-2/+3
provided (everywhere but treemap) This commit deprecates rev_iter, mut_rev_iter, move_rev_iter everywhere (except treemap) and also deprecates related functions like rsplit, rev_components, and rev_str_components. In every case, these functions can be replaced with the non-reversed form followed by a call to .rev(). To make this more concrete, a translation table for all functional changes necessary follows: * container.rev_iter() -> container.iter().rev() * container.mut_rev_iter() -> container.mut_iter().rev() * container.move_rev_iter() -> container.move_iter().rev() * sliceorstr.rsplit(sep) -> sliceorstr.split(sep).rev() * path.rev_components() -> path.components().rev() * path.rev_str_components() -> path.str_components().rev() In terms of the type system, this change also deprecates any specialized reversed iterator types (except in treemap), opting instead to use Rev directly if any type annotations are needed. However, since methods directly returning reversed iterators are now discouraged, the need for such annotations should be small. However, in those cases, the general pattern for conversion is to take whatever follows Rev in the original reversed name and surround it with Rev<>: * RevComponents<'a> -> Rev<Components<'a>> * RevStrComponents<'a> -> Rev<StrComponents<'a>> * RevItems<'a, T> -> Rev<Items<'a, T>> * etc. The reasoning behind this change is that it makes the standard API much simpler without reducing readability, performance, or power. The presence of functions such as rev_iter adds more boilerplate code to libraries (all of which simply call .iter().rev()), clutters up the documentation, and only helps code by saving two characters. Additionally, the numerous type synonyms that were used to make the type signatures look nice like RevItems add even more boilerplate and clutter up the docs even more. With this change, all that cruft goes away. [breaking-change]
2014-03-31syntax: Switch field privacy as necessaryAlex Crichton-2/+2
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-17De-@ codemap and diagnostic.Eduard Burtescu-3/+3
2014-03-14rustc: Fix cfg(not(a, b)) to be not(a && b)Alex Crichton-2/+2
Previously, the cfg attribute `cfg(not(a, b))` was translated to `(!a && !b)`, but this isn't very useful because that can already be expressed as `cfg(not(a), not(b))`. This commit changes the translation to `!(a && b)` which is more symmetrical of the rest of the `cfg` attribute. Put another way, I would expect `cfg(clause)` to be the opposite of `cfg(not(clause))`, but this is not currently the case with multiple element clauses.
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-4/+6
2014-03-01libsyntax: Mechanically change `~[T]` to `Vec<T>`Patrick Walton-5/+5
2014-02-28std: Change assert_eq!() to use {} instead of {:?}Alex Crichton-2/+2
Formatting via reflection has been a little questionable for some time now, and it's a little unfortunate that one of the standard macros will silently use reflection when you weren't expecting it. This adds small bits of code bloat to libraries, as well as not always being necessary. In light of this information, this commit switches assert_eq!() to using {} in the error message instead of {:?}. In updating existing code, there were a few error cases that I encountered: * It's impossible to define Show for [T, ..N]. I think DST will alleviate this because we can define Show for [T]. * A few types here and there just needed a #[deriving(Show)] * Type parameters needed a Show bound, I often moved this to `assert!(a == b)` * `Path` doesn't implement `Show`, so assert_eq!() cannot be used on two paths. I don't think this is much of a regression though because {:?} on paths looks awful (it's a byte array). Concretely speaking, this shaved 10K off a 656K binary. Not a lot, but sometime significant for smaller binaries.
2014-02-23Remove all ToStr impls, add Show implsAlex Crichton-1/+1
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-23Move std::{trie, hashmap} to libcollectionsAlex Crichton-1/+1
These two containers are indeed collections, so their place is in libcollections, not in libstd. There will always be a hash map as part of the standard distribution of Rust, but by moving it out of the standard library it makes libstd that much more portable to more platforms and environments. This conveniently also removes the stuttering of 'std::hashmap::HashMap', although 'collections::HashMap' is only one character shorter.
2014-02-02libsyntax: De-`@str` literal strings in the ASTPatrick Walton-19/+26
2014-02-02libsyntax: Introduce an `InternedString` type to reduce `@str` in thePatrick Walton-36/+47
compiler and use it for attributes
2014-01-09libsyntax: Renamed types, traits and enum variants to CamelCase.Eduard Burtescu-20/+20
2014-01-03librustc: De-`@mut` the span handlerPatrick Walton-3/+2
2014-01-01syntax::diagnostic: Remove unnecessary traitsklutzy-3/+3
This removes trait `handler` and `span_handler`, and renames `HandlerT` to `Handler`, `CodemapT` to `SpanHandler`.
2013-12-29Rename PkgId to CrateIdLuis de Bethencourt-1/+1
2013-12-29Rename pkgid variablesLuis de Bethencourt-2/+2
2013-12-22std::vec: make the sorting closure use `Ordering` rather than just beingHuon Wilson-5/+1
(implicitly) less_eq.
2013-12-21std::vec: add a sugary .sort() method for plain Ord sorting.Huon Wilson-0/+4
This moves the custom sorting to `.sort_by`.
2013-12-20extra: remove sort in favour of the std method.Huon Wilson-3/+1
Fixes #9676.
2013-12-19Rename pkgid to crate_idCorey Richardson-1/+1
Closes #11035
2013-12-10Make crate hash stable and externally computable.Jack Moffitt-0/+8
This replaces the link meta attributes with a pkgid attribute and uses a hash of this as the crate hash. This makes the crate hash computable by things other than the Rust compiler. It also switches the hash function ot SHA1 since that is much more likely to be available in shell, Python, etc than SipHash. Fixes #10188, #8523.
2013-11-28Register new snapshotsAlex Crichton-2/+2
2013-11-26libsyntax: Remove all non-`proc` `do` syntax.Patrick Walton-15/+13
2013-10-29Assorted cleanups suggested by reviewers.Jed Davis-2/+1
2013-10-29Lint non-FFI-safe enums.Jed Davis-0/+19
2013-10-29Add parser for `#[repr(...)]`; nothing uses it yet.Jed Davis-1/+95
Also export enum attrs into metadata, and add a convenient interface for obtaining the repr hint from either a local or remote definition.
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-11/+11
Who doesn't like a massive renaming?
2013-10-09option: rewrite the API to use compositionDaniel Micay-1/+1
2013-10-08add new enum ast::StrStyle as field to ast::lit_strBenjamin Herr-3/+3
For the benefit of the pretty printer we want to keep track of how string literals in the ast were originally represented in the source code. This commit changes parser functions so they don't extract strings from the token stream without at least also returning what style of string literal it was. This is stored in the resulting ast node for string literals, obviously, for the package id in `extern mod = r"package id"` view items, for the inline asm in `asm!()` invocations. For `asm!()`'s other arguments or for `extern "Rust" fn()` items, I just the style of string, because it seemed disproportionally cumbersome to thread that information through the string processing that happens with those string literals, given the limited advantage raw string literals would provide in these positions. The other syntax extensions don't seem to store passed string literals in the ast, so they also discard the style of strings they parse.
2013-10-01Migrate users of 'loop' to 'continue'Alex Crichton-1/+1
Closes #9467
2013-09-30syntax: Remove usage of fmt!Alex Crichton-12/+12
2013-09-26rustdoc: Render stability attributesAlex Crichton-1/+1
Closes #8965
2013-09-12std: Rename {Option,Result}::chain{,_err}* to {and_then,or_else}Erick Tryzelaar-2/+2
2013-09-04Implement support for indicating the stability of items.Huon Wilson-0/+38
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.
2013-09-02libsyntax: Remove obsolete fixme.Luqman Aden-1/+0
2013-09-01Modernized a few type names in rustc and syntaxMarvin Löbel-2/+2
2013-08-12Forbid pub/priv where it has no effectAlex Crichton-3/+3
Closes #5495
2013-08-11libsyntax: Update from `@Object` to `@mut Object` as requiredNiko Matsakis-1/+1
2013-08-10std: Transform.find_ -> .findErick Tryzelaar-2/+2
2013-08-10std: Rename Iterator.transform -> .mapErick Tryzelaar-2/+2
cc #5898
2013-08-10Mass rename of .consume{,_iter}() to .move_iter()Erick Tryzelaar-1/+1
cc #7887
2013-08-07core: option.map_consume -> option.map_moveErick Tryzelaar-1/+1
2013-08-05Updated std::Option, std::Either and std::ResultMarvin Löbel-1/+1
- Made naming schemes consistent between Option, Result and Either - Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None) - Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead