8000 Rollup of 7 pull requests by Mark-Simulacrum · Pull Request #65109 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 7 pull requests #65109

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
Closed
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9fbb2a9
Fix missing calls to drop on unwind with lto=fat; issue 64655.
pnkfelix Oct 2, 2019
a371972
Regression tests for issue 64655.
pnkfelix Oct 2, 2019
3adcc3e
fix typo
pnkfelix Oct 2, 2019
e7e6dec
Apply suggestions from code review
pnkfelix Oct 3, 2019
5e7e8cd
Update attributes.rs
pnkfelix Oct 3, 2019
71e5f78
Update issue-64655-extern-rust-must-allow-unwind.rs
pnkfelix Oct 3, 2019
1222cc9
permit asyncawait-ondeck to be added by anyone
nikomatsakis Oct 3, 2019
1fcbd90
Update triagebot.toml
nikomatsakis Oct 3, 2019
ed60cf2
When encountering chained operators use heuristics to recover from ba…
estebank Sep 30, 2019
6c9f298
review comments
estebank Sep 30, 2019
d7dceaa
Account for missing turbofish in paths too
estebank Sep 30, 2019
d27683a
Prove bad turbofish parser recovery in test
estebank Sep 30, 2019
dfdc369
review comments
estebank Oct 1, 2019
f1499a8
review comments
estebank Oct 1, 2019
02f57f8
review comments
estebank Oct 3, 2019
76456e7
review comments
estebank Oct 4, 2019
d896088
Upgrade librustc_macros dependencies
mati865 Oct 4, 2019
2d87bac
replace GeneratorSubsts with SubstsRef
csmoe Oct 3, 2019
fa7a87b
generate GeneratorSubsts from SubstsRef
csmoe Oct 3, 2019
774ea80
replace GeneratorSubsts inside related types
csmoe Oct 3, 2019
ef9fe10
remove GeneratorSubsts visitors
csmoe Oct 3, 2019
afc0bb9
clean up GeneratorSubsts
csmoe Oct 3, 2019
e9009c8
[const-prop] Fix ICE when trying to eval polymorphic promoted MIR
wesleywiser Oct 3, 2019
08ec3fe
dont run these tests on targets that default to panic=abort.
pnkfelix Oct 4, 2019
91a096a
move middle::liveness to rustc_passes
Mark-Simulacrum Oct 4, 2019
bb70782
middle::dead -> rustc_passes
Mark-Simulacrum Oct 4, 2019
82bfd8e
middle::entry -> rustc_passes
Mark-Simulacrum Oct 4, 2019
7c3f65b
middle::intrinsicck -> rustc_passes
Mark-Simulacrum Oct 4, 2019
c4ec53f
Rollup merge of #64909 - estebank:turbofish-reloaded, r=Centril
Mark-Simulacrum Oct 4, 2019
2889139
Rollup merge of #65020 - pnkfelix:targetted-fix-for-always-marking-ru…
Mark-Simulacrum Oct 4, 2019
b7c3e07
Rollup merge of #65064 - rust-lang:permit-asyncawait-ondeck-by-anyone…
Mark-Simulacrum Oct 4, 2019
dc87b27
Rollup merge of #65066 - wesleywiser:fix_const_prop_ice_on_polymorphi…
Mark-Simulacrum Oct 4, 2019
aa98a2b
Rollup merge of #65100 - csmoe:generator, r=nikomatsakis
Mark-Simulacrum Oct 4, 2019
18f62d7
Rollup merge of #65101 - mati865:rustc_macro-deps, r=nikomatsakis
Mark-Simulacrum Oct 4, 2019
4c094e1
Rollup merge of #65105 - Mark-Simulacrum:split-librustc, r=nikomatsakis
Mark-Simulacrum Oct 4, 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
review comments
  • Loading branch information
