Skip to content

Commit ae0030b

Browse files
committed
Auto merge of #101378 - matthiaskrgr:rollup-s1awa47, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #101335 (rustdoc: remove old CSS selector that causes weird spacing) - #101347 (ffx component run should provide a collection) - #101364 (Shrink suggestion span of argument mismatch error) - #101365 (remove redundant clones) Failed merges: - #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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 17 additions & 6 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 5 additions & 8 deletions
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

Lines changed: 1 addition & 1 deletion
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
},
Lines changed: 10 additions & 0 deletions
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

Lines changed: 10 additions & 0 deletions
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 4 deletions
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

0 commit comments

Comments
 (0)