Skip to content

Commit ae0030b

Browse files
committed
Auto merge of rust-lang#101378 - matthiaskrgr:rollup-s1awa47, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - rust-lang#101335 (rustdoc: remove old CSS selector that causes weird spacing) - rust-lang#101347 (ffx component run should provide a collection) - rust-lang#101364 (Shrink suggestion span of argument mismatch error) - rust-lang#101365 (remove redundant clones) Failed merges: - rust-lang#101349 (rustdoc: remove `.impl-items { flex-basis }` CSS, not in flex container) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 47d1cdb + 01da61a commit ae0030b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+154
-124
lines changed

compiler/rustc_parse/src/parser/attr_wrapper.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl AttrWrapper {
5252
// Prepend `self.attrs` to `attrs`.
5353
// FIXME: require passing an NT to prevent misuse of this method
5454
pub(crate) fn prepend_to_nt_inner(self, attrs: &mut AttrVec) {
55-
let mut self_attrs = self.attrs.clone();
55+
let mut self_attrs = self.attrs;
5656
std::mem::swap(attrs, &mut self_attrs);
5757
attrs.extend(self_attrs);
5858
}

compiler/rustc_typeck/src/check/fn_ctxt/checks.rs

+17-6
Original file line numberDiff line numberDiff line change
@@ -1056,11 +1056,22 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10561056
};
10571057
if let Some(suggestion_text) = suggestion_text {
10581058
let source_map = self.sess().source_map();
1059-
let mut suggestion = format!(
1060-
"{}(",
1061-
source_map.span_to_snippet(full_call_span).unwrap_or_else(|_| fn_def_id
1062-
.map_or("".to_string(), |fn_def_id| tcx.item_name(fn_def_id).to_string()))
1063-
);
1059+
let (mut suggestion, suggestion_span) =
1060+
if let Some(call_span) = full_call_span.find_ancestor_inside(error_span) {
1061+
("(".to_string(), call_span.shrink_to_hi().to(error_span.shrink_to_hi()))
1062+
} else {
1063+
(
1064+
format!(
1065+
"{}(",
1066+
source_map.span_to_snippet(full_call_span).unwrap_or_else(|_| {
1067+
fn_def_id.map_or("".to_string(), |fn_def_id| {
1068+
tcx.item_name(fn_def_id).to_string()
1069+
})
1070+
})
1071+
),
1072+
error_span,
1073+
)
1074+
};
10641075
let mut needs_comma = false;
10651076
for (expected_idx, provided_idx) in matched_inputs.iter_enumerated() {
10661077
if needs_comma {
@@ -1088,7 +1099,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10881099
}
10891100
suggestion += ")";
10901101
err.span_suggestion_verbose(
1091-
error_span,
1102+
suggestion_span,
10921103
&suggestion_text,
10931104
suggestion,
10941105
Applicability::HasPlaceholders,

src/doc/rustc/src/platform-support/fuchsia.md

+2
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ Finally, run the component:
570570

571571
```sh
572572
${SDK_PATH}/tools/${ARCH}/ffx component run \
573+
/core/ffx-laboratory:hello_fuchsia \
573574
fuchsia-pkg://hello-fuchsia/hello_fuchsia_manifest#meta/hello_fuchsia.cm
574575
```
575576

@@ -579,6 +580,7 @@ passed.
579580
```sh
580581
${SDK_PATH}/tools/${ARCH}/ffx component run \
581582
--recreate \
583+
/core/ffx-laboratory:hello_fuchsia \
582584
fuchsia-pkg://hello-fuchsia/hello_fuchsia_manifest#meta/hello_fuchsia.cm
583585
```
584586

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

+5-8
Original file line numberDiff line numberDiff line change
@@ -778,14 +778,6 @@ pre, .rustdoc.source .example-wrap {
778778
margin-bottom: .6em;
779779
}
780780

781-
.content .impl-items > .item-info {
782-
margin-left: 40px;
783-
}
784-
785-
.methods > .item-info, .content .impl-items > .item-info {
786-
margin-top: -8px;
787-
}
788-
789781
.impl-items {
790782
flex-basis: 100%;
791783
}
@@ -2035,6 +2027,11 @@ in storage.js plus the media query with (min-width: 701px)
20352027
#main-content > div > details.rustdoc-toggle > summary::before {
20362028
left: -11px;
20372029
}
2030+
2031+
/* Align summary-nested and unnested item-info gizmos. */
2032+
.content .impl-items > .item-info {
2033+
margin-left: 34px;
2034+
}
20382035
}
20392036

20402037
@media print {

src/librustdoc/json/conversions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ impl FromWithTcx<clean::Type> for Type {
486486
},
487487
QPath(box clean::QPathData { assoc, self_type, trait_, .. }) => Type::QualifiedPath {
488488
name: assoc.name.to_string(),
489-
args: Box::new(assoc.args.clone().into_tcx(tcx)),
489+
args: Box::new(assoc.args.into_tcx(tcx)),
490490
self_type: Box::new(self_type.into_tcx(tcx)),
491491
trait_: trait_.into_tcx(tcx),
492492
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This test ensures that the "item-info" looks about the same
2+
// whether or not it's inside a toggle.
3+
goto: file://|DOC_PATH|/lib2/struct.ItemInfoAlignmentTest.html
4+
5+
// First, we try it in "desktop" mode.
6+
size: (1200, 870)
7+
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x"))
8+
// Next, we try it in "mobile" mode (max-width: 700px).
9+
size: (650, 650)
10+
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x"))

src/test/rustdoc-gui/src/lib2/lib.rs

+10
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,13 @@ where
170170
type Output;
171171
fn index(&self, index: Idx) -> &Self::Output;
172172
}
173+
174+
pub struct ItemInfoAlignmentTest;
175+
176+
impl ItemInfoAlignmentTest {
177+
/// This method has docs
178+
#[deprecated]
179+
pub fn foo() {}
180+
#[deprecated]
181+
pub fn bar() {}
182+
}

src/test/ui/argument-suggestions/basic.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ LL | fn extra() {}
2626
help: remove the extra argument
2727
|
2828
LL | extra();
29-
| ~~~~~~~
29+
| ~~
3030

3131
error[E0061]: this function takes 1 argument but 0 arguments were supplied
3232
--> $DIR/basic.rs:22:5
@@ -42,7 +42,7 @@ LL | fn missing(_i: u32) {}
4242
help: provide the argument
4343
|
4444
LL | missing(/* u32 */);
45-
| ~~~~~~~~~~~~~~~~~~
45+
| ~~~~~~~~~~~
4646

4747
error[E0308]: arguments to this function are incorrect
4848
--> $DIR/basic.rs:23:5
@@ -60,7 +60,7 @@ LL | fn swapped(_i: u32, _s: &str) {}
6060
help: swap these arguments
6161
|
6262
LL | swapped(1, "");
63-
| ~~~~~~~~~~~~~~
63+
| ~~~~~~~
6464

6565
error[E0308]: arguments to this function are incorrect
6666
--> $DIR/basic.rs:24:5
@@ -79,7 +79,7 @@ LL | fn permuted(_x: X, _y: Y, _z: Z) {}
7979
help: reorder these arguments
8080
|
8181
LL | permuted(X {}, Y {}, Z {});
82-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
82+
| ~~~~~~~~~~~~~~~~~~
8383

8484
error[E0057]: this function takes 1 argument but 0 arguments were supplied
8585
--> $DIR/basic.rs:27:5
@@ -95,7 +95,7 @@ LL | let closure = |x| x;
9595
help: provide the argument
9696
|
9797
LL | closure(/* value */);
98-
| ~~~~~~~~~~~~~~~~~~~~
98+
| ~~~~~~~~~~~~~
9999

100100
error: aborting due to 6 previous errors
101101

src/test/ui/argument-suggestions/complex.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | fn complex(_i: u32, _s: &str, _e: E, _f: F, _g: G, _x: X, _y: Y, _z: Z ) {}
1212
help: did you mean
1313
|
1414
LL | complex(/* u32 */, &"", /* E */, F::X2, G{}, X {}, Y {}, Z {});
15-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1616

1717
error: aborting due to previous error
1818

src/test/ui/argument-suggestions/exotic-calls.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | fn foo<T: Fn()>(t: T) {
1212
help: remove the extra argument
1313
|
1414
LL | t();
15-
| ~~~
15+
| ~~
1616

1717
error[E0057]: this function takes 0 arguments but 1 argument was supplied
1818
--> $DIR/exotic-calls.rs:7:5
@@ -28,7 +28,7 @@ LL | fn bar(t: impl Fn()) {
2828
help: remove the extra argument
2929
|
3030
LL | t();
31-
| ~~~
31+
| ~~
3232

3333
error[E0057]: this function takes 0 arguments but 1 argument was supplied
3434
--> $DIR/exotic-calls.rs:16:5
@@ -44,7 +44,7 @@ LL | fn baz() -> impl Fn() {
4444
help: remove the extra argument
4545
|
4646
LL | baz()()
47-
|
47+
| ~~
4848

4949
error[E0057]: this function takes 0 arguments but 1 argument was supplied
5050
--> $DIR/exotic-calls.rs:22:5
@@ -60,7 +60,7 @@ LL | let x = || {};
6060
help: remove the extra argument
6161
|
6262
LL | x();
63-
| ~~~
63+
| ~~
6464

6565
error: aborting due to 4 previous errors
6666

src/test/ui/argument-suggestions/extra_arguments.stderr

+14-14
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | fn empty() {}
1212
help: remove the extra argument
1313
|
1414
LL | empty();
15-
| ~~~~~~~
15+
| ~~
1616

1717
error[E0061]: this function takes 1 argument but 2 arguments were supplied
1818
--> $DIR/extra_arguments.rs:9:3
@@ -28,7 +28,7 @@ LL | fn one_arg(_a: i32) {}
2828
help: remove the extra argument
2929
|
3030
LL | one_arg(1);
31-
| ~~~~~~~~~~
31+
| ~~~
3232

3333
error[E0061]: this function takes 1 argument but 2 arguments were supplied
3434
--> $DIR/extra_arguments.rs:10:3
@@ -44,7 +44,7 @@ LL | fn one_arg(_a: i32) {}
4444
help: remove the extra argument
4545
|
4646
LL | one_arg(1);
47-
| ~~~~~~~~~~
47+
| ~~~
4848

4949
error[E0061]: this function takes 1 argument but 3 arguments were supplied
5050
--> $DIR/extra_arguments.rs:11:3
@@ -62,7 +62,7 @@ LL | fn one_arg(_a: i32) {}
6262
help: remove the extra arguments
6363
|
6464
LL | one_arg(1);
65-
| ~~~~~~~~~~
65+
| ~~~
6666

6767
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
6868
--> $DIR/extra_arguments.rs:13:3
@@ -78,7 +78,7 @@ LL | fn two_arg_same(_a: i32, _b: i32) {}
7878
help: remove the extra argument
7979
|
8080
LL | two_arg_same(1, 1);
81-
| ~~~~~~~~~~~~~~~~~~
81+
| ~~~~~~
8282

8383
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
8484
--> $DIR/extra_arguments.rs:14:3
@@ -94,7 +94,7 @@ LL | fn two_arg_same(_a: i32, _b: i32) {}
9494
help: remove the extra argument
9595
|
9696
LL | two_arg_same(1, 1);
97-
| ~~~~~~~~~~~~~~~~~~
97+
| ~~~~~~
9898

9999
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
100100
--> $DIR/extra_arguments.rs:16:3
@@ -110,7 +110,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {}
110110
help: remove the extra argument
111111
|
112112
LL | two_arg_diff(1, "");
113-
| ~~~~~~~~~~~~~~~~~~~
113+
| ~~~~~~~
114114

115115
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
116116
--> $DIR/extra_arguments.rs:17:3
@@ -126,7 +126,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {}
126126
help: remove the extra argument
127127
|
128128
LL | two_arg_diff(1, "");
129-
| ~~~~~~~~~~~~~~~~~~~
129+
| ~~~~~~~
130130

131131
error[E0061]: this function takes 2 arguments but 4 arguments were supplied
132132
--> $DIR/extra_arguments.rs:18:3
@@ -144,7 +144,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {}
144144
help: remove the extra arguments
145145
|
146146
LL | two_arg_diff(1, "");
147-
| ~~~~~~~~~~~~~~~~~~~
147+
| ~~~~~~~
148148

149149
error[E0061]: this function takes 2 arguments but 4 arguments were supplied
150150
--> $DIR/extra_arguments.rs:19:3
@@ -162,7 +162,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {}
162162
help: remove the extra arguments
163163
|
164164
LL | two_arg_diff(1, "");
165-
| ~~~~~~~~~~~~~~~~~~~
165+
| ~~~~~~~
166166

167167
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
168168
--> $DIR/extra_arguments.rs:22:3
@@ -178,7 +178,7 @@ LL | fn two_arg_same(_a: i32, _b: i32) {}
178178
help: remove the extra argument
179179
|
180180
LL | two_arg_same(1, 1);
181-
| ~~~~~~~~~~~~~~~~~~
181+
| ~~~~~~
182182

183183
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
184184
--> $DIR/extra_arguments.rs:23:3
@@ -194,7 +194,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {}
194194
help: remove the extra argument
195195
|
196196
LL | two_arg_diff(1, "");
197-
| ~~~~~~~~~~~~~~~~~~~
197+
| ~~~~~~~
198198

199199
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
200200
--> $DIR/extra_arguments.rs:24:3
@@ -213,7 +213,7 @@ LL | fn two_arg_same(_a: i32, _b: i32) {}
213213
help: remove the extra argument
214214
|
215215
LL | two_arg_same(1, 1);
216-
| ~~~~~~~~~~~~~~~~~~
216+
| ~~~~~~
217217

218218
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
219219
--> $DIR/extra_arguments.rs:30:3
@@ -232,7 +232,7 @@ LL | fn two_arg_diff(_a: i32, _b: &str) {}
232232
help: remove the extra argument
233233
|
234234
LL | two_arg_diff(1, "");
235-
| ~~~~~~~~~~~~~~~~~~~
235+
| ~~~~~~~
236236

237237
error: aborting due to 14 previous errors
238238

src/test/ui/argument-suggestions/issue-96638.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | fn f(_: usize, _: &usize, _: usize) {}
1414
help: provide the argument
1515
|
1616
LL | f(/* usize */, &x, /* usize */);
17-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1818

1919
error: aborting due to previous error
2020

src/test/ui/argument-suggestions/issue-97197.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | pub fn g(a1: (), a2: bool, a3: bool, a4: bool, a5: bool, a6: ()) -> () {}
1212
help: provide the arguments
1313
|
1414
LL | g((), /* bool */, /* bool */, /* bool */, /* bool */, ());
15-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1616

1717
error: aborting due to previous error
1818

src/test/ui/argument-suggestions/issue-97484.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ LL | foo(&&A, B, C, D, &E, F, G);
2020
help: remove the extra arguments
2121
|
2222
LL | foo(&&A, D, /* &E */, G);
23-
| ~~~~~~~~~~~~~~~~~~~~~~~~
23+
| ~~~~~~~~~~~~~~~~~~~~~
2424

2525
error: aborting due to previous error
2626

src/test/ui/argument-suggestions/issue-98894.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | (|_, ()| ())(if true {} else {return;});
1212
help: provide the argument
1313
|
1414
LL | (|_, ()| ())(if true {} else {return;}, ());
15-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1616

1717
error: aborting due to previous error
1818

src/test/ui/argument-suggestions/issue-98897.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | (|_, ()| ())([return, ()]);
1212
help: provide the argument
1313
|
1414
LL | (|_, ()| ())([return, ()], ());
15-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15+
| ~~~~~~~~~~~~~~~~~~
1616

1717
error: aborting due to previous error
1818

src/test/ui/argument-suggestions/issue-99482.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | let f = |_: (), f: fn()| f;
1212
help: provide the argument
1313
|
1414
LL | let _f = f((), main);
15-
| ~~~~~~~~~~~
15+
| ~~~~~~~~~~
1616

1717
error: aborting due to previous error
1818

0 commit comments

Comments
 (0)