about summary refs log tree commit diff
path: root/src/libsyntax/fold.rs
AgeCommit message (Collapse)AuthorLines
2014-07-08auto merge of #15493 : brson/rust/tostr, r=pcwaltonbors-2/+2
This updates https://github.com/rust-lang/rust/pull/15075. Rename `ToStr::to_str` to `ToString::to_string`. The naive renaming ends up with two `to_string` functions defined on strings in the prelude (the other defined via `collections::str::StrAllocating`). To remedy this I removed `StrAllocating::to_string`, making all conversions from `&str` to `String` go through `Show`. This has a measurable impact on the speed of this conversion, but the sense I get from others is that it's best to go ahead and unify `to_string` and address performance for all `to_string` conversions in `core::fmt`. `String::from_str(...)` still works as a manual fast-path. Note that the patch was done with a script, and ended up renaming a number of other `*_to_str` functions, particularly inside of rustc. All the ones I saw looked correct, and I didn't notice any additional API breakage. Closes #15046.
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-2/+2
[breaking-change]
2014-07-08Change DST syntax: type -> Sized?Nick Cameron-3/+3
closes #13367 [breaking-change] Use `Sized?` to indicate a dynamically sized type parameter or trait (used to be `type`). E.g., ``` trait Tr for Sized? {} fn foo<Sized? X: Share>(x: X) {} ```
2014-07-04comments onlyJohn Clements-1/+1
2014-07-03Simplify PatIdent to contain an Ident rather than a PathJohn Clements-2/+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-27adjust fold to fold over interpolated items/exprs/etc.John Clements-17/+68
Closes #15221
2014-06-27removed incomplete commentJohn Clements-17/+0
as written, I don't believe this comment was helpful; I think it's better just to steer the reader toward a general understanding of hygiene.
2014-06-27make fold_attribute part of Folder traitJohn Clements-23/+25
2014-06-16rustc: Improve span for error about using a method as a field.Kevin Butler-1/+1
libsyntax: ExprField now contains a SpannedIdent rather than Ident. [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-11rustc: Move the AST from @T to Gc<T>Alex Crichton-3/+3
2014-06-11syntax: Move the AST from @T to Gc<T>Alex Crichton-51/+59
2014-06-09librustc: Implement sugar for the `FnMut` traitPatrick Walton-0/+10
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-27auto merge of #14414 : richo/rust/features/nerf_unused_string_fns, ↵bors-4/+4
r=alexcrichton This should block on #14323
2014-05-27std: Rename strbuf operations to stringRicho Healey-4/+4
[breaking-change]
2014-05-26syntax: Add a source field to `Local` for tracking if it comes from `let`s ↵Huon Wilson-0/+1
or `for`s.
2014-05-24Add AttrId to Attribute_Steven Fackler-0/+1
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-08libsyntax: Remove uses of `~str` from libsyntax, and fix falloutPatrick Walton-11/+13
2014-05-03Temporary patch to accept arbitrary lifetimes (behind feature gate) in bound ↵Niko Matsakis-1/+2
lists. This is needed to bootstrap fix for #5723.
2014-04-28auto merge of #13791 : lifthrasiir/rust/mod-inner-span, r=huonwbors-0/+1
This PR is primarily motivated by (and fixes) #12926. We currently only have a span for the individual item itself and not for the referred contents. This normally does not cause a problem since both are located in the same file; it *is* possible that the contained statement or item is located in the other file (the syntax extension can do that), but even in that case the syntax extension should be located in the same file as the item. The module item (i.e. `mod foo;`) is the only exception here, and thus warrants a special treatment. Rustdoc would now distinguish `mod foo;` from `mod foo {...}` by checking if the span for the module item and module contents is in different files. If it's the case, we'd prefer module contents over module item. There are alternative strategies, but as noted above we will have some corner cases if we don't record the contents span explicitly.
2014-04-27syntax: `Mod` records the span for inner contents.Kang Seonghoon-0/+1
this is useful when the module item and module contents are defined from different files (like rustdoc). in most cases the original span for the module item would be used; in other cases, the span for module contents is available separately at the `inner` field.
2014-04-26syntax: ViewItemUse no longer contains multiple view paths.Kang Seonghoon-39/+37
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 #13713 : edwardw/rust/methodcall-span, r=alexcrichtonbors-1/+1
Specifically, the method parameter cardinality mismatch or missing method error message span now gets method itself exactly. It was the whole expression. Closes #9390 Closes #13684 Closes #13709
2014-04-23Allow attributes on match armsSteven Fackler-0/+1
RFC: 0008-match-arm-attributes
2014-04-24Calibrate span for method call error messagesEdward Wang-1/+1
Specifically, the method parameter cardinality mismatch or missing method error message span now gets method itself exactly. It was the whole expression. Closes #9390 Closes #13684 Closes #13709
2014-04-23Support unsized types with the `type` keywordNick Cameron-1/+3
2014-04-23Add a span to ast::TyParamNick Cameron-1/+2
2014-04-20Allow inheritance between structs.Nick Cameron-1/+11
No subtyping, no interaction with traits. Partially addresses #9912.
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-5/+5
2014-04-17Extended `syntax::{fold, ast_map}` to include lifetimes.Felix S. Klock II-33/+60
Part of this required added an override of `fold_type_method` in the Folder for Ctx impl; it follows the same pattern as `fold_method`. Also, as a drive-by fix, I moved all of the calls to `folder.new_id` in syntax::fold's no-op default traversal to really be the first statement in each function. * This is to uphold the invariant that `folder.new_id` is always called first (an unfortunate requirement of the current `ast_map` code), an invariant that we seemingly were breaking in e.g. the previous `noop_fold_block`. * Now it should be easier to see when adding new code that this invariant must be upheld. * (note that the breakage in `noop_fold_block` may not have mattered so much previously, since the only thing that blocks can bind are lifetimes, which I am only adding support for now.)
2014-04-11syntax: remove ast::Sigil.Eduard Burtescu-3/+10
2014-04-10Renamed ast::Purity to ast::FnStyle and ast::ImpureFn to ast::NormalFn and ↵Kasey Carrothers-6/+6
updated associated variable and function names.
2014-04-04syntax: remove obsolete mutability from ExprVec and ExprRepeat.Eduard Burtescu-4/+4
2014-04-03syntax: Remove AbiSet, use one AbiAlex Crichton-2/+2
This change removes the AbiSet from the AST, converting all usage to have just one Abi value. The current scheme selects a relevant ABI given a list of ABIs based on the target architecture and how relevant each ABI is to that architecture. Instead of this mildly complicated scheme, only one ABI will be allowed in abi strings, and pseudo-abis will be created for special cases as necessary. For example the "system" abi exists for stdcall on win32 and C on win64. Closes #10049
2014-03-30Removed deprecated functions `map` and `flat_map` for vectors and slices.Marvin Löbel-52/+52
2014-03-28De-@ TokenTree.Eduard Burtescu-3/+5
2014-03-27syntax: add a missing span rewrite in fold.Huon Wilson-1/+1
This was leaving Decls without the new spans; this is a minor change, since literally nothing reads in the code base reads the span of a Decl itself, always just its contents.
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-1/+1
Closes #12771
2014-03-18syntax: Don't parameterize the the pretty printerAlex Crichton-2/+2
The pretty printer constitues an enormous amount of code, there's no reason for it to be generic. This just least to a huge amount of metadata which isn't necessary. Instead, this change migrates the pretty printer to using a trait object instead. Closes #12985
2014-03-17Fix rustdoc and tests.Eduard Burtescu-5/+7
2014-03-15rustc: Remove compiler support for __log_level()Alex Crichton-1/+0
This commit removes all internal support for the previously used __log_level() expression. The logging subsystem was previously modified to not rely on this magical expression. This also removes the only other function to use the module_data map in trans, decl_gc_metadata. It appears that this is an ancient function from a GC only used long ago. This does not remove the crate map entirely, as libgreen still uses it to hook in to the event loop provided by libgreen.
2014-03-12Changed lists of lifetimes in ast and ty to use Vec instead of OptVec.Felix S. Klock II-2/+2
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-12alpha-rename .ident to .name in Lifetime, including in rustdoc.Felix S. Klock II-1/+1