diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-09-16 08:49:53 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-09-19 12:10:23 -0700 |
| commit | fa496c9ded0ca63d34d1402c1b737db908094ea4 (patch) | |
| tree | a239998e69a85f479100f3c46a0b6fe8ae53752c | |
| parent | 02e3fb89a7e0c7944ed8237f5d307322879b6fcc (diff) | |
| download | rust-fa496c9ded0ca63d34d1402c1b737db908094ea4.tar.gz rust-fa496c9ded0ca63d34d1402c1b737db908094ea4.zip | |
Ignore obligations coming from desugared call spans
7 files changed, 195 insertions, 289 deletions
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 90489bd8d89..4db289a1824 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -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 { + 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; + } } } } diff --git a/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs b/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs index 13cc5ba1184..22bcbb1064d 100644 --- a/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs +++ b/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs @@ -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<(), ()> { diff --git a/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr b/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr index a7ff14f01d4..7caa9f26bc2 100644 --- a/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr +++ b/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr @@ -17,103 +17,103 @@ 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 @@ -121,13 +121,13 @@ LL | match await { await => () } | 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 @@ -138,7 +138,7 @@ 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` @@ -146,7 +146,7 @@ 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` @@ -154,7 +154,7 @@ 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` @@ -162,7 +162,7 @@ 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` @@ -170,7 +170,7 @@ 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` @@ -178,7 +178,7 @@ 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` @@ -186,7 +186,7 @@ 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` @@ -194,7 +194,7 @@ 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` @@ -202,7 +202,7 @@ 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` @@ -210,7 +210,7 @@ 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` @@ -218,7 +218,7 @@ 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` @@ -226,27 +226,22 @@ 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`. diff --git a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.rs b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.rs index a856420c347..7d1e5c3d64d 100644 --- a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.rs +++ b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.rs @@ -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 @@ -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 @@ -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 diff --git a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr index e06d81923f1..4edc00efc7e 100644 --- a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr +++ b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr @@ -1,5 +1,5 @@ error: expected one of `,` or `>`, found `&&` - --> $DIR/disallowed-positions.rs:248:14 + --> $DIR/disallowed-positions.rs:242:14 | LL | true && let 1 = 1 | ^^ expected one of `,` or `>` here @@ -41,7 +41,7 @@ LL | if -let 0 = 0 {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:47:9 + --> $DIR/disallowed-positions.rs:46:9 | LL | if (let 0 = 0)? {} | ^^^^^^^^^ @@ -50,7 +50,7 @@ LL | if (let 0 = 0)? {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:52:16 + --> $DIR/disallowed-positions.rs:50:16 | LL | if true || let 0 = 0 {} | ^^^^^^^^^ @@ -59,7 +59,7 @@ LL | if true || let 0 = 0 {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:53:17 + --> $DIR/disallowed-positions.rs:51:17 | LL | if (true || let 0 = 0) {} | ^^^^^^^^^ @@ -68,7 +68,7 @@ LL | if (true || let 0 = 0) {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:54:25 + --> $DIR/disallowed-positions.rs:52:25 | LL | if true && (true || let 0 = 0) {} | ^^^^^^^^^ @@ -77,7 +77,7 @@ LL | if true && (true || let 0 = 0) {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:55:25 + --> $DIR/disallowed-positions.rs:53:25 | LL | if true || (true && let 0 = 0) {} | ^^^^^^^^^ @@ -86,7 +86,7 @@ LL | if true || (true && let 0 = 0) {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:58:12 + --> $DIR/disallowed-positions.rs:56:12 | LL | if x = let 0 = 0 {} | ^^^^^^^^^ @@ -95,7 +95,7 @@ LL | if x = let 0 = 0 {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:61:15 + --> $DIR/disallowed-positions.rs:59:15 | LL | if true..(let 0 = 0) {} | ^^^^^^^^^ @@ -104,7 +104,7 @@ LL | if true..(let 0 = 0) {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:63:11 + --> $DIR/disallowed-positions.rs:61:11 | LL | if ..(let 0 = 0) {} | ^^^^^^^^^ @@ -113,7 +113,7 @@ LL | if ..(let 0 = 0) {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:65:9 + --> $DIR/disallowed-positions.rs:63:9 | LL | if (let 0 = 0).. {} | ^^^^^^^^^ @@ -122,7 +122,7 @@ LL | if (let 0 = 0).. {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:69:8 + --> $DIR/disallowed-positions.rs:67:8 | LL | if let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -131,7 +131,7 @@ LL | if let Range { start: _, end: _ } = true..true && false {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:73:8 + --> $DIR/disallowed-positions.rs:71:8 | LL | if let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -140,7 +140,7 @@ LL | if let Range { start: _, end: _ } = true..true || false {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:80:8 + --> $DIR/disallowed-positions.rs:78:8 | LL | if let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -149,7 +149,7 @@ LL | if let Range { start: F, end } = F..|| true {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:88:8 + --> $DIR/disallowed-positions.rs:86:8 | LL | if let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -158,7 +158,7 @@ LL | if let Range { start: true, end } = t..&&false {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:94:19 + --> $DIR/disallowed-positions.rs:92:19 | LL | if let true = let true = true {} | ^^^^^^^^^^^^^^^ @@ -167,7 +167,7 @@ LL | if let true = let true = true {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:98:12 + --> $DIR/disallowed-positions.rs:96:12 | LL | while &let 0 = 0 {} | ^^^^^^^^^ @@ -176,7 +176,7 @@ LL | while &let 0 = 0 {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:101:12 + --> $DIR/disallowed-positions.rs:99:12 | LL | while !let 0 = 0 {} | ^^^^^^^^^ @@ -185,7 +185,7 @@ LL | while !let 0 = 0 {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:102:12 + --> $DIR/disallowed-positions.rs:100:12 | LL | while *let 0 = 0 {} | ^^^^^^^^^ @@ -194,7 +194,7 @@ LL | while *let 0 = 0 {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:104:12 + --> $DIR/disallowed-positions.rs:102:12 | LL | while -let 0 = 0 {} | ^^^^^^^^^ @@ -203,7 +203,7 @@ LL | while -let 0 = 0 {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:113:12 + --> $DIR/disallowed-positions.rs:110:12 | LL | while (let 0 = 0)? {} | ^^^^^^^^^ @@ -212,7 +212,7 @@ LL | while (let 0 = 0)? {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:118:19 + --> $DIR/disallowed-positions.rs:114:19 | LL | while true || let 0 = 0 {} | ^^^^^^^^^ @@ -221,7 +221,7 @@ LL | while true || let 0 = 0 {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:119:20 + --> $DIR/disallowed-positions.rs:115:20 | LL | while (true || let 0 = 0) {} | ^^^^^^^^^ @@ -230,7 +230,7 @@ LL | while (true || let 0 = 0) {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:120:28 + --> $DIR/disallowed-positions.rs:116:28 | LL | while true && (true || let 0 = 0) {} | ^^^^^^^^^ @@ -239,7 +239,7 @@ LL | while true && (true || let 0 = 0) {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:121:28 + --> $DIR/disallowed-positions.rs:117:28 | LL | while true || (true && let 0 = 0) {} | ^^^^^^^^^ @@ -248,7 +248,7 @@ LL | while true || (true && let 0 = 0) {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:124:15 + --> $DIR/disallowed-positions.rs:120:15 | LL | while x = let 0 = 0 {} | ^^^^^^^^^ @@ -257,7 +257,7 @@ LL | while x = let 0 = 0 {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:127:18 + --> $DIR/disallowed-positions.rs:123:18 | LL | while true..(let 0 = 0) {} | ^^^^^^^^^ @@ -266,7 +266,7 @@ LL | while true..(let 0 = 0) {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:129:14 + --> $DIR/disallowed-positions.rs:125:14 | LL | while ..(let 0 = 0) {} | ^^^^^^^^^ @@ -275,7 +275,7 @@ LL | while ..(let 0 = 0) {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:131:12 + --> $DIR/disallowed-positions.rs:127:12 | LL | while (let 0 = 0).. {} | ^^^^^^^^^ @@ -284,7 +284,7 @@ LL | while (let 0 = 0).. {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:135:11 + --> $DIR/disallowed-positions.rs:131:11 | LL | while let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -293,7 +293,7 @@ LL | while let Range { start: _, end: _ } = true..true && false {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:139:11 + --> $DIR/disallowed-positions.rs:135:11 | LL | while let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -302,7 +302,7 @@ LL | while let Range { start: _, end: _ } = true..true || false {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:146:11 + --> $DIR/disallowed-positions.rs:142:11 | LL | while let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -311,7 +311,7 @@ LL | while let Range { start: F, end } = F..|| true {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:154:11 + --> $DIR/disallowed-positions.rs:150:11 | LL | while let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -320,7 +320,7 @@ LL | while let Range { start: true, end } = t..&&false {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:160:22 + --> $DIR/disallowed-positions.rs:156:22 | LL | while let true = let true = true {} | ^^^^^^^^^^^^^^^ @@ -329,7 +329,7 @@ LL | while let true = let true = true {} = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:174:6 + --> $DIR/disallowed-positions.rs:170:6 | LL | &let 0 = 0; | ^^^^^^^^^ @@ -338,7 +338,7 @@ LL | &let 0 = 0; = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:176:6 + --> $DIR/disallowed-positions.rs:172:6 | LL | !let 0 = 0; | ^^^^^^^^^ @@ -347,7 +347,7 @@ LL | !let 0 = 0; = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:177:6 + --> $DIR/disallowed-positions.rs:173:6 | LL | *let 0 = 0; | ^^^^^^^^^ @@ -356,7 +356,7 @@ LL | *let 0 = 0; = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:179:6 + --> $DIR/disallowed-positions.rs:175:6 | LL | -let 0 = 0; | ^^^^^^^^^ @@ -365,7 +365,7 @@ LL | -let 0 = 0; = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:188:6 + --> $DIR/disallowed-positions.rs:183:6 | LL | (let 0 = 0)?; | ^^^^^^^^^ @@ -374,7 +374,7 @@ LL | (let 0 = 0)?; = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:193:13 + --> $DIR/disallowed-positions.rs:187:13 | LL | true || let 0 = 0; | ^^^^^^^^^ @@ -383,7 +383,7 @@ LL | true || let 0 = 0; = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:194:14 + --> $DIR/disallowed-positions.rs:188:14 | LL | (true || let 0 = 0); | ^^^^^^^^^ @@ -392,7 +392,7 @@ LL | (true || let 0 = 0); = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:195:22 + --> $DIR/disallowed-positions.rs:189:22 | LL | true && (true || let 0 = 0); | ^^^^^^^^^ @@ -401,7 +401,7 @@ LL | true && (true || let 0 = 0); = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:198:9 + --> $DIR/disallowed-positions.rs:192:9 | LL | x = let 0 = 0; | ^^^^^^^^^ @@ -410,7 +410,7 @@ LL | x = let 0 = 0; = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:200:12 + --> $DIR/disallowed-positions.rs:194:12 | LL | true..(let 0 = 0); | ^^^^^^^^^ @@ -419,7 +419,7 @@ LL | true..(let 0 = 0); = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:201:8 + --> $DIR/disallowed-positions.rs:195:8 | LL | ..(let 0 = 0); | ^^^^^^^^^ @@ -428,7 +428,7 @@ LL | ..(let 0 = 0); = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:202:6 + --> $DIR/disallowed-positions.rs:196:6 | LL | (let 0 = 0)..; | ^^^^^^^^^ @@ -437,7 +437,7 @@ LL | (let 0 = 0)..; = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:204:6 + --> $DIR/disallowed-positions.rs:198:6 | LL | (let Range { start: _, end: _ } = true..true || false); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -446,7 +446,7 @@ LL | (let Range { start: _, end: _ } = true..true || false); = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:208:6 + --> $DIR/disallowed-positions.rs:202:6 | LL | (let true = let true = true); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -455,7 +455,7 @@ LL | (let true = let true = true); = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:208:17 + --> $DIR/disallowed-positions.rs:202:17 | LL | (let true = let true = true); | ^^^^^^^^^^^^^^^ @@ -464,7 +464,7 @@ LL | (let true = let true = true); = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:213:6 + --> $DIR/disallowed-positions.rs:207:6 | LL | &let 0 = 0 | ^^^^^^^^^ @@ -473,7 +473,7 @@ LL | &let 0 = 0 = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:224:17 + --> $DIR/disallowed-positions.rs:218:17 | LL | true && let 1 = 1 | ^^^^^^^^^ @@ -482,7 +482,7 @@ LL | true && let 1 = 1 = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:230:17 + --> $DIR/disallowed-positions.rs:224:17 | LL | true && let 1 = 1 | ^^^^^^^^^ @@ -491,7 +491,7 @@ LL | true && let 1 = 1 = note: as well as when nested within `&&` and parenthesis in those conditions error: `let` expressions are not supported here - --> $DIR/disallowed-positions.rs:236:17 + --> $DIR/disallowed-positions.rs:230:17 | LL | true && let 1 = 1 | ^^^^^^^^^ @@ -536,16 +536,17 @@ LL | if -let 0 = 0 {} | = note: an implementation of `std::ops::Neg` might be missing for `bool` -error[E0277]: the trait bound `bool: std::ops::Try` is not satisfied - --> $DIR/disallowed-positions.rs:47:8 +error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` + --> $DIR/disallowed-positions.rs:46:8 | LL | if (let 0 = 0)? {} - | ^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `bool` + | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool` | + = help: the trait `std::ops::Try` is not implemented for `bool` = note: required by `std::ops::Try::into_result` error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`) - --> $DIR/disallowed-positions.rs:47:8 + --> $DIR/disallowed-positions.rs:46:8 | LL | if (let 0 = 0)? {} | ^^^^^^^^^^^^ cannot use the `?` operator in a function that returns `()` @@ -554,7 +555,7 @@ LL | if (let 0 = 0)? {} = note: required by `std::ops::Try::from_error` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:58:8 + --> $DIR/disallowed-positions.rs:56:8 | LL | if x = let 0 = 0 {} | ^^^^^^^^^^^^^ @@ -566,7 +567,7 @@ LL | if x = let 0 = 0 {} found type `()` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:61:8 + --> $DIR/disallowed-positions.rs:59:8 | LL | if true..(let 0 = 0) {} | ^^^^^^^^^^^^^^^^^ expected bool, found struct `std::ops::Range` @@ -575,7 +576,7 @@ LL | if true..(let 0 = 0) {} found type `std::ops::Range<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:63:8 + --> $DIR/disallowed-positions.rs:61:8 | LL | if ..(let 0 = 0) {} | ^^^^^^^^^^^^^ expected bool, found struct `std::ops::RangeTo` @@ -584,7 +585,7 @@ LL | if ..(let 0 = 0) {} found type `std::ops::RangeTo<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:65:8 + --> $DIR/disallowed-positions.rs:63:8 | LL | if (let 0 = 0).. {} | ^^^^^^^^^^^^^ expected bool, found struct `std::ops::RangeFrom` @@ -593,7 +594,7 @@ LL | if (let 0 = 0).. {} found type `std::ops::RangeFrom<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:69:12 + --> $DIR/disallowed-positions.rs:67:12 | LL | if let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this match expression has type `bool` @@ -604,7 +605,7 @@ LL | if let Range { start: _, end: _ } = true..true && false {} found type `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:69:8 + --> $DIR/disallowed-positions.rs:67:8 | LL | if let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found struct `std::ops::Range` @@ -613,7 +614,7 @@ LL | if let Range { start: _, end: _ } = true..true && false {} found type `std::ops::Range<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:73:12 + --> $DIR/disallowed-positions.rs:71:12 | LL | if let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this match expression has type `bool` @@ -624,7 +625,7 @@ LL | if let Range { start: _, end: _ } = true..true || false {} found type `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:73:8 + --> $DIR/disallowed-positions.rs:71:8 | LL | if let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found struct `std::ops::Range` @@ -633,7 +634,7 @@ LL | if let Range { start: _, end: _ } = true..true || false {} found type `std::ops::Range<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:80:12 + --> $DIR/disallowed-positions.rs:78:12 | LL | if let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found struct `std::ops::Range` @@ -642,16 +643,16 @@ LL | if let Range { start: F, end } = F..|| true {} found type `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:80:41 + --> $DIR/disallowed-positions.rs:78:41 | LL | if let Range { start: F, end } = F..|| true {} | ^^^^^^^ expected bool, found closure | = note: expected type `bool` - found type `[closure@$DIR/disallowed-positions.rs:80:41: 80:48]` + found type `[closure@$DIR/disallowed-positions.rs:78:41: 78:48]` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:80:8 + --> $DIR/disallowed-positions.rs:78:8 | LL | if let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found struct `std::ops::Range` @@ -660,7 +661,7 @@ LL | if let Range { start: F, end } = F..|| true {} found type `std::ops::Range<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:88:12 + --> $DIR/disallowed-positions.rs:86:12 | LL | if let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this match expression has type `bool` @@ -671,7 +672,7 @@ LL | if let Range { start: true, end } = t..&&false {} found type `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:88:44 + --> $DIR/disallowed-positions.rs:86:44 | LL | if let Range { start: true, end } = t..&&false {} | ^^^^^^^ expected bool, found &&bool @@ -680,7 +681,7 @@ LL | if let Range { start: true, end } = t..&&false {} found type `&&bool` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:88:8 + --> $DIR/disallowed-positions.rs:86:8 | LL | if let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found struct `std::ops::Range` @@ -688,41 +689,17 @@ LL | if let Range { start: true, end } = t..&&false {} = note: expected type `bool` found type `std::ops::Range<bool>` -error[E0277]: the trait bound `bool: std::ops::Try` is not satisfied - --> $DIR/disallowed-positions.rs:47:8 - | -LL | if (let 0 = 0)? {} - | ^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `bool` - -error[E0277]: the trait bound `{integer}: std::ops::Try` is not satisfied - --> $DIR/disallowed-positions.rs:42:20 - | -LL | if let 0 = 0? {} - | ^ the trait `std::ops::Try` is not implemented for `{integer}` - | - = help: the following implementations were found: - <std::iter::LoopState<C, B> as std::ops::Try> - <std::option::Option<T> as std::ops::Try> - <std::result::Result<T, E> as std::ops::Try> - <std::task::Poll<std::option::Option<std::result::Result<T, E>>> as std::ops::Try> - <std::task::Poll<std::result::Result<T, E>> as std::ops::Try> - = note: required by `std::ops::Try::into_result` - -error[E0277]: the trait bound `{integer}: std::ops::Try` is not satisfied +error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` --> $DIR/disallowed-positions.rs:42:20 | LL | if let 0 = 0? {} - | ^^ the trait `std::ops::Try` is not implemented for `{integer}` + | ^^ the `?` operator cannot be applied to type `{integer}` | - = help: the following implementations were found: - <std::iter::LoopState<C, B> as std::ops::Try> - <std::option::Option<T> as std::ops::Try> - <std::result::Result<T, E> as std::ops::Try> - <std::task::Poll<std::option::Option<std::result::Result<T, E>>> as std::ops::Try> - <std::task::Poll<std::result::Result<T, E>> as std::ops::Try> + = help: the trait `std::ops::Try` is not implemented for `{integer}` + = note: required by `std::ops::Try::into_result` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:98:11 + --> $DIR/disallowed-positions.rs:96:11 | LL | while &let 0 = 0 {} | ^^^^^^^^^^ expected bool, found &bool @@ -731,29 +708,30 @@ LL | while &let 0 = 0 {} found type `&bool` error[E0614]: type `bool` cannot be dereferenced - --> $DIR/disallowed-positions.rs:102:11 + --> $DIR/disallowed-positions.rs:100:11 | LL | while *let 0 = 0 {} | ^^^^^^^^^^ error[E0600]: cannot apply unary operator `-` to type `bool` - --> $DIR/disallowed-positions.rs:104:11 + --> $DIR/disallowed-positions.rs:102:11 | LL | while -let 0 = 0 {} | ^^^^^^^^^^ cannot apply unary operator `-` | = note: an implementation of `std::ops::Neg` might be missing for `bool` -error[E0277]: the trait bound `bool: std::ops::Try` is not satisfied - --> $DIR/disallowed-positions.rs:113:11 +error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` + --> $DIR/disallowed-positions.rs:110:11 | LL | while (let 0 = 0)? {} - | ^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `bool` + | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool` | + = help: the trait `std::ops::Try` is not implemented for `bool` = note: required by `std::ops::Try::into_result` error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`) - --> $DIR/disallowed-positions.rs:113:11 + --> $DIR/disallowed-positions.rs:110:11 | LL | while (let 0 = 0)? {} | ^^^^^^^^^^^^ cannot use the `?` operator in a function that returns `()` @@ -762,7 +740,7 @@ LL | while (let 0 = 0)? {} = note: required by `std::ops::Try::from_error` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:124:11 + --> $DIR/disallowed-positions.rs:120:11 | LL | while x = let 0 = 0 {} | ^^^^^^^^^^^^^ @@ -774,7 +752,7 @@ LL | while x = let 0 = 0 {} found type `()` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:127:11 + --> $DIR/disallowed-positions.rs:123:11 | LL | while true..(let 0 = 0) {} | ^^^^^^^^^^^^^^^^^ expected bool, found struct `std::ops::Range` @@ -783,7 +761,7 @@ LL | while true..(let 0 = 0) {} found type `std::ops::Range<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:129:11 + --> $DIR/disallowed-positions.rs:125:11 | LL | while ..(let 0 = 0) {} | ^^^^^^^^^^^^^ expected bool, found struct `std::ops::RangeTo` @@ -792,7 +770,7 @@ LL | while ..(let 0 = 0) {} found type `std::ops::RangeTo<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:131:11 + --> $DIR/disallowed-positions.rs:127:11 | LL | while (let 0 = 0).. {} | ^^^^^^^^^^^^^ expected bool, found struct `std::ops::RangeFrom` @@ -801,7 +779,7 @@ LL | while (let 0 = 0).. {} found type `std::ops::RangeFrom<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:135:15 + --> $DIR/disallowed-positions.rs:131:15 | LL | while let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this match expression has type `bool` @@ -812,7 +790,7 @@ LL | while let Range { start: _, end: _ } = true..true && false {} found type `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:135:11 + --> $DIR/disallowed-positions.rs:131:11 | LL | while let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found struct `std::ops::Range` @@ -821,7 +799,7 @@ LL | while let Range { start: _, end: _ } = true..true && false {} found type `std::ops::Range<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:139:15 + --> $DIR/disallowed-positions.rs:135:15 | LL | while let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this match expression has type `bool` @@ -832,7 +810,7 @@ LL | while let Range { start: _, end: _ } = true..true || false {} found type `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:139:11 + --> $DIR/disallowed-positions.rs:135:11 | LL | while let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found struct `std::ops::Range` @@ -841,7 +819,7 @@ LL | while let Range { start: _, end: _ } = true..true || false {} found type `std::ops::Range<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:146:15 + --> $DIR/disallowed-positions.rs:142:15 | LL | while let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found struct `std::ops::Range` @@ -850,16 +828,16 @@ LL | while let Range { start: F, end } = F..|| true {} found type `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:146:44 + --> $DIR/disallowed-positions.rs:142:44 | LL | while let Range { start: F, end } = F..|| true {} | ^^^^^^^ expected bool, found closure | = note: expected type `bool` - found type `[closure@$DIR/disallowed-positions.rs:146:44: 146:51]` + found type `[closure@$DIR/disallowed-positions.rs:142:44: 142:51]` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:146:11 + --> $DIR/disallowed-positions.rs:142:11 | LL | while let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found struct `std::ops::Range` @@ -868,7 +846,7 @@ LL | while let Range { start: F, end } = F..|| true {} found type `std::ops::Range<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:154:15 + --> $DIR/disallowed-positions.rs:150:15 | LL | while let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this match expression has type `bool` @@ -879,7 +857,7 @@ LL | while let Range { start: true, end } = t..&&false {} found type `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:154:47 + --> $DIR/disallowed-positions.rs:150:47 | LL | while let Range { start: true, end } = t..&&false {} | ^^^^^^^ expected bool, found &&bool @@ -888,7 +866,7 @@ LL | while let Range { start: true, end } = t..&&false {} found type `&&bool` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:154:11 + --> $DIR/disallowed-positions.rs:150:11 | LL | while let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found struct `std::ops::Range` @@ -896,63 +874,40 @@ LL | while let Range { start: true, end } = t..&&false {} = note: expected type `bool` found type `std::ops::Range<bool>` -error[E0277]: the trait bound `bool: std::ops::Try` is not satisfied - --> $DIR/disallowed-positions.rs:113:11 - | -LL | while (let 0 = 0)? {} - | ^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `bool` - -error[E0277]: the trait bound `{integer}: std::ops::Try` is not satisfied - --> $DIR/disallowed-positions.rs:108:23 +error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` + --> $DIR/disallowed-positions.rs:106:23 | LL | while let 0 = 0? {} - | ^ the trait `std::ops::Try` is not implemented for `{integer}` - | - = help: the following implementations were found: - <std::iter::LoopState<C, B> as std::ops::Try> - <std::option::Option<T> as std::ops::Try> - <std::result::Result<T, E> as std::ops::Try> - <std::task::Poll<std::option::Option<std::result::Result<T, E>>> as std::ops::Try> - <std::task::Poll<std::result::Result<T, E>> as std::ops::Try> - = note: required by `std::ops::Try::into_result` - -error[E0277]: the trait bound `{integer}: std::ops::Try` is not satisfied - --> $DIR/disallowed-positions.rs:108:23 - | -LL | while let 0 = 0? {} - | ^^ the trait `std::ops::Try` is not implemented for `{integer}` + | ^^ the `?` operator cannot be applied to type `{integer}` | - = help: the following implementations were found: - <std::iter::LoopState<C, B> as std::ops::Try> - <std::option::Option<T> as std::ops::Try> - <std::result::Result<T, E> as std::ops::Try> - <std::task::Poll<std::option::Option<std::result::Result<T, E>>> as std::ops::Try> - <std::task::Poll<std::result::Result<T, E>> as std::ops::Try> + = help: the trait `std::ops::Try` is not implemented for `{integer}` + = note: required by `std::ops::Try::into_result` error[E0614]: type `bool` cannot be dereferenced - --> $DIR/disallowed-positions.rs:177:5 + --> $DIR/disallowed-positions.rs:173:5 | LL | *let 0 = 0; | ^^^^^^^^^^ error[E0600]: cannot apply unary operator `-` to type `bool` - --> $DIR/disallowed-positions.rs:179:5 + --> $DIR/disallowed-positions.rs:175:5 | LL | -let 0 = 0; | ^^^^^^^^^^ cannot apply unary operator `-` | = note: an implementation of `std::ops::Neg` might be missing for `bool` -error[E0277]: the trait bound `bool: std::ops::Try` is not satisfied - --> $DIR/disallowed-positions.rs:188:5 +error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` + --> $DIR/disallowed-positions.rs:183:5 | LL | (let 0 = 0)?; - | ^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `bool` + | ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool` | + = help: the trait `std::ops::Try` is not implemented for `bool` = note: required by `std::ops::Try::into_result` error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`) - --> $DIR/disallowed-positions.rs:188:5 + --> $DIR/disallowed-positions.rs:183:5 | LL | (let 0 = 0)?; | ^^^^^^^^^^^^ cannot use the `?` operator in a function that returns `()` @@ -961,7 +916,7 @@ LL | (let 0 = 0)?; = note: required by `std::ops::Try::from_error` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:204:10 + --> $DIR/disallowed-positions.rs:198:10 | LL | (let Range { start: _, end: _ } = true..true || false); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this match expression has type `bool` @@ -972,7 +927,7 @@ LL | (let Range { start: _, end: _ } = true..true || false); found type `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:213:5 + --> $DIR/disallowed-positions.rs:207:5 | LL | fn outside_if_and_while_expr() { | - help: try adding a return type: `-> &bool` @@ -983,76 +938,52 @@ LL | &let 0 = 0 = note: expected type `()` found type `&bool` -error[E0277]: the trait bound `bool: std::ops::Try` is not satisfied - --> $DIR/disallowed-positions.rs:188:5 - | -LL | (let 0 = 0)?; - | ^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `bool` - -error[E0277]: the trait bound `{integer}: std::ops::Try` is not satisfied - --> $DIR/disallowed-positions.rs:183:17 +error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` + --> $DIR/disallowed-positions.rs:179:17 | LL | let 0 = 0?; - | ^ the trait `std::ops::Try` is not implemented for `{integer}` - | - = help: the following implementations were found: - <std::iter::LoopState<C, B> as std::ops::Try> - <std::option::Option<T> as std::ops::Try> - <std::result::Result<T, E> as std::ops::Try> - <std::task::Poll<std::option::Option<std::result::Result<T, E>>> as std::ops::Try> - <std::task::Poll<std::result::Result<T, E>> as std::ops::Try> - = note: required by `std::ops::Try::into_result` - -error[E0277]: the trait bound `{integer}: std::ops::Try` is not satisfied - --> $DIR/disallowed-positions.rs:183:17 + | ^^ the `?` operator cannot be applied to type `{integer}` | -LL | let 0 = 0?; - | ^^ the trait `std::ops::Try` is not implemented for `{integer}` - | - = help: the following implementations were found: - <std::iter::LoopState<C, B> as std::ops::Try> - <std::option::Option<T> as std::ops::Try> - <std::result::Result<T, E> as std::ops::Try> - <std::task::Poll<std::option::Option<std::result::Result<T, E>>> as std::ops::Try> - <std::task::Poll<std::result::Result<T, E>> as std::ops::Try> + = help: the trait `std::ops::Try` is not implemented for `{integer}` + = note: required by `std::ops::Try::into_result` error[E0019]: constant contains unimplemented expression type - --> $DIR/disallowed-positions.rs:224:25 + --> $DIR/disallowed-positions.rs:218:25 | LL | true && let 1 = 1 | ^ error[E0019]: constant contains unimplemented expression type - --> $DIR/disallowed-positions.rs:224:21 + --> $DIR/disallowed-positions.rs:218:21 | LL | true && let 1 = 1 | ^ error[E0019]: constant contains unimplemented expression type - --> $DIR/disallowed-positions.rs:230:25 + --> $DIR/disallowed-positions.rs:224:25 | LL | true && let 1 = 1 | ^ error[E0019]: constant contains unimplemented expression type - --> $DIR/disallowed-positions.rs:230:21 + --> $DIR/disallowed-positions.rs:224:21 | LL | true && let 1 = 1 | ^ error[E0019]: constant contains unimplemented expression type - --> $DIR/disallowed-positions.rs:236:25 + --> $DIR/disallowed-positions.rs:230:25 | LL | true && let 1 = 1 | ^ error[E0019]: constant contains unimplemented expression type - --> $DIR/disallowed-positions.rs:236:21 + --> $DIR/disallowed-positions.rs:230:21 | LL | true && let 1 = 1 | ^ -error: aborting due to 115 previous errors +error: aborting due to 109 previous errors Some errors have detailed explanations: E0019, E0277, E0308, E0600, E0614. For more information about an error, try `rustc --explain E0019`. diff --git a/src/test/ui/try-operator-on-main.rs b/src/test/ui/try-operator-on-main.rs index 3372fac5707..602c3c5c359 100644 --- a/src/test/ui/try-operator-on-main.rs +++ b/src/test/ui/try-operator-on-main.rs @@ -10,7 +10,6 @@ fn main() { // a non-`Try` type on a non-`Try` fn ()?; //~ ERROR the `?` operator can only - //~^ ERROR the trait bound `(): std::ops::Try` is not satisfied // an unrelated use of `Try` try_trait_generic::<()>(); //~ ERROR the trait bound @@ -20,8 +19,7 @@ fn main() { fn try_trait_generic<T: Try>() -> T { // and a non-`Try` object on a `Try` fn. - ()?; //~ ERROR the trait bound `(): std::ops::Try` is not satisfied - //~^ ERROR the trait bound `(): std::ops::Try` is not satisfied + ()?; //~ ERROR the `?` operator can only be applied to values that implement `std::ops::Try` loop {} } diff --git a/src/test/ui/try-operator-on-main.stderr b/src/test/ui/try-operator-on-main.stderr index 07d99c16dbf..6878cd80629 100644 --- a/src/test/ui/try-operator-on-main.stderr +++ b/src/test/ui/try-operator-on-main.stderr @@ -7,25 +7,17 @@ LL | std::fs::File::open("foo")?; = help: the trait `std::ops::Try` is not implemented for `()` = note: required by `std::ops::Try::from_error` -error[E0277]: the trait bound `(): std::ops::Try` is not satisfied - --> $DIR/try-operator-on-main.rs:12:5 - | -LL | ()?; - | ^^ the trait `std::ops::Try` is not implemented for `()` - | - = note: required by `std::ops::Try::into_result` - -error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`) +error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` --> $DIR/try-operator-on-main.rs:12:5 | LL | ()?; - | ^^^ cannot use the `?` operator in a function that returns `()` + | ^^^ the `?` operator cannot be applied to type `()` | = help: the trait `std::ops::Try` is not implemented for `()` - = note: required by `std::ops::Try::from_error` + = note: required by `std::ops::Try::into_result` error[E0277]: the trait bound `(): std::ops::Try` is not satisfied - --> $DIR/try-operator-on-main.rs:16:5 + --> $DIR/try-operator-on-main.rs:15:5 | LL | try_trait_generic::<()>(); | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `()` @@ -33,20 +25,15 @@ LL | try_trait_generic::<()>(); LL | fn try_trait_generic<T: Try>() -> T { | ----------------------------------- required by `try_trait_generic` -error[E0277]: the trait bound `(): std::ops::Try` is not satisfied - --> $DIR/try-operator-on-main.rs:23:5 +error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` + --> $DIR/try-operator-on-main.rs:22:5 | LL | ()?; - | ^^ the trait `std::ops::Try` is not implemented for `()` + | ^^^ the `?` operator cannot be applied to type `()` | + = help: the trait `std::ops::Try` is not implemented for `()` = note: required by `std::ops::Try::into_result` -error[E0277]: the trait bound `(): std::ops::Try` is not satisfied - --> $DIR/try-operator-on-main.rs:23:5 - | -LL | ()?; - | ^^^ the trait `std::ops::Try` is not implemented for `()` - -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. |
