about summary refs log tree commit diff
path: root/src/libsyntax_pos/lib.rs
AgeCommit message (Collapse)AuthorLines
2019-12-30Rename directories for some crates from `syntax_x` to `rustc_x`Vadim Petrochenkov-1672/+0
`syntax_expand` -> `rustc_expand` `syntax_pos` -> `rustc_span` `syntax_ext` -> `rustc_builtin_macros`
2019-12-25Store callbacks in global staticsMark Rousskov-5/+6
The callbacks have precisely two states: the default, and the one present throughout almost all of the rustc run (the filled in value which has access to TyCtxt). We used to store this as a thread local, and reset it on each thread to the non-default value. But this is somewhat wasteful, since there is no reason to set it globally -- while the callbacks themselves access TLS, they do not do so in a manner that fails in when we do not have TLS to work with.
2019-12-22Format the worldMark Rousskov-144/+154
2019-11-23Implement HashStable for Span in libsyntax_pos.Camille GILLOT-10/+90
2019-11-23Move CachingSourceMapView to libsyntax_pos.Camille GILLOT-0/+2
2019-11-23Rename StableHashingContextLike to HashStableContext.Camille GILLOT-2/+2
2019-11-22Invert flow in impl HashStable of Span.Camille GILLOT-2/+12
2019-11-22Add StableHashingContextLike to HashStable_Generic derive.Camille GILLOT-0/+5
2019-11-17HashStable_Generic for libsyntax_pos.Camille GILLOT-1/+3
2019-11-15Move SourceMap to syntax_posMark Rousskov-0/+2
This does not update the use sites or delete the now unnecessary SourceMapper trait, to allow git to interpret the file move as a rename rather than a new file.
2019-11-15Move FatalError to syntax_posMark Rousskov-0/+1
This is a bit unfortunate, but code needs to be able to fatally error early on (in particular, syntax_pos after we move SourceMap there). It's also a tiny bit of code, which means it's ultimately not that bad.
2019-11-12Snap cfgsMark Rousskov-2/+0
2019-11-01`Span` cannot represent `span.hi < span.lo`Vadim Petrochenkov-1/+0
So we can remove the corresponding checks from various code
2019-10-25Rollup merge of #65074 - Rantanen:json-byte-pos, r=matkladMazdak Farrokhzad-4/+60
Fix the start/end byte positions in the compiler JSON output Track the changes made during normalization in the `SourceFile` and use this information to correct the `start_byte` and `end_byte` fields in the JSON output. This should ensure the start/end byte fields can be used to index the original file, even if Rust normalized the source code for parsing purposes. Both CRLF to LF and BOM removal are handled with this one. The rough plan was discussed with @matklad in rust-lang-nursery/rustfix#176 - although I ended up going with `u32` offset tracking so I wouldn't need to deal with `u32 + i32` arithmetics when applying the offset to the span byte positions. Fixes #65029
2019-10-25RFC 2008: StabilizationDavid Wood-1/+1
This commit stabilizes RFC 2008 (#44109) by removing the feature gate. Signed-off-by: David Wood <david@davidtw.co>
2019-10-21Fix the start/end byte positions in the compiler JSON outputMikko Rantanen-4/+60
2019-10-21Remove many unnecessary trait derivations.Nicholas Nethercote-1/+1
2019-10-15Stabilize proc macros generating `macro_rules` itemsVadim Petrochenkov-1/+1
2019-10-03proc_macro: Add `Span::mixed_site` exposing `macro_rules` hygieneVadim Petrochenkov-0/+6
2019-09-30Fixed weird non-sequential indices for serialisation of `SourceFile` type.Alexander Regueiro-16/+15
2019-09-28Switch over all StableHash impls to new formatMark Rousskov-6/+6
2019-09-15Remove `with_legacy_ctxt`Matthew Jasper-7/+0
2019-09-05Add `with_{def_site,call_site,legacy}_ctxt,` methods to `Span`Vadim Petrochenkov-0/+19
Use these to create call-site spans for AST passes when needed.
2019-09-05Add an ExpnKind for AST passesMatthew Jasper-0/+1
2019-08-23hygiene: Require passing transparency explicitly to `apply_mark`Vadim Petrochenkov-3/+3
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/+56
Normalize newlines when loading files Fixes #62865
2019-08-15hygiene: `ExpnInfo` -> `ExpnData`Vadim Petrochenkov-25/+25
For naming consistency with everything else in this area
2019-08-15syntax_pos: Remove the duplicate global editionVadim Petrochenkov-2/+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: Remove `Option`s from functions returning `ExpnInfo`Vadim Petrochenkov-36/+27
The expansion info is not optional and should always exist
2019-08-15syntax_pos: `NO_EXPANSION`/`SyntaxContext::empty()` -> `SyntaxContext::root()`Vadim Petrochenkov-9/+12
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-0/+6
2019-08-14convert \r\n to \n when loading filesAleksey Kladov-0/+56
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-02libsyntax_pos: Unconfigure tests during normal buildVadim Petrochenkov-22/+3
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-23cleanup: Remove `extern crate serialize as rustc_serialize`sVadim Petrochenkov-6/+3
2019-07-19Adjust other names after the `Mark` renamingVadim Petrochenkov-8/+8
2019-07-19libsyntax: Remove `Mark` into `ExpnId`Vadim Petrochenkov-8/+8
2019-07-11hygiene: Make sure each `Mark` has an associated expansion infoVadim Petrochenkov-1/+2
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-1/+1
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: Reuse `MacroKind` in `ExpnKind`Vadim Petrochenkov-3/+6
Orthogonality and reuse are good.
2019-07-11syntax: Make def-site span mandatory in ↵Vadim Petrochenkov-2/+2
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-11Rename some things in `syntax_pos/hygiene`Vadim Petrochenkov-12/+12
More consistent with other naming: ExpnFormat -> ExpnKind ExpnKind::name -> ExpnKind::descr DesugaringKind::name -> DesugaringKind::descr Shorter, no tautology: CompilerDesugaring -> Desugaring CompilerDesugaringKind -> DesugaringKind
2019-06-24Enable internal lints in bootstrapflip1995-1/+0
2019-06-17don't ICE on large filesAleksey Kladov-3/+9
This is an extremely marginal error, so the cost of properly threading `Handler` everywhere just not seemed justified. However, it's useful to panic when we create a file, and not when we slice strings with overflown indexes somewhere in the guts of the compiler. For this reason, while we provide safe `try_new_source_file`, we don't change the existing public interface and just panic more or less cleanly.
2019-06-12Rollup merge of #61568 - Mark-Simulacrum:symbol-fmt-macros, r=estebankMazdak Farrokhzad-3/+15
Use Symbol, Span in libfmt_macros I'm not super happy with this, personally, but I think it might be a decent start -- happy to take suggestions as to how to expand this or change things further. r? @estebank Fixes #60795
2019-06-11Add deny(unused_lifetimes) to all the crates that have deny(internal).Eduard-Mihai Burtescu-0/+1