about summary refs log tree commit diff
path: root/src/libsyntax_pos
AgeCommit message (Collapse)AuthorLines
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-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
2019-08-11add basic lint testing for misuse of mem::zeroed and mem::uninitializedRalf Jung-0/+3
2019-08-03Move special treatment of `derive(Copy, PartialEq, Eq)` from expansion ↵Vadim Petrochenkov-1/+0
infrastructure to elsewhere
2019-08-03Auto merge of #63180 - varkor:trait-alias-impl-trait, r=Centrilbors-4/+4
Change opaque type syntax from `existential type` to type alias `impl Trait` This implements a new feature gate `type_alias_impl_trait` (this is slightly different from the originally proposed feature name, but matches what has been used in discussion since), deprecating the old `existential_types` feature. The syntax for opaque types has been changed. In addition, the "existential" terminology has been replaced with "opaque", as per previous discussion and the RFC. This makes partial progress towards implementing https://github.com/rust-lang/rust/issues/63063. r? @Centril
2019-08-03Rollup merge of #63121 - estebank:formatting-pos, r=alexcrichtonMazdak Farrokhzad-0/+1
On `format!()` arg count mismatch provide extra info When positional width and precision formatting flags are present in a formatting string that has an argument count mismatch, provide extra information pointing at them making it easiser to understand where the problem may lay: ``` error: 4 positional arguments in format string, but there are 3 arguments --> $DIR/ifmt-bad-arg.rs:78:15 | LL | println!("{} {:.*} {}", 1, 3.2, 4); | ^^ ^^--^ ^^ --- this parameter corresponds to the precision flag | | | this precision flag adds an extra required argument at position 1, which is why there are 4 arguments expected | = note: positional arguments are zero-based = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html error: 4 positional arguments in format string, but there are 3 arguments --> $DIR/ifmt-bad-arg.rs:81:15 | LL | println!("{} {:07$.*} {}", 1, 3.2, 4); | ^^ ^^-----^ ^^ --- this parameter corresponds to the precision flag | | | | | this precision flag adds an extra required argument at position 1, which is why there are 4 arguments expected | this width flag expects an `usize` argument at position 7, but there are 3 arguments | = note: positional arguments are zero-based = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html error: invalid reference to positional argument 7 (there are 3 arguments) --> $DIR/ifmt-bad-arg.rs:84:18 | LL | println!("{} {:07$} {}", 1, 3.2, 4); | ^^^--^ | | | this width flag expects an `usize` argument at position 7, but there are 3 arguments | = note: positional arguments are zero-based = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html ``` Fix #49384.
2019-08-02Replace "existential" by "opaque"varkor-4/+3
2019-08-02Switch existential_type to type_alias_impl_traitvarkor-0/+1
2019-08-02libsyntax_pos: Unconfigure tests during normal buildVadim Petrochenkov-210/+210
2019-07-29review commentsEsteban Küber-0/+1
2019-07-28Deny `unused_lifetimes` through rustbuildVadim Petrochenkov-2/+0
2019-07-28Remove lint annotations in specific crates that are already enforced by ↵Vadim Petrochenkov-1/+0
rustbuild Remove some random unnecessary lint `allow`s
2019-07-27Remove run-pass test suitesVadim Petrochenkov-1/+1
2019-07-23cleanup: Remove `extern crate serialize as rustc_serialize`sVadim Petrochenkov-9/+6
2019-07-19hygiene: Tweak naming some moreVadim Petrochenkov-48/+49
2019-07-19Adjust other names after the `Mark` renamingVadim Petrochenkov-111/+115
2019-07-19libsyntax: Remove `Mark` into `ExpnId`Vadim Petrochenkov-58/+58
2019-07-19Auto merge of #62684 - petrochenkov:scopevisit, r=davidtwcobors-0/+1
resolve: Improve candidate search for unresolved macro suggestions Use same scope visiting machinery for both collecting suggestion candidates and actually resolving the names. The PR is better read in per-commit fashion with whitespace changes ignored (the first commit in particular moves some code around). This should be the last pre-requisite for https://github.com/rust-lang/rust/pull/62086. r? @davidtwco
2019-07-18Auto merge of #61749 - davidtwco:rfc-2203-const-array-repeat-exprs, r=eddybbors-0/+1
rustc/rustc_mir: Implement RFC 2203. This PR implements RFC 2203, allowing constants in array repeat expressions. Part of #49147. r? @eddyb
2019-07-18resolve: Visit all scopes to collect suggestion candidates for unresolved macrosVadim Petrochenkov-0/+1
2019-07-11Remove feature gate `dropck_parametricity` completelyLzu Tao-1/+0
Therefore we also remove `#[unsafe_destructor_blind_to_params]` attribute completly.
2019-07-11hygiene: Make sure each `Mark` has an associated expansion infoVadim Petrochenkov-4/+19
The root expansion was missing one. Expansions created for "derive containers" (see one of the next commits for the description) also didn't get expansion info.
2019-07-11hygiene: Fix wording of desugaring descriptionsVadim Petrochenkov-9/+10
Use variant names rather than descriptions for identifying desugarings in `#[rustc_on_unimplemented]`. Both are highly unstable, but variant name is at least a single identifier.
2019-07-11hygiene: Introduce a helper method for creating new expansionsVadim Petrochenkov-35/+26
Creating a fresh expansion and immediately generating a span from it is the most common scenario. Also avoid allocating `allow_internal_unstable` lists for derive markers repeatedly. And rename `ExpnInfo::with_unstable` to `ExpnInfo::allow_unstable`, seems to be a better fitting name.
2019-07-11expand: Do not overwrite existing `ExpnInfo` when injecting derive markersVadim Petrochenkov-1/+5
Create a fresh expansion for them instead - this is the usual way to allow unstable features for generated/desugared code. Fixes https://github.com/rust-lang/rust/issues/52363
2019-07-11hygiene: Reuse `MacroKind` in `ExpnKind`Vadim Petrochenkov-21/+22
Orthogonality and reuse are good.
2019-07-11hygiene: Remove some unused implsVadim Petrochenkov-7/+7
2019-07-11syntax: Make def-site span mandatory in ↵Vadim Petrochenkov-8/+6
ExpnInfo/MacroBacktrace/DiagnosticSpanMacroExpansion We have to deal with dummy spans anyway Remove def-site span from expander interfaces. It's not used by the expansion infra, only by specific expanders, which can keep it themselves if they want it.
2019-07-11hygiene: Remove some dead codeVadim Petrochenkov-27/+1
2019-07-11Rename some things in `syntax_pos/hygiene`Vadim Petrochenkov-34/+34
More consistent with other naming: ExpnFormat -> ExpnKind ExpnKind::name -> ExpnKind::descr DesugaringKind::name -> DesugaringKind::descr Shorter, no tautology: CompilerDesugaring -> Desugaring CompilerDesugaringKind -> DesugaringKind