estebank committed Oct 3, 2019
commit 6c9f298a8bee9b1716b2e6fcdb8305c3f4874fc6
87 changes: 49 additions & 38 deletions src/libsyntax/parse/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ impl<'a> Parser<'a> {
);
match lhs.kind {
ExprKind::Binary(op, _, _) if op.node.is_comparison() => {

// Respan to include both operators.
let op_span = op.span.to(self.prev_span);
let mut err = self.struct_span_err(
Expand All @@ -573,70 +574,63 @@ impl<'a> Parser<'a> {
let msg = "use `::<...>` instead of `<...>` if you meant to specify type \
arguments";
if *outer_op == AssocOp::Less {
// if self.look_ahead(1, |t| t.kind == token::Lt || t.kind == token::ModSep) {
let snapshot = self.clone();
self.bump();
// So far we have parsed `foo<bar<`
let mut acc = 1;
while acc > 0 {
match &self.token.kind {
token::Lt => {
acc += 1;
}
token::Gt => {
acc -= 1;
}
token::BinOp(token::Shr) => {
acc -= 2;
}
token::Eof => {
break;
}
_ => {}
}
self.bump();
}
// So far we have parsed `foo<bar<`, consume the rest of the type params
let modifiers = vec![
(token::Lt, 1),
(token::Gt, -1),
(token::BinOp(token::Shr), -2),
];
let early_return = vec![token::Eof];
self.consume_tts(1, &modifiers[..], &early_return[..]);

if self.token.kind != token::OpenDelim(token::Paren) {
// We don't have `foo< bar >(`, so we rewind the parser and bail out.
mem::replace(self, snapshot.clone());
}
}
if self.token.kind == token::OpenDelim(token::Paren) {
// We have high certainty that this was a bad turbofish at this point.
// `foo< bar >(`
err.span_suggestion(
op_span.shrink_to_lo(),
msg,
"::".to_string(),
Applicability::MaybeIncorrect,
);

let snapshot = self.clone();
self.bump();
let mut acc = 1;
while acc > 0 {
match &self.token.kind {
token::OpenDelim(token::Paren) => {
acc += 1;
}
token::CloseDelim(token::Paren) => {
acc -= 1;
}
token::Eof => {
break;
}
_ => {}
}
self.bump();
}

// Consume the fn call arguments.
let modifiers = vec![
(token::OpenDelim(token::Paren), 1),
(token::CloseDelim(token::Paren), -1),
];
let early_return = vec![token::Eof];
self.bump(); // `(`
self.consume_tts(1, &modifiers[..], &early_return[..]);

if self.token.kind == token::Eof {
// Not entirely sure now, but we bubble the error up with the
// suggestion.
mem::replace(self, snapshot);
return Err(err);
} else {
// 99% certain that the suggestion is correct, continue parsing.
err.emit();
// FIXME: actually check that the two expressions in the binop are
// paths and resynthesize new fn call expression instead of using
// `ExprKind::Err` placeholder.
return Ok(Some(self.mk_expr(
lhs.span.to(self.prev_span),
ExprKind::Err,
ThinVec::new(),
)));
}
} else {
// All we know is that this is `foo < bar >` and *nothing* else. Try to
// be helpful, but don't attempt to recover.
err.help(msg);
err.help("or use `(...)` if you meant to specify fn arguments");
// These cases cause too many knock-down errors, bail out (#61329).
Expand Down Expand Up @@ -1424,6 +1418,23 @@ impl<'a> Parser<'a> {
err
}

fn consume_tts(
&mut self,
mut acc: i64,
modifier: &[(token::TokenKind, i64)], // Not using FxHasMap and FxHashSet due to
early_return: &[token::TokenKind], // `token::TokenKind: !Eq + !Hash`.
) {
while acc > 0 {
if let Some((_, val)) = modifier.iter().filter(|(t, _)| *t == self.token.kind).next() {
acc += *val;
}
if early_return.contains(&self.token.kind) {
break;
}
self.bump();
}
}

/// Replace duplicated recovered parameters with `_` pattern to avoid unecessary errors.
///
/// This is necessary because at this point we don't know whether we parsed a function with
Expand Down
0