Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a9985cf

Browse files
committedFeb 2, 2023
Auto merge of #107584 - matthiaskrgr:rollup-vav4ljz, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #107201 (Remove confusing 'while checking' note from opaque future type mismatches) - #107312 (Add Style Guide rules for let-else statements) - #107488 (Fix syntax in `-Zunpretty-expanded` output for derived `PartialEq`.) - #107531 (Inline CSS background images directly into the CSS) - #107576 (Add proc-macro boilerplate to crt-static test) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 821b2a8 + 643fc97 commit a9985cf

28 files changed

+155
-254
lines changed
 

‎compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,30 @@ pub fn expand_deriving_partial_eq(
2929
cx.span_bug(field.span, "not exactly 2 arguments in `derive(PartialEq)`");
3030
};
3131

32-
// We received `&T` arguments. Convert them to `T` by
33-
// stripping `&` or adding `*`. This isn't necessary for
34-
// type checking, but it results in much better error
35-
// messages if something goes wrong.
32+
// We received arguments of type `&T`. Convert them to type `T` by stripping
33+
// any leading `&` or adding `*`. This isn't necessary for type checking, but
34+
// it results in better error messages if something goes wrong.
35+
//
36+
// Note: for arguments that look like `&{ x }`, which occur with packed
37+
// structs, this would cause expressions like `{ self.x } == { other.x }`,
38+
// which isn't valid Rust syntax. This wouldn't break compilation because these
39+
// AST nodes are constructed within the compiler. But it would mean that code
40+
// printed by `-Zunpretty=expanded` (or `cargo expand`) would have invalid
41+
// syntax, which would be suboptimal. So we wrap these in parens, giving
42+
// `({ self.x }) == ({ other.x })`, which is valid syntax.
3643
let convert = |expr: &P<Expr>| {
3744
if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Not, inner) =
3845
&expr.kind
3946
{
40-
inner.clone()
47+
if let ExprKind::Block(..) = &inner.kind {
48+
// `&{ x }` form: remove the `&`, add parens.
49+
cx.expr_paren(field.span, inner.clone())
50+
} else {
51+
// `&x` form: remove the `&`.
52+
inner.clone()
53+
}
4154
} else {
55+
// No leading `&`: add a leading `*`.
4256
cx.expr_deref(field.span, expr.clone())
4357
}
4458
};

‎compiler/rustc_expand/src/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,10 @@ impl<'a> ExtCtxt<'a> {
272272
self.expr(sp, ast::ExprKind::AddrOf(ast::BorrowKind::Ref, ast::Mutability::Not, e))
273273
}
274274

275+
pub fn expr_paren(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr> {
276+
self.expr(sp, ast::ExprKind::Paren(e))
277+
}
278+
275279
pub fn expr_call(
276280
&self,
277281
span: Span,

‎compiler/rustc_infer/src/infer/error_reporting/mod.rs

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ use crate::traits::{
6060

6161
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
6262
use rustc_errors::{pluralize, struct_span_err, Diagnostic, ErrorGuaranteed, IntoDiagnosticArg};
63-
use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString, MultiSpan};
63+
use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString};
6464
use rustc_hir as hir;
6565
use rustc_hir::def::DefKind;
6666
use rustc_hir::def_id::{DefId, LocalDefId};
@@ -1470,51 +1470,17 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
14701470
for (key, values) in types.iter() {
14711471
let count = values.len();
14721472
let kind = key.descr();
1473-
let mut returned_async_output_error = false;
14741473
for &sp in values {
1475-
if sp.is_desugaring(DesugaringKind::Async) && !returned_async_output_error {
1476-
if [sp] != err.span.primary_spans() {
1477-
let mut span: MultiSpan = sp.into();
1478-
span.push_span_label(
1479-
sp,
1480-
format!(
1481-
"checked the `Output` of this `async fn`, {}{} {}{}",
1482-
if count > 1 { "one of the " } else { "" },
1483-
target,
1484-
kind,
1485-
pluralize!(count),
1486-
),
1487-
);
1488-
err.span_note(
1489-
span,
1490-
"while checking the return type of the `async fn`",
1491-
);
1492-
} else {
1493-
err.span_label(
1494-
sp,
1495-
format!(
1496-
"checked the `Output` of this `async fn`, {}{} {}{}",
1497-
if count > 1 { "one of the " } else { "" },
1498-
target,
1499-
kind,
1500-
pluralize!(count),
1501-
),
1502-
);
1503-
err.note("while checking the return type of the `async fn`");
1504-
}
1505-
returned_async_output_error = true;
1506-
} else {
1507-
err.span_label(
1508-
sp,
1509-
format!(
1510-
"{}{} {}{}",
1511-
if count == 1 { "the " } else { "one of the " },
1512-
target,
1513-
kind,
1514-
pluralize!(count),
1515-
),
1516-
);
1517-
}
1474+
err.span_label(
1475+
sp,
1476+
format!(
1477+
"{}{} {}{}",
1478+
if count == 1 { "the " } else { "one of the " },
1479+
target,
1480+
kind,
1481+
pluralize!(count),
1482+
),
1483+
);
15181484
}
15191485
}
15201486
}
@@ -1537,7 +1503,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
15371503
// |
15381504
// = note: expected unit type `()`
15391505
// found closure `[closure@$DIR/issue-20862.rs:2:5: 2:14 x:_]`
1540-
if !self.ignore_span.overlaps(span) {
1506+
//
1507+
// Also ignore opaque `Future`s that come from async fns.
1508+
if !self.ignore_span.overlaps(span)
1509+
&& !span.is_desugaring(DesugaringKind::Async)
1510+
{
15411511
self.types.entry(kind).or_default().insert(span);
15421512
}
15431513
}

