about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2018-06-01Fix processing mod with multi-level path on WindowsEvgenii Pashkin-1/+8
2018-06-01Add closing bracket expectation to sequences, modified appropriate test cases.Crazycolorz5-2/+7
2018-05-31Rollup merge of #51240 - nnethercote:parse-2, r=nikomatsakisGuillaume Gomez-5/+3
Two minor parsing tweaks
2018-05-31Avoid an unnecessary `match` when lexing "<-".Nicholas Nethercote-5/+1
2018-05-31Tweak identifer lexing.Nicholas Nethercote-0/+2
By calling `bump()` after getting the first char, to avoid a redundant `ident_continue()` test on it.
2018-05-31Auto merge of #51145 - petrochenkov:npbot, r=alexcrichtonbors-0/+10
resolve: Make sure indeterminate and inconsistent macro resolutions always generate errors Addresses the issue described in https://github.com/rust-lang/rust/pull/50911#issuecomment-392560525 I haven't come up with a minimized reproduction yet, but confirmed that `npbot` now generates the correct error with `![feature(use_extern_macros)]`.
2018-05-30resolve: Make sure indeterminate and inconsistent macro resolutions always ↵Vadim Petrochenkov-0/+10
generate errors
2018-05-30rustc: don't visit lifetime parameters through visit_lifetime.Eduard-Mihai Burtescu-2/+2
2018-05-30syntax: remove overloading of fold_lifetime{,_def}{,s}.Eduard-Mihai Burtescu-54/+20
2018-05-28Auto merge of #50724 - zackmdavis:applicability_rush, r=Manishearthbors-67/+166
add suggestion applicabilities to librustc and libsyntax A down payment on #50723. Interested in feedback on whether my `MaybeIncorrect` vs. `MachineApplicable` judgement calls are well-calibrated (and that we have a consensus on what this means). r? @Manishearth cc @killercup @estebank
2018-05-27Auto merge of #51101 - 11Takanori:fix-typo, r=frewsxcvbors-1/+1
Fix typo in macro_parser.rs innacurate -> inaccurate
2018-05-27Ensure every unstable feature has a tracking issue.kennytm-22/+24
2018-05-27Auto merge of #51075 - ↵bors-7/+18
estebank:and_the_case_of_the_confusable_float_exponent, r=eddyb Check for confusable Unicode chars in float literal exponent Fixing tests for #49989. Resolves #49746.
2018-05-27Auto merge of #51066 - est31:master, r=sfacklerbors-1/+1
Point to the current box syntax tracking issue The issue was used for both box syntax as well as placement new. It got closed due to placement new being unapproved. So a new one got created for box syntax, yet neither the unstable book nor feature_gate.rs got updated. We are doing this now. r? @aidanhs
2018-05-27innacurate -> inaccurateTakanori Ishibashi-1/+1
2018-05-26Fix testEsteban Küber-4/+8
2018-05-26Point to the current box syntax tracking issueest31-1/+1
The issue was used for both box syntax as well as placement new. It got closed due to placement new being unapproved. So a new one got created for box syntax, yet neither the unstable book nor feature_gate.rs got updated. We are doing this now.
2018-05-26Auto merge of #51072 - petrochenkov:ifield, r=eddybbors-15/+15
Use `Ident`s for fields in HIR Continuation of https://github.com/rust-lang/rust/pull/49718, part of https://github.com/rust-lang/rust/issues/49300
2018-05-26Auto merge of #51052 - nikomatsakis:obsolete-arrow, r=petrochenkovbors-5/+44
restore emplacement syntax (obsolete) Fix https://github.com/rust-lang/rust/issues/50832 r? @petrochenkov
2018-05-26Add `Ident::as_str` helperVadim Petrochenkov-15/+15
2018-05-25in which we check for confusable Unicodepoints in float literal exponentZack M. Davis-5/+12
The `FatalError.raise()` might seem unmotivated (in most places in the compiler, `err.emit()` suffices), but it's actually used to maintain behavior (viz., stop lexing, don't emit potentially spurious errors looking for the next token after the bad Unicodepoint in the exponent): the previous revision's `self.err_span_` ultimately calls `Handler::emit`, which aborts if the `Handler`'s continue_after_error flag is set, which seems to typically be true during lexing (see `phase_1_parse_input` and and how `CompileController::basic` has `continue_parse_after_error: false` in librustc_driver). Also, let's avoid apostrophes in error messages (the present author would argue that users expect a reassuringly detached, formal, above-it-all tone from a Serious tool like a compiler), and use an RLS-friendly structured suggestion. Resolves #49746.
2018-05-26Auto merge of #50070 - toidiu:ak-2093-outlives, r=nikomatsakisbors-0/+6
2093 infer outlives requirements Tracking issue: #44493 RFC: https://github.com/rust-lang/rfcs/pull/2093 - [x] add `rustc_attrs` flag - [x] use `RequirePredicates` type - [x] handle explicit predicates on `dyn` Trait - [x] handle explicit predicates on projections - [x] more tests - [x] remove `unused`, `dead_code` and etc.. - [x] documentation
2018-05-25Implement outlives requirements inference for dyn and projections.toidiu-0/+6
Add tests, documentation and attr for feature.
2018-05-24restore emplacement syntax (obsolete)Niko Matsakis-5/+44
2018-05-24Replace `ScalarKind` with `Primitive`Oliver Schneider-35/+2
2018-05-24Auto merge of #50930 - toidiu:ak-ordOutlivesPredicate, r=nikomatsakisbors-1/+1
implement Ord for OutlivesPredicate and other types It became necessary while implementing https://github.com/rust-lang/rust/pull/50070 to have `Ord` implemented for `OutlivesPredicate`. This PR implements `Ord` for `OutlivesPredicate` as well as other types needed for the implementation.
2018-05-24Auto merge of #51023 - kennytm:rollup, r=kennytmbors-8/+8
Rollup of 9 pull requests Successful merges: - #50864 (Add NetBSD/arm target specs) - #50956 (rust-gdb: work around the re-used -d argument in cgdb) - #50964 (Make sure that queries have predictable symbol names.) - #50965 (Update LLVM to pull in another wasm fix) - #50972 (Add -Z no-parallel-llvm flag) - #50979 (Fix span for type-only arguments) - #50981 (Shrink `LiveNode`.) - #50995 (move type out of unsafe block) - #51011 ( rustdoc: hide macro export statements from docs) Failed merges:
2018-05-24Rollup merge of #50979 - Manishearth:type-only, r=estebankkennytm-8/+8
Fix span for type-only arguments Currently it points to the comma or parenthesis before the type, which is broken cc @mark-i-m this is what broke #48309 r? @estebank
2018-05-24Auto merge of #50971 - alexcrichton:no-stringify, r=petrochenkovbors-82/+98
rustc: Correctly pretty-print macro delimiters This commit updates the `Mac_` AST structure to keep track of the delimiters that it originally had for its invocation. This allows us to faithfully pretty-print macro invocations not using parentheses (e.g. `vec![...]`). This in turn helps procedural macros due to #43081. Closes #50840
2018-05-24implement Ord for OutlivesPredicate and other typestoidiu-1/+1
2018-05-24Auto merge of #50943 - oli-obk:cleanups, r=estebankbors-0/+72
impl Trait diagnostic/test cleanups
2018-05-22add `Span` information into `Qself`Niko Matsakis-10/+36
2018-05-22Fix span for type-only argumentsManish Goregaokar-8/+8
2018-05-22rustc: Correctly pretty-print macro delimitersAlex Crichton-82/+98
This commit updates the `Mac_` AST structure to keep track of the delimiters that it originally had for its invocation. This allows us to faithfully pretty-print macro invocations not using parentheses (e.g. `vec![...]`). This in turn helps procedural macros due to #43081. Closes #50840
2018-05-23Rollup merge of #50946 - alexcrichton:fix-parse-lifetime, r=petrochenkovkennytm-1/+8
rustc: Fix procedural macros generating lifetime tokens This commit fixes an accidental regression from #50473 where lifetime tokens produced by procedural macros ended up getting lost in translation in the compiler and not actually producing parseable code. The issue lies in the fact that a lifetime's `Ident` is prefixed with `'`. The `glue` implementation for gluing joint tokens together forgot to take this into account so the lifetime inside of `Ident` was missing the leading tick! The `glue` implementation here is updated to create a new `Symbol` in these situations to manufacture a new `Ident` with a leading tick to ensure it parses correctly. Closes #50942
2018-05-23Rollup merge of #50914 - simartin:issue_50636, r=oli-obkkennytm-3/+12
Issue #50636: Improve error diagnostic with missing commas after struct fields. Fixes #50636
2018-05-22Allow let bindings in const fn and constantsOliver Schneider-0/+3
2018-05-22Auto merge of #50838 - alexcrichton:token-impls, r=eddybbors-17/+42
rustc: Fix joint-ness of stringified token-streams This commit fixes `StringReader`'s parsing of tokens which have been stringified through procedural macros. Whether or not a token tree is joint is defined by span information, but when working with procedural macros these spans are often dummy and/or overridden which means that they end up considering all operators joint if they can! The fix here is to track the raw source span as opposed to the overridden span. With this information we can more accurately classify `Punct` structs as either joint or not. Closes #50700
2018-05-21Remove rustc_serialize_exclude_nullManish Goregaokar-5/+0
2018-05-21Stabilize suggestion applicability field in json outputManish Goregaokar-17/+4
2018-05-21Satisfy tidyOliver Schneider-2/+2
2018-05-21rustc: Fix procedural macros generating lifetime tokensAlex Crichton-1/+8
This commit fixes an accidental regression from #50473 where lifetime tokens produced by procedural macros ended up getting lost in translation in the compiler and not actually producing parseable code. The issue lies in the fact that a lifetime's `Ident` is prefixed with `'`. The `glue` implementation for gluing joint tokens together forgot to take this into account so the lifetime inside of `Ident` was missing the leading tick! The `glue` implementation here is updated to create a new `Symbol` in these situations to manufacture a new `Ident` with a leading tick to ensure it parses correctly. Closes #50942
2018-05-21Improve the diagnostic around impl Trait <-> generic param mismatchOliver Schneider-0/+72
2018-05-21Auto merge of #50924 - petrochenkov:spanover, r=alexcrichtonbors-11/+13
lexer: Fix span override for the first token in a string Previously due to peculiarities of `StringReader` construction something like `"a b c d".parse::<TokenStream>()` gave you one non-overridden span for `a` and then three correctly overridden spans for `b`, `c` and `d`. Now all the spans are overridden.
2018-05-20Auto merge of #50851 - eddyb:the-only-constant, r=nikomatsakisbors-29/+73
rustc: introduce {ast,hir}::AnonConst to consolidate so-called "embedded constants". Previously, constants in array lengths and enum variant discriminants were "merely an expression", and had no separate ID for, e.g. type-checking or const-eval, instead reusing the expression's. That complicated code working with bodies, because such constants were the only special case where the "owner" of the body wasn't the HIR parent, but rather the same node as the body itself. Also, if the body happened to be a closure, we had no way to allocate a `DefId` for both the constant *and* the closure, leading to *several* bugs (mostly ICEs where type errors were expected). This PR rectifies the situation by adding another (`{ast,hir}::AnonConst`) node around every such constant. Also, const generics are expected to rely on the new `AnonConst` nodes, as well (cc @varkor). * fixes #48838 * fixes #50600 * fixes #50688 * fixes #50689 * obsoletes #50623 r? @nikomatsakis
2018-05-20suggestion applicabilities for libsyntax and librustc, run-rustfix testsZack M. Davis-67/+166
Consider this a down payment on #50723. To recap, an `Applicability` enum was recently (#50204) added, to convey to Rustfix and other tools whether we think it's OK for them to blindly apply the suggestion, or whether to prompt a human for guidance (because the suggestion might contain placeholders that we can't infer, or because we think it has a sufficiently high probability of being wrong even though it's— presumably—right often enough to be worth emitting in the first place). When a suggestion is marked as `MaybeIncorrect`, we try to use comments to indicate precisely why (although there are a few places where we just say `// speculative` because the present author's subjective judgement balked at the idea that the suggestion has no false positives). The `run-rustfix` directive is opporunistically set on some relevant UI tests (and a couple tests that were in the `test/ui/suggestions` directory, even if the suggestions didn't originate in librustc or libsyntax). This is less trivial than it sounds, because a surprising number of test files aren't equipped to be tested as fixed even when they contain successfully fixable errors, because, e.g., there are more, not-directly-related errors after fixing. Some test files need an attribute or underscore to avoid unused warnings tripping up the "fixed code is still producing diagnostics" check despite the fixes being correct; this is an interesting contrast-to/inconsistency-with the behavior of UI tests (which secretly pass `-A unused`), a behavior which we probably ought to resolve one way or the other (filed issue #50926). A few suggestion labels are reworded (e.g., to avoid phrasing it as a question, which which is discouraged by the style guidelines listed in `.span_suggestion`'s doc-comment).
2018-05-20lexer: Fix span override for the first token in a stringVadim Petrochenkov-11/+13
2018-05-20Issue #50636: Improve error diagnostic with missing commas after struct fields.Simon Martin-3/+12
2018-05-20Auto merge of #50855 - nnethercote:fewer-macro_parser-allocs, r=petrochenkovbors-35/+87
Speed up the macro parser These three commits reduce the number of allocations done by the macro parser, in some cases dramatically. For example, for a clean check builds of html5ever, the number of allocations is reduced by 40%. Here are the rustc-benchmarks that are sped up by at least 1%. ``` html5ever-check avg: -6.6% min: -10.3% max: -4.1% html5ever avg: -5.2% min: -9.5% max: -2.8% html5ever-opt avg: -4.3% min: -9.3% max: -1.6% crates.io-check avg: -1.8% min: -2.9% max: -0.6% crates.io-opt avg: -1.0% min: -2.2% max: -0.1% crates.io avg: -1.1% min: -2.2% max: -0.2% ```
2018-05-20Auto merge of #50820 - alexcrichton:no-modules, r=petrochenkovbors-5/+56
rustc: Disallow modules and macros in expansions This commit feature gates generating modules and macro definitions in procedural macro expansions. Custom derive is exempt from this check as it would be a large retroactive breaking change (#50587). It's hoped that we can hopefully stem the bleeding to figure out a better solution here before opening up the floodgates. The restriction here is specifically targeted at surprising hygiene results [1] that result in non-"copy/paste" behavior. Hygiene and procedural macros is intended to be avoided as much as possible for Macros 1.2 by saying everything is "as if you copy/pasted the code", but modules and macros are sort of weird exceptions to this rule that aren't fully fleshed out. [1]: https://github.com/rust-lang/rust/issues/50504#issuecomment-387734625 cc #50504