about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2017-12-12Improve pretty printing `$crate::` paths.Jeffrey Seyfried-12/+34
2017-12-13Resolve absolute paths as extern under a feature flagVadim Petrochenkov-0/+3
2017-12-09Use hygiene to access the injected crate (`core` or `std`) from builtin macros.Jeffrey Seyfried-14/+11
2017-12-09Use Try syntax for Option in place of macros or matchMatt Brubeck-12/+4
2017-12-07Auto merge of #46497 - AgustinCB:issue-46311, r=petrochenkovbors-13/+1
Modify message for keyword as identifier name This is a temporary solution to #46311. The message is generic enough to cover both cases and is probably a fine enough solution to the specific problem described in the task. However, the underlying reason for this to be wrong is that `next_token_inner` returns `Lifetime` even if the token is a label. That's not simple, as the syntax for both can be quite similar and it may need to take a look to the next token to make a decision. I'm not sure I have enough knowledge about the project to be able to solve that (yet!), so I thought I'll fix the immediate problem first.
2017-12-07add closure requirement tests, improve debugging outputNiko Matsakis-0/+6
The overall format is now easier to read. Also, There is now graphviz output, as well as a `#[rustc_regions]` annotation that dumps internal state.
2017-12-07address commentsAgustin Chiappe Berrini-3/+9
2017-12-07Auto merge of #46187 - notriddle:patch-1, r=QuietMisdreavusbors-1/+1
Rename C-like enum to Field-less enum There is no need to reference the C programming language to explain this concept.
2017-12-06and refactor to just move the checkingAgustin Chiappe Berrini-21/+3
2017-12-06Stabilize abi_sysv64CensoredUsername-8/+4
2017-12-02Auto merge of #46381 - estebank:expected-span, r=nikomatsakisbors-6/+23
Point to next token when it is in the expected line r? @nikomatsakis
2017-12-02Auto merge of #46347 - raventid:did-you-mean-increase-accuracy, r=estebankbors-5/+27
Add case insensitive comparison, besides Levenstein for DYM Closes #46332 Draft version. The idea is that Levenstein does not work for some cases when we have multiple equal weights for strings. I didn't understand the case with `if found != name => Some(found)` so it means that new code does not work correctly yet. At least now I think that we might return all maximal weights from levenstein and think about next cases in priority order: 1) There is exact match -> None 2) There is exact match, but case insensitive -> Some(match) 3) There is some match from levenstein -> Some(matches.take_any) 4) There is no match -> None @estebank WDYT?
2017-12-02Auto merge of #46343 - jseyfried:fix_hygiene_bug, r=nrcbors-3/+10
Fix hygiene bug. Fixes #42708. r? @nrc
2017-12-02Auto merge of #45904 - sunjay:gat-parser, r=nikomatsakisbors-7/+61
Generic Associated Types Parsing & Name Resolution Hi! This PR adds parsing for generic associated types! :tada: :tada: :tada: Tracking Issue: #44265 ## Notes For Reviewers * [x] I still need to add the stdout and stderr files to my ui tests. It takes me a *long* time to compile the compiler locally, so I'm going to add this as soon as possible in the next day or so. * [ ] My current ui tests aren't very good or very thorough. I'm reusing the `parse_generics` and `parse_where_clause` methods from elsewhere in the parser, so my changes work without being particularly complex. I'm not sure if I should duplicate all of the generics test cases for generic associated types. It might actually be appropriate to duplicate everything here, since we don't want to rely on an implementation detail in case it changes in the future. If you think so too, I'll adapt all of the generics test cases into the generic associated types test cases. * [ ] There is still more work required to make the run-pass tests pass here. In particular, we need to make the following errors disappear: ``` error[E0110]: lifetime parameters are not allowed on this type --> ./src/test/run-pass/rfc1598-generic-associated-types/streaming_iterator.rs:23:41 | 23 | bar: <T as StreamingIterator>::Item<'static>, | ^^^^^^^ lifetime parameter not allowed on this type ``` ``` error[E0261]: use of undeclared lifetime name `'a` --> ./src/test/run-pass/rfc1598-generic-associated-types/iterable.rs:15:47 | 15 | type Iter<'a>: Iterator<Item = Self::Item<'a>>; | ^^ undeclared lifetime ``` There is a FIXME comment in streaming_iterator. If you uncomment that line, you get the following: ``` error: expected one of `!`, `+`, `,`, `::`, or `>`, found `=` --> ./src/test/run-pass/rfc1598-generic-associated-types/streaming_iterator.rs:29:45 | 29 | fn foo<T: for<'a> StreamingIterator<Item<'a>=&'a [i32]>>(iter: T) { /* ... */ } | ^ expected one of `!`, `+`, `,`, `::`, or `>` here ``` r? @nikomatsakis
2017-12-01incr.comp.: Store Spans as (file,line,col,length) in incr.comp. cache.Michael Woerister-1/+1
The previous method ran into problems because ICH would treat Spans as (file,line,col) but the cache contained byte offsets and its possible for the latter to change while the former stayed stable.
2017-12-01Testing and fixesSunjay Varma-1/+1
2017-12-01Preventing moving out of the trait item kindSunjay Varma-1/+1
2017-12-01Parsing where clauses correctly and documenting the grammar being parsedSunjay Varma-2/+8
2017-12-01Specifically gating generic_associated_types feature on associated Type ↵Sunjay Varma-8/+12
declarations
2017-12-01Fixed tidy errorsSunjay Varma-2/+4
2017-12-01Adding feature gateSunjay Varma-0/+9
2017-12-01Added run-pass tests for associated generic typesSunjay Varma-2/+2
2017-12-01Parsing generics in both trait items and impl itemsSunjay Varma-3/+36
2017-12-01Auto merge of #45997 - estebank:pub-ident, r=nikomatsakisbors-10/+111
Account for missing keyword in fn/struct definition Fix #38911.
2017-12-01Auto merge of #45846 - pietroalbini:use-nested-groups, r=petrochenkovbors-206/+222
Add nested groups in imports This PR adds support for nested groups in imports (rust-lang/rfcs#2128, tracking issue #44494). r? @petrochenkov
2017-12-01move comparator into +find_best_match_name+ functionJulian Kulesh-5/+27
2017-11-30Implement RFC 2128 (use_nested_groups)Pietro Albini-206/+222
This commit adds support for nested groups inside `use` declarations, such as `use foo::{bar, sub::{baz::Foo, *}};`.
2017-11-29Point to next token when it is in the expected lineEsteban Küber-6/+23
2017-11-29incr.comp.: Remove on-export crate metadata hashing.Michael Woerister-12/+0
2017-11-28Fix hygiene bug.Jeffrey Seyfried-3/+10
2017-11-28Rollup merge of #46258 - colinmarsh19:master, r=estebankkennytm-1/+6
Remove semicolon note In reference to issue #46186 r? @estebank First time doing a pull request, if there are any suggestions on how to improve this please let me know. @jjolly
2017-11-26limit packed copy-out to non-generic Copy structsAriel Ben-Yehuda-1/+1
2017-11-25Changed from note to span_suggestion_shortcolinmarsh19-1/+2
2017-11-25Fixed Err by passing "err"colinmarsh19-1/+1
2017-11-25Remove semicolon notecolinmarsh19-1/+5
Added note that specifies a semicolon should be removed after a given struct
2017-11-24Consume trailing doc comments to avoid parse errorsEsteban Küber-3/+2
2017-11-24Revert to correct recovery behaviorEsteban Küber-0/+1
2017-11-24Emit `DocComment` in bad location error but continue parsing struct fieldsEsteban Küber-2/+10
2017-11-24Suggest macro call when not sure that it is fn definitionEsteban Küber-19/+16
2017-11-24Do not attemt to continue parsing after `pub ident`Esteban Küber-115/+23
Try to identify the following code in order to provide better diagnostics, but return the error to bail out early during the parse.
2017-11-24Do not rewind parser and ignore following blocksEsteban Küber-52/+189
When encountering `pub ident`, attempt to identify the code that comes afterwards, wether it is a brace block (assume it is a struct), a paren list followed by a colon (assume struct) or a paren list followed by a block (assume a fn). Consume those blocks to avoid any further parser errors and return a `Placeholder` item in order to allow the parser to continue. In the case of unenclosed blocks, the behavior is the same as it is currently: no further errors are processed.
2017-11-24Account for missing keyword in fn/struct definitionEsteban Küber-1/+52
2017-11-22Update parser.rsMichael Howell-1/+1
2017-11-22Implement in-band lifetime bindingsTaylor Cramer-0/+3
2017-11-22Auto merge of #44781 - QuietMisdreavus:doc-include, r=GuillaumeGomezbors-5/+105
rustdoc: include external files in documentation (RFC 1990) Part of https://github.com/rust-lang/rfcs/pull/1990 (needs work on the error reporting, which i'm deferring to after this initial PR) cc #44732 Also fixes #42760, because the prep work for the error reporting made it easy to fix that at the same time.
2017-11-21make with_unsugared_doc preserve is_sugared_docQuietMisdreavus-4/+6
2017-11-21allow loading external files in documentationQuietMisdreavus-1/+99
Partial implementation of https://github.com/rust-lang/rfcs/pull/1990 (needs error reporting work) cc #44732
2017-11-22Rollup merge of #46052 - oli-obk:rendered_diagnostics_in_json, r=petrochenkovkennytm-3/+25
Include rendered diagnostic in json r? @petrochenkov
2017-11-21Auto merge of #45771 - petrochenkov:crate, r=nikomatsakisbors-7/+38
Support `::crate` in paths cc https://github.com/rust-lang/rust/issues/45477 Fixes https://github.com/rust-lang/rust/issues/45229
2017-11-21Auto merge of #45545 - durka:macro-backtrace, r=nrcbors-1/+1
show macro backtrace with -Z flag Fixes #39413 by adding a facility to restore the "old school" macro expansion backtraces (previously removed in https://github.com/rust-lang/rust/commit/61865384b8fa6d79d2b36cbd7c899eaf15f4aeea). The restored functionality is accessed through the flag `-Z external-macro-backtrace`. Errors showing the truncated backtraces will suggest this flag. ### Example Code: <details> `a/src/lib.rs` ```rust #[macro_export] macro_rules! a { () => { a!(@) }; (@) => { a!(@@) }; (@@) => { syntax error; } } ``` `b/src/main.rs` ```rust #[macro_use] extern crate a; macro_rules! b { () => { b!(@) }; (@) => { b!(@@) }; (@@) => { syntax error; } } fn main() { a!(); b!(); } ``` </details> <br/><br/> Running without env var (note: first error is from remote macro, second from local macro): <details> ``` $ cargo +custom run Compiling b v0.1.0 error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` --> src/main.rs:12:5 | 12 | a!(); | ^^^^^ | | | expected one of 8 possible tokens here | unexpected token | = note: this error originates in a macro outside of the current crate (run with RUST_MACRO_BACKTRACE=1 for more info) error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` --> src/main.rs:7:16 | 7 | syntax error; | -^^^^^ unexpected token | | | expected one of 8 possible tokens here ... 13 | b!(); | ----- in this macro invocation error: aborting due to 2 previous errors error: Could not compile `b`. To learn more, run the command again with --verbose. ``` </details> The output is the same as today, except for an addition to the note which aids discoverability of the new environment variable. <br/><br/> Running _with_ env var: <details> ``` $ RUST_MACRO_BACKTRACE=1 cargo +custom run Compiling b v0.1.0 error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` --> <a macros>:1:72 | 1 | ( ) => { a ! ( @ ) } ; ( @ ) => { a ! ( @ @ ) } ; ( @ @ ) => { syntax error ; | -^^^^^ unexpected token | | | expected one of 8 possible tokens here src/main.rs:12:5: 12:10 note: in this expansion of a! (defined in <a macros>) <a macros>:1:11: 1:20 note: in this expansion of a! (defined in <a macros>) <a macros>:1:36: 1:47 note: in this expansion of a! (defined in <a macros>) error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` --> src/main.rs:7:16 | 7 | syntax error; | -^^^^^ unexpected token | | | expected one of 8 possible tokens here src/main.rs:12:5: 12:10 note: in this expansion of a! (defined in <a macros>) <a macros>:1:11: 1:20 note: in this expansion of a! (defined in <a macros>) <a macros>:1:36: 1:47 note: in this expansion of a! (defined in <a macros>) error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` --> src/main.rs:7:16 | 7 | syntax error; | -^^^^^ unexpected token | | | expected one of 8 possible tokens here src/main.rs:13:5: 13:10 note: in this expansion of b! (defined in src/main.rs) src/main.rs:4:13: 4:18 note: in this expansion of b! (defined in src/main.rs) src/main.rs:5:14: 5:20 note: in this expansion of b! (defined in src/main.rs) error: aborting due to 2 previous errors error: Could not compile `b`. To learn more, run the command again with --verbose. ``` </details> The output is hard to read, but better than nothing (and it's exactly what we used to have before the infamous `fix_multispans_in_std_macros`). <br/><br/> Wishlist: - Save the actual source of macros in crate metadata, not just AST, so the output can be improved - Hopefully this would allow line numbers in the trace as well - Show the actual macro invocations in the traces r? @nrc