‎src/doc/style-guide/src/statements.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,84 @@ let Foo {
9999
);
100100
```
101101

102+
#### else blocks (let-else statements)
103+
104+
If a let statement contains an `else` component, also known as a let-else statement,
105+
then the `else` component should be formatted according to the same rules as the `else` block
106+
in [control flow expressions (i.e. if-else, and if-let-else expressions)](./expressions.md#control-flow-expressions).
107+
Apply the same formatting rules to the components preceding
108+
the `else` block (i.e. the `let pattern: Type = initializer_expr ...` portion)
109+
as described [above](#let-statements)
110+
111+
Similarly to if-else expressions, if the initializer
112+
expression is multi-lined, then the `else` keyword and opening brace of the block (i.e. `else {`)
113+
should be put on the same line as the end of the initializer
114+
expression with a preceding space if all the following are true:
115+
116+
* The initializer expression ends with one or more closing
117+
parentheses, square brackets, and/or braces
118+
* There is nothing else on that line
119+
* That line is not indented beyond the indent of the first line containing the `let` keyword
120+
121+
For example:
122+
123+
```rust
124+
let Some(x) = y.foo(
125+
"abc",
126+
fairly_long_identifier,
127+
"def",
128+
"123456",
129+
"string",
130+
"cheese",
131+
) else {
132+
bar()
133+
}
134+
```
135+
136+
Otherwise, the `else` keyword and opening brace should be placed on the next line after the end of the initializer expression, and should not be indented (the `else` keyword should be aligned with the `let` keyword).
137+
138+
For example:
139+
140+
```rust
141+
let Some(x) = abcdef()
142+
.foo(
143+
"abc",
144+
some_really_really_really_long_ident,
145+
"ident",
146+
"123456",
147+
)
148+
.bar()
149+
.baz()
150+
.qux("fffffffffffffffff")
151+
else {
152+
foo_bar()
153+
}
154+
```
155+
156+
##### Single line let-else statements
157+
158+
The entire let-else statement may be formatted on a single line if all the following are true:
159+
160+
* the entire statement is *short*
161+
* the `else` block contains a single-line expression and no statements
162+
* the `else` block contains no comments
163+
* the let statement components preceding the `else` block can be formatted on a single line
164+
165+
```rust
166+
let Some(1) = opt else { return };
167+
168+
let Some(1) = opt else {
169+
return;
170+
};
171+
172+
let Some(1) = opt else {
173+
// nope
174+
return
175+
};
176+
```
177+
178+
Formatters may allow users to configure the value of the threshold
179+
used to determine whether a let-else statement is *short*.
102180

103181
### Macros in statement position
104182

‎src/librustdoc/html/static/css/rustdoc.css

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -814,8 +814,11 @@ so that we can apply CSS-filters to change the arrow color in themes */
814814
background-repeat: no-repeat;
815815
background-size: 20px;
816816
background-position: calc(100% - 2px) 56%;
817-
/* image is black color */
818-
background-image: url("down-arrow-927217e04c7463ac.svg");
817+
/* down arrow (image is black color) */
818+
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" \
819+
width="128" height="128" viewBox="-30 -20 176 176"><path d="M111,40.5L64,87.499L17,40.5" \
820+
fill="none" stroke="black" strike-linecap="square" stroke-miterlimit="10" stroke-width="12"/> \
821+
</svg>');
819822
/* changes the arrow image color */
820823
filter: var(--crate-search-div-filter);
821824
}
@@ -1444,7 +1447,10 @@ details.toggle > summary.hideme > span {
14441447
}
14451448

14461449
details.toggle > summary::before {
1447-
background: url("toggle-plus-1092eb4930d581b0.svg") no-repeat top left;
1450+
/* toggle plus */
1451+
background: url('data:image/svg+xml,<svg width="17" height="17" \
1452+
shape-rendering="crispEdges" stroke="black" fill="none" xmlns="http://www.w3.org/2000/svg"><path \
1453+
d="M5 2.5H2.5v12H5m7-12h2.5v12H12M5 8.5h7M8.5 12V8.625v0V5"/></svg>') no-repeat top left;
14481454
content: "";
14491455
cursor: pointer;
14501456
width: 16px;
@@ -1522,7 +1528,10 @@ details.toggle[open] > summary.hideme > span {
15221528
}
15231529

15241530
details.toggle[open] > summary::before {
1525-
background: url("toggle-minus-31bbd6e4c77f5c96.svg") no-repeat top left;
1531+
/* toggle minus */
1532+
background: url('data:image/svg+xml,<svg width="17" height="17" \
1533+
shape-rendering="crispEdges" stroke="black" fill="none" xmlns="http://www.w3.org/2000/svg"><path \
1534+
d="M5 2.5H2.5v12H5m7-12h2.5v12H12M5 8.5h7"/></svg>') no-repeat top left;
15261535
}
15271536

15281537
details.toggle[open] > summary::after {

‎src/librustdoc/html/static/images/down-arrow.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/librustdoc/html/static/images/toggle-minus.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/librustdoc/html/static/images/toggle-plus.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/librustdoc/html/static_files.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ static_files! {
102102
scrape_examples_js => "static/js/scrape-examples.js",
103103
wheel_svg => "static/images/wheel.svg",
104104
clipboard_svg => "static/images/clipboard.svg",
105-
down_arrow_svg => "static/images/down-arrow.svg",
106-
toggle_minus_png => "static/images/toggle-minus.svg",
107-
toggle_plus_png => "static/images/toggle-plus.svg",
108105
copyright => "static/COPYRIGHT.txt",
109106
license_apache => "static/LICENSE-APACHE.txt",
110107
license_mit => "static/LICENSE-MIT.txt",

‎tests/ui/async-await/dont-suggest-missing-await.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ LL | take_u32(x)
66
| |
77
| arguments to this function are incorrect
88
|
9-
note: while checking the return type of the `async fn`
10-
--> $DIR/dont-suggest-missing-await.rs:7:24
11-
|
12-
LL | async fn make_u32() -> u32 {
13-
| ^^^ checked the `Output` of this `async fn`, found opaque type
149
= note: expected type `u32`
1510
found opaque type `impl Future<Output = u32>`
1611
note: function defined here

‎tests/ui/async-await/generator-desc.stderr

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,6 @@ LL | fun(one(), two());
2121
| |
2222
| arguments to this function are incorrect
2323
|
24-
note: while checking the return type of the `async fn`
25-
--> $DIR/generator-desc.rs:5:16
26-
|
27-
LL | async fn one() {}
28-
| ^ checked the `Output` of this `async fn`, expected opaque type
29-
note: while checking the return type of the `async fn`
30-
--> $DIR/generator-desc.rs:6:16
31-
|
32-
LL | async fn two() {}
33-
| ^ checked the `Output` of this `async fn`, found opaque type
3424
= note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/generator-desc.rs:5:16>)
3525
found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/generator-desc.rs:6:16>)
3626
= help: consider `await`ing on both `Future`s

‎tests/ui/async-await/issue-61076.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ async fn struct_() -> Struct {
5454
}
5555

5656
async fn tuple() -> Tuple {
57-
//~^ NOTE checked the `Output` of this `async fn`, expected opaque type
58-
//~| NOTE while checking the return type of the `async fn`
59-
//~| NOTE in this expansion of desugaring of `async` block or function
6057
Tuple(1i32)
6158
}
6259

‎tests/ui/async-await/issue-61076.stderr

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LL | foo().await?;
1111
| ++++++
1212

1313
error[E0277]: the `?` operator can only be applied to values that implement `Try`
14-
--> $DIR/issue-61076.rs:65:5
14+
--> $DIR/issue-61076.rs:62:5
1515
|
1616
LL | t?;
1717
| ^^ the `?` operator cannot be applied to type `T`
@@ -23,7 +23,7 @@ LL | t.await?;
2323
| ++++++
2424

2525
error[E0609]: no field `0` on type `impl Future<Output = Tuple>`
26-
--> $DIR/issue-61076.rs:74:26
26+
--> $DIR/issue-61076.rs:71:26
2727
|
2828
LL | let _: i32 = tuple().0;
2929
| ^ field not available in `impl Future`, but it is available in its `Output`
@@ -34,7 +34,7 @@ LL | let _: i32 = tuple().await.0;
3434
| ++++++
3535

3636
error[E0609]: no field `a` on type `impl Future<Output = Struct>`
37-
--> $DIR/issue-61076.rs:78:28
37+
--> $DIR/issue-61076.rs:75:28
3838
|
3939
LL | let _: i32 = struct_().a;
4040
| ^ field not available in `impl Future`, but it is available in its `Output`
@@ -45,7 +45,7 @@ LL | let _: i32 = struct_().await.a;
4545
| ++++++
4646

4747
error[E0599]: no method named `method` found for opaque type `impl Future<Output = Struct>` in the current scope
48-
--> $DIR/issue-61076.rs:82:15
48+
--> $DIR/issue-61076.rs:79:15
4949
|
5050
LL | struct_().method();
5151
| ^^^^^^ method not found in `impl Future<Output = Struct>`
@@ -56,19 +56,14 @@ LL | struct_().await.method();
5656
| ++++++
5757

5858
error[E0308]: mismatched types
59-
--> $DIR/issue-61076.rs:91:9
59+
--> $DIR/issue-61076.rs:88:9
6060
|
6161
LL | match tuple() {
6262
| ------- this expression has type `impl Future<Output = Tuple>`
6363
LL |
6464
LL | Tuple(_) => {}
6565
| ^^^^^^^^ expected opaque type, found `Tuple`
6666
|
67-
note: while checking the return type of the `async fn`
68-
--> $DIR/issue-61076.rs:56:21
69-
|
70-
LL | async fn tuple() -> Tuple {
71-
| ^^^^^ checked the `Output` of this `async fn`, expected opaque type
7267
= note: expected opaque type `impl Future<Output = Tuple>`
7368
found struct `Tuple`
7469
help: consider `await`ing on the `Future`

‎tests/ui/async-await/issue-98634.stderr

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Futu
44
LL | StructAsync { callback }.await;
55
| ^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
66
|
7-
note: while checking the return type of the `async fn`
8-
--> $DIR/issue-98634.rs:24:21
9-
|
10-
LL | async fn callback() {}
11-
| ^ checked the `Output` of this `async fn`, found opaque type
127
= note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>`
138
found opaque type `impl Future<Output = ()>`
149
note: required by a bound in `StructAsync`
@@ -23,11 +18,6 @@ error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Futu
2318
LL | StructAsync { callback }.await;
2419
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
2520
|
26-
note: while checking the return type of the `async fn`
27-
--> $DIR/issue-98634.rs:24:21
28-
|
29-
LL | async fn callback() {}
30-
| ^ checked the `Output` of this `async fn`, found opaque type
3121
= note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>`
3222
found opaque type `impl Future<Output = ()>`
3323
note: required by a bound in `StructAsync`
@@ -42,11 +32,6 @@ error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Futu
4232
LL | StructAsync { callback }.await;
4333
| ^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
4434
|
45-
note: while checking the return type of the `async fn`
46-
--> $DIR/issue-98634.rs:24:21
47-
|
48-
LL | async fn callback() {}
49-
| ^ checked the `Output` of this `async fn`, found opaque type
5035
= note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>`
5136
found opaque type `impl Future<Output = ()>`
5237
note: required by a bound in `StructAsync`

‎tests/ui/async-await/issues/issue-102206.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ LL | std::mem::size_of_val(foo());
88
| | help: consider borrowing here: `&foo()`
99
| arguments to this function are incorrect
1010
|
11-
note: while checking the return type of the `async fn`
12-
--> $DIR/issue-102206.rs:3:16
13-
|
14-
LL | async fn foo() {}
15-
| ^ checked the `Output` of this `async fn`, found opaque type
1611
= note: expected reference `&_`
1712
found opaque type `impl Future<Output = ()>`
1813
note: function defined here

‎tests/ui/async-await/suggest-missing-await-closure.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ LL | take_u32(x)
66
| |
77
| arguments to this function are incorrect
88
|
9-
note: while checking the return type of the `async fn`
10-
--> $DIR/suggest-missing-await-closure.rs:8:24
11-
|
12-
LL | async fn make_u32() -> u32 {
13-
| ^^^ checked the `Output` of this `async fn`, found opaque type
149
= note: expected type `u32`
1510
found opaque type `impl Future<Output = u32>`
1611
note: function defined here

‎tests/ui/async-await/suggest-missing-await.stderr

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ LL | take_u32(x)
66
| |
77
| arguments to this function are incorrect
88
|
9-
note: while checking the return type of the `async fn`
10-
--> $DIR/suggest-missing-await.rs:5:24
11-
|
12-
LL | async fn make_u32() -> u32 {
13-
| ^^^ checked the `Output` of this `async fn`, found opaque type
149
= note: expected type `u32`
1510
found opaque type `impl Future<Output = u32>`
1611
note: function defined here
@@ -29,11 +24,6 @@ error[E0308]: mismatched types
2924
LL | dummy()
3025
| ^^^^^^^ expected `()`, found opaque type
3126
|
32-
note: while checking the return type of the `async fn`
33-
--> $DIR/suggest-missing-await.rs:18:18
34-
|
35-
LL | async fn dummy() {}
36-
| ^ checked the `Output` of this `async fn`, found opaque type
3727
= note: expected unit type `()`
3828
found opaque type `impl Future<Output = ()>`
3929
help: consider `await`ing on the `Future`
@@ -60,11 +50,6 @@ LL | |
6050
LL | | };
6151
| |_____- `if` and `else` have incompatible types
6252
|
63-
note: while checking the return type of the `async fn`
64-
--> $DIR/suggest-missing-await.rs:18:18
65-
|
66-
LL | async fn dummy() {}
67-
| ^ checked the `Output` of this `async fn`, expected opaque type
6853
= note: expected opaque type `impl Future<Output = ()>`
6954
found unit type `()`
7055
help: consider `await`ing on the `Future`
@@ -87,11 +72,6 @@ LL | |
8772
LL | | };
8873
| |_____- `match` arms have incompatible types
8974
|
90-
note: while checking the return type of the `async fn`
91-
--> $DIR/suggest-missing-await.rs:18:18
92-
|
93-
LL | async fn dummy() {}
94-
| ^ checked the `Output` of this `async fn`, expected opaque type
9575
= note: expected opaque type `impl Future<Output = ()>`
9676
found unit type `()`
9777
help: consider `await`ing on the `Future`
@@ -108,11 +88,6 @@ LL | let _x = match dummy() {
10888
LL | () => {}
10989
| ^^ expected opaque type, found `()`
11090
|
111-
note: while checking the return type of the `async fn`
112-
--> $DIR/suggest-missing-await.rs:18:18
113-
|
114-
LL | async fn dummy() {}
115-
| ^ checked the `Output` of this `async fn`, expected opaque type
11691
= note: expected opaque type `impl Future<Output = ()>`
11792
found unit type `()`
11893
help: consider `await`ing on the `Future`
@@ -129,11 +104,6 @@ LL | match dummy_result() {
129104
LL | Ok(_) => {}
130105
| ^^^^^ expected opaque type, found `Result<_, _>`
131106
|
132-
note: while checking the return type of the `async fn`
133-
--> $DIR/suggest-missing-await.rs:57:28
134-
|
135-
LL | async fn dummy_result() -> Result<(), ()> {
136-
| ^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, expected opaque type
137107
= note: expected opaque type `impl Future<Output = Result<(), ()>>`
138108
found enum `Result<_, _>`
139109
help: consider `await`ing on the `Future`
@@ -150,11 +120,6 @@ LL | match dummy_result() {
150120
LL | Err(_) => {}
151121
| ^^^^^^ expected opaque type, found `Result<_, _>`
152122
|
153-
note: while checking the return type of the `async fn`
154-
--> $DIR/suggest-missing-await.rs:57:28
155-
|
156-
LL | async fn dummy_result() -> Result<(), ()> {
157-
| ^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, expected opaque type
158123
= note: expected opaque type `impl Future<Output = Result<(), ()>>`
159124
found enum `Result<_, _>`
160125
help: consider `await`ing on the `Future`

‎tests/ui/deriving/deriving-all-codegen.stdout

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ impl ::core::marker::StructuralPartialEq for PackedPoint { }
209209
impl ::core::cmp::PartialEq for PackedPoint {
210210
#[inline]
211211
fn eq(&self, other: &PackedPoint) -> bool {
212-
{ self.x } == { other.x } && { self.y } == { other.y }
212+
({ self.x }) == ({ other.x }) && ({ self.y }) == ({ other.y })
213213
}
214214
}
215215
#[automatically_derived]
@@ -718,8 +718,8 @@ impl<T: ::core::cmp::PartialEq + ::core::marker::Copy + Trait,
718718
::core::marker::Copy {
719719
#[inline]
720720
fn eq(&self, other: &PackedGeneric<T, U>) -> bool {
721-
{ self.0 } == { other.0 } && { self.1 } == { other.1 } &&
722-
{ self.2 } == { other.2 }
721+
({ self.0 }) == ({ other.0 }) && ({ self.1 }) == ({ other.1 }) &&
722+
({ self.2 }) == ({ other.2 })
723723
}
724724
}
725725
#[automatically_derived]

‎tests/ui/impl-trait/in-trait/method-signature-matches.stderr

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ LL | async fn owo(_: u8) {}
2424
| expected `()`, found `u8`
2525
| help: change the parameter type to match the trait: `()`
2626
|
27-
note: while checking the return type of the `async fn`
28-
--> $DIR/method-signature-matches.rs:20:25
29-
|
30-
LL | async fn owo(_: u8) {}
31-
| ^ checked the `Output` of this `async fn`, expected opaque type
32-
note: while checking the return type of the `async fn`
33-
--> $DIR/method-signature-matches.rs:20:25
34-
|
35-
LL | async fn owo(_: u8) {}
36-
| ^ checked the `Output` of this `async fn`, found opaque type
3727
note: type in trait
3828
--> $DIR/method-signature-matches.rs:16:21
3929
|

‎tests/ui/impl-trait/issue-102605.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ LL | convert_result(foo())
66
| |
77
| arguments to this function are incorrect
88
|
9-
note: while checking the return type of the `async fn`
10-
--> $DIR/issue-102605.rs:3:19
11-
|
12-
LL | async fn foo() -> Result<(), String> {
13-
| ^^^^^^^^^^^^^^^^^^ checked the `Output` of this `async fn`, found opaque type
149
= note: expected enum `Result<(), _>`
1510
found opaque type `impl Future<Output = Result<(), String>>`
1611
note: function defined here

‎tests/ui/impl-trait/issue-99914.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ error[E0308]: mismatched types
44
LL | t.and_then(|t| -> _ { bar(t) });
55
| ^^^^^^ expected `Result<_, Error>`, found opaque type
66
|
7-
note: while checking the return type of the `async fn`
8-
--> $DIR/issue-99914.rs:13:23
9-
|
10-
LL | async fn bar(t: Okay) {}
11-
| ^ checked the `Output` of this `async fn`, found opaque type
127
= note: expected enum `Result<_, Error>`
138
found opaque type `impl Future<Output = ()>`
149
help: try wrapping the expression in `Ok`

‎tests/ui/proc-macro/crt-static.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// ignore-wasm32
66
// ignore-sgx no support for proc-macro crate type
77
// build-pass
8+
// force-host
9+
// no-prefer-dynamic
10+
811
#![crate_type = "proc-macro"]
912

1013
// FIXME: This don't work when crate-type is specified by attribute

‎tests/ui/suggestions/if-then-neeing-semi.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,9 @@ fn extra_semicolon() {
1515
};
1616
}
1717

18-
async fn async_dummy() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type
19-
//~| NOTE while checking the return type of the `async fn`
20-
//~| NOTE in this expansion of desugaring of `async` block or function
21-
//~| NOTE checked the `Output` of this `async fn`, expected opaque type
22-
//~| NOTE while checking the return type of the `async fn`
23-
//~| NOTE in this expansion of desugaring of `async` block or function
24-
async fn async_dummy2() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type
25-
//~| NOTE checked the `Output` of this `async fn`, found opaque type
26-
//~| NOTE while checking the return type of the `async fn`
27-
//~| NOTE in this expansion of desugaring of `async` block or function
28-
//~| NOTE while checking the return type of the `async fn`
29-
//~| NOTE in this expansion of desugaring of `async` block or function
18+
async fn async_dummy() {}
19+
20+
async fn async_dummy2() {}
3021

3122
async fn async_extra_semicolon_same() {
3223
let _ = if true {

‎tests/ui/suggestions/if-then-neeing-semi.stderr

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: `if` and `else` have incompatible types
2-
--> $DIR/if-then-neeing-semi.rs:37:9
2+
--> $DIR/if-then-neeing-semi.rs:28:9
33
|
44
LL | let _ = if true {
55
| _____________-
@@ -15,11 +15,6 @@ LL | |
1515
LL | | };
1616
| |_____- `if` and `else` have incompatible types
1717
|
18-
note: while checking the return type of the `async fn`
19-
--> $DIR/if-then-neeing-semi.rs:18:24
20-
|
21-
LL | async fn async_dummy() {}
22-
| ^ checked the `Output` of this `async fn`, found opaque type
2318
= note: expected unit type `()`
2419
found opaque type `impl Future<Output = ()>`
2520
help: consider `await`ing on the `Future`
@@ -33,7 +28,7 @@ LL + async_dummy()
3328
|
3429

3530
error[E0308]: `if` and `else` have incompatible types
36-
--> $DIR/if-then-neeing-semi.rs:50:9
31+
--> $DIR/if-then-neeing-semi.rs:41:9
3732
|
3833
LL | let _ = if true {
3934
| _____________-
@@ -49,11 +44,6 @@ LL | |
4944
LL | | };
5045
| |_____- `if` and `else` have incompatible types
5146
|
52-
note: while checking the return type of the `async fn`
53-
--> $DIR/if-then-neeing-semi.rs:24:25
54-
|
55-
LL | async fn async_dummy2() {}
56-
| ^ checked the `Output` of this `async fn`, found opaque type
5747
= note: expected unit type `()`
5848
found opaque type `impl Future<Output = ()>`
5949
help: consider `await`ing on the `Future`
@@ -69,7 +59,7 @@ LL ~ Box::new(async_dummy2())
6959
|
7060

7161
error[E0308]: `if` and `else` have incompatible types
72-
--> $DIR/if-then-neeing-semi.rs:63:9
62+
--> $DIR/if-then-neeing-semi.rs:54:9
7363
|
7464
LL | let _ = if true {
7565
| _____________-
@@ -85,18 +75,8 @@ LL | |
8575
LL | | };
8676
| |_____- `if` and `else` have incompatible types
8777
|
88-
note: while checking the return type of the `async fn`
89-
--> $DIR/if-then-neeing-semi.rs:18:24
90-
|
91-
LL | async fn async_dummy() {}
92-
| ^ checked the `Output` of this `async fn`, expected opaque type
93-
note: while checking the return type of the `async fn`
94-
--> $DIR/if-then-neeing-semi.rs:24:25
95-
|
96-
LL | async fn async_dummy2() {}
97-
| ^ checked the `Output` of this `async fn`, found opaque type
9878
= note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/if-then-neeing-semi.rs:18:24>)
99-
found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/if-then-neeing-semi.rs:24:25>)
79+
found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/if-then-neeing-semi.rs:20:25>)
10080
= note: distinct uses of `impl Trait` result in different opaque types
10181
help: consider `await`ing on both `Future`s
10282
|

‎tests/ui/suggestions/issue-81839.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ LL | | _ => cx.answer_str("hi"),
1414
LL | | }
1515
| |_____- `match` arms have incompatible types
1616
|
17-
note: while checking the return type of the `async fn`
18-
--> $DIR/auxiliary/issue-81839.rs:6:49
19-
|
20-
LL | pub async fn answer_str(&self, _s: &str) -> Test {
21-
| ^^^^ checked the `Output` of this `async fn`, found opaque type
2217
= note: expected unit type `()`
2318
found opaque type `impl Future<Output = Test>`
2419

‎tests/ui/suggestions/match-prev-arm-needing-semi.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,9 @@ fn extra_semicolon() {
1313
};
1414
}
1515

16-
async fn async_dummy() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type
17-
//~| NOTE while checking the return type of the `async fn`
18-
//~| NOTE in this expansion of desugaring of `async` block or function
19-
//~| NOTE checked the `Output` of this `async fn`, expected opaque type
20-
//~| NOTE while checking the return type of the `async fn`
21-
//~| NOTE in this expansion of desugaring of `async` block or function
22-
async fn async_dummy2() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type
23-
//~| NOTE checked the `Output` of this `async fn`, found opaque type
24-
//~| NOTE while checking the return type of the `async fn`
25-
//~| NOTE in this expansion of desugaring of `async` block or function
26-
//~| NOTE while checking the return type of the `async fn`
27-
//~| NOTE in this expansion of desugaring of `async` block or function
16+
async fn async_dummy() {}
17+
18+
async fn async_dummy2() {}
2819

2920
async fn async_extra_semicolon_same() {
3021
let _ = match true { //~ NOTE `match` arms have incompatible types

‎tests/ui/suggestions/match-prev-arm-needing-semi.stderr

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: `match` arms have incompatible types
2-
--> $DIR/match-prev-arm-needing-semi.rs:35:18
2+
--> $DIR/match-prev-arm-needing-semi.rs:26:18
33
|
44
LL | let _ = match true {
55
| _____________-
@@ -15,11 +15,6 @@ LL | |
1515
LL | | };
1616
| |_____- `match` arms have incompatible types
1717
|
18-
note: while checking the return type of the `async fn`
19-
--> $DIR/match-prev-arm-needing-semi.rs:16:24
20-
|
21-
LL | async fn async_dummy() {}
22-
| ^ checked the `Output` of this `async fn`, found opaque type
2318
= note: expected unit type `()`
2419
found opaque type `impl Future<Output = ()>`
2520
help: consider `await`ing on the `Future`
@@ -33,7 +28,7 @@ LL + async_dummy()
3328
|
3429

3530
error[E0308]: `match` arms have incompatible types
36-
--> $DIR/match-prev-arm-needing-semi.rs:48:18
31+
--> $DIR/match-prev-arm-needing-semi.rs:39:18
3732
|
3833
LL | let _ = match true {
3934
| _____________-
@@ -49,11 +44,6 @@ LL | |
4944
LL | | };
5045
| |_____- `match` arms have incompatible types
5146
|
52-
note: while checking the return type of the `async fn`
53-
--> $DIR/match-prev-arm-needing-semi.rs:22:25
54-
|
55-
LL | async fn async_dummy2() {}
56-
| ^ checked the `Output` of this `async fn`, found opaque type
5747
= note: expected unit type `()`
5848
found opaque type `impl Future<Output = ()>`
5949
help: consider `await`ing on the `Future`
@@ -69,7 +59,7 @@ LL ~ false => Box::new(async_dummy2()),
6959
|
7060

7161
error[E0308]: `match` arms have incompatible types
72-
--> $DIR/match-prev-arm-needing-semi.rs:59:18
62+
--> $DIR/match-prev-arm-needing-semi.rs:50:18
7363
|
7464
LL | let _ = match true {
7565
| _____________-
@@ -83,18 +73,8 @@ LL | |
8373
LL | | };
8474
| |_____- `match` arms have incompatible types
8575
|
86-
note: while checking the return type of the `async fn`
87-
--> $DIR/match-prev-arm-needing-semi.rs:16:24
88-
|
89-
LL | async fn async_dummy() {}
90-
| ^ checked the `Output` of this `async fn`, expected opaque type
91-
note: while checking the return type of the `async fn`
92-
--> $DIR/match-prev-arm-needing-semi.rs:22:25
93-
|
94-
LL | async fn async_dummy2() {}
95-
| ^ checked the `Output` of this `async fn`, found opaque type
9676
= note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:16:24>)
97-
found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:22:25>)
77+
found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:18:25>)
9878
= note: distinct uses of `impl Trait` result in different opaque types
9979
help: consider `await`ing on both `Future`s
10080
|

‎tests/ui/type-alias-impl-trait/issue-98604.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ error[E0271]: expected `test` to be a fn item that returns `Pin<Box<dyn Future<O
44
LL | Box::new(test) as AsyncFnPtr;
55
| ^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
66
|
7-
note: while checking the return type of the `async fn`
8-
--> $DIR/issue-98604.rs:5:17
9-
|
10-
LL | async fn test() {}
11-
| ^ checked the `Output` of this `async fn`, found opaque type
127
= note: expected struct `Pin<Box<(dyn Future<Output = ()> + 'static)>>`
138
found opaque type `impl Future<Output = ()>`
149
= note: required for the cast from `fn() -> impl Future<Output = ()> {test}` to the object type `dyn Fn() -> Pin<Box<(dyn Future<Output = ()> + 'static)>>`

0 commit comments

Comments
 (0)
Please sign in to comment.