Commit Graph

3196 Commits

Author SHA1 Message Date
varkor
6015edf9af Remove name from GenericParamKind::Lifetime 2018-06-20 12:23:08 +01:00
varkor
80dbe58efc Use ParamBounds in WhereRegionPredicate 2018-06-20 12:23:07 +01:00
varkor
aed530a457 Lift bounds into GenericParam 2018-06-20 12:22:46 +01:00
varkor
3bcb006fd9 Rename structures in ast 2018-06-20 12:21:52 +01:00
varkor
2c6ff2469a Refactor ast::GenericParam as a struct 2018-06-20 12:21:08 +01:00
varkor
d643946550 Rename ast::GenericParam and ast::GenericArg
It's so confusing to have everything having the same name, at least while refactoring.
2018-06-20 12:19:04 +01:00
varkor
76c0d68745 Rename "parameter" to "arg" 2018-06-20 12:19:04 +01:00
varkor
1ed60a9173 Rename *Parameter to *Param 2018-06-20 12:19:04 +01:00
varkor
494859e8dd Consolidate PathParameters and AngleBracketedParameterData 2018-06-20 12:19:03 +01:00
bors
ed39523406 Auto merge of #51278 - EPashkin:fix_mod_with_multilevel_paths_on_windows, r=nikomatsakis
Fix processing mod with multi-level path on Windows

