about summary refs log tree commit diff
path: root/src/libsyntax/ast_util.rs
AgeCommit message (Collapse)AuthorLines
2014-07-09libsyntax: Remove uses of advance.Luqman Aden-5/+5
2014-07-09Fix all the test falloutCorey Richardson-4/+4
2014-07-09syntax: doc comments all the thingsCorey Richardson-7/+7
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-7/+7
[breaking-change]
2014-07-03Simplify PatIdent to contain an Ident rather than a PathJohn Clements-7/+3
Rationale: for what appear to be historical reasons only, the PatIdent contains a Path rather than an Ident. This means that there are many places in the code where an ident is artificially promoted to a path, and---much more problematically--- a bunch of elements from a path are simply thrown away, which seems like an invitation to some really nasty bugs. This commit replaces the Path in a PatIdent with a SpannedIdent, which just contains an ident and a span.
2014-06-26Remove unnecessary to_string callsPiotr Jawniak-3/+3
This commit removes superfluous to_string calls from various places
2014-06-25auto merge of #15160 : alexcrichton/rust/remove-f128, r=brsonbors-1/+0
The f128 type has very little support in the compiler and the feature is basically unusable today. Supporting half-baked features in the compiler can be detrimental to the long-term development of the compiler, and hence this feature is being removed.
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-15/+4
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-24Remove the quad_precision_float feature gateAlex Crichton-1/+0
The f128 type has very little support in the compiler and the feature is basically unusable today. Supporting half-baked features in the compiler can be detrimental to the long-term development of the compiler, and hence this feature is being removed.
2014-06-17librustc: Make addresses of immutable statics insignificant unlessPatrick Walton-0/+13
`#[inline(never)]` is used. Closes #8958. This can break some code that relied on the addresses of statics being distinct; add `#[inline(never)]` to the affected statics. [breaking-change]
2014-06-14rustc: Obsolete the `@` syntax entirelyAlex Crichton-1/+1
This removes all remnants of `@` pointers from rustc. Additionally, this removes the `GC` structure from the prelude as it seems odd exporting an experimental type in the prelude by default. Closes #14193 [breaking-change]
2014-06-13libsyntax: Allow `+` to separate trait bounds from objects.Patrick Walton-0/+1
RFC #27. After a snapshot, the old syntax will be removed. This can break some code that looked like `foo as &Trait:Send`. Now you will need to write `foo as (&Trait+Send)`. Closes #12778. [breaking-change]
2014-06-11syntax: Move the AST from @T to Gc<T>Alex Crichton-21/+21
2014-06-06Move Def out of syntax crate, where it does not belongNiko Matsakis-27/+0
2014-05-29auto merge of #14483 : ahmedcharles/rust/patbox, r=alexcrichtonbors-1/+1
2014-05-28Add AST node for pattern macrosKeegan McAllister-0/+1
2014-05-27Rename PatUniq to PatBox. Fixes part of #13910.Ahmed Charles-1/+1
2014-05-27std: Rename strbuf operations to stringRicho Healey-9/+9
[breaking-change]
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-6/+6
[breaking-change]
2014-05-23syntax: Clean out obsolete syntax parsingAlex Crichton-0/+1
All of these features have been obsolete since February 2014, where most have been obsolete since 2013. There shouldn't be any more need to keep around the parser hacks after this length of time.
2014-05-14Removed unnecessary arguments for walk_* functionsMichael Darakananda-4/+3
2014-05-13syntax: Print suffixed token literals correctlyAlex Crichton-0/+3
Previously, literals "1i" were printed as "1". This fixes the numeric-method-autoexport test for pretty printing.
2014-05-13syntax: Fix printing INT64_MINAlex Crichton-5/+16
Integers are always parsed as a u64 in libsyntax, but they're stored as i64. The parser and pretty printer both printed an i64 instead of u64, sometimes introducing an extra negative sign.
2014-05-08libsyntax: Remove uses of `~str` from libsyntax, and fix falloutPatrick Walton-13/+17
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-1/+1
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-05-01auto merge of #13724 : nikomatsakis/rust/expr-use-visitor, r=pnkfelixbors-1/+24
Pre-step towards issue #12624 and others: Introduce ExprUseVisitor, remove the moves computation. ExprUseVisitor is a visitor that walks the AST for a function and calls a delegate to inform it where borrows, copies, and moves occur. In this patch, I rewrite the gather_loans visitor to use ExprUseVisitor, but in future patches, I think we could rewrite regionck, check_loans, and possibly other passes to use it as well. This would refactor the repeated code between those places that tries to determine where copies/moves/etc occur. r? @alexcrichton
2014-04-26syntax: ViewItemUse no longer contains multiple view paths.Kang Seonghoon-12/+10
it reflected the obsolete syntax `use a, b, c;` and did not make past the parser (though it was a non-fatal error so we can continue). this legacy affected many portions of rustc and rustdoc as well, so this commit cleans them up altogether.
2014-04-24auto merge of #13671 : dcrewi/rust/lint-directives-on-use-items, r=alexcrichtonbors-2/+10
Fixes #10534
2014-04-24Pre-step towards issue #12624 and others: Introduce ExprUseVisitor, remove theNiko Matsakis-1/+24
moves computation. ExprUseVisitor is a visitor that walks the AST for a function and calls a delegate to inform it where borrows, copies, and moves occur. In this patch, I rewrite the gather_loans visitor to use ExprUseVisitor, but in future patches, I think we could rewrite regionck, check_loans, and possibly other passes to use it as well. This would refactor the repeated code between those places that tries to determine where copies/moves/etc occur.
2014-04-22Apply lint attrs to individual "use" declarationsDavid Creswick-2/+10
Fixes #10534
2014-04-22add support for quadruple precision floating pointDaniel Micay-1/+1
This currently requires linking against a library like libquadmath (or libgcc), because compiler-rt barely has any support for this and most hardware does not yet have 128-bit precision floating point. For this reason, it's currently hidden behind a feature gate. When compiler-rt is updated to trunk, some tests can be added for constant evaluation since there will be support for the comparison operators. Closes #13381
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-1/+1
2014-04-13libsyntax: update helper to stringify TyU* and TyI* to take into account ↵Kevin Butler-14/+30
having a value. Fixes #13359.
2014-04-10auto merge of #13440 : huonw/rust/strbuf, r=alexcrichtonbors-2/+3
libstd: Implement `StrBuf`, a new string buffer type like `Vec`, and port all code over to use it. Rebased & tests-fixed version of https://github.com/mozilla/rust/pull/13269
2014-04-10Renamed ast::Purity to ast::FnStyle and ast::ImpureFn to ast::NormalFn and ↵Kasey Carrothers-1/+1
updated associated variable and function names.
2014-04-10libstd: Implement `StrBuf`, a new string buffer type like `Vec`, andPatrick Walton-2/+3
port all code over to use it.
2014-04-08Register new snapshotsAlex Crichton-1/+1
2014-03-31syntax: Switch field privacy as necessaryAlex Crichton-5/+5
2014-03-30Removed deprecated functions `map` and `flat_map` for vectors and slices.Marvin Löbel-10/+12
2014-03-26syntax: Permit visibility on tuple fieldsAlex Crichton-2/+1
This change is in preparation for #8122. Nothing is currently done with these visibility qualifiers, they are just parsed and accepted by the compiler. RFC: 0004-private-fields
2014-03-22Migrate all users of opt_vec to owned_slice, delete opt_vec.Huon Wilson-5/+5
syntax::opt_vec is now entirely unused, and so can go.
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-2/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-2/+2
Closes #12771
2014-03-12Suggest explicit lifetime parameter on some errorsKiet Tran-0/+21
Some types of error are caused by missing lifetime parameter on function or method declaration. In such cases, this commit generates some suggestion about what the function declaration could be. This does not support method declaration yet.
2014-03-12Changed lists of lifetimes in ast and ty to use Vec instead of OptVec.Felix S. Klock II-3/+4
There is a broader revision (that does this across the board) pending in #12675, but that is awaiting the arrival of more data (to decide whether to keep OptVec alive by using a non-Vec internally). For this code, the representation of lifetime lists needs to be the same in both ScopeChain and in the ast and ty structures. So it seemed cleanest to just use `vec_ng::Vec`, now that it has a cheaper empty representation than the current `vec` code.
2014-03-07rename ast::ViewItemExternMod to ast::ViewItemExternCrate, and ↵Liigo Zhuang-1/+1
clean::ExternMod to clean::ExternCrate
2014-03-05Refactor and fix FIXME's in mtwt hygiene codeEdward Wang-457/+1
- Moves mtwt hygiene code into its own file - Fixes FIXME's which leads to ~2x speed gain in expansion pass - It is now @-free
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-10/+13
2014-03-01libsyntax: Mechanically change `~[T]` to `Vec<T>`Patrick Walton-55/+55
2014-02-28std: Change assert_eq!() to use {} instead of {:?}Alex Crichton-6/+6
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.