about summary refs log tree commit diff
path: root/src/libsyntax_pos
AgeCommit message (Collapse)AuthorLines
2019-10-01Rollup merge of #64907 - alexreg:tidy-up, r=Mark-SimulacrumMazdak Farrokhzad-16/+15
A small amount of tidying-up factored out from PR #64648 As requested by @Mark-Simulacrum, I put this in a separate commit to make it easier to review. (As far as I can tell, no violations of the policy here, and they are simply in a separate PR because they're not directly related to the import of that PR.) r? @Mark-Simulacrum
2019-09-30Fixed weird non-sequential indices for serialisation of `SourceFile` type.Alexander Regueiro-16/+15
2019-09-29remove indexed_vec re-export from rustc_data_structurescsmoe-6/+6
2019-09-29Rollup merge of #64824 - Mark-Simulacrum:no-stable-hasher-result-everywhere, ↵Mazdak Farrokhzad-6/+6
r=michaelwoerister No StableHasherResult everywhere This removes the generic parameter on `StableHasher`, instead moving it to the call to `finish`. This has the side-effect of making all `HashStable` impls nicer, since we no longer need the verbose `<W: StableHasherResult>` that previously existed -- often forcing line wrapping. This is done for two reasons: * we should avoid false "generic" dependency on the result of StableHasher * we don't need to codegen two/three copies of all the HashStable impls when they're transitively used to produce a fingerprint, u64, or u128. I haven't measured, but this might actually make our artifacts somewhat smaller too. * Easier to understand/read/write code -- the result of the stable hasher is irrelevant when writing a hash impl.
2019-09-28Upgrade async/await to "used" keywords.Eric Huss-4/+4
2019-09-28Switch over all StableHash impls to new formatMark Rousskov-6/+6
2019-09-24reserve `impl<T> From<!> for T`Ariel Ben-Yehuda-0/+1
this is necessary for never-type stabilization
2019-09-17Rollup merge of #64486 - matthewjasper:hygiene-debugging, r=petrochenkovTyler Mandry-0/+32
Print out more information for `-Zunpretty=expanded,hygiene` I've found this helpful when trying to understand how hygiene works. Closes #16420
2019-09-17Print syntax contexts and marks when printing hygiene informationMatthew Jasper-0/+32
2019-09-15Auto merge of #64483 - petrochenkov:expectattr2, r=Centrilbors-0/+7
resolve: Tweak some "cannot find" wording for macros
2019-09-15resolve: Tweak "cannot find" wording for attributesVadim Petrochenkov-0/+7
2019-09-15Remove `with_legacy_ctxt`Matthew Jasper-7/+0
2019-09-15Give more `Idents` spansMatthew Jasper-1/+1
2019-09-07Support "soft" feature-gating using a lintVadim Petrochenkov-0/+1
Use it for feature-gating `#[bench]`
2019-09-07Rollup merge of #63919 - matthewjasper:remove-gensymmed, r=petrochenkovMazdak Farrokhzad-18/+57
Use hygiene for AST passes AST passes are now able to have resolve consider their expansions as if they were opaque macros defined either in some module in the current crate, or a fake empty module with `#[no_implicit_prelude]`. * Add an ExpnKind for AST passes. * Remove gensyms in AST passes. * Remove gensyms in`#[test]`, `#[bench]` and `#[test_case]`. * Allow opaque macros to define tests. * Move tests for unit tests to their own directory. * Remove `Ident::{gensym, is_gensymed}` - `Ident::gensym_if_underscore` still exists. cc #60869, #61019 r? @petrochenkov
2019-09-05Add `with_{def_site,call_site,legacy}_ctxt,` methods to `Span`Vadim Petrochenkov-1/+20
Use these to create call-site spans for AST passes when needed.
2019-09-05Remove `Ident::{gensym, is_gensymed}`Matthew Jasper-15/+12
`gensym_if_underscore` still exists. The symbol interner can still create arbitray gensyms, this is just not exposed publicly.
2019-09-05Allow ast passes to create hygienic spansMatthew Jasper-1/+1
2019-09-05Add an ExpnKind for AST passesMatthew Jasper-1/+24
2019-09-04Add `Symbol::{with,with2}`.Nicholas Nethercote-13/+29
And remove the `unsafe` blocks, they're not necessary. Also rewrite `InternedString::{with,with2}` to use the new functions. Finally, add some comments about the speed of the `as_str()`/`as_interned_str()` functions.
2019-09-04Remove `LocalInternedString::intern`.Nicholas Nethercote-13/+0
2019-09-04Remove `Encodable`/`Decodable` impls for `LocalInternedString`.Nicholas Nethercote-12/+0
2019-09-04Remove hashing impls for `LocalInternedString`.Nicholas Nethercote-1/+1
2019-09-04Remove `LocalInternedString::get`.Nicholas Nethercote-9/+0
It has a single use, which is easily changed to something better.
2019-09-04Remove `LocalInternedString::as_interned_str()`.Nicholas Nethercote-6/+0
It's unused.
2019-08-30Add a "diagnostic item" schemeOliver Scherer-1/+4
This allows lints and other diagnostics to refer to items by a unique ID instead of relying on whacky path resolution schemes that may break when items are relocated.
2019-08-29Rollup merge of #63945 - Centril:recover-mut-pat, r=estebankMazdak Farrokhzad-0/+5
Recover `mut $pat` and other improvements - Recover on e.g. `mut Foo(x, y)` and suggest `Foo(mut x, mut y)`. Fixes https://github.com/rust-lang/rust/issues/63764. - Recover on e.g. `let mut mut x;` - Recover on e.g. `let keyword` and `let keyword(...)`. - Cleanups in `token.rs` with `fn is_non_raw_ident_where` and friends.
2019-08-27Add default serialization for `Ident`sMatthew Jasper-2/+22
Add tests for -Zast-json and -Zast-json-noexpand, which need this impl.
2019-08-27Simplify with Symbol/Token::is_book_lit.Mazdak Farrokhzad-0/+5
2019-08-23Remove default macro transparenciesVadim Petrochenkov-5/+1
All transparancies are passed explicitly now. Also remove `#[rustc_macro_transparency]` annotations from built-in macros, they are no longer used. `#[rustc_macro_transparency]` only makes sense for declarative macros now.
2019-08-23hygiene: Require passing transparency explicitly to `apply_mark`Vadim Petrochenkov-33/+19
2019-08-23incremental: Do not rely on default transparency when decoding syntax contextsVadim Petrochenkov-9/+17
Using `ExpnId`s default transparency here instead of the mark's real transparency was actually incorrect.
2019-08-23resolve: Do not rely on default transparency when detecting proc macro derivesVadim Petrochenkov-12/+0
2019-08-23Audit uses of `apply_mark` in built-in macrosVadim Petrochenkov-0/+8
Replace them with equivalents of `Span::{def_site,call_site}` from proc macro API. The new API is much less error prone and doesn't rely on macros having default transparency.
2019-08-18Auto merge of #62948 - matklad:failable-file-loading, r=petrochenkovbors-0/+76
Normalize newlines when loading files Fixes #62865
2019-08-18Auto merge of #61708 - dlrobertson:or-patterns-0, r=centrilbors-0/+1
Initial implementation of or-patterns An incomplete implementation of or-patterns (e.g. `Some(0 | 1)` as a pattern). This patch set aims to implement initial parsing of `or-patterns`. Related to: #54883 CC @alexreg @varkor r? @Centril
2019-08-17initial implementation of or-pattern parsingDan Robertson-0/+1
Initial implementation of parsing or-patterns e.g., `Some(Foo | Bar)`. This is a partial implementation of RFC 2535.
2019-08-17Remove unused `SyntaxContext` serialization implsMatthew Jasper-4/+0
The implementations were wrong and unused.
2019-08-17Stop emulating cross-crate hygiene with gensymsMatthew Jasper-31/+5
Most `Ident`s are serialized as `InternedString`s the exceptions are: * Reexports * Attributes * Idents in macro definitions Using gensyms helped reexports emulate hygiene. However, the actual item wouldn't have a gensymmed name so would be usable cross-crate. So removing this case until we have proper cross-crate hygiene seems sensible. Codegen attributes (`inline`, `export_name`) are resolved by their `Symbol`. This meant that opaque macro-expanded codegen attributes could cause linker errors. This prevented making built-in derives hygienic.
2019-08-16Rollup merge of #63613 - petrochenkov:stdhyg, r=alexcrichtonMazdak Farrokhzad-1/+0
Hygienize use of built-in macros in the standard library Same as https://github.com/rust-lang/rust/pull/61629, but for built-in macros. Closes https://github.com/rust-lang/rust/issues/48781 r? @alexcrichton
2019-08-15Remove `__rust_unstable_column`Vadim Petrochenkov-1/+0
2019-08-15hygiene: `ExpnInfo` -> `ExpnData`Vadim Petrochenkov-70/+70
For naming consistency with everything else in this area
2019-08-15hygiene: Merge a tiny bit of the "share expansion definition data" PRVadim Petrochenkov-1/+3
2019-08-15syntax_pos: Remove the duplicate global editionVadim Petrochenkov-7/+0
It was introduced to avoid going through `hygiene_data`, but now it's read only once, when `ParseSess` is created, so going through a lock is ok.
2019-08-15hygiene: Merge `ExpnInfo` and `InternalExpnData`Vadim Petrochenkov-37/+33
2019-08-15hygiene: Remove `Option`s from functions returning `ExpnInfo`Vadim Petrochenkov-72/+49
The expansion info is not optional and should always exist
2019-08-15`Ident::with_empty_ctxt` -> `Ident::with_dummy_span`Vadim Petrochenkov-5/+5
`Ident` has had a full span rather than just a `SyntaxContext` for a long time now.
2019-08-15syntax_pos: `NO_EXPANSION`/`SyntaxContext::empty()` -> `SyntaxContext::root()`Vadim Petrochenkov-15/+18
For consistency with `ExpnId::root`. Also introduce a helper `Span::with_root_ctxt` for creating spans with `SyntaxContext::root()` context
2019-08-15syntax_pos: Introduce a helper for checking whether a span comes from expansionVadim Petrochenkov-3/+8
2019-08-14convert \r\n to \n when loading filesAleksey Kladov-0/+76