Fix error in [rustfmt](https://github.com/rust-lang-nursery/rustfmt/issues/1754) because libsyntax can not handle `mod` with multilevel path on Windows.

Alternative is do almost same in https://github.com/rust-lang/rust/blob/master/src/libstd/sys/windows/fs.rs#L717 to allow work on paths with different separators, Ex. "\\\\?\\c:\\windows/temp"
2018-06-19 02:17:52 +00:00
bors
9181741ede Auto merge of #51549 - PSeitz:patch-1, r=kennytm
Follow up to #51508, make parse_block public instead parse_block_expr

This is an follow up to #51508

I mistakenly made parse_block_expr public instead of parse_block.
This fixes this.
2018-06-17 14:05:43 +00:00
bors
594b05dd97 Auto merge of #51425 - QuietMisdreavus:thats-def-a-namespace-there, r=petrochenkov
refactor: create multiple HIR items for imports

When lowering `use` statements into HIR, they get a `Def` of the thing they're pointing at. This is great for things that need to know what was just pulled into scope. However, this is a bit misleading, because a `use` statement can pull things from multiple namespaces if their names collide. This is a problem for rustdoc, because if there are a module and a function with the same name (for example) then it will only document the module import, because that's that the lowered `use` statement points to.

The current version of this PR does the following:

* Whenever the resolver comes across a `use` statement, it loads the definitions into a new `import_map` instead of the existing `def_map`. This keeps the resolutions per-namespace so that all the target definitions are available.
* When lowering `use` statements, it looks up the resolutions in the `import_map` and creates multiple `Item`s if there is more than one resolution.
* To ensure the `NodeId`s are properly tracked in the lowered module, they need to be created in the AST, and pulled out as needed if multiple resolutions are available.

Fixes https://github.com/rust-lang/rust/issues/34843
2018-06-17 09:48:10 +00:00
PSeitz
b1c0857f62 Follow up on https://github.com/rust-lang/rust/pull/51508, make parse_block public instead parse_block_expr
This is an follow up to #51508

I mistakenly made parse_block_expr public instead of parse_block.
This fixes this.
2018-06-16 08:00:14 +02:00
bors
967c1f3be1 Auto merge of #50296 - cmdd:master, r=nikomatsakis
Add error message for using >= 65535 hashes for raw string literal escapes

Fixes #50111.
2018-06-15 19:05:25 +00:00
QuietMisdreavus
122b5b47c2 create multiple HIR items for a use statement 2018-06-14 17:47:28 -05:00
Mark Rousskov
1e06b1757c
Rollup merge of #51502 - jebrosen:pub_parse_methods, r=Mark-Simulacrum
Make parse_seq_to_end and parse_path public

(see SergioBenitez/Rocket#660, rust-lang/rust#51265)

Rocket currently uses `parse_seq_to_end` and `parse_path` in its codegen macros. Assuming I tested correctly, this is the minimal set of methods that are currently necessary to build Rocket again. I would be happy to add documentation of this and Rocket's other usages, if desired.
2018-06-12 11:22:53 -06:00
bors
a1aae290d5 Auto merge of #51508 - PSeitz:master, r=Mark-Simulacrum
Make span_fatal and parse_block public

span_fatal and parse_block  were made private in #51265. These methods are used in stainless.

Related #51498 #51504
2018-06-12 11:06:09 +00:00
PSeitz
6fd9ede0cd
Make span_fatal and parse_block public
span_fatal and parse_block  were made private in #51265. These methods are used in stainless.

Related #51498 #51504
2018-06-11 21:19:12 +02:00
jeb
7e56261fcb Make parse_seq_to_end and parse_path public 2018-06-11 10:40:58 -06:00
Seiichi Uchida
ed74b0b016 Make parse_ident public 2018-06-11 23:04:11 +09:00
bors
a805a2a5eb Auto merge of #50205 - topecongiro:include-parens-to-type-parameter, r=petrochenkov
Include parens to type parameter

The motivation of this PR is to fix a bug in rustfmt (cc https://github.com/rust-lang-nursery/rustfmt/issues/2630).
2018-06-10 20:09:22 +00:00
Seiichi Uchida
699be41809 Simplify an error handling in the parser 2018-06-10 10:37:38 +09:00
Seiichi Uchida
78a19d9b88 Include parens to type parameter 2018-06-10 10:37:38 +09:00
Mark Simulacrum
60058e5dbe Crate-ify and delete unused code in syntax::parse 2018-06-09 16:57:19 -06:00
bors
61d88318aa Auto merge of #51068 - Crazycolorz5:pluseqsplitting, r=petrochenkov
parser: Split `+=` into `+` and `=` where `+` is explicitly requested (such as generics)

Added functions in tokens to check whether a token leads with `+`. Used them when parsing to allow for token splitting of `+=` into `+` and `=`.
Fixes https://github.com/rust-lang/rust/issues/47856
2018-06-09 17:46:36 +00:00
Mark Rousskov
71865fb947
Rollup merge of #51099 - Crazycolorz5:expectedcloseparen, r=estebank
Fix Issue 38777

When looking through for a closing bracket in the loop condition, adds them to expecteds.
https://github.com/rust-lang/rust/issues/38777
2018-06-08 17:20:57 -06:00
David Cao
313d6c53df provide error message when using more than 65535 hash symbols for raw strings 2018-06-08 15:32:28 -07:00
Niko Matsakis
b417701ac1 add an explanatory comment 2018-06-07 00:26:31 +03:00
bors
35aeecb8aa Auto merge of #51201 - estebank:dotdot, r=petrochenkov
Accept `..` in incorrect position to avoid further errors

We currently give a specific message when encountering a `..` anywhere
other than the end of a pattern. Modify the parser to accept it (while
still emitting the error) so that we don't also trigger "missing fields
in pattern" errors afterwards.

Add suggestions to either remove trailing `,` or moving the `..` to the
end.

Follow up to #49268.
2018-06-06 14:04:06 +00:00
Esteban Küber
d66d35bb91 Account for comma in suggestion 2018-06-05 08:48:55 -07:00
Esteban Küber
cbc70a0d68 Improve diagnostics for incorrect .. usage
When using `..` somewhere other than the end, parse the rest of the
pattern correctly while still emitting an error.

Add suggestions to either remove trailing `,` or moving the `..` to the
end.
2018-06-05 08:48:55 -07:00
Esteban Küber
8f4a5429c2 Accept .. in incorrect position to avoid further errors
We currently give a specific message when encountering a `..` anywhere
other than the end of a pattern. Modify the parser to accept it (while
still emitting the error) so that we don't also trigger "missing fields
in pattern" errors afterwards.
2018-06-05 08:48:54 -07:00
Crazycolorz5
759a0e07b5 Fixed indentation error. 2018-06-04 22:25:01 -04:00
Crazycolorz5
812ace6e86 Fixed incorrect check_plus to token.is_like_plus. 2018-06-04 22:25:01 -04:00
Crazycolorz5
a5dc83d970 Tidy fixes. 2018-06-04 22:25:01 -04:00
Crazycolorz5
7a9ffa7307 Added is_like_plus to token, and used that in place of equality comparison to Plus token. 2018-06-04 22:25:00 -04:00
Crazycolorz5
682033c4e4 Implemented eat_plus and used it in parsing parse_ty_param_bounds_common. 2018-06-04 22:25:00 -04:00
Yaron Tausky
3303e6847b Suggest not mutably borrowing a mutable reference
This commit is concerned with the case where the user tries to mutably
borrow a mutable reference, thereby triggering an error. Instead of the
existing suggestion to make the binding mutable, the compiler will now
suggest to avoid borrowing altogether.
2018-06-01 23:17:10 +02:00
Evgenii Pashkin
bd6c81aebb Fix processing mod with multi-level path on Windows 2018-06-01 21:09:42 +03:00
Crazycolorz5
c1df62a760 Add closing bracket expectation to sequences, modified appropriate test cases. 2018-06-01 10:05:46 -04:00
Guillaume Gomez
7552c2ea64
Rollup merge of #51240 - nnethercote:parse-2, r=nikomatsakis
Two minor parsing tweaks
2018-05-31 22:17:16 +02:00
Nicholas Nethercote
5adba8e9d9 Avoid an unnecessary match when lexing "<-". 2018-05-31 16:05:39 +10:00
Nicholas Nethercote
3af6291eff Tweak identifer lexing.
By calling `bump()` after getting the first char, to avoid a redundant
`ident_continue()` test on it.
2018-05-31 16:04:33 +10:00
bors
16cd84ee22 Auto merge of #50724 - zackmdavis:applicability_rush, r=Manishearth
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-28 10:11:26 +00:00
bors
1a6bda68cd Auto merge of #51075 - 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-27 03:32:47 +00:00
Esteban Küber
7dec8a4e99 Fix test 2018-05-26 12:03:50 -07:00
bors
1e504d301c Auto merge of #51072 - petrochenkov:ifield, r=eddyb
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-26 16:56:22 +00:00
Vadim Petrochenkov
1e4269cb83 Add Ident::as_str helper 2018-05-26 15:20:23 +03:00
Zack M. Davis
6437295b17 in which we check for confusable Unicodepoints in float literal exponent
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-25 20:48:31 -07:00
Niko Matsakis
01d6ed525f restore emplacement syntax (obsolete) 2018-05-24 18:49:58 -04:00