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

Skip to content

Rollup of 8 pull requests #64626

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 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e608549
Filter out stmts made for the redundant_semicolon lint when pretty-pr…
nathanwhit Sep 12, 2019
96526d4
Add test for redundant_semicolon lint interaction with proc macro attrs
nathanwhit Sep 12, 2019
194d357
Document `From` trait for `LhsExpr`
crgl Sep 3, 2019
8112f71
rustbuild: Turn down compression on exe installers
alexcrichton Sep 19, 2019
1ab5593
factor out pluralisation remains after #64280
Sep 19, 2019
fde8cfe
rustbuild: Turn down compression on msi installers
alexcrichton Sep 19, 2019
255dd3f
rustbuild: Improve output of `dist` step
alexcrichton Sep 19, 2019
02e3fb8
When possible point at argument causing item obligation failure
estebank Sep 16, 2019
fa496c9
Ignore obligations coming from desugared call spans
estebank Sep 16, 2019
5976e0e
Review comment: move to its own method
estebank Sep 16, 2019
2fbd692
When possible, suggest fn call
estebank Sep 16, 2019
c1ed439
review comments
estebank Sep 18, 2019
09f05d2
review comments
estebank Sep 19, 2019
d64c90d
remove duplicated code
estebank Sep 19, 2019
3db2c13
Add Compatibility Notes to RELEASES.md for 1.38.0
XAMPPRocky Sep 19, 2019
c34d9e6
add comments
estebank Sep 19, 2019
bd4090b
Rollup merge of #64136 - crgl:doc-from-parser-lhs, r=Centril
Centril Sep 20, 2019
906f74c
Rollup merge of #64342 - glorv:master, r=varkor
Centril Sep 20, 2019
fa5d8ab
Rollup merge of #64387 - nathanwhit:redundant-semi-fix, r=varkor
Centril Sep 20, 2019
c54aa52
Rollup merge of #64498 - estebank:point-at-arg, r=Centril
Centril Sep 20, 2019
539aaff
Rollup merge of #64615 - alexcrichton:smaller-exe, r=Mark-Simulacrum
Centril Sep 20, 2019
5a667aa
Rollup merge of #64617 - alexcrichton:smaller-msi, r=Mark-Simulacrum
Centril Sep 20, 2019
0c5f9a9
Rollup merge of #64618 - alexcrichton:improve-dist-output, r=Mark-Sim…
Centril Sep 20, 2019
5c610c8
Rollup merge of #64621 - XAMPPRocky:relnotes, r=Mark-Simulacrum
Centril Sep 20, 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
Ignore obligations coming from desugared call spans
  • Loading branch information
