8000 Rollup of 5 pull requests by Centril · Pull Request #64955 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 5 pull requests #64955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 37 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a3639c6
Make all alt builders produce parallel-enabled compilers
Mark-Simulacrum Sep 23, 2019
d2c0d10
[const-prop] Handle MIR Rvalue::Repeat
wesleywiser Sep 14, 2019
f290467
syntax: cleanup method parsing.
Centril Sep 29, 2019
378cc98
syntax: `is_named_argument` -> `is_named_param`.
Centril Sep 29, 2019
4fa9c3b
syntax refactor `parse_fn_params`
Centril Sep 29, 2019
40dc9da
syntax refactor `parse_self_param` (1)
Centril Sep 29, 2019
f688f8a
syntax refactor `parse_self_param` (2)
Centril Sep 29, 2019
ac454e9
syntax refactor `parse_self_param` (3)
Centril Sep 30, 2019
4306d00
syntax refactor `parse_self_param` (4)
Centril Sep 30, 2019
0492302
syntax refactor `parse_self_param` (5)
Centril Sep 30, 2019
347deac
syntax: reorder param parsing to make more sense.
Centril Sep 30, 2019
d9d0e5d
syntax: cleanup `parse_fn_decl`.
Centril Sep 30, 2019
5b80ead
syntax: misc cleanup
Centril Sep 30, 2019
66bf323
syntax: cleanup `parse_visibility`.
Centril Sep 30, 2019
573a8d8
syntax: extract `error_on_invalid_abi`.
Centril Sep 30, 2019
258e86a
syntax: fuse more code paths together.
Centril Sep 30, 2019
bea404f
syntax: stylistic cleanup in item parsing.
Centril Sep 30, 2019
151ce96
syntax: reduce repetition in fn parsing.
Centril Sep 30, 2019
b0b073c
Self-Profiling: Refactor SelfProfiler API to be RAII based where poss…
michaelwoerister Sep 27, 2019
d942622
Self-Profiling: Make names of existing events more consistent and use…
michaelwoerister Sep 27, 2019
85f2945
[const-prop] Handle MIR Rvalue::Aggregates
wesleywiser Sep 14, 2019
ea78010
[const-prop] Handle MIR Rvalue::Discriminant
wesleywiser Sep 15, 2019
b3234a3
[const-prop] Handle MIR Rvalue::Box
wesleywiser Sep 15, 2019
5804c3b
Cleanup const_prop() some
wesleywiser Sep 15, 2019
1a1067d
Make the default parallelism 1
Mark-Simulacrum Sep 30, 2019
df298b4
syntax: document some methods.
Centril Oct 1, 2019
30647d1
syntax: put helpers of `parse_self_param` in the method.
Centril Oct 1, 2019
49780d2
syntax: merge things back into `parse_visibility`.
Centril Oct 1, 2019
e046904
syntax: de-closure-ify `check_or_expected`.
Centril Oct 1, 2019
5c5dd80
syntax: reformat passing of `FnHeader` to `parse_item_fn`.
Centril Oct 1, 2019
3237ded
Add long error explanation for E0495
GuillaumeGomez Sep 12, 2019
be89e52
update ui tests
GuillaumeGomez Sep 12, 2019
5ac7e21
Rollup merge of #64404 - GuillaumeGomez:err-E0495, r=cramertj
Centril Oct 1, 2019
525159b
Rollup merge of #64722 - Mark-Simulacrum:alt-parallel, r=alexcrichton
Centril Oct 1, 2019
e5bef70
Rollup merge of #64840 - michaelwoerister:self-profiling-raii-refacto…
Centril Oct 1, 2019
4707702
Rollup merge of #64890 - wesleywiser:const_prop_rvalue, r=oli-obk
Centril Oct 1, 2019
35e8755
Rollup merge of #64910 - Centril:params-cleanup, r=petrochenkov
Centril Oct 1, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
syntax refactor parse_self_param (2)
  • Loading branch information
Centril committed Sep 30, 2019
commit f688f8aedffcd802012b355c182dafbdf5e819f5
27 changes: 16 additions & 11 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1264,17 +1264,22 @@ impl<'a> Parser<'a> {
&& self.look_ahead(n + 1, |t| t != &token::ModSep)
}

fn expect_self_ident(&mut self) -> Ident {
match self.token.kind {
// Preserve hygienic context.
token::Ident(name, _) => {
let span = self.token.span;
self.bump();
Ident::new(name, span)
}
_ => unreachable!(),
}
}

/// Returns the parsed optional self parameter and whether a self shortcut was used.
///
/// See `parse_self_param_with_attrs` to collect attributes.
fn parse_self_param(&mut self) -> PResult<'a, Option<Param>> {
let expect_ident = |this: &mut Self| match this.token.kind {
// Preserve hygienic context.
token::Ident(name, _) =>
{ let span = this.token.span; this.bump(); Ident::new(name, span) }
_ => unreachable!()
};

// Parse optional `self` parameter of a method.
// Only a limited set of initial token sequences is considered `self` parameters; anything
// else is parsed as a normal function parameter list, so some lookahead is required.
Expand Down Expand Up @@ -1308,7 +1313,7 @@ impl<'a> Parser<'a> {
SelfKind::Region(Some(lt), Mutability::Mutable)
} else {
return Ok(None);
}, expect_ident(self), self.prev_span)
}, self.expect_self_ident(), self.prev_span)
}
token::BinOp(token::Star) => {
// `*self`
Expand All @@ -1333,13 +1338,13 @@ impl<'a> Parser<'a> {
SelfKind::Value(Mutability::Immutable)
} else {
return Ok(None);
}, expect_ident(self), self.prev_span)
}, self.expect_self_ident(), self.prev_span)
}
token::Ident(..) => {
if self.is_isolated_self(0) {
// `self`
// `self: TYPE`
let eself_ident = expect_ident(self);
let eself_ident = self.expect_self_ident();
let eself_hi = self.prev_span;
(if self.eat(&token::Colon) {
let ty = self.parse_ty()?;
Expand All @@ -1352,7 +1357,7 @@ impl<'a> Parser<'a> {
// `mut self`
// `mut self: TYPE`
self.bump();
let eself_ident = expect_ident(self);
let eself_ident = self.expect_self_ident();
let eself_hi = self.prev_span;
(if self.eat(&token::Colon) {
let ty = self.parse_ty()?;
Expand Down
0