about summary refs log tree commit diff
path: root/src/libsyntax_pos/lib.rs
AgeCommit message (Collapse)AuthorLines
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
2019-06-09Introduce InnerSpan abstractionMark Rousskov-3/+15
This should be used when trying to get at subsets of a larger span, especially when the larger span is not available in the code attempting to work with those subsets (especially common in the fmt_macros crate). This is usually a good replacement for (BytePos, BytePos) and (usize, usize) tuples. This commit also removes from_inner_byte_pos, since it took usize arguments, which is error prone.
2019-06-08Remove unused `#![feature(custom_attribute)]`sVadim Petrochenkov-1/+0
2019-06-05Add `modernize_and_adjust` methods.Nicholas Nethercote-0/+8
These combine two `HygieneData::with` calls into one.
2019-06-05Move `modern` calls inside `glob_adjust` and `reverse_glob_adjust`.Nicholas Nethercote-5/+4
2019-05-29Introduce and use `SyntaxContext::outer_expn_info()`.Nicholas Nethercote-10/+10
It reduces two `hygiene_data` accesses to one on some hot paths.
2019-05-21Move `edition` outside the hygiene lock and avoid accessing itJohn Kåre Alsaker-3/+7
2019-05-13Remove the equality operation between `Symbol` and strings.Nicholas Nethercote-1/+1
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-1/+1
Because it's going to be used a lot.
2019-04-17Deny `internal` in stage0Mateusz Mikuła-1/+1
2019-04-15Use a proc macro to declare preallocated symbolsJohn Kåre Alsaker-0/+2
2019-04-05remove lookup_char_pos_adjAleksey Kladov-12/+1
It is now exactly equivalent to lookup_char_pos.
2019-04-03Deny internal lints on non conflicting cratesflip1995-0/+1
- libarena - librustc_allocator - librustc_borrowck - librustc_codegen_ssa - librustc_codegen_utils - librustc_driver - librustc_errors - librustc_incremental - librustc_metadata - librustc_passes - librustc_privacy - librustc_resolve - librustc_save_analysis - librustc_target - librustc_traits - libsyntax - libsyntax_ext - libsyntax_pos