Commit Graph

3395 Commits

Author SHA1 Message Date
Guillaume Gomez 796892e0ef Rollup merge of #56220 - estebank:suggest-lifetime-move, r=nikomatsakis
Suggest appropriate place for lifetime when declared after type arguments
2018-11-29 13:10:39 +01:00
Esteban Küber 6f028fe8e0 Specify suggestion applicability 2018-11-26 13:58:46 -08:00
Vadim Petrochenkov dae4c7b1ff resolve: Implement edition hygiene for imports and absolute paths
Use per-span hygiene in a few other places in resolve
Prefer `rust_2015`/`rust_2018` helpers to comparing editions
2018-11-27 00:32:30 +03:00
Esteban Küber 45dfe43887 Emit one diagnostic for multiple misplaced lifetimes 2018-11-26 08:32:47 -08:00
Esteban Küber 234d043d18 Move lifetimes before the *first* type argument 2018-11-25 12:51:04 -08:00
Esteban Küber 79ee8f329d Suggest appropriate place for lifetime when declared after type arguments 2018-11-25 12:41:38 -08:00
Guillaume Gomez 75d226ed76 Rollup merge of #56002 - Axary:master, r=estebank
fix #55972: Erroneous self arguments on bare functions emit subpar compilation error

#55972

r? @estebank
2018-11-22 10:37:50 +01:00
Axary 88d60941da improve error note 2018-11-20 14:43:16 +01:00
bors 5aff30734b Auto merge of #55971 - SergioBenitez:skip-non-semantic, r=alexcrichton
Ignore non-semantic tokens for 'probably_eq' streams.

Improves the situation in #43081 by skipping typically non-semantic tokens when checking for 'probably_eq'.

r? @alexcrichton
2018-11-19 19:57:02 +00:00
Sergio Benitez 78eb516dda Ignore non-semantic tokens for 'probably_eq' streams. 2018-11-16 23:37:23 -08:00
Axary 2be930bd03 fix tidy (remove whitespace) 2018-11-16 19:35:13 +01:00
Axary fe23ffbda0 improve error when self is used as not the first argument 2018-11-16 19:27:27 +01:00
Axary 646d68f585 add a note to the error message 2018-11-16 18:43:06 +01:00
Axary 218e35efa1 eat CloseDelim 2018-11-16 13:54:49 +01:00
Eric Huss 7f4bc2247a Clean up some non-mod-rs stuff. 2018-11-14 18:55:41 -08:00
Nicholas Nethercote c6862992d9 Change Lit::short_name to Lit::literal_name.
This avoids a moderately hot allocation in `parse_lit_token`.
2018-11-12 15:16:03 +11:00
Mark Rousskov 686de87d2f Rollup merge of #55777 - nnethercote:less-P-in-ast, r=petrochenkov
Use `Lit` rather than `P<Lit>` in `ast::ExprKind`.

Because it results in fewer allocations and small speedups on some
benchmarks.
2018-11-08 18:15:19 -07:00
Nicholas Nethercote 706c2ad651 Use Lit rather than P<Lit> in ast::ExprKind.
Because it results in fewer allocations and small speedups on some
benchmarks.
2018-11-08 19:00:55 +11:00
kennytm 9d9146ad95 Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwco
refactor: use shorthand fields

refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-07 21:27:00 +08:00
teresy eca11b99a7 refactor: use shorthand fields 2018-11-06 15:05:44 -05:00
bors af791bb8f4 Auto merge of #55451 - estebank:arg-doc, r=pnkfelix
Custom diagnostic when trying to doc comment argument

When writing

```
pub fn f(
    /// Comment
    id: u8,
) {}
```

Produce a targeted diagnostic

```
error: documentation comments cannot be applied to method arguments
  --> $DIR/fn-arg-doc-comment.rs:2:5
   |
LL |     /// Comment
   |     ^^^^^^^^^^^ doc comments are not allowed here
```

Fix #54801.
2018-11-05 16:36:18 +00:00
bors 794fc062be Auto merge of #55455 - estebank:expected-descr, r=michaelwoerister
Use token description in "expected/found" parse messages

Fix #54309.
2018-11-04 06:56:11 +00:00
bors 6d69fe7a2f Auto merge of #54861 - rep-nop:find_main_in_doctest, r=estebank
rustdoc: Replaces fn main search and extern crate search with proper parsing during doctests.

Fixes #21299.
Fixes #33731.

