summary refs log tree commit diff
path: root/src/libsyntax_pos/symbol.rs
AgeCommit message (Collapse)AuthorLines
2019-05-20Auto merge of #60815 - nnethercote:use-Symbol-more-2, r=petrochenkovbors-2/+20
Use `Symbol` even more These patches simplify the code a bit (fewer conversions) and also speed things up a bit (fewer `with_interner` calls). r? @petrochenkov
2019-05-20Introduce `LocalInternedString::intern`.Nicholas Nethercote-1/+12
`LocalInternedString::intern(x)` is preferable to `Symbol::intern(x).as_str()`, because the former involves one call to `with_interner` while the latter involves two.
2019-05-20Introduce `InternedString::intern`.Nicholas Nethercote-1/+8
`InternedString::intern(x)` is preferable to `Symbol::intern(x).as_interned_str()`, because the former involves one call to `with_interner` while the latter involves two. The case within InternedString::decode() is particularly hot, and this change reduces the number of `with_interner` calls by up to 13%.
2019-05-19Stop using gensyms in HIR loweringMatthew Jasper-0/+7
These names aren't ever handled by resolve, so there's no reason to make them gensyms.
2019-05-17Avoid unnecessary interning in `DefPathData::as_interned_str()`.Nicholas Nethercote-0/+7
2019-05-17Avoid unnecessary interning in `Ident::from_str()` calls.Nicholas Nethercote-0/+2
A lot of these static symbols are pre-interned.
2019-05-17Change `rustc::util::common::FN_OUTPUT_NAME` to a `Symbol`.Nicholas Nethercote-0/+1
2019-05-15Move `box` from the stable keyword to unstable keywords listPulkit Goyal-1/+1
Fixes #60849
2019-05-13Remove the equality operation between `Symbol` and strings.Nicholas Nethercote-6/+0
And also the equality between `Path` and strings, because `Path` is made up of `Symbol`s.
2019-05-13Rename `syntax::symbol::symbols` as `syntax::symbol::sym`.Nicholas Nethercote-3/+4
Because it's going to be used a lot.
2019-05-13Add lots of static `Symbols`.Nicholas Nethercote-4/+384
These will be used in the subsequent commits. Many of them are attributes. The commit also adds the ability to handle symbols that aren't identifiers (e.g. "proc-macro").
2019-05-11Auto merge of #60700 - petrochenkov:preintern, r=nnethercotebors-9/+10
syntax_pos: Optimize symbol interner pre-filling slightly r? @nnethercote
2019-05-10syntax_pos: Optimize symbol interner pre-filling slightlyVadim Petrochenkov-9/+10
2019-05-10Reduce `Symbol`'s interface slightly.Nicholas Nethercote-5/+1
2019-05-10Remove the `From<InternedString> for String` impl.Nicholas Nethercote-6/+0
It's not used.
2019-05-10Add various comments.Nicholas Nethercote-9/+43
Lots of details I wish I'd known when I first looked at this code.
2019-05-10Avoid recursion in de-gensym functions.Nicholas Nethercote-2/+5
2019-05-10Add `InternedString::with2`.Nicholas Nethercote-2/+11
This lets comparisons occur with a single access to the interner, instead of two.
2019-05-07Implement built-in await syntaxTaylor Cramer-0/+1
Adds support for .await under the existing async_await feature gate. Moves macro-like await! syntax to the await_macro feature gate. Removes support for `await` as a non-keyword under the `async_await` feature.
2019-04-15Preallocate BUILTIN_ATTRIBUTES symbols and use a hash map instead of loopingJohn Kåre Alsaker-10/+121
2019-04-15Use colon for keyword defsJohn Kåre Alsaker-61/+61
2019-04-15Move modules outside the proc macroJohn Kåre Alsaker-0/+28
2019-04-15Make check_name genericJohn Kåre Alsaker-1/+2
2019-04-15Use a proc macro to declare preallocated symbolsJohn Kåre Alsaker-125/+88
2019-04-14Add missing backtick to Symbol documentation.krk-1/+1
2019-03-31Fix lifetime on LocalInternedString::get functionJohn Kåre Alsaker-1/+5
2019-03-19Do not encode gensymed imports in metadataVadim Petrochenkov-0/+4
2019-03-16syntax: Introduce `Ident::can_be_raw`Vadim Petrochenkov-4/+9
2019-02-10rustc: doc commentsAlexander Regueiro-6/+6
2019-02-04libsyntax_pos => 2018Taiki Endo-24/+25
2019-01-28Use multiple threads by default. Limits tests to one thread. Do some renaming.John Kåre Alsaker-2/+2
2019-01-13remove extern_in_paths.Mazdak Farrokhzad-1/+0
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-14Rollup merge of #56699 - nnethercote:SymbolIndex, r=oli-obkkennytm-22/+39
Use a `newtype_index!` within `Symbol`. This shrinks `Option<Symbol>` from 8 bytes to 4 bytes, which shrinks `Token` from 24 bytes to 16 bytes. This reduces instruction counts by up to 1% across a range of benchmarks. r? @oli-obk
2018-12-12Bump to 1.33.0Alex Crichton-1/+1
* Update bootstrap compiler * Update version to 1.33.0 * Remove some `#[cfg(stage0)]` annotations Actually updating the version number is blocked on updating Cargo
2018-12-12Use a `newtype_index!` within `Symbol`.Nicholas Nethercote-22/+39
This shrinks `Option<Symbol>` from 8 bytes to 4 bytes, which shrinks `Token` from 24 bytes to 16 bytes. This reduces instruction counts by up to 1% across a range of benchmarks.
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-21/+24
2018-12-06Auto merge of #56392 - petrochenkov:regensym, r=oli-obkbors-1/+5
Delay gensym creation for "underscore items" (`use foo as _`/`const _`) until name resolution So they cannot be cloned by macros. See https://github.com/rust-lang/rust/pull/56303 for the discussion. Mostly fix cross-crate use of underscore items by inverting the "gensyms are lost in metadata" bug as described in https://github.com/rust-lang/rust/pull/56303#issuecomment-442464695. Fix unused import warnings for single-segment imports (first commit) and `use crate_name as _` imports (as specified in https://github.com/rust-lang/rust/pull/56303#issuecomment-442274118). Prohibit accidentally implemented `static _: TYPE = EXPR;` (cc https://github.com/rust-lang/rust/pull/55983). Add more tests for `use foo as _` imports.
2018-12-04Address review commentsVadim Petrochenkov-4/+4
2018-12-04syntax: Rename some keywordsVadim Petrochenkov-6/+6
`CrateRoot` -> `PathRoot`, `::` doesn't necessarily mean crate root now `SelfValue` -> `SelfLower`, `SelfType` -> `SelfUpper`, both `self` and `Self` can be used in type and value namespaces now
2018-12-04syntax: `dyn` is a used keyword nowVadim Petrochenkov-5/+13
2018-12-02Delay gensym creation for "underscore items" until name resolutionVadim Petrochenkov-1/+5
Prohibit `static _` Fis unused import warnings for `use foo as _` Add more tests for `use foo as _`
2018-12-01Rollup merge of #56336 - nnethercote:clean-up-pp, r=nikomatsakiskennytm-0/+4
Clean up and streamline the pretty-printer Some minor improvements.
2018-11-29Use `Cow` in `Token::String`.Nicholas Nethercote-0/+4
`Printer::word` takes a `&str` and converts it into a `String`, which causes an allocation. But that allocation is rarely necessary, because `&str` is almost always a `&'static str` or a `String` that won't be used again. This commit changes `Token::String` so it holds a `Cow<'static, str>` instead of a `String`, which avoids a lot of allocations.
2018-11-27resolve: Implement edition hygiene for imports and absolute pathsVadim Petrochenkov-2/+1
Use per-span hygiene in a few other places in resolve Prefer `rust_2015`/`rust_2018` helpers to comparing editions
2018-10-19Prefer `Default::default` over `FxHash*::default` in struct constructorsOliver Scherer-11/+3
2018-09-16Treat `dyn` as a keyword in the 2018 editionvarkor-10/+9
2018-08-23Auto merge of #52602 - scottmcm:tryblock-expr, r=nikomatsakisbors-9/+11
Implement try block expressions I noticed that `try` wasn't a keyword yet in Rust 2018, so... ~~Fix​es https://github.com/rust-lang/rust/issues/52604~~ That was fixed by PR https://github.com/rust-lang/rust/pull/53135 cc https://github.com/rust-lang/rust/issues/31436 https://github.com/rust-lang/rust/issues/50412
2018-08-19Put `try` in the reserved list, not the in-use listScott McMurray-12/+5
2018-08-19Add `try` to syntax_pos as an edition-2018-only keywordScott McMurray-10/+19