about summary refs log tree commit diff
path: root/src/libsyntax/print
AgeCommit message (Collapse)AuthorLines
2015-10-13Dict -> Struct, StructDef -> VariantData, def -> dataVadim Petrochenkov-4/+4
2015-10-13Remove now redundant NodeId from VariantVadim Petrochenkov-1/+0
2015-10-13Decouple structure kinds from NodeIdsVadim Petrochenkov-3/+5
2015-10-13Unify structures and enum variants in ASTVadim Petrochenkov-21/+11
2015-10-12Remove the push_unsafe! and pop_unsafe! macros.Nick Cameron-2/+2
This is a [breaking change].
2015-10-09Some cleanup of no longer used AST thingsNick Cameron-1/+1
2015-10-01Stop re-exporting AttrStyle's variants and rename them.Ms2ger-4/+4
2015-09-26Auto merge of #28642 - petrochenkov:name3, r=nrcbors-4/+3
This PR removes random remaining `Ident`s outside of libsyntax and performs general cleanup In particular, interfaces of `Name` and `Ident` are tidied up, `Name`s and `Ident`s being small `Copy` aggregates are always passed to functions by value, and `Ident`s are never used as keys in maps, because `Ident` comparisons are tricky. Although this PR closes https://github.com/rust-lang/rust/issues/6993 there's still work related to it: - `Name` can be made `NonZero` to compress numerous `Option<Name>`s and `Option<Ident>`s but it requires const unsafe functions. - Implementation of `PartialEq` on `Ident` should be eliminated and replaced with explicit hygienic, non-hygienic or member-wise comparisons. - Finally, large parts of AST can potentially be converted to `Name`s in the same way as HIR to clearly separate identifiers used in hygienic and non-hygienic contexts. r? @nrc
2015-09-24Cleanup interfaces of Name, SyntaxContext and IdentVadim Petrochenkov-4/+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-24Remove the deprecated box(PLACE) syntax.Eduard Burtescu-9/+12
2015-09-21Use ast::AsmDialect's variants qualified, and drop the pointless prefix.Ms2ger-1/+1
2015-09-20Replace `ast::Mac_` enum with structAndrew Paseltiner-26/+18
Closes #28527.
2015-09-18Auto merge of #28442 - nagisa:remove-enum-vis-field, r=alexcrichtonbors-3/+1
Followup on #28440 Do not merge before the referenced PR is merged. I will fix the PR once that is merged (or close if it is not)
2015-09-18Implement empty struct with braces (RFC 218)Vadim Petrochenkov-25/+25
2015-09-17Remove Visibility field from enum variantsSimonas Kazlauskas-3/+1
Followup on #28440
2015-09-16Use ast attributes every where (remove HIR attributes).Nick Cameron-310/+350
This could be a [breaking-change] if your lint or syntax extension (is that even possible?) uses HIR attributes or literals.
2015-09-04Auto merge of #28170 - nagisa:loopctl-label-spans, r=alexcrichtonbors-2/+2
r? @alexcrichton
2015-09-03Use consistent terminology for byte string literalsVadim Petrochenkov-3/+3
Avoid confusion with binary integer literals and binary operator expressions in libsyntax
2015-09-03Use proper span for break and continue labelsSimonas Kazlauskas-2/+2
Fixes #28109
2015-08-21Auto merge of #27613 - GSam:binop, r=nrcbors-3/+30
In the case where there are no paren in the AST, the pretty printer doesn't correctly print binary operations where precedence is concerned. Parenthesis may be missing due to some kind of expansion or manipulation of the AST. Example: Pretty printer prints Expr(*, Expr(+, 1, 1), 2) as 1 + 1 * 2, as opposed to (1 + 1) * 2 r? @nrc
2015-08-10Auto merge of #27451 - seanmonstar:use-groups-as, r=alexcrichtonbors-4/+16
An implementation of [RFC 1219](https://github.com/rust-lang/rfcs/pull/1219). The RFC is not merged yet, but once merged, this could be.
2015-08-10Avoid adding extra paren with two castsGarming Sam-1/+5
2015-08-09Casts are a type of binopGarming Sam-1/+1
This just adds paren following the same cases as before
2015-08-09Add operator precedence for pretty printerGarming Sam-2/+25
Previously it just added parentheses in excess. e.g. ((1 + 2) + 3) + 4
2015-08-09Binary ops should add parenthesis to each sideGarming Sam-2/+2
Otherwise, we get (1 + 2) * 3 looking like 1 + 2 * 3
2015-08-08rustc: rename multiple imports in a listSean McArthur-4/+16
2015-08-06Auto merge of #27296 - jroesch:type-macros, r=huonwbors-0/+3
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-04Add a macro invocation to the type ASTJared Roesch-0/+3
Reapplied the changes from https://github.com/freebroccolo/rust/commit/dc64b731d7f66c2b43d5e5e8c721be7bd3b59540 to a clean branch of master
2015-08-03syntax: Implement #![no_core]Alex Crichton-1/+1
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-28remove `get_ident` and `get_name`, make `as_str` soundOliver Schneider-16/+16
2015-07-22Hack for "unsafety hygiene" -- `push_unsafe!` and `pop_unsafe!`.Felix S. Klock II-2/+2
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
2015-07-09Auto merge of #26904 - bluss:no-repeat, r=alexcrichtonbors-4/+3
In a followup to PR #26849, improve one more location for I/O where we can use `Vec::resize` to ensure better performance when zeroing buffers. Use the `vec![elt; n]` macro everywhere we can in the tree. It replaces `repeat(elt).take(n).collect()` which is more verbose, requires type hints, and right now produces worse code. `vec![]` is preferable for vector initialization. The `vec![]` replacement touches upon one I/O path too, Stdin::read for windows, and that should be a small improvement. r? @alexcrichton
2015-07-09Use vec![elt; n] where possibleUlrik Sverdrup-4/+3
The common pattern `iter::repeat(elt).take(n).collect::<Vec<_>>()` is exactly equivalent to `vec![elt; n]`, do this replacement in the whole tree. (Actually, vec![] is smart enough to only call clone n - 1 times, while the former solution would call clone n times, and this fact is virtually irrelevant in practice.)
2015-07-05Feature-gate #[prelude_import].Eduard Burtescu-1/+3
2015-06-11Conver reborrows to .iter() calls where appropriateJoshua Landau-2/+2
2015-05-22Two more small fixes.Niko Matsakis-1/+1
2015-05-21Make various fixes:Niko Matsakis-14/+2
- add feature gate - add basic tests - adjust parser to eliminate conflict between `const fn` and associated constants - allow `const fn` in traits/trait-impls, but forbid later in type check - correct some merge conflicts
2015-05-21syntax: parse `const fn` for free functions and inherent methods.Eduard Burtescu-8/+41
2015-05-15syntax: Add unquoting ast::{Generics,WhereClause}Erick Tryzelaar-13/+15
2015-05-15syntax: Allow pretty printing more interpolated itemsErick Tryzelaar-13/+13
2015-05-13Merge branch 'master' into mulit-decorNick Cameron-9/+9
2015-05-12Merge branch 'master' intoNick Cameron-1/+1
2015-05-11Auto merge of #25085 - carols10cents:remove-old-tilde, r=steveklabnikbors-9/+9
There were still some mentions of `~[T]` and `~T`, mostly in comments and debugging statements. I tried to do my best to preserve meaning, but I might have gotten some wrong-- I'm happy to fix anything :)
2015-05-04Correct pretty-printing of `type Foo<T> where T: Bound = ...;`Felix S. Klock II-1/+1
Fix #25031
2015-05-03Update old uses of ~ in comments and debugging statementsCarol Nichols-9/+9
2015-04-30Merge branch 'master' into mulit-decorNick Cameron-82/+73
2015-04-27Auto merge of #23606 - quantheory:associated_const, r=nikomatsakisbors-0/+31
Closes #17841. The majority of the work should be done, e.g. trait and inherent impls, different forms of UFCS syntax, defaults, and cross-crate usage. It's probably enough to replace the constants in `f32`, `i8`, and so on, or close to good enough. There is still some significant functionality missing from this commit: - ~~Associated consts can't be used in match patterns at all. This is simply because I haven't updated the relevant bits in the parser or `resolve`, but it's *probably* not hard to get working.~~ - Since you can't select an impl for trait-associated consts until partway through type-checking, there are some problems with code that assumes that you can check constants earlier. Associated consts that are not in inherent impls cause ICEs if you try to use them in array sizes or match ranges. For similar reasons, `check_static_recursion` doesn't check them properly, so the stack goes ka-blooey if you use an associated constant that's recursively defined. That's a bit trickier to solve; I'm not entirely sure what the best approach is yet. - Dealing with consts associated with type parameters will raise some new issues (e.g. if you have a `T: Int` type parameter and want to use `<T>::ZERO`). See rust-lang/rfcs#865. - ~~Unused associated consts don't seem to trigger the `dead_code` lint when they should. Probably easy to fix.~~ Also, this is the first time I've been spelunking in rustc to such a large extent, so I've probably done some silly things in a couple of places.
2015-04-25Interpolate AST nodes in quasiquote.Geoffry Song-81/+41
This changes the `ToTokens` implementations for expressions, statements, etc. with almost-trivial ones that produce `Interpolated(*Nt(...))` pseudo-tokens. In this way, quasiquote now works the same way as macros do: already-parsed AST fragments are used as-is, not reparsed. The `ToSource` trait is removed. Quasiquote no longer involves pretty-printing at all, which removes the need for the `encode_with_hygiene` hack. All associated machinery is removed. A new `Nonterminal` is added, NtArm, which the parser now interpolates. This is just for quasiquote, not macros (although it could be in the future). `ToTokens` is no longer implemented for `Arg` (although this could be added again) and `Generics` (which I don't think makes sense). This breaks any compiler extensions that relied on the ability of `ToTokens` to turn AST fragments back into inspectable token trees. For this reason, this closes #16987. As such, this is a [breaking-change]. Fixes #16472. Fixes #15962. Fixes #17397. Fixes #16617.
2015-04-25Merge branch 'syntax' of https://github.com/aochagavia/rust into mulit-decorNick Cameron-1/+0
Conflicts: src/librustc/plugin/registry.rs src/libsyntax/ext/base.rs src/libsyntax/ext/cfg_attr.rs src/libsyntax/ext/deriving/mod.rs src/libsyntax/ext/expand.rs src/libsyntax/print/pprust.rs src/test/auxiliary/macro_crate_test.rs
2015-04-24Change name of unit test sub-module to "tests".Johannes Oertel-1/+1
Changes the style guidelines regarding unit tests to recommend using a sub-module named "tests" instead of "test" for unit tests as "test" might clash with imports of libtest.