about summary refs log tree commit diff
path: root/src/libsyntax/util
AgeCommit message (Collapse)AuthorLines
2016-12-06annotate stricter lifetimes on LateLintPass methods to allow them to forward ↵Oliver Schneider-1/+1
to a Visitor
2016-11-21Fix fallout in `rustdoc` and tests.Jeffrey Seyfried-5/+4
2016-11-21Use `Symbol` instead of `InternedString` in the AST, HIR, and various other ↵Jeffrey Seyfried-6/+5
places.
2016-11-20Move `syntax::util::interner` -> `syntax::symbol`, cleanup.Jeffrey Seyfried-113/+3
2016-11-11Change implementation of syntax::util::SmallVector to use ↵Mark-Simulacrum-256/+61
data_structures::SmallVec.
2016-11-10syntax: don't fake a block around closures' bodies during parsing.Eduard Burtescu-2/+2
2016-10-31Changed most vec! invocations to use square bracesiirelu-3/+3
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
2016-10-29Move `CrateConfig` from `Crate` to `ParseSess`.Jeffrey Seyfried-4/+1
2016-10-25Use `SmallVector` for `TtReader::stack`.Nicholas Nethercote-10/+40
This avoids 800,000 heap allocations when compiling html5ever. It requires tweaking `SmallVector` a little.
2016-10-13Get rid of double indirection in string interner by using `Rc<str>`Vadim Petrochenkov-25/+15
2016-09-07Refactor code out of the folder implementation for `StripUnconfigured`.Jeffrey Seyfried-0/+6
2016-07-11Factor the `RefCell` out of the `Interner`.Jeffrey Seyfried-60/+34
2016-07-11Remove `Interner<T>` and rename `StrInterner` to `Interner`.Jeffrey Seyfried-136/+13
2016-07-11Encapsulate `RcStr` in `syntax::util::interner`.Jeffrey Seyfried-56/+20
2016-06-26Rollup merge of #34339 - jseyfried:thin_vec, r=petrochenkov,ManishearthJeffrey Seyfried-0/+59
Generalize and abstract `ThinAttributes` to `ThinVec<Attribute>`.
2016-06-26Rollup merge of #34316 - jseyfried:refactor_ast_stmt, r=eddybJeffrey Seyfried-4/+0
Refactor away `ast::Decl`, refactor `ast::Stmt`, and rename `ast::ExprKind::Again` to `ast::ExprKind::Continue`.
2016-06-26Rollup merge of #33943 - jseyfried:libsyntax_cleanup, r=nrcJeffrey Seyfried-34/+34
Miscellaneous low priority cleanup in `libsyntax`.
2016-06-26Rollup merge of #34385 - cgswords:tstream, r=nrcJeffrey Seyfried-1/+2
syntax-[breaking-change] cc #31645 (Only breaking because ast::TokenTree is now tokenstream::TokenTree.) This pull request refactors TokenTrees into their own file as src/libsyntax/tokenstream.rs, moving them out of src/libsyntax/ast.rs, in order to prepare for an accompanying TokenStream implementation (per RFC 1566).
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-1/+1
2016-06-21Refactored tokentrees into their own files in preparation for tokenstreams. ↵cgswords-1/+2
Modified tests to point to the new file now.
2016-06-18Auto merge of #34295 - jseyfried:cfg_decoration, r=eddybbors-0/+9
Perform `cfg` attribute processing on decorator-generated items Fixes https://users.rust-lang.org/t/unused-attribute-warning-for-custom-derive-attribute/6180. r? @nrc
2016-06-19Generalize and abstract `ThinAttributes`Jeffrey Seyfried-0/+59
2016-06-17Fix falloutJeffrey Seyfried-4/+0
2016-06-16Auto merge of #34187 - luser:extern-crate-abspaths, r=michaelwoeristerbors-1/+1
Add an abs_path member to FileMap, use it when writing debug info. Fixes #34179. When items are inlined from extern crates, the filename in the debug info is taken from the FileMap that's serialized in the rlib metadata. Currently this is just FileMap.name, which is whatever path is passed to rustc. Since libcore and libstd are built by invoking rustc with relative paths, they wind up with relative paths in the rlib, and when linked into a binary the debug info uses relative paths for the names, but since the compilation directory for the final binary, tools trying to read source filenames will wind up with bad paths. We noticed this in Firefox with source filenames from libcore/libstd having bad paths. This change stores an absolute path in FileMap.abs_path, and uses that if available for writing debug info. This is not going to magically make debuggers able to find the source, but it will at least provide sensible paths.
2016-06-16Add an abs_path member to FileMap, use it when writing debug info.Ted Mielczarek-1/+1
When items are inlined from extern crates, the filename in the debug info is taken from the FileMap that's serialized in the rlib metadata. Currently this is just FileMap.name, which is whatever path is passed to rustc. Since libcore and libstd are built by invoking rustc with relative paths, they wind up with relative paths in the rlib, and when linked into a binary the debug info uses relative paths for the names, but since the compilation directory for the final binary, tools trying to read source filenames will wind up with bad paths. We noticed this in Firefox with source filenames from libcore/libstd having bad paths. This change stores an absolute path in FileMap.abs_path, and uses that if available for writing debug info. This is not going to magically make debuggers able to find the source, but it will at least provide sensible paths.
2016-06-16Auto merge of #34239 - jseyfried:fix_macro_use_scope_regression, r=nrcbors-0/+10
Revert a change in the scope of macros imported from crates to fix a regression Fixes #34212. The regression was caused by #34032, which changed the scope of macros imported from extern crates to match the scope of macros imported from modules. r? @nrc
2016-06-16Strip unconfigured nodes from decorator-generated ASTJeffrey Seyfried-0/+9
2016-06-15prefer `if let` to match with `None => ()` arm in some placesZack M. Davis-6/+4
Casual grepping revealed some places in the codebase (some of which antedated `if let`'s December 2014 stabilization in c200ae5a) where we were using a match with a `None => ()` arm where (in the present author's opinion) an `if let` conditional would be more readable. (Other places where matching to the unit value did seem to better express the intent were left alone.) It's likely that we don't care about making such trivial, non-functional, sheerly æsthetic changes. But if we do, this is a patch.
2016-06-14Remove the type parameter from `syntax::visit::Visitor`Jeffrey Seyfried-34/+34
2016-06-12Implement `Into<Vec<T>>` for `SmallVector<T>`Jeffrey Seyfried-0/+10
2016-05-25Remove ExplicitSelf from ASTVadim Petrochenkov-4/+0
2016-04-12Remove unused trait importsSeo Sanghyeon-2/+0
2016-03-07Auto merge of #29734 - Ryman:whitespace_consistency, r=Aatchbors-49/+59
libsyntax: be more accepting of whitespace in lexer Fixes #29590. Perhaps this may need more thorough testing? r? @Aatch
2016-02-27libsyntax: parse inclusive rangesAlex Burka-5/+9
2016-02-11Remove some unnecessary indirection from AST structuresVadim Petrochenkov-1/+1
2016-02-11[breaking-change] don't glob export ast::BinOp_Oliver Schneider-40/+40
2016-01-16libsyntax: accept only whitespace with the PATTERN_WHITE_SPACE propertyKevin Butler-20/+19
This aligns with unicode recommendations and should be stable for all future unicode releases. See http://unicode.org/reports/tr31/#R3. This renames `libsyntax::lexer::is_whitespace` to `is_pattern_whitespace` so potentially breaks users of libsyntax.
2016-01-14libsyntax: make matches_codepattern unicode awareKevin Butler-45/+57
2016-01-14libsyntax: use char::is_whitespace instead of custom implementationsKevin Butler-2/+1
Fixes #29590.
2015-12-30use structured errorsNick Cameron-8/+12
2015-12-23Auto merge of #30377 - Wafflespeanut:levenshtein, r=Manishearthbors-20/+34
fixes part of #30197
2015-12-19Auto merge of #30184 - petrochenkov:ascr, r=nikomatsakisbors-7/+9
This PR is a rebase of the original PR by @eddyb https://github.com/rust-lang/rust/pull/21836 with some unrebasable parts manually reapplied, feature gate added + type equality restriction added as described below. This implementation is partial because the type equality restriction is applied to all type ascription expressions and not only those in lvalue contexts. Thus, all difficulties with detection of these contexts and translation of coercions having effect in runtime are avoided. So, you can't write things with coercions like `let slice = &[1, 2, 3]: &[u8];`. It obviously makes type ascription less useful than it should be, but it's still much more useful than not having type ascription at all. In particular, things like `let v = something.iter().collect(): Vec<_>;` and `let u = t.into(): U;` work as expected and I'm pretty happy with these improvements alone. Part of https://github.com/rust-lang/rust/issues/23416
2015-12-18Deprecate name `OwnedSlice` and don't use itVadim Petrochenkov-4/+2
2015-12-16Add ExprType to HIR and make everything compileVadim Petrochenkov-7/+9
+ Apply parser changes manually + Add feature gate
2015-12-16Modify the Levenshtein-based suggestions to include importsRavi Shankar-20/+34
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-17/+102
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-0/+8
2015-11-26Some TLC for the MoveMap traitMarvin Löbel-17/+102
2015-11-26Add suggestion of similar macro names to `macro undefined` error messageFlorian Hartwig-0/+63