about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2017-12-14When attempting to write str with single quote suggest double quotesEsteban Küber-1/+27
2017-12-14Auto merge of #45047 - durka:trait-alias, r=petrochenkovbors-14/+66
trait alias infrastructure This will be an implementation of trait aliases (RFC 1733, #41517). Progress so far: - [x] Feature gate - [x] Add to parser - [x] `where` clauses - [x] prohibit LHS type parameter bounds via AST validation https://github.com/rust-lang/rust/pull/45047#discussion_r143575575 - [x] Add to AST and HIR - [x] make a separate PathSource for trait alias contexts https://github.com/rust-lang/rust/pull/45047#discussion_r143353932 - [x] Stub out enough of typeck and resolve to just barely not ICE Postponed: - [ ] Actually implement the alias part - [ ] #21903 - [ ] #24010 I need some pointers on where to start with that last one. The test currently does this: ``` error[E0283]: type annotations required: cannot resolve `_: CD` --> src/test/run-pass/trait-alias.rs:34:16 | 34 | let both = foo(); | ^^^ | = note: required by `foo` ```
2017-12-14feature gate trait aliasesAlex Burka-0/+8
2017-12-14add trait aliases to ASTAlex Burka-14/+58
2017-12-14incr.comp.: Do less hashing per Span.Michael Woerister-22/+4
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-97/+121
2017-12-13Auto merge of #46550 - jseyfried:cleanup_builtin_hygiene, r=nrcbors-26/+45
macros: hygienize use of `core`/`std` in builtin macros Today, if a builtin macro wants to access an item from `core` or `std` (depending `#![no_std]`), it generates `::core::path::to::item` or `::std::path::to::item` respectively (c.f. `fn std_path()` in `libsyntax/ext/base.rs`). This PR refactors the builtin macros to instead always emit `$crate::path::to::item` here. That is, the def site of builtin macros is taken to be in `extern crate core;` or `extern crate std;`. Since builtin macros are macros 1.0 (i.e. mostly unhygienic), changing the def site can only effect the resolution of `$crate`. r? @nrc
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