Let me know if there's any additional changes you'd like made!
2018-11-04 01:43:40 +00:00
Alexander Regueiro 4bdc3d833a Extended elaboration for trait aliases to include arbitrary bounds. 2018-11-03 04:09:34 +00:00
Alexander Regueiro 90041d638b Added support for trait aliases as object types. 2018-11-03 04:09:34 +00:00
QuietMisdreavus 014c8c4c38 implement existing parser fns in terms of fallible fns 2018-11-02 17:07:28 -05:00
QuietMisdreavus 0fe6aae49a buffer errors from initial tokenization when parsing 2018-11-01 11:57:29 -05:00
David Lavati 6c9f6a1afd Rename other occs of (Code/File)Map to Source(Map/File) #51574 2018-10-29 21:26:13 +01:00
Esteban Küber 54858d5a67 Fix regression 2018-10-29 09:39:58 -07:00
Pietro Albini 97ff2d6ab1 Rollup merge of #55384 - nnethercote:better-integer_lit-float_lit, r=michaelwoerister
Avoid unnecessary allocations in `float_lit` and `integer_lit`.

This commit avoids an allocation when parsing any float and integer
literals that don't involved underscores.

This reduces the number of allocations done for the `tuple-stress`
benchmark by 10%, reducing its instruction count by just under 1%.
2018-10-29 09:47:45 +01:00
Esteban Küber 3e22e0c3bc Use token description in "expected/found" parse messages 2018-10-28 16:05:50 -07:00
Esteban Küber adb96ec64b Provide specific label for patern parsing error 2018-10-28 14:38:00 -07:00
Esteban Küber d491734b15 Point at match when a parse failure ocurrs inside of it 2018-10-28 11:41:23 -07:00
Esteban Küber ea57134607 Produce targeted diagnostic when using doc comments on fn args
Before parsing argument names and types, try to consume an incorrectly
included doc comment or attribute in order to recover and continue
parsing the rest of the fn definition.
2018-10-28 11:38:50 -07:00
bors 4f5cfa611d Auto merge of #55192 - cramertj:nested-mod, r=petrochenkov
Fix ordering of nested modules in non-mod.rs mods

Flatten relative offset into directory path before adding inline
(mod x { ... }) module names to the current directory path.

Fix #55094
2018-10-28 13:13:55 +00:00
Nicholas Nethercote eb637d26ba Avoid unnecessary allocations in float_lit and integer_lit.
This commit avoids an allocation when parsing any float and integer
literals that don't involved underscores.

This reduces the number of allocations done for the `tuple-stress`
benchmark by 10%, reducing its instruction count by just under 1%.
2018-10-26 22:08:39 +11:00
Nick Cameron 59cb1705d7 rebasing and reviewer changes
Primarily refactoring `(Ident, Option<NodeId>)` to `Segment`
2018-10-26 09:50:51 +13:00
Nick Cameron fc67d8fac4 Give each PathSegment a NodeId 2018-10-26 09:48:44 +13:00
Vadim Petrochenkov 21d67c45a3 Fix a few tests with target-specific output
Enable one fully ignored test
2018-10-21 14:06:29 +03:00
ljedrz d28aed6dc4 Prefer unwrap_or_else to unwrap_or in case of function calls/allocations 2018-10-19 09:45:45 +02:00
Taylor Cramer ca35ca8395 Fix ordering of nested modules in non-mod.rs mods
Flatten relative offset into directory path before adding inline
(mod x { ... }) module names to the current directory path.

Fix #55094
2018-10-18 17:11:51 -07:00
Donato Sciarra 406cbf1a39 Support underscore as constant name
Issue: 54912
2018-10-14 10:14:58 +02:00
kennytm 644dbf99ed Rollup merge of #54967 - holmgr:master, r=estebank
Remove incorrect span for second label inner macro invocation

A fix for issue #54841
2018-10-12 22:04:16 +08:00
bors 849a0e9c40 Auto merge of #53933 - GuillaumeGomez:codeblock-error-display, r=QuietMisdreavus
Improve error display for codeblocks in rustdoc

Part of #53919.

r? @QuietMisdreavus
2018-10-12 09:23:10 +00:00
bors a534216fa6 Auto merge of #54850 - mcr431:fix-54707-trait-function-from-macro, r=nikomatsakis
Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls

Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls

Previously parsing trait items only handled opening brace token and semicolon, I added a branch to the match statement that will also handle interpolated blocks.
2018-10-11 09:19:23 +00:00
Manish Goregaokar e1e628ec87 Rollup merge of #54893 - dsciarra:issue-54379, r=pnkfelix
Fixes #47311.
r? @nrc
2018-10-10 15:59:21 -07:00
Manish Goregaokar 8ebc6d6dbb Rollup merge of #54862 - Havvy:cfg_attr_multi, r=petrochenkov
Fixes #47311.
r? @nrc
2018-10-10 15:58:40 -07:00
holmgr 05bb22d9e8 Remove incorrect span for second label inner macro invocation 2018-10-10 19:39:16 +02:00
Matthew Russo 344747330c parse_trait_item_ now handles interpolated blocks as function body decls 2018-10-08 22:50:34 -04:00
Donato Sciarra b7248d5988 Fix internal compiler error on malformed match arm pattern.
Issue: 54379
2018-10-07 13:14:21 +02:00