about summary refs log tree commit diff
path: root/src/libsyntax/ext/base.rs
AgeCommit message (Collapse)AuthorLines
2016-05-02replace fileline_{help,note} with {help,note}Niko Matsakis-4/+3
The extra filename and line was mainly there to keep the indentation relative to the main snippet; now that this doesn't include filename/line-number as a prefix, it is distracted.
2016-03-02Fix the search paths for macro-expanded non-inline modulesJeffrey Seyfried-0/+8
2016-02-16Add check on find_best_match_for_name and improve help message for undefined ↵ggomez-1/+6
macro
2016-02-13Rename ast::Pat_ and its variantsVadim Petrochenkov-3/+3
2016-02-11Remove some unnecessary indirection from AST structuresVadim Petrochenkov-16/+16
2016-02-11[breaking-change] don't glob export ast::Item_ variantsOliver 'ker' Schneider-1/+1
2016-02-11[breaking-change] don't pub export ast::Stmt_ variantsOliver Schneider-3/+3
2016-02-11[breaking-change] don't pub export ast::Lit_ variantsOliver Schneider-2/+2
2016-02-11[breaking-change] don't pub export ast::Ty_ variantsOliver Schneider-1/+1
2016-02-11[breaking-change] don't glob export ast::Expr_ variantsOliver Schneider-3/+3
2015-12-31Cut out a bunch of Result and panictry! boilerplate from libsyntax.Nick Cameron-1/+1
[breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
2015-12-30use structured errorsNick Cameron-11/+25
2015-12-23Auto merge of #30377 - Wafflespeanut:levenshtein, r=Manishearthbors-10/+3
fixes part of #30197
2015-12-17move error handling from libsyntax/diagnostics.rs to libsyntax/errors/*Nick Cameron-1/+1
Also split out emitters into their own module.
2015-12-16Modify the Levenshtein-based suggestions to include importsRavi Shankar-10/+3
2015-12-15Move built-in syntax extensions to a separate crateSeo Sanghyeon-29/+0
2015-12-13remove deprecated APIs missed in #30182Tamir Duberstein-7/+0
2015-12-04Auto merge of #29850 - Kimundi:attributes_that_make_a_statement, r=pnkfelixbors-3/+4
See https://github.com/rust-lang/rfcs/pull/16 and https://github.com/rust-lang/rust/issues/15701 - Added syntax support for attributes on expressions and all syntax nodes in statement position. - Extended `#[cfg]` folder to allow removal of statements, and of expressions in optional positions like expression lists and trailing block expressions. - Extended lint checker to recognize lint levels on expressions and locals. - As per RFC, attributes are not yet accepted on `if` expressions. Examples: ```rust let x = y; { ... } assert_eq!((1, #[cfg(unset)] 2, 3), (1, 3)); let FOO = 0; ``` Implementation wise, there are a few rough corners and open questions: - The parser work ended up a bit ugly. - The pretty printer change was based mostly on guessing. - Similar to the `if` case, there are some places in the grammar where a new `Expr` node starts, but where it seemed weird to accept attributes and hence the parser doesn't. This includes: - const expressions in patterns - in the middle of an postfix operator chain (that is, after `.`, before indexing, before calls) - on range expressions, since `#[attr] x .. y` parses as `(#[attr] x) .. y`, which is inconsistent with `#[attr] .. y` which would parse as `#[attr] (.. y)` - Attributes are added as additional `Option<Box<Vec<Attribute>>>` fields in expressions and locals. - Memory impact has not been measured yet. - A cfg-away trailing expression in a block does not currently promote the previous `StmtExpr` in a block to a new trailing expr. That is to say, this won't work: ```rust let x = { #[cfg(foo)] Foo { data: x } #[cfg(not(foo))] Foo { data: y } }; ``` - One-element tuples can have their inner expression removed to become Unit, but just Parenthesis can't. Eg, `(#[cfg(unset)] x,) == ()` but `(#[cfg(unset)] x) == error`. This seemed reasonable to me since tuples and unit are type constructors, but could probably be argued either way. - Attributes on macro nodes are currently unconditionally dropped during macro expansion, which seemed fine since macro disappear at that point? - Attributes on `ast::ExprParens` will be prepend-ed to the inner expression in the hir folder. - The work on pretty printer tests for this did trigger, but not fix errors regarding macros: - expression `foo![]` prints as `foo!()` - expression `foo!{}` prints as `foo!()` - statement `foo![];` prints as `foo!();` - statement `foo!{};` prints as `foo!();` - statement `foo!{}` triggers a `None` unwrap ICE.
2015-11-27Introduce max_suggestion_distance function to avoid duplicating the heuristicFlorian Hartwig-4/+2
2015-11-26Added stmt_expr_attribute feature gateMarvin Löbel-3/+3
2015-11-26Add syntax support for attributes on expressions and all syntaxMarvin Löbel-0/+1
nodes in statement position. Extended #[cfg] folder to allow removal of statements, and of expressions in optional positions like expression lists and trailing block expressions. Extended lint checker to recognize lint levels on expressions and locals.
2015-11-26Add '!' to macro name suggestion, use fileline_help instead of span_helpFlorian Hartwig-1/+1
2015-11-26Add suggestion of similar macro names to `macro undefined` error messageFlorian Hartwig-0/+17
2015-11-24Auto merge of #30000 - Manishearth:unreachable-call, r=nrcbors-2/+2
Fixes #1889
2015-11-24Fix unreachable code in libsyntaxManish Goregaokar-2/+2
2015-11-23Auto merge of #29952 - petrochenkov:depr, r=brsonbors-1/+1
Part of https://github.com/rust-lang/rust/issues/29935 The deprecation lint is still called "deprecated", so people can continue using `#[allow(deprecated)]` and similar things.
2015-11-22Look up macro names as well when suggesting replacements for function ↵Manish Goregaokar-3/+9
resolve errors fixes #5780
2015-11-20Rename #[deprecated] to #[rustc_deprecated]Vadim Petrochenkov-1/+1
2015-11-13Auto merge of #29761 - eefriedman:rename-nopanic, r=sanxiynbors-2/+2
Just `sed s/_nopanic//g`. Hopefully makes libsyntax a bit more readable.
2015-11-11libsyntax: Add more quasiquoting macrosKyle Mayes-0/+12
2015-11-10Rename _nopanic methods to remove the suffix.Eli Friedman-2/+2
Just `sed s/_nopanic//g`. Hopefully makes libsyntax a bit more readable.
2015-11-10Use lifetime elisionSeo Sanghyeon-2/+2
2015-11-03Auto merge of #29285 - eefriedman:libsyntax-panic, r=nrcbors-2/+2
A set of commits which pushes some panics out of core parser methods, and into users of those parser methods.
2015-10-31Remove PatWildMultiVadim Petrochenkov-1/+1
2015-10-27Don't use panicking helpers in Parser.Eli Friedman-2/+2
2015-10-16Auto merge of #29014 - petrochenkov:stability, r=brsonbors-1/+1
Stricter checking of stability attributes + enforcement of their invariants at compile time (+ removed dead file librustc_front/attr.rs) I intended to enforce use of `reason` for unstable items as well (it normally presents for new items), but it turned out too intrusive, many older unstable items don't have `reason`s. r? @aturon I'm studying how stability works and do some refactoring along the way, so it's probably not the last PR.
2015-10-13Refactor attr::StabilityVadim Petrochenkov-1/+1
Stricter checking + enforcement of invariants at compile time
2015-10-12Remove the push_unsafe! and pop_unsafe! macros.Nick Cameron-6/+0
This is a [breaking change].
2015-10-09Auto merge of #28857 - nrc:lowering, r=nikomatsakisbors-5/+2
r? @nikomatsakis
2015-10-09Some cleanup of no longer used AST thingsNick Cameron-5/+2
2015-10-08typos: fix a grabbag of typos all over the placeCristi Cobzarenco-1/+1
2015-09-24Cleanup interfaces of Name, SyntaxContext and IdentVadim Petrochenkov-3/+3
Make sure Name, SyntaxContext and Ident are passed by value Make sure Idents don't serve as keys (or parts of keys) in maps, Ident comparison is not well defined
2015-09-01Remove the Modifier and Decorator kinds of syntax extensions.Nick Cameron-68/+0
This is a [breaking-change] for syntax extension authors. The fix is to use MultiModifier or MultiDecorator, which have the same functionality but are more flexible. Users of syntax extensions are unaffected.
2015-08-27Enumify CompilerExpansion in ExpnInfoManish Goregaokar-4/+5
2015-08-17feature gate `cfg(target_feature)`.Huon Wilson-1/+5
This is theoretically a breaking change, but GitHub search turns up no uses of it, and most non-built-in cfg's are passed via cargo features, which look like `feature = "..."`, and hence can't overlap.
2015-08-06Auto merge of #27296 - jroesch:type-macros, r=huonwbors-0/+20
This pull request implements the functionality for [RFC 873](https://github.com/rust-lang/rfcs/blob/master/text/0873-type-macros.md). This is currently just an update of @freebroccolo's branch from January, the corresponding commits are linked in each commit message. @nikomatsakis and I had talked about updating the macro language to support a lifetime fragment specifier, and it is possible to do that work on this branch as well. If so we can (collectively) talk about it next week during the pre-RustCamp work week.
2015-08-04Update and add test caseJared Roesch-1/+6
Test case from here: https://github.com/freebroccolo/rust/commit/9e93fef3c0e61836a8b56f727eb7a2e94bb4ca09
2015-08-04Extend macro machinery to expand macros in typesJared Roesch-0/+15
Reapplied the changes from https://github.com/freebroccolo/rust/commit/7aafe24139abc2d1f302bbb166bcaa006f12cf4d to a clean branch of master
2015-08-03syntax: Implement #![no_core]Alex Crichton-4/+9
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-07-22Hack for "unsafety hygiene" -- `push_unsafe!` and `pop_unsafe!`.Felix S. Klock II-0/+6
Even after expansion, the generated expressions still track depth of such pushes (i.e. how often you have "pushed" without a corresponding "pop"), and we add a rule that in a context with a positive `push_unsafe!` depth, it is effectively an `unsafe` block context. (This way, we can inject code that uses `unsafe` features, but still contains within it a sub-expression that should inherit the outer safety checking setting, outside of the injected code.) This is a total hack; it not only needs a feature-gate, but probably should be feature-gated forever (if possible). ignore-pretty in test/run-pass/pushpop-unsafe-okay.rs