about summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2014-02-02libsyntax: Make float literals not use `@str`Patrick Walton-4/+3
2014-02-02libsyntax: De-`@str` pathnamesPatrick Walton-18/+15
2014-02-02librustc: Stop using `@str` for source.Patrick Walton-14/+14
2014-02-02libsyntax: De-`@str` `to_source`Patrick Walton-41/+42
2014-02-02libsyntax: De-`@str` literal strings in the ASTPatrick Walton-79/+161
2014-02-02libsyntax: Introduce an `InternedString` type to reduce `@str` in thePatrick Walton-22/+53
compiler and use it for attributes
2014-01-31Fix minor doc typosVirgile Andreani-2/+2
2014-01-30Implement default type parameters in generics.Eduard Burtescu-5/+16
2014-01-30Remove Times traitBrendan Zabarauskas-2/+2
`Times::times` was always a second-class loop because it did not support the `break` and `continue` operations. Its playful appeal was then lost after `do` was disabled for closures. It's time to let this one go.
2014-01-27auto merge of #11826 : huonw/rust/7621-deriving-errors, r=alexcrichtonbors-9/+7
cc #7621. See the commit message. I'm not sure if we should merge this now, or wait until we can write `Clone::clone(x)` which will directly solve the above issue with perfect error messages.
2014-01-28syntax: make deriving have slightly less cryptic error messages.Huon Wilson-9/+7
This unfortunately changes an error like error: mismatched types: expected `&&NotClone` but found `&NotClone` into error: type `NotClone` does not implement any method in scope named `clone`
2014-01-27Demote self to an (almost) regular argument and remove the env param.Eduard Burtescu-8/+13
Fixes #10667 and closes #10259.
2014-01-27auto merge of #11834 : huonw/rust/deriving-spans, r=alexcrichtonbors-137/+139
I'd forgotten to update them when I changed this a while ago; it now displays error messages linked to the struct/variant field, rather than the `#[deriving(Trait)]` line, for all traits. This also adds a very large number of autogenerated tests. I can easily remove/tone down that commit if necessary.
2014-01-27syntax: improve the spans of some #[deriving] traits.Huon Wilson-137/+138
This makes error messages about (e.g.) `#[deriving(Clone)] struct Foo { x: Type }` point at `x: Type` rather than `Clone` in the header (while still referring to the `#[deriving(Clone)]` in the expansion info).
2014-01-26Removed all instances of XXX in preparation for relaxing of FIXME ruleSalem Talha-8/+8
2014-01-26syntax: Fix a missing closing code tag in docs.Huon Wilson-0/+1
2014-01-25Simplify and rename macro APISteven Fackler-139/+70
Now that procedural macros can be implemented outside of the compiler, it's more important to have a reasonable API to work with. Here are the basic changes: * Rename SyntaxExpanderTTTrait to MacroExpander, SyntaxExpanderTT to BasicMacroExpander, etc. I think "procedural macro" is the right term for these now, right? The other option would be SynExtExpander or something like that. * Stop passing the SyntaxContext to extensions. This was only ever used by macro_rules, which doesn't even use it anymore. I can't think of a context in which an external extension would need it, and removal allows the API to be significantly simpler - no more SyntaxExpanderTTItemExpanderWithoutContext wrappers to worry about.
2014-01-24Move macro_rules! macros to libstdSteven Fackler-241/+0
They all have to go into a single module at the moment unfortunately. Ideally, the logging macros would live in std::logging, condition! would live in std::condition, format! in std::fmt, etc. However, this introduces cyclic dependencies between those modules and the macros they use which the current expansion system can't deal with. We may be able to get around this by changing the expansion phase to a two-pass system but that's for a later PR. Closes #2247 cc #11763
2014-01-24auto merge of #11720 : sfackler/rust/macro-export-source, r=alexcrichtonbors-7/+16
The old method of serializing the AST gives totally bogus spans if the expansion of an imported macro causes compilation errors. The best solution seems to be to serialize the actual textual macro definition and load it the same way the std-macros are. I'm not totally confident that getting the source from the CodeMap will always do the right thing, but it seems to work in simple cases.
2014-01-23Update flip() to be rev().Sean Chalmers-2/+2
Consensus leaned in favour of using rev instead of flip.
2014-01-23Rename Invert to Flip - Issue 10632Sean Chalmers-2/+2
Renamed the invert() function in iter.rs to flip(). Also renamed the Invert<T> type to Flip<T>. Some related code comments changed. Documentation that I could find has been updated, and all the instances I could locate where the function/type were called have been updated as well.
2014-01-23Redo exported macro serializationSteven Fackler-7/+16
The old method of serializing the AST gives totally bogus spans if the expansion of an imported macro causes compilation errors. The best solution seems to be to serialize the actual textual macro definition and load it the same way the std-macros are. I'm not totally confident that getting the source from the CodeMap will always do the right thing, but it seems to work in simple cases.
2014-01-22Add LowerExp 'e' and UpperExp 'E' format traits/specifiersSiegeLord-0/+2
2014-01-21[std::str] Rename from_utf8_owned_opt() to from_utf8_owned(), drop the old ↵Simon Sapin-1/+1
from_utf8_owned() behavior
2014-01-21[std::vec] Rename .pop_opt() to .pop(), drop the old .pop() behaviorSimon Sapin-12/+15
2014-01-21[std::vec] Rename .last_opt() to .last(), drop the old .last() behaviorSimon Sapin-2/+3
2014-01-21Remove unnecessary parentheses.Huon Wilson-7/+7
2014-01-20auto merge of #11670 : sfackler/rust/extctxt-span-note, r=alexcrichtonbors-0/+4
It was the only span_* missing.
2014-01-20auto merge of #11660 : sfackler/rust/quote-unused-sp, r=huonwbors-2/+2
The provided span isn't used in all cases (namely primitives).
2014-01-19auto merge of #11644 : huonw/rust/less-fatality, r=cmrbors-84/+197
This means that compilation continues for longer, and so we can see more errors per compile. This is mildly more user-friendly because it stops users having to run rustc n times to see n macro errors: just run it once to see all of them.
2014-01-19Add span_note to ExtCtxtSteven Fackler-0/+4
It was the only span_* missing.
2014-01-19auto merge of #11639 : sfackler/rust/macro-crate-path, r=alexcrichtonbors-2/+2
If the library is in the working directory, its path won't have a "/" which will cause dlopen to search /usr/lib etc. It turns out that Path auto-normalizes during joins so Path::new(".").join(path) is actually a no-op.
2014-01-18Avoid unused variable warning in quote_*!Steven Fackler-2/+2
The provided span isn't used in all cases (namely primitives).
2014-01-18auto merge of #11607 : alexcrichton/rust/issue-9957, r=cmrbors-1/+1
For `use` statements, this means disallowing qualifiers when in functions and disallowing `priv` outside of functions. For `extern mod` statements, this means disallowing everything everywhere. It may have been envisioned for `pub extern mod foo` to be a thing, but it currently doesn't do anything (resolve doesn't pick it up), so better to err on the side of forwards-compatibility and forbid it entirely for now. Closes #9957
2014-01-18Forbid unnecessary visibility on view itemsAlex Crichton-1/+1
For `use` statements, this means disallowing qualifiers when in functions and disallowing `priv` outside of functions. For `extern mod` statements, this means disallowing everything everywhere. It may have been envisioned for `pub extern mod foo` to be a thing, but it currently doesn't do anything (resolve doesn't pick it up), so better to err on the side of forwards-compatibility and forbid it entirely for now. Closes #9957
2014-01-17Actually force a / in the path for ext cratesSteven Fackler-2/+2
If the library is in the working directory, its path won't have a "/" which will cause dlopen to search /usr/lib etc. It turns out that Path auto-normalizes during joins so Path::new(".").join(path) is actually a no-op.
2014-01-17auto merge of #11585 : nikomatsakis/rust/issue-3511-rvalue-lifetimes, r=pcwaltonbors-22/+23
Major changes: - Define temporary scopes in a syntax-based way that basically defaults to the innermost statement or conditional block, except for in a `let` initializer, where we default to the innermost block. Rules are documented in the code, but not in the manual (yet). See new test run-pass/cleanup-value-scopes.rs for examples. - Refactors Datum to better define cleanup roles. - Refactor cleanup scopes to not be tied to basic blocks, permitting us to have a very large number of scopes (one per AST node). - Introduce nascent documentation in trans/doc.rs covering datums and cleanup in a more comprehensive way. r? @pcwalton
2014-01-18syntax::ext: replace span_fatal with span_err in many places.Huon Wilson-84/+197
This means that compilation continues for longer, and so we can see more errors per compile. This is mildly more user-friendly because it stops users having to run rustc n times to see n macro errors: just run it once to see all of them.
2014-01-17Change expansion of `for` loop to use a `match` statementNiko Matsakis-18/+12
so that the "innermost enclosing statement" used for rvalue temporaries matches up with user expectations
2014-01-16Load macros from external modulesSteven Fackler-75/+216
2014-01-15Issue #3511 - Rationalize temporary lifetimes.Niko Matsakis-4/+11
Major changes: - Define temporary scopes in a syntax-based way that basically defaults to the innermost statement or conditional block, except for in a `let` initializer, where we default to the innermost block. Rules are documented in the code, but not in the manual (yet). See new test run-pass/cleanup-value-scopes.rs for examples. - Refactors Datum to better define cleanup roles. - Refactor cleanup scopes to not be tied to basic blocks, permitting us to have a very large number of scopes (one per AST node). - Introduce nascent documentation in trans/doc.rs covering datums and cleanup in a more comprehensive way.
2014-01-14auto merge of #11485 : eddyb/rust/sweep-old-rust, r=nikomatsakisbors-1/+1
2014-01-13librustc: Remove `@` pointer patterns from the languagePatrick Walton-69/+69
2014-01-12Removed remnants of `@mut` and `~mut` from comments and the type system.Eduard Burtescu-1/+1
2014-01-11auto merge of #11463 : brson/rust/envcaps, r=huonwbors-6/+6
Death to caps.
2014-01-10syntax: Fix capitalization in macro_parser errorsBrian Anderson-5/+5
2014-01-10rustc: Fix formatting of env! error messageBrian Anderson-1/+1
Death to caps.
2014-01-11Remove re-exports of std::io::stdio::{print, println} in the prelude.Brendan Zabarauskas-5/+5
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
2014-01-09libsyntax: Renamed types, traits and enum variants to CamelCase.Eduard Burtescu-600/+561
2014-01-09Remove ApproxEq and assert_approx_eq!Brendan Zabarauskas-37/+0
This trait seems to stray too far from the mandate of a standard library as implementations may vary between use cases.