Skip to content

Commit 472651a

Browse files
committed
Auto merge of rust-lang#106558 - compiler-errors:rollup-lkii3j3, r=compiler-errors
Rollup of 4 pull requests Successful merges: - rust-lang#106525 (Report WF error for chalk *and* new solver) - rust-lang#106533 (Use smaller spans for missing lifetime/generic args) - rust-lang#106543 (rustdoc: remove no-op CSS `.rustdoc.source .sidebar { width: 0 }`) - rust-lang#106554 (Fix a typo in the explanation of E0588) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 93bf84c + 01cb9dc commit 472651a

35 files changed

+84
-80
lines changed

compiler/rustc_error_codes/src/error_codes/E0588.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct Aligned(i32);
1111
struct Packed(Aligned);
1212
```
1313

14-
Just like you cannot have both `align` and `packed` representation hints on a
14+
Just like you cannot have both `align` and `packed` representation hints on the
1515
same type, a `packed` type cannot contain another type with the `align`
1616
representation hint. However, you can do the opposite:
1717

compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -597,11 +597,15 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
597597
let span = self.path_segment.ident.span;
598598

599599
// insert a suggestion of the form "Y<'a, 'b>"
600-
let ident = self.path_segment.ident.name.to_ident_string();
601-
let sugg = format!("{}<{}>", ident, suggested_args);
600+
let sugg = format!("<{}>", suggested_args);
602601
debug!("sugg: {:?}", sugg);
603602

604-
err.span_suggestion_verbose(span, &msg, sugg, Applicability::HasPlaceholders);
603+
err.span_suggestion_verbose(
604+
span.shrink_to_hi(),
605+
&msg,
606+
sugg,
607+
Applicability::HasPlaceholders,
608+
);
605609
}
606610

607611
AngleBrackets::Available => {
@@ -643,11 +647,15 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
643647
let span = self.path_segment.ident.span;
644648

645649
// insert a suggestion of the form "Y<T, U>"
646-
let ident = self.path_segment.ident.name.to_ident_string();
647-
let sugg = format!("{}<{}>", ident, suggested_args);
650+
let sugg = format!("<{}>", suggested_args);
648651
debug!("sugg: {:?}", sugg);
649652

650-
err.span_suggestion_verbose(span, &msg, sugg, Applicability::HasPlaceholders);
653+
err.span_suggestion_verbose(
654+
span.shrink_to_hi(),
655+
&msg,
656+
sugg,
657+
Applicability::HasPlaceholders,
658+
);
651659
}
652660
AngleBrackets::Available => {
653661
let gen_args_span = self.gen_args.span().unwrap();

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
11681168
}
11691169

11701170
ty::PredicateKind::WellFormed(ty) => {
1171-
if self.tcx.sess.opts.unstable_opts.trait_solver != TraitSolver::Chalk {
1171+
if self.tcx.sess.opts.unstable_opts.trait_solver == TraitSolver::Classic {
11721172
// WF predicates cannot themselves make
11731173
// errors. They can only block due to
11741174
// ambiguity; otherwise, they always
@@ -1180,7 +1180,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
11801180
// which bounds actually failed to hold.
11811181
self.tcx.sess.struct_span_err(
11821182
span,
1183-
&format!("the type `{}` is not well-formed (chalk)", ty),
1183+
&format!("the type `{}` is not well-formed", ty),
11841184
)
11851185
}
11861186
}

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -1598,14 +1598,10 @@ in storage.js
15981598

15991599
.sidebar.shown,
16001600
.source-sidebar-expanded .source .sidebar,
1601-
.sidebar:focus-within {
1601+
.rustdoc:not(.source) .sidebar:focus-within {
16021602
left: 0;
16031603
}
16041604

1605-
.rustdoc.source > .sidebar {
1606-
width: 0;
1607-
}
1608-
16091605
.mobile-topbar h2 {
16101606
padding-bottom: 0;
16111607
margin: auto 0.5em auto auto;

src/test/rustdoc-gui/sidebar-source-code-display.goml

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ assert-css: (
171171

172172
// We now check that the scroll position is kept when opening the sidebar.
173173
click: "#src-sidebar-toggle"
174-
wait-for-css: (".sidebar", {"width": "0px"})
174+
wait-for-css: (".sidebar", {"left": "-1000px"})
175175
// We scroll to line 117 to change the scroll position.
176176
scroll-to: '//*[@id="117"]'
177177
assert-window-property: {"pageYOffset": "2542"}
178178
// Expanding the sidebar...
179179
click: "#src-sidebar-toggle"
180-
wait-for-css: (".sidebar", {"width": "500px"})
180+
wait-for-css: (".sidebar", {"left": "0px"})
181181
click: "#src-sidebar-toggle"
182-
wait-for-css: (".sidebar", {"width": "0px"})
182+
wait-for-css: (".sidebar", {"left": "-1000px"})
183183
// The "scrollTop" property should be the same.
184184
assert-window-property: {"pageYOffset": "2542"}
185185

src/test/rustdoc-gui/sidebar-source-code.goml

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ assert-count: ("//*[@id='source-sidebar']/details[not(text()='lib2') and not(@op
7777

7878
// We now switch to mobile mode.
7979
size: (600, 600)
80-
wait-for-css: (".source-sidebar-expanded nav.sidebar", {"width": "600px"})
80+
wait-for-css: (".source-sidebar-expanded nav.sidebar", {"left": "0px"})
8181
// We collapse the sidebar.
8282
click: (10, 10)
83-
// We check that the sidebar has the expected width (0).
84-
assert-css: ("nav.sidebar", {"width": "0px"})
83+
// We check that the sidebar has been moved off-screen.
84+
assert-css: ("nav.sidebar", {"left": "-1000px"})
8585
// We ensure that the class has been removed.
8686
assert-false: ".source-sidebar-expanded"
8787
assert: "nav.sidebar"

src/test/rustdoc-ui/issue-105742.stderr

+22-22
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | type Item<'a, T>;
1212
help: add missing lifetime argument
1313
|
1414
LL | <Self as SVec>::Item<'a>,
15-
| ~~~~~~~~
15+
| ++++
1616

1717
error[E0107]: missing generics for associated type `SVec::Item`
1818
--> $DIR/issue-105742.rs:13:21
@@ -28,7 +28,7 @@ LL | type Item<'a, T>;
2828
help: add missing generic argument
2929
|
3030
LL | <Self as SVec>::Item<T>,
31-
| ~~~~~~~
31+
| +++
3232

3333
error[E0107]: missing generics for associated type `SVec::Item`
3434
--> $DIR/issue-105742.rs:18:37
@@ -44,7 +44,7 @@ LL | type Item<'a, T>;
4444
help: add missing lifetime argument
4545
|
4646
LL | Output = <Index<<Self as SVec>::Item<'a>,
47-
| ~~~~~~~~
47+
| ++++
4848

4949
error[E0107]: missing generics for associated type `SVec::Item`
5050
--> $DIR/issue-105742.rs:18:37
@@ -60,7 +60,7 @@ LL | type Item<'a, T>;
6060
help: add missing generic argument
6161
|
6262
LL | Output = <Index<<Self as SVec>::Item<T>,
63-
| ~~~~~~~
63+
| +++
6464

6565
error[E0107]: missing generics for associated type `SVec::Item`
6666
--> $DIR/issue-105742.rs:23:30
@@ -76,7 +76,7 @@ LL | type Item<'a, T>;
7676
help: add missing lifetime argument
7777
|
7878
LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
79-
| ~~~~~~~~
79+
| ++++
8080

8181
error[E0107]: missing generics for associated type `SVec::Item`
8282
--> $DIR/issue-105742.rs:23:30
@@ -92,7 +92,7 @@ LL | type Item<'a, T>;
9292
help: add missing generic argument
9393
|
9494
LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
95-
| ~~~~~~~
95+
| +++
9696

9797
error[E0107]: missing generics for associated type `SVec::Item`
9898
--> $DIR/issue-105742.rs:23:46
@@ -108,7 +108,7 @@ LL | type Item<'a, T>;
108108
help: add missing lifetime argument
109109
|
110110
LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
111-
| ~~~~~~~~
111+
| ++++
112112

113113
error[E0107]: missing generics for associated type `SVec::Item`
114114
--> $DIR/issue-105742.rs:23:46
@@ -124,7 +124,7 @@ LL | type Item<'a, T>;
124124
help: add missing generic argument
125125
|
126126
LL | Output = <Self as SVec>::Item> as SVec>::Item<T>,
127-
| ~~~~~~~
127+
| +++
128128

129129
error[E0107]: missing generics for associated type `SVec::Item`
130130
--> $DIR/issue-105742.rs:5:40
@@ -140,7 +140,7 @@ LL | type Item<'a, T>;
140140
help: add missing lifetime argument
141141
|
142142
LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item<'_> = T, Output = T>) {
143-
| ~~~~~~~~
143+
| ++++
144144

145145
error[E0107]: missing generics for associated type `SVec::Item`
146146
--> $DIR/issue-105742.rs:5:40
@@ -156,7 +156,7 @@ LL | type Item<'a, T>;
156156
help: add missing generic argument
157157
|
158158
LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item<T> = T, Output = T>) {
159-
| ~~~~~~~
159+
| +++
160160

161161
error[E0107]: missing generics for associated type `SVec::Item`
162162
--> $DIR/issue-105742.rs:13:21
@@ -172,7 +172,7 @@ LL | type Item<'a, T>;
172172
help: add missing lifetime argument
173173
|
174174
LL | <Self as SVec>::Item<'a>,
175-
| ~~~~~~~~
175+
| ++++
176176

177177
error[E0107]: missing generics for associated type `SVec::Item`
178178
--> $DIR/issue-105742.rs:13:21
@@ -188,7 +188,7 @@ LL | type Item<'a, T>;
188188
help: add missing generic argument
189189
|
190190
LL | <Self as SVec>::Item<T>,
191-
| ~~~~~~~
191+
| +++
192192

193193
error[E0107]: missing generics for associated type `SVec::Item`
194194
--> $DIR/issue-105742.rs:18:37
@@ -204,7 +204,7 @@ LL | type Item<'a, T>;
204204
help: add missing lifetime argument
205205
|
206206
LL | Output = <Index<<Self as SVec>::Item<'a>,
207-
| ~~~~~~~~
207+
| ++++
208208

209209
error[E0107]: missing generics for associated type `SVec::Item`
210210
--> $DIR/issue-105742.rs:18:37
@@ -220,7 +220,7 @@ LL | type Item<'a, T>;
220220
help: add missing generic argument
221221
|
222222
LL | Output = <Index<<Self as SVec>::Item<T>,
223-
| ~~~~~~~
223+
| +++
224224

225225
error[E0107]: missing generics for associated type `SVec::Item`
226226
--> $DIR/issue-105742.rs:23:30
@@ -236,7 +236,7 @@ LL | type Item<'a, T>;
236236
help: add missing lifetime argument
237237
|
238238
LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
239-
| ~~~~~~~~
239+
| ++++
240240

241241
error[E0107]: missing generics for associated type `SVec::Item`
242242
--> $DIR/issue-105742.rs:23:30
@@ -252,7 +252,7 @@ LL | type Item<'a, T>;
252252
help: add missing generic argument
253253
|
254254
LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
255-
| ~~~~~~~
255+
| +++
256256

257257
error[E0107]: missing generics for associated type `SVec::Item`
258258
--> $DIR/issue-105742.rs:23:46
@@ -268,7 +268,7 @@ LL | type Item<'a, T>;
268268
help: add missing lifetime argument
269269
|
270270
LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
271-
| ~~~~~~~~
271+
| ++++
272272

273273
error[E0107]: missing generics for associated type `SVec::Item`
274274
--> $DIR/issue-105742.rs:23:46
@@ -284,7 +284,7 @@ LL | type Item<'a, T>;
284284
help: add missing generic argument
285285
|
286286
LL | Output = <Self as SVec>::Item> as SVec>::Item<T>,
287-
| ~~~~~~~
287+
| +++
288288

289289
error[E0038]: the trait `SVec` cannot be made into an object
290290
--> $DIR/issue-105742.rs:5:31
@@ -329,7 +329,7 @@ LL | type Item<'a, T>;
329329
help: add missing lifetime argument
330330
|
331331
LL | fn len(&self) -> <Self as SVec>::Item<'_>;
332-
| ~~~~~~~~
332+
| ++++
333333

334334
error[E0107]: missing generics for associated type `SVec::Item`
335335
--> $DIR/issue-105742.rs:35:38
@@ -345,7 +345,7 @@ LL | type Item<'a, T>;
345345
help: add missing generic argument
346346
|
347347
LL | fn len(&self) -> <Self as SVec>::Item<T>;
348-
| ~~~~~~~
348+
| +++
349349

350350
error[E0107]: missing generics for associated type `SVec::Item`
351351
--> $DIR/issue-105742.rs:35:38
@@ -361,7 +361,7 @@ LL | type Item<'a, T>;
361361
help: add missing lifetime argument
362362
|
363363
LL | fn len(&self) -> <Self as SVec>::Item<'_>;
364-
| ~~~~~~~~
364+
| ++++
365365

366366
error[E0107]: missing generics for associated type `SVec::Item`
367367
--> $DIR/issue-105742.rs:35:38
@@ -377,7 +377,7 @@ LL | type Item<'a, T>;
377377
help: add missing generic argument
378378
|
379379
LL | fn len(&self) -> <Self as SVec>::Item<T>;
380-
| ~~~~~~~
380+
| +++
381381

382382
error: aborting due to 23 previous errors
383383

src/test/ui/chalkify/recursive_where_clause_on_type.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ fn foo<T: Foo>() {
2525
fn main() {
2626
// For some reason, the error is duplicated...
2727

28-
foo::<S>() //~ ERROR the type `S` is not well-formed (chalk)
29-
//~^ ERROR the type `S` is not well-formed (chalk)
28+
foo::<S>() //~ ERROR the type `S` is not well-formed
29+
//~^ ERROR the type `S` is not well-formed
3030
}

src/test/ui/chalkify/recursive_where_clause_on_type.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: the type `S` is not well-formed (chalk)
1+
error: the type `S` is not well-formed
22
--> $DIR/recursive_where_clause_on_type.rs:28:11
33
|
44
LL | foo::<S>()
55
| ^
66

7-
error: the type `S` is not well-formed (chalk)
7+
error: the type `S` is not well-formed
88
--> $DIR/recursive_where_clause_on_type.rs:28:5
99
|
1010
LL | foo::<S>()

src/test/ui/consts/issue-103790.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ LL | struct S<const S: (), const S: S = { S }>;
2020
help: add missing generic argument
2121
|
2222
LL | struct S<const S: (), const S: S<S> = { S }>;
23-
| ~~~~
23+
| +++
2424

2525
error[E0391]: cycle detected when computing type of `S::S`
2626
--> $DIR/issue-103790.rs:4:32

src/test/ui/generic-associated-types/elided-in-expr-position.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | type Assoc<'a> where Self: 'a;
1212
help: add missing lifetime argument
1313
|
1414
LL | fn g(&self) -> Self::Assoc<'_>;
15-
| ~~~~~~~~~
15+
| ++++
1616

1717
error[E0107]: missing generics for associated type `Trait::Assoc`
1818
--> $DIR/elided-in-expr-position.rs:31:26
@@ -28,7 +28,7 @@ LL | type Assoc<'a> where Self: 'a;
2828
help: add missing lifetime argument
2929
|
3030
LL | fn g(&self) -> Self::Assoc<'_> {
31-
| ~~~~~~~~~
31+
| ++++
3232

3333
error: aborting due to 2 previous errors
3434

src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | type Y<'a>;
1212
help: add missing lifetime argument
1313
|
1414
LL | fn foo<'a, T1: X<Y<'a> = T1>>(t : T1) -> T1::Y<'a> {
15-
| ~~~~~
15+
| ++++
1616

1717
error[E0107]: missing generics for associated type `X::Y`
1818
--> $DIR/gat-trait-path-missing-lifetime.rs:8:20
@@ -28,7 +28,7 @@ LL | type Y<'a>;
2828
help: add missing lifetime argument
2929
|
3030
LL | fn foo<'a, T1: X<Y<'a> = T1>>(t : T1) -> T1::Y<'a> {
31-
| ~~~~~
31+
| ++++
3232

3333
error: aborting due to 2 previous errors
3434

src/test/ui/generic-associated-types/issue-71176.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | type A<'a>;
1212
help: add missing lifetime argument
1313
|
1414
LL | inner: Box<dyn Provider<A<'a> = B>>,
15-
| ~~~~~
15+
| ++++
1616

1717
error: aborting due to previous error
1818

src/test/ui/generic-associated-types/issue-76535.base.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | type SubType<'a>: SubTrait where Self: 'a;
1212
help: add missing lifetime argument
1313
|
1414
LL | let sub: Box<dyn SuperTrait<SubType<'a> = SubStruct>> = Box::new(SuperStruct::new(0));
15-
| ~~~~~~~~~~~
15+
| ++++
1616

1717
error[E0038]: the trait `SuperTrait` cannot be made into an object
1818
--> $DIR/issue-76535.rs:39:14

0 commit comments

Comments
 (0)