about summary refs log tree commit diff
path: root/src/libsyntax_pos/lib.rs
AgeCommit message (Collapse)AuthorLines
2018-07-28Auto merge of #52355 - pietroalbini:zfeature, r=eddybbors-0/+5
Add the -Zcrate-attr=foo unstable rustc option This PR adds a new unstable option to `rustc`: `-Zcrate-attr=foo`. The option can be used to inject crate-level attributes from the CLI, and it's meant to be used by tools like Crater that needs to add their own attributes to a crate without changing the source code. The exact reason I need this is to implement "edition runs" in Crater: we need to add the preview feature flag to every crate, and editing the crates' source code on the fly might produce unexpected results, while a compiler flag is more reliable. cc https://github.com/rust-lang-nursery/crater/issues/282 @Mark-Simulacrum
2018-07-28Rollup merge of #52703 - ljedrz:vec_improvements, r=nikomatsakiskennytm-5/+4
Improve a few vectors - calculate capacity or build from iterators Collecting from iterators improves readability and tailoring vector capacities should be beneficial in terms of performance.
2018-07-27Add the -Zcrate-attr=foo nightly rustc flag to inject crate attributesPietro Albini-0/+5
2018-07-26Improve a few vectors - calculate capacity or build from iteratorsljedrz-5/+4
2018-07-25Deny bare_trait_objects globallyTatsuyuki Ishi-2/+0
2018-07-12Deny bare trait objects in the rest of rustljedrz-0/+2
2018-07-08libsyntax_pos: Tweak some visibilitiesVadim Petrochenkov-1/+1
2018-06-30Fortify dummy span checkingVadim Petrochenkov-1/+8
2018-06-30hygiene: Implement transparent marksVadim Petrochenkov-0/+6
2018-06-28Fix FileMap::line_begin_pos().Michael Woerister-5/+3
The method relied on the FileMap still being under construction in order for it to do what the name promises. It's now independent of the current state.
2018-06-27syntax_pos: Store multibyte char size as u8 instead of u32.Michael Woerister-1/+1
2018-06-27Add SSE2 accelerated version of FileMap analysis.Michael Woerister-68/+9
2018-06-27Use u32 instead of usize of encoding byte count of multi-byte chars.Michael Woerister-3/+17
2018-06-27Make FileMap::{lines, multibyte_chars, non_narrow_chars} non-mutable.Michael Woerister-70/+88
2018-06-26migrate codebase to `..=` inclusive range patternsZack M. Davis-2/+2
These were stabilized in March 2018's #47813, and are the Preferred Way to Do It going forward (q.v. #51043).
2018-06-23hygiene: Merge `NameAndSpan` into `ExpnInfo`Vadim Petrochenkov-21/+18
2018-05-18Auto merge of #50307 - petrochenkov:keyhyg2, r=nikomatsakisbors-0/+8
Implement edition hygiene for keywords Determine "keywordness" of an identifier in its hygienic context. cc https://github.com/rust-lang/rust/pull/49611 I've resurrected `proc` as an Edition-2015-only keyword for testing purposes, but it should probably be buried again. EDIT: `proc` is removed again.
2018-05-18Auto merge of #50847 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-0/+7
Rollup of 10 pull requests Successful merges: - #50387 (Remove leftover tab in libtest outputs) - #50553 (Add Option::xor method) - #50610 (Improve format string errors) - #50649 (Tweak `nearest_common_ancestor()`.) - #50790 (Fix grammar documentation wrt Unicode identifiers) - #50791 (Fix null exclusions in grammar docs) - #50806 (Add `bless` x.py subcommand for easy ui test replacement) - #50818 (Speed up `opt_normalize_projection_type`) - #50837 (Revert #49767) - #50839 (Make sure people know the book is free oline) Failed merges:
2018-05-17Turn some functions from `token.rs` into methods on `Ident`Vadim Petrochenkov-0/+6
2018-05-17Move definition of `Edition` from libsyntax to libsyntax_posVadim Petrochenkov-0/+2
2018-05-17Rollup merge of #50610 - estebank:fmt-str, r=KimundiMark Simulacrum-0/+7
Improve format string errors Point at format string position inside the formatting string: ``` error: invalid format string: unmatched `}` found --> $DIR/format-string-error.rs:21:22 | LL | let _ = format!("}"); | ^ unmatched `}` in format string ``` Explain that argument names can't start with an underscore: ``` error: invalid format string: invalid argument name `_foo` --> $DIR/format-string-error.rs:15:23 | LL | let _ = format!("{_foo}", _foo = 6usize); | ^^^^ invalid argument name in format string | = note: argument names cannot start with an underscore ``` Fix #23476. The more accurate spans will only be seen when using `format!` directly, when using `println!` the diagnostics machinery makes the span be the entire statement.
2018-05-14Remove `StringReader::col`.Nicholas Nethercote-0/+9
It only has a single use, within code handling indented block comments. We can replace that with the new `FileMap::col_pos()`, which computes the col position (BytePos instead of CharPos) based on the record of the last newline char (which we already record). This is actually an improvement, because `trim_whitespace_prefix_and_push_line()` was using `col`, which is a `CharPos`, as a slice index, which is a byte/char confusion.
2018-05-13Inline `char_at()` and `record_width`.Nicholas Nethercote-0/+1
Because `bump()` is hot.
2018-05-10Improve format string errorsEsteban Küber-0/+7
- Point at format string position inside the formatting string - Explain that argument names can't start with an underscore
2018-05-10Allocate Symbol strings from an arenaJohn Kåre Alsaker-0/+1
2018-05-03Always inline simple BytePos and CharPos methods.Nicholas Nethercote-0/+10
Because they are (a) trivial, and (b) super hot. This change speeds up most rustc-benchmarks, the best by 5%.
2018-04-26Fix review nitsbobtwinkles-1/+1
2018-04-23Implement parent() on `syntax_pos::Span`bobtwinkles-0/+6
... and reimplement proc_macro::Span::parent using it. This function turns out to be useful in the compiler as well
2018-04-08Move deny(warnings) into rustbuildMark Simulacrum-1/+0
This permits easier iteration without having to worry about warnings being denied. Fixes #49517
2018-04-07Auto merge of #49661 - alexcrichton:bump-bootstrap, r=nikomatsakisbors-1/+0
Bump the bootstrap compiler to 1.26.0 beta Holy cow that's a lot of `cfg(stage0)` removed and a lot of new stable language features!
2018-04-06Use `Span` instead of `SyntaxContext` in `Ident`Vadim Petrochenkov-1/+47
2018-04-05Bump the bootstrap compiler to 1.26.0 betaAlex Crichton-1/+0
Holy cow that's a lot of `cfg(stage0)` removed and a lot of new stable language features!
2018-03-26Stabilize i128_typeMark Mansi-1/+1
2018-03-23Rollup merge of #49030 - Zoxc:misc, r=michaelwoeristerAlex Crichton-1/+5
Misc changes from my parallel rustc branch r? @michaelwoerister
2018-03-17Make Span and Symbol implement Send and SyncJohn Kåre Alsaker-1/+5
2018-03-17Rename `Span::empty` to `Span::shrink_to_lo`, add `Span::shrink_to_hi`Vadim Petrochenkov-2/+9
2018-03-15Make FileMap thread-safeJohn Kåre Alsaker-30/+37
2018-03-14Remove syntax and syntax_pos thread localsJohn Kåre Alsaker-1/+22
2018-03-05while let all the thingsleonardo.yvens-6/+1
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-8/+8
2018-02-28Rollup merge of #48359 - jsgf:remap-path-prefix, r=sanxiynManish Goregaokar-1/+1
Fixes #47311. r? @nrc
2018-02-22Implement --remap-path-prefixJeremy Fitzhardinge-1/+1
Remove experimental -Zremap-path-prefix-from/to, and replace it with the stabilized --remap-path-prefix=from=to variant. This is an implementation for issue of #41555.
2018-02-18Fix up tests and typosSeiichi Uchida-1/+1
2018-02-18Replace dummy spans with empty spansSeiichi Uchida-0/+6
2018-02-02Rollup merge of #47942 - estebank:macro-spans, r=nikomatsakis Minimize weird ↵kennytm-6/+17
spans involving macro context Sometimes the parser attempts to synthesize spans from within a macro context with the span for the captured argument, leading to non-sensical spans with very bad output. Given that an incorrect span is worse than a partially incomplete span, when detecting this situation return only one of the spans without merging them. Fix #32072, #47778. CC #23480.
2018-02-01Minimize weird spans involving macro contextEsteban Küber-6/+17
Sometimes the parser attempts to synthesize spans from within a macro context with the span for the captured argument, leading to non-sensical spans with very bad output. Given that an incorrect span is worse than a partially incomplete span, when detecting this situation return only one of the spans without mergin them.
2018-01-27end_point handling multibyte characters correctly.David Wood-16/+0
2018-01-27Moved overflow check into end_point function.David Wood-1/+3
2017-12-19incr.comp.: Precompute small hash for filenames to save some work.Michael Woerister-5/+21
2017-12-15incr.comp.: Revert hashing optimization that caused regression.Michael Woerister-33/+0