about summary refs log tree commit diff
path: root/src/libsyntax_pos
AgeCommit message (Collapse)AuthorLines
2018-05-26Add `Ident::as_str` helperVadim Petrochenkov-3/+7
2018-05-18Auto merge of #50307 - petrochenkov:keyhyg2, r=nikomatsakisbors-8/+164
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-18Auto merge of #50566 - nnethercote:bump, r=petrochenkovbors-0/+10
Streamline `StringReader::bump` These patches make `bump` smaller and nicer. They speed up most runs for coercions and tuple-stress by 1--3%.
2018-05-17Remove the `proc` keyword againVadim Petrochenkov-13/+7
2018-05-17Turn some functions from `token.rs` into methods on `Ident`Vadim Petrochenkov-1/+62
2018-05-17Add two keywords specific to editions 2015 and 2018 respectivelyVadim Petrochenkov-7/+11
2018-05-17Add edition to expansion infoVadim Petrochenkov-1/+14
2018-05-17Move definition of `Edition` from libsyntax to libsyntax_posVadim Petrochenkov-0/+84
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-14Hyperlink DOI against preferred resolverKatrin Leinweber-1/+1
https://www.doi.org/doi_handbook/3_Resolution.html#3.8
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-13Fix impl PartialOrd for InternedStringJohn Kåre Alsaker-1/+1
2018-05-12Rollup merge of #50607 - Zoxc:symbol-arena, r=michaelwoeristerMark Simulacrum-8/+34
Allocate Symbol strings from an arena This is an alternative to https://github.com/rust-lang/rust/pull/50549 cc @nnethercote r? @michaelwoerister
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-8/+34
2018-05-09Inline `Span` methods.Nicholas Nethercote-0/+3
Because they are simple and hot. This change speeds up some incremental runs of a few rustc-perf benchmarks, the best by 3%.
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-28Rollup merge of #50192 - bobtwinkles:libsyntax_extensions, r=jseyfriedkennytm-0/+49
Add some utilities to `libsyntax` Adds a few functions to `Mark` and `Span` that I found useful in an upcoming refactor of NLL region error reporting. Also includes some new documentation based on my discussion with @jseyfried on IRC. r? @jseyfried
2018-04-27Rename InternedString to LocalInternedString and introduce a new thread-safe ↵John Kåre Alsaker-28/+164
InternedString
2018-04-26Fix review nitsbobtwinkles-6/+6
2018-04-25Auto merge of #49986 - zofrex:better-derived-argument-names, r=Manishearthbors-0/+4
Provide better names for builtin deriving-generated attributes First attempt at fixing #49967 Not in love with any choices here, don't be shy if you aren't happy with anything :) I've tested that this produces nicer names in documentation, and that it no longer has issues conflicting with constants with the same name. (I guess we _could_ make a test for that... unsure if that would be valuable) In all cases I took the names from the methods as declared in the relevant trait. In some cases I had to prepend the names with _ otherwise there were errors about un-used variables. I'm uneasy with the inconsistency... do they all need to be like that? Is there a way to generate an alternate impl or use a different name (`_`?) in the cases where the arguments are not used? Lastly the gensym addition to Ident I implemented largely as suggested, but I want to point out it's a little circuitous (at least, as far as I understand it). `cx.ident_of(name)` is just `Ident::from_str`, so we create an Ident then another Ident from it. `Ident::with_empty_ctxt(Symbol::gensym(string))` may or may not be equivalent, I don't know if it's important to intern it _then_ gensym it. It seems like either we could use that, or if we do want a new method to make this convenient, it could be on Ident instead (`from_str_gensymed`?)
2018-04-23Implement a least upper bound for marks.bobtwinkles-0/+27
This is useful when trying to compute when something is lexically before something else, but they aren't necessarily in the same SyntaxContext
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-23Add documentation for SyntaxContext::remove_markbobtwinkles-0/+16
2018-04-23Use FxHashMap in syntax_pos::symbol::Interner::intern.Nicholas Nethercote-2/+2
Because it's faster than HashMap. This change reduces the time taken for a few of the rustc-perf benchmarks, mostly the small ones, by up to 5%.
2018-04-17Rollup merge of #49699 - zesterer:master, r=joshtriplettGuillaume Gomez-14/+13
Removed 'proc' from the reserved keywords list Remove 'proc' from the reserved keywords list. 'proc' is a very useful identifier name for a lot of things. It's especially useful when dealing with processes, operating system internals, and kernel development.
2018-04-16Remove unwanted auto-linking and updateGuillaume Gomez-2/+2
2018-04-15Provide better names for builtin deriving-generated attributesJames Sanderson-0/+4
2018-04-12Auto merge of #49371 - scottmcm:catch-wrapping, r=nikomatsakisbors-0/+2
Add ok-wrapping to catch blocks, per RFC Updates the `catch{}` lowering to wrap the result in `Try::from_ok`. r? @nikomatsakis Fixes #41414 Fixes #43818
2018-04-11Reenumerated symbolsJoshua Barretto-13/+13
2018-04-10Add ok-wrapping to catch blocks, per RFCScott McMurray-0/+2
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 `Ident` instead of `Name` in `MetaItem`Vadim Petrochenkov-7/+1
2018-04-06Get rid of `SpannedIdent`Vadim Petrochenkov-1/+6
2018-04-06Use `Span` instead of `SyntaxContext` in `Ident`Vadim Petrochenkov-12/+77
2018-04-05Merge pull request #1 from rust-lang/masterJoshua Barretto-5/+11
Merge upstream changes
2018-04-05Removed 'proc' from the reserved keywords listJoshua Barretto-1/+0
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-04-03Remove all unstable placement featuresAidan Hobson Sayers-2/+0
Closes #22181, #27779
2018-03-26Stabilize i128_typeMark Mansi-1/+1
2018-03-23Rollup merge of #49030 - Zoxc:misc, r=michaelwoeristerAlex Crichton-2/+10
Misc changes from my parallel rustc branch r? @michaelwoerister
2018-03-18Auto merge of #48917 - petrochenkov:import, r=oli-obkbors-2/+9
syntax: Make imports in AST closer to the source and cleanup their parsing This is a continuation of https://github.com/rust-lang/rust/pull/45846 in some sense.
2018-03-17Make Span and Symbol implement Send and SyncJohn Kåre Alsaker-2/+10
2018-03-17Rename `Span::empty` to `Span::shrink_to_lo`, add `Span::shrink_to_hi`Vadim Petrochenkov-2/+9
2018-03-17syntax: Make `_` an identifierVadim Petrochenkov-61/+65
2018-03-15Make FileMap thread-safeJohn Kåre Alsaker-30/+37
2018-03-14Remove syntax and syntax_pos thread localsJohn Kåre Alsaker-24/+41