about summary refs log tree commit diff
path: root/src/libsyntax/ext/source_util.rs
AgeCommit message (Collapse)AuthorLines
2016-11-22Clean up directory ownership semantics.Jeffrey Seyfried-2/+3
2016-11-21Use `Symbol` instead of `InternedString` in the AST, HIR, and various other ↵Jeffrey Seyfried-7/+5
places.
2016-11-20Move `syntax::util::interner` -> `syntax::symbol`, cleanup.Jeffrey Seyfried-7/+5
2016-11-11Change implementation of syntax::util::SmallVector to use ↵Mark-Simulacrum-1/+1
data_structures::SmallVec.
2016-10-29Move `CrateConfig` from `Crate` to `ParseSess`.Jeffrey Seyfried-9/+2
2016-10-14Avoid many CrateConfig clones.Nicholas Nethercote-1/+1
This commit changes `ExtCtx::cfg()` so it returns a `CrateConfig` reference instead of a clone. As a result, it also changes all of the `cfg()` callsites to explicitly clone... except one, because the commit also changes `macro_parser::parse()` to take `&CrateConfig`. This is good, because that function can be hot, and `CrateConfig` is expensive to clone. This change almost halves the number of heap allocations done by rustc for `html5ever` in rustc-benchmarks suite, which makes compilation 1.20x faster.
2016-09-13Move macro resolution into `librustc_resolve`.Jeffrey Seyfried-2/+2
2016-09-05Refactor `SyntaxEnv`.Jeffrey Seyfried-5/+3
2016-06-27Auto merge of #34424 - jseyfried:breaking_batch, r=Manishearthbors-11/+11
Batch up libsyntax breaking changes Batch of the following syntax-[breaking-change] changes: - #34213: Add a variant `Macro` to `TraitItemKind` - #34368: Merge the variant `QPath` of `PatKind` into the variant `PatKind::Path` - #34385: Move `syntax::ast::TokenTree` into a new module `syntax::tokenstream` - #33943: - Remove the type parameter from `visit::Visitor` - Remove `attr::WithAttrs` -- use `attr::HasAttrs` instead. - Change `fold_tt`/`fold_tts` to take token trees by value and avoid wrapping token trees in `Rc`. - Remove the field `ctxt` of `ast::Mac_` - Remove inherent method `attrs()` of types -- use the method `attrs` of `HasAttrs` instead. - #34316: - Remove `ast::Decl`/`ast::DeclKind` and add variants `Local` and `Item` to `StmtKind`. - Move the node id for statements from the `StmtKind` variants to a field of `Stmt` (making `Stmt` a struct instead of an alias for `Spanned<StmtKind>`) - Rename `ast::ExprKind::Again` to `Continue`. - #34339: Generalize and abstract `ThinAttributes` to `ThinVec<Attribute>` - Use `.into()` in convert between `Vec<Attribute>` and `ThinVec<Attribute>` - Use autoderef instead of `.as_attr_slice()` - #34436: Remove the optional expression from `ast::Block` and instead use a `StmtKind::Expr` at the end of the statement list. - #34403: Move errors into a separate crate (unlikely to cause breakage)
2016-06-26Rollup merge of #34385 - cgswords:tstream, r=nrcJeffrey Seyfried-8/+9
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-24Revert a change to the relative path for macro-expanded `include!`sJeffrey Seyfried-1/+2
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-3/+2
2016-06-21Refactored tokentrees into their own files in preparation for tokenstreams. ↵cgswords-8/+9
Modified tests to point to the new file now.
2016-06-16Add an abs_path member to FileMap, use it when writing debug info.Ted Mielczarek-2/+2
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-02-11[breaking-change] don't pub export ast::Lit_ variantsOliver Schneider-1/+1
2015-12-30use structured errorsNick Cameron-5/+3
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-10-27Don't use panicking helpers in Parser.Eli Friedman-2/+2
2015-09-03Use consistent terminology for byte string literalsVadim Petrochenkov-1/+1
Avoid confusion with binary integer literals and binary operator expressions in libsyntax
2015-07-28remove `get_ident` and `get_name`, make `as_str` soundOliver Schneider-1/+1
2015-07-21Provide a filemap ctor with line infoNick Cameron-2/+2
2015-07-10Change some instances of .connect() to .join()Wesley Wiser-1/+1
2015-06-16Fix file!(), line!() and column!() macrosSimonas Kazlauskas-3/+3
These used to return wrong results in case they were expanded inside compiler’s iternal syntax sugar (closures, if-let) expansions Fixes #26322
2015-04-21syntax: remove #![feature(box_syntax, box_patterns)]Erick Tryzelaar-1/+1
2015-04-14include_bytes! now registers the file includedTheo Belaire-0/+5
This is a little bit tricky, since with include_str!, we know that we are including utf-8 content, so it's safe to store the source as a String in a FileMap. We don't know that for include_bytes!, but I don't think we actually need to track the contents anyways, so I'm passing "". new_filemap does check for the zero length content, and it should be reasonable, howeven I'm not sure if it would be better to pass None instead of Some(Rc::new("")) as the src component of a FileMap. Fixes bug #24348
2015-04-05Work towards a non-panicing parser (libsyntax)Phil Dawes-2/+2
- Functions in parser.rs return PResult<> rather than panicing - Other functions in libsyntax call panic! explicitly for now if they rely on panicing behaviour. - 'panictry!' macro added as scaffolding while converting panicing functions. (This does the same as 'unwrap()' but is easier to grep for and turn into try!()) - Leaves panicing wrappers for the following functions so that the quote_* macros behave the same: - parse_expr, parse_item, parse_pat, parse_arm, parse_ty, parse_stmt
2015-03-23Add generic conversion traitsAaron Turon-1/+1
This commit: * Introduces `std::convert`, providing an implementation of RFC 529. * Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all in favor of the corresponding generic conversion traits. Consequently, various IO APIs now take `AsRef<Path>` rather than `AsPath`, and so on. Since the types provided by `std` implement both traits, this should cause relatively little breakage. * Deprecates many `from_foo` constructors in favor of `from`. * Changes `PathBuf::new` to take no argument (creating an empty buffer, as per convention). The previous behavior is now available as `PathBuf::from`. * De-stabilizes `IntoCow`. It's not clear whether we need this separate trait. Closes #22751 Closes #14433 [breaking-change]
2015-03-13syntax: use lookahead to distinguish inner and outer attributes, instead of ↵Eduard Burtescu-1/+1
passing the latter around.
2015-03-12Stabilize std::pathAaron Turon-5/+1
This commit stabilizes essentially all of the new `std::path` API. The API itself is changed in a couple of ways (which brings it in closer alignment with the RFC): * `.` components are now normalized away, unless they appear at the start of a path. This in turn effects the semantics of e.g. asking for the file name of `foo/` or `foo/.`, both of which yield `Some("foo")` now. This semantics is what the original RFC specified, and is also desirable given early experience rolling out the new API. * The `parent` function now succeeds if, and only if, the path has at least one non-root/prefix component. This change affects `pop` as well. * The `Prefix` component now involves a separate `PrefixComponent` struct, to better allow for keeping both parsed and unparsed prefix data. In addition, the `old_path` module is now deprecated. Closes #23264 [breaking-change]
2015-03-04std: Deprecate std::old_io::fsAlex Crichton-13/+20
This commit deprecates the majority of std::old_io::fs in favor of std::fs and its new functionality. Some functions remain non-deprecated but are now behind a feature gate called `old_fs`. These functions will be deprecated once suitable replacements have been implemented. The compiler has been migrated to new `std::fs` and `std::path` APIs where appropriate as part of this change.
2015-02-27Replace MacExpr / MacPat / MacItems with MacEagerKeegan McAllister-7/+7
MacEager is a MacResult implementation for the common case where you've already built each form of AST that you might return. Fixes #17637. Based on #18814. This is a [breaking-change] for syntax extensions: * MacExpr::new becomes MacEager::expr. * MacPat::new becomes MacEager::pat. * MacItems::new becomes MacEager::items. It takes a SmallVector directly, not an iterator.
2015-02-23Auto merge of #21769 - brooksbp:column-line-macro, r=nick29581bors-2/+3
Please see discussion in #19284 .
2015-02-21Resolve includeme.fragment conflict.Brian Brooks-2/+3
2015-02-20Remove remaining uses of `[]`. This time I tried to use deref coercions ↵Niko Matsakis-1/+1
where possible.
2015-02-18Round 3 test fixes and conflictsAlex Crichton-4/+4
2015-02-18rollup merge of #22502: nikomatsakis/deprecate-bracket-bracketAlex Crichton-3/+3
Conflicts: src/libcollections/slice.rs src/libcollections/str.rs src/librustc/middle/lang_items.rs src/librustc_back/rpath.rs src/librustc_typeck/check/regionck.rs src/libstd/ffi/os_str.rs src/libsyntax/diagnostic.rs src/libsyntax/parse/parser.rs src/libsyntax/util/interner.rs src/test/run-pass/regions-refcell.rs
2015-02-18Replace all uses of `&foo[]` with `&foo[..]` en masse.Niko Matsakis-3/+3
2015-02-18Opt for .cloned() over .map(|x| x.clone()) etc.Kevin Butler-1/+1
2015-02-07Fix handling of parse errors when using `include!()`.Leo Testard-2/+6
Makes the compilation abort when a parse error is encountered while trying to parse an item in an included file. The previous behaviour was to stop processing the file when a token that can't start an item was encountered, without producing any error. Fixes #21146.
2015-02-06Libsyntax has been updatedGuillaumeGomez-2/+1
2015-02-06Replace the get method by the deref one on InternedStringGuillaumeGomez-1/+2
2015-01-26Fallout of io => old_ioAlex Crichton-1/+1
2015-01-24syntax: Don't put quotes around filenames in codemapAlex Crichton-4/+4
This ends up propagating all the way out to the output of dep-info which then makes Cargo think that files are not existent (it thinks the files have quotes in their name) when they in fact do.
2015-01-17libsyntax: rename functions from uint to usizePaul Collier-2/+2
2015-01-07rollup merge of #20657: alexcrichton/stabilize-macrosAlex Crichton-6/+0
2015-01-07use slicing sugarJorge Aparicio-9/+9
2015-01-07std: Stablize the macros moduleAlex Crichton-6/+0
This commit performs a pass over the `std::macros` module, applying stability attributes where necessary. In particular, this audits macros for patterns such as: * Standard use of forward-to-format-args via `$($arg:tt)*` (or `+`) * Prevent macro-defined identifiers from leaking into expression arguments as hygiene is not perfectly implemented. * Wherever possible, `$crate` is used now. Specifically, the following actions were taken: * The `std::macros` module itself is no longer public. * The `panic!` macro is stable * The `assert!` macro is stable * The `assert_eq!` macro is stable * The `debug_assert!` macro is stable * The `debug_assert_eq!` macro is stable * The `unreachable!` macro is stable after removing the extra forms to bring the definition in line with the `unimplemented!` macro. * The `try!` macro is stable * The `vec!` macro is stable [breaking-change]
2015-01-06rollup merge of #20481: seanmonstar/fmt-show-stringAlex Crichton-4/+4
Conflicts: src/compiletest/runtest.rs src/libcore/fmt/mod.rs src/libfmt_macros/lib.rs src/libregex/parse.rs src/librustc/middle/cfg/construct.rs src/librustc/middle/dataflow.rs src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/middle/ty.rs src/librustc_back/archive.rs src/librustc_borrowck/borrowck/fragments.rs src/librustc_borrowck/borrowck/gather_loans/mod.rs src/librustc_resolve/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/save/mod.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/callee.rs src/librustc_trans/trans/common.rs src/librustc_trans/trans/consts.rs src/librustc_trans/trans/controlflow.rs src/librustc_trans/trans/debuginfo.rs src/librustc_trans/trans/expr.rs src/librustc_trans/trans/monomorphize.rs src/librustc_typeck/astconv.rs src/librustc_typeck/check/method/mod.rs src/librustc_typeck/check/mod.rs src/librustc_typeck/check/regionck.rs src/librustc_typeck/collect.rs src/libsyntax/ext/format.rs src/libsyntax/ext/source_util.rs src/libsyntax/ext/tt/transcribe.rs src/libsyntax/parse/mod.rs src/libsyntax/parse/token.rs src/test/run-pass/issue-8898.rs
2015-01-06core: split into fmt::Show and fmt::StringSean McArthur-4/+4
fmt::Show is for debugging, and can and should be implemented for all public types. This trait is used with `{:?}` syntax. There still exists #[derive(Show)]. fmt::String is for types that faithfully be represented as a String. Because of this, there is no way to derive fmt::String, all implementations must be purposeful. It is used by the default format syntax, `{}`. This will break most instances of `{}`, since that now requires the type to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the correct fix. Types that were being printed specifically for users should receive a fmt::String implementation to fix this. Part of #20013 [breaking-change]
2015-01-07Replace full slice notation with index callsNick Cameron-7/+7