about summary refs log tree commit diff
path: root/src/libsyntax_pos
AgeCommit message (Collapse)AuthorLines
2019-05-30Add `HygieneData::{outer,expn_info,is_descendant_of}` methods.Nicholas Nethercote-26/+24
This commit factors out some repeated code.
2019-05-29Introduce and use `SyntaxContext::outer_expn_info()`.Nicholas Nethercote-10/+20
It reduces two `hygiene_data` accesses to one on some hot paths.
2019-05-29Introduce and use `Mark::outer_is_descendant_of()`.Nicholas Nethercote-3/+18
It reduces two `hygiene_data` accesses to one on some hot paths.
2019-05-27Use `Symbol` more in lint APIsOliver Scherer-0/+10
2019-05-27Use `Symbol` equality in `may_begin_with` and `parse_nt`.Nicholas Nethercote-0/+7
2019-05-27Use `Symbol` equality in `is_ident_named`.Nicholas Nethercote-0/+2
2019-05-27Pre-intern "0", "1", ..., "9", and use where appropriate.Nicholas Nethercote-2/+18
2019-05-27Pass symbols to `ExtCtxt::std_path` instead of strings.Nicholas Nethercote-0/+21
Because this function is hot. Also remove the dead `ty_option` function.
2019-05-27Avoid unnecessary internings.Nicholas Nethercote-0/+6
Most involving `Symbol::intern` on string literals.
2019-05-27Avoid interning in `resolve_place_op`.Nicholas Nethercote-0/+4
This function is hot for `keccak`.
2019-05-24Don't arena-allocate static symbols.Nicholas Nethercote-13/+6
It's just a waste of memory. This also gets rid of the special case for "".
2019-05-23syntax: Some code cleanupVadim Petrochenkov-0/+2
2019-05-23Auto merge of #60740 - petrochenkov:kw, r=nnethercotebors-43/+36
Simplify use of keyword symbols They mirror non-keyword symbols now (see https://github.com/rust-lang/rust/pull/60630). `keywords::MyKeyword.name()` -> `kw::MyKeyword` `keywords::MyKeyword.ident()` -> `Ident::with_empty_ctxt(kw::MyKeyword)` (not common) `keywords::Invalid.ident()` -> `Ident::invalid()` (more common) Keywords are simply `Symbol` constants now, the `Keyword` struct is eliminated. This means `kw::MyKeyword` can now be used in `match` in particular.
2019-05-22Restore the old behavior of the rustdoc keyword check + Fix rebaseVadim Petrochenkov-0/+5
2019-05-22Eliminate unnecessary `Ident::with_empty_ctxt`sVadim Petrochenkov-0/+5
2019-05-22Simplify use of keyword symbolsVadim Petrochenkov-43/+26
2019-05-22Allow null-pointer-optimized enums in FFI if their underlying representation ↵Michael Bradshaw-0/+1
is FFI safe This allows types like Option<NonZeroU8> to be used in FFI without triggering the improper_ctypes lint. This works by changing the is_repr_nullable_ptr function to consider an enum E to be FFI-safe if: - E has no explicit #[repr(...)]. - It only has two variants. - One of those variants is empty (meaning it has no fields). - The other variant has only one field. - That field is one of the following: - &T - &mut T - extern "C" fn - core::num::NonZero* - core::ptr::NonNull<T> - #[repr(transparent)] struct wrapper around one of the types in this list. - The size of E and its field are both known and are both the same size (implying E is participating in the nonnull optimization).
2019-05-22Rollup merge of #61003 - nnethercote:rm-InternedString-PartialEq-impls, ↵Mazdak Farrokhzad-37/+1
r=petrochenkov Remove impls for `InternedString`/string equality. `Symbol` received the same treatment in #60630. Also, we can derive `PartialEq` for `InternedString`. r? @petrochenkov
2019-05-21Move `edition` outside the hygiene lock and avoid accessing itJohn Kåre Alsaker-15/+15
2019-05-21Remove impls for `InternedString`/string equality.Nicholas Nethercote-37/+1
`Symbol` received the same treatment in #60630. Also, we can derive `PartialEq` for `InternedString`.
2019-05-21Auto merge of #60903 - nnethercote:mv-gensyms-from-Symbol-to-Ident, ↵bors-35/+38
r=petrochenkov Move gensym operations from `Symbol` to `Ident` Gensyms are always at the `Ident` level, and long-term we probably want to record gensym-ness in hygiene data. r? @petrochenkov
2019-05-20Remove `Symbol::gensym()`.Nicholas Nethercote-25/+31
2019-05-20Eliminate `Symbol::gensymed`.Nicholas Nethercote-5/+2
2019-05-20Move `is_gensymed` from `Symbol` to `Ident`.Nicholas Nethercote-5/+5
Note that the `is_gensymed` call on `primitive_types` is unnecessary because that table only contains the name of primitive types (e.g. `i32`) and never contains gensyms.
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-10/+5
And also the equality between `Path` and strings, because `Path` is made up of `Symbol`s.
2019-05-13Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.Nicholas Nethercote-2/+2
2019-05-13Rename `syntax::symbol::symbols` as `syntax::symbol::sym`.Nicholas Nethercote-4/+5
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-10Auto merge of #59288 - Centril:hir-if-to-match, r=oli-obkbors-0/+5
[let_chains, 1/6] Remove hir::ExprKind::If Per https://github.com/rust-lang/rust/issues/53667#issuecomment-471583239. r? @oli-obk
2019-05-10Remove hir::ExprKind::If and replace it with lowering to hir::ExprKind::Match.Mazdak Farrokhzad-0/+5
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/+3
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-22Promote rust comments to rustdocAlexey Shmalko-3/+3
2019-04-17Deny `internal` in stage0Mateusz Mikuła-1/+1
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