| Age | Commit message (Collapse) | Author | Lines |
|
This function is hot for `keccak`.
|
|
It's just a waste of memory. This also gets rid of the special case for
"".
|
|
|
|
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.
|
|
|
|
|
|
|
|
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).
|
|
r=petrochenkov
Remove impls for `InternedString`/string equality.
`Symbol` received the same treatment in #60630.
Also, we can derive `PartialEq` for `InternedString`.
r? @petrochenkov
|
|
|
|
`Symbol` received the same treatment in #60630.
Also, we can derive `PartialEq` for `InternedString`.
|
|
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
|
|
|
|
|
|
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.
|
|
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
|
|
`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.
|
|
`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%.
|
|
These names aren't ever handled by resolve, so there's no reason to
make them gensyms.
|
|
|
|
A lot of these static symbols are pre-interned.
|
|
|
|
Fixes #60849
|
|
And also the equality between `Path` and strings, because `Path` is made
up of `Symbol`s.
|
|
|
|
Because it's going to be used a lot.
|
|
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").
|
|
syntax_pos: Optimize symbol interner pre-filling slightly
r? @nnethercote
|
|
[let_chains, 1/6] Remove hir::ExprKind::If
Per https://github.com/rust-lang/rust/issues/53667#issuecomment-471583239.
r? @oli-obk
|
|
|
|
|
|
|
|
It's not used.
|
|
Lots of details I wish I'd known when I first looked at this code.
|
|
|
|
This lets comparisons occur with a single access to the interner,
instead of two.
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Increase `Span` from 4 bytes to 8 bytes.
This increases the size of some important types, such as `ast::Expr` and
`mir::Statement`. However, it drastically reduces how much the interner
is used, and the fields are more natural sizes that don't require bit
operations to extract.
As a result, instruction counts drop across a range of workloads, by as
much as 10% for `script-servo` incremental builds.
Peak memory usage goes up a little for some cases, but down by more for
some other cases -- as much as 18% for non-incremental builds of
`packed-simd`.
The commit also:
- removes the `repr(packed)`, because it has negligible effect, but can
cause undefined behaviour;
- replaces explicit impls of common traits (`Copy`, `PartialEq`, etc.)
with derived ones.
r? @petrochenkov
|
|
remove lookup_char_pos_adj
It is now exactly equivalent to lookup_char_pos.
|
|
Fix lifetime on LocalInternedString::get function
cc @eddyb @nnethercote
|
|
It is now exactly equivalent to lookup_char_pos.
|
|
This increases the size of some important types, such as `ast::Expr` and
`mir::Statement`. However, it drastically reduces how much the interner
is used, and the fields are more natural sizes that don't require bit
operations to extract.
As a result, instruction counts drop across a range of workloads, by as
much as 12% for incremental "check" builds of `script-servo`.
Peak memory usage goes up a little for some cases, but down by more for
some other cases -- as much as 18% for non-incremental builds of
`packed-simd`.
The commit also:
- removes the `repr(packed)`, because it has negligible effect, but can
cause undefined behaviour;
- replaces explicit impls of common traits (`Copy`, `PartialEq`, etc.)
with derived ones.
|