estebank committed Sep 19, 2019
commit fa496c9ded0ca63d34d1402c1b737db908094ea4
28 changes: 15 additions & 13 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3273,21 +3273,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if let Err(
mut errors,
) = self.fulfillment_cx.borrow_mut().select_where_possible(self) {
for error in &mut errors {
if let ty::Predicate::Trait(predicate) = error.obligation.predicate {
let mut referenced_in = vec![];
for (i, ty) in &final_arg_types {
let ty = self.resolve_vars_if_possible(ty);
info!("final ty {} {:?}", i, ty);
for ty in ty.walk() {
info!("walk {:?}", ty);
if ty == predicate.skip_binder().self_ty() {
referenced_in.push(*i);
if !sp.desugaring_kind().is_some() {
// We *do not* do this for desugared call spans to keep good diagnostics
// involving try.
for error in &mut errors {
if let ty::Predicate::Trait(predicate) = error.obligation.predicate {
8000 let mut referenced_in = vec![];
for (i, ty) in &final_arg_types {
let ty = self.resolve_vars_if_possible(ty);
for ty in ty.walk() {
if ty == predicate.skip_binder().self_ty() {
referenced_in.push(*i);
}
}
}
}
if referenced_in.len() == 1 {
error.obligation.cause.span = args[referenced_in[0]].span;
if referenced_in.len() == 1 {
error.obligation.cause.span = args[referenced_in[0]].span;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ async fn foo2() -> Result<(), ()> {
}
async fn foo3() -> Result<(), ()> {
let _ = await bar()?; //~ ERROR incorrect use of `await`
//~^ ERROR the trait bound `impl std::future::Future: std::ops::Try` is not satisfied
//~| ERROR the trait bound `impl std::future::Future: std::ops::Try` is not satisfied
//~^ ERROR the `?` operator can only be applied to values that implement `std::ops::Try`
Ok(())
}
async fn foo21() -> Result<(), ()> {
Expand Down
9E88
Original file line number Diff line number Diff line change
Expand Up @@ -17,117 +17,117 @@ LL | let _ = await bar()?;
| ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar()?.await`

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:22:13
--> $DIR/incorrect-syntax-suggestions.rs:21:13
|
LL | let _ = await { bar() };
| ^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ bar() }.await`

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:26:13
--> $DIR/incorrect-syntax-suggestions.rs:25:13
|
LL | let _ = await(bar());
| ^^^^^^^^^^^^ help: `await` is a postfix operation: `(bar()).await`

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:30:13
--> $DIR/incorrect-syntax-suggestions.rs:29:13
|
LL | let _ = await { bar() }?;
| ^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ bar() }.await`

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:34:14
--> $DIR/incorrect-syntax-suggestions.rs:33:14
|
LL | let _ = (await bar())?;
| ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:38:24
--> $DIR/incorrect-syntax-suggestions.rs:37:24
|
LL | let _ = bar().await();
| ^^ help: `await` is not a method call, remove the parentheses

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:42:24
--> $DIR/incorrect-syntax-suggestions.rs:41:24
|
LL | let _ = bar().await()?;
| ^^ help: `await` is not a method call, remove the parentheses

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:54:13
--> $DIR/incorrect-syntax-suggestions.rs:53:13
|
LL | let _ = await bar();
| ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:59:13
--> $DIR/incorrect-syntax-suggestions.rs:58:13
|
LL | let _ = await? bar();
| ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await?`

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:64:13
--> $DIR/incorrect-syntax-suggestions.rs:63:13
|
LL | let _ = await bar()?;
| ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar()?.await`

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:69:14
--> $DIR/incorrect-syntax-suggestions.rs:68:14
|
LL | let _ = (await bar())?;
| ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:74:24
--> $DIR/incorrect-syntax-suggestions.rs:73:24
|
LL | let _ = bar().await();
| ^^ help: `await` is not a method call, remove the parentheses

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:79:24
--> $DIR/incorrect-syntax-suggestions.rs:78:24
|
LL | let _ = bar().await()?;
| ^^ help: `await` is not a method call, remove the parentheses

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:107:13
--> $DIR/incorrect-syntax-suggestions.rs:106:13
|
LL | let _ = await!(bar());
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:111:13
--> $DIR/incorrect-syntax-suggestions.rs:110:13
|
LL | let _ = await!(bar())?;
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:116:17
--> $DIR/incorrect-syntax-suggestions.rs:115:17
|
LL | let _ = await!(bar())?;
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:124:17
--> $DIR/incorrect-syntax-suggestions.rs:123:17
|
LL | let _ = await!(bar())?;
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`

error: expected expression, found `=>`
--> $DIR/incorrect-syntax-suggestions.rs:132:25
--> $DIR/incorrect-syntax-suggestions.rs:131:25
|
LL | match await { await => () }
| ----- ^^ expected expression
| |
| while parsing this incorrect await expression

error: incorrect use of `await`
--> $DIR/incorrect-syntax-suggestions.rs:132:11
--> $DIR/incorrect-syntax-suggestions.rs:131:11
|
LL | match await { await => () }
| ^^^^^^^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ await => () }.await`

error: expected one of `.`, `?`, `{`, or an operator, found `}`
--> $DIR/incorrect-syntax-suggestions.rs:135:1
--> $DIR/incorrect-syntax-suggestions.rs:134:1
|
LL | match await { await => () }
| ----- - expected one of `.`, `?`, `{`, or an operator here
Expand All @@ -138,115 +138,110 @@ LL | }
| ^ unexpected token

error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/incorrect-syntax-suggestions.rs:54:13
--> $DIR/incorrect-syntax-suggestions.rs:53:13
|
LL | fn foo9() -> Result<(), ()> {
| ---- this is not `async`
LL | let _ = await bar();
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/incorrect-syntax-suggestions.rs:59:13
--> $DIR/incorrect-syntax-suggestions.rs:58:13
|
LL | fn foo10() -> Result<(), ()> {
| ----- this is not `async`
LL | let _ = await? bar();
| ^^^^^^^^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/incorrect-syntax-suggestions.rs:64:13
--> $DIR/incorrect-syntax-suggestions.rs:63:13
|
LL | fn foo11() -> Result<(), ()> {
| ----- this is not `async`
LL | let _ = await bar()?;
| ^^^^^^^^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/incorrect-syntax-suggestions.rs:69:14
--> $DIR/incorrect-syntax-suggestions.rs:68:14
|
LL | fn foo12() -> Result<(), ()> {
| ----- this is not `async`
LL | let _ = (await bar())?;
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/incorrect-syntax-suggestions.rs:74:13
--> $DIR/incorrect-syntax-suggestions.rs:73:13
|
LL | fn foo13() -> Result<(), ()> {
| ----- this is not `async`
LL | let _ = bar().await();
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/incorrect-syntax-suggestions.rs:79:13
--> $DIR/incorrect-syntax-suggestions.rs:78:13
|
LL | fn foo14() -> Result<(), ()> {
| ----- this is not `async`
LL | let _ = bar().await()?;
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/incorrect-syntax-suggestions.rs:84:13
--> $DIR/incorrect-syntax-suggestions.rs:83:13
|
LL | fn foo15() -> Result<(), ()> {
| ----- this is not `async`
LL | let _ = bar().await;
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/incorrect-syntax-suggestions.rs:88:13
--> $DIR/incorrect-syntax-suggestions.rs:87:13
|
LL | fn foo16() -> Result<(), ()> {
| ----- this is not `async`
LL | let _ = bar().await?;
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/incorrect-syntax-suggestions.rs:93:17
--> $DIR/incorrect-syntax-suggestions.rs:92:17
|
LL | fn foo() -> Result<(), ()> {
| --- this is not `async`
LL | let _ = bar().await?;
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/incorrect-syntax-suggestions.rs:100:17
--> $DIR/incorrect-syntax-suggestions.rs:99:17
|
LL | let foo = || {
| -- this is not `async`
LL | let _ = bar().await?;
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/incorrect-syntax-suggestions.rs:116:17
--> $DIR/incorrect-syntax-suggestions.rs:115:17
|
LL | fn foo() -> Result<(), ()> {
| --- this is not `async`
LL | let _ = await!(bar())?;
| ^^^^^^^^^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/incorrect-syntax-suggestions.rs:124:17
--> $DIR/incorrect-syntax-suggestions.rs:123:17
|
LL | let foo = || {
| -- this is not `async`
LL | let _ = await!(bar())?;
| ^^^^^^^^^^^^^ only allowed inside `async` functions and blocks

error[E0277]: the trait bound `impl std::future::Future: std::ops::Try` is not satisfied
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
--> $DIR/incorrect-syntax-suggestions.rs:16:19
|
LL | let _ = await bar()?;
| ^^^^^ the trait `std::ops::Try` is not implemented for `impl std::future::Future`
| ^^^^^^ the `?` operator cannot be applied to type `impl std::future::Future`
|
= help: the trait `std::ops::Try` is not implemented for `impl std::future::Future`
= note: required by `std::ops::Try::into_result`

error[E0277]: the trait bound `impl std::future::Future: std::ops::Try` is not satisfied
--> $DIR/incorrect-syntax-suggestions.rs:16:19
|
LL | let _ = await bar()?;
| ^^^^^^ the trait `std::ops::Try` is not implemented for `impl std::future::Future`

error: aborting due to 36 previous errors
error: aborting due to 35 previous errors

For more information about this error, try `rustc --explain E0277`.
24 changes: 9 additions & 15 deletions src/test/ui/rfc-2497-if-let-chains/disallowed-positions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ fn nested_within_if_expr() {

fn _check_try_binds_tighter() -> Result<(), ()> {
if let 0 = 0? {}
//~^ ERROR the trait bound `{integer}: std::ops::Try` is not satisfied
//~| ERROR the trait bound `{integer}: std::ops::Try` is not satisfied
//~^ ERROR the `?` operator can only be applied to values that implement `std::ops::Try`
Ok(())
}
if (let 0 = 0)? {} //~ ERROR `let` expressions are not supported here
//~^ ERROR the trait bound `bool: std::ops::Try` is not satisfied
//~| ERROR the trait bound `bool: std::ops::Try` is not satisfied
//~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option`
//~^ ERROR the `?` operator can only be applied to values that implement `std::ops::Try`
//~| ERROR the `?` operator can only be used in a function that returns `Result`

if true || let 0 = 0 {} //~ ERROR `let` expressions are not supported here
if (true || let 0 = 0) {} //~ ERROR `let` expressions are not supported here
Expand Down Expand Up @@ -106,14 +104,12 @@ fn nested_within_while_expr() {

fn _check_try_binds_tighter() -> Result<(), ()> {
while let 0 = 0? {}
//~^ ERROR the trait bound `{integer}: std::ops::Try` is not satisfied
//~| ERROR the trait bound `{integer}: std::ops::Try` is not satisfied
//~^ ERROR the `?` operator can only be applied to values that implement `std::ops::Try`
Ok(())
}
while (let 0 = 0)? {} //~ ERROR `let` expressions are not supported here
//~^ ERROR the trait bound `bool: std::ops::Try` is not satisfied
//~| ERROR the trait bound `bool: std::ops::Try` is not satisfied
//~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option`
//~^ ERROR the `?` operator can only be applied to values that implement `std::ops::Try`
//~| ERROR the `?` operator can only be used in a function that returns `Result`

while true || let 0 = 0 {} //~ ERROR `let` expressions are not supported here
while (true || let 0 = 0) {} //~ ERROR `let` expressions are not supported here
Expand Down Expand Up @@ -181,14 +177,12 @@ fn outside_if_and_while_expr() {

fn _check_try_binds_tighter() -> Result<(), ()> {
let 0 = 0?;
//~^ ERROR the trait bound `{integer}: std::ops::Try` is not satisfied
//~| ERROR the trait bound `{integer}: std::ops::Try` is not satisfied
//~^ ERROR the `?` operator can only be applied to values that implement `std::ops::Try`
Ok(())
}
(let 0 = 0)?; //~ ERROR `let` expressions are not supported here
//~^ ERROR the trait bound `bool: std::ops::Try` is not satisfied
//~| ERROR the trait bound `bool: std::ops::Try` is not satisfied
//~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option`
//~^ ERROR the `?` operator can only be used in a function that returns `Result`
//~| ERROR the `?` operator can only be applied to values that implement `std::ops::Try`

true || let 0 = 0; //~ ERROR `let` expressions are not supported here
(true || let 0 = 0); //~ ERROR `let` expressions are not supported here
Expand Down
Loading
0