Skip to content

Commit

Permalink
Auto merge of rust-lang#101378 - matthiaskrgr:rollup-s1awa47, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

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
  • Loading branch information
bors committed Sep 3, 2022
2 parents 47d1cdb + 01da61a commit ae0030b
Show file tree
Hide file tree
Showing 44 changed files with 154 additions and 124 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/parser/attr_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl AttrWrapper {
// Prepend `self.attrs` to `attrs`.
// FIXME: require passing an NT to prevent misuse of this method
pub(crate) fn prepend_to_nt_inner(self, attrs: &mut AttrVec) {
let mut self_attrs = self.attrs.clone();
let mut self_attrs = self.attrs;
std::mem::swap(attrs, &mut self_attrs);
attrs.extend(self_attrs);
}
Expand Down
23 changes: 17 additions & 6 deletions compiler/rustc_typeck/src/check/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,11 +1056,22 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
};
if let Some(suggestion_text) = suggestion_text {
let source_map = self.sess().source_map();
let mut suggestion = format!(
"{}(",
source_map.span_to_snippet(full_call_span).unwrap_or_else(|_| fn_def_id
.map_or("".to_string(), |fn_def_id| tcx.item_name(fn_def_id).to_string()))
);
let (mut suggestion, suggestion_span) =
if let Some(call_span) = full_call_span.find_ancestor_inside(error_span) {
("(".to_string(), call_span.shrink_to_hi().to(error_span.shrink_to_hi()))
} else {
(
format!(
"{}(",
source_map.span_to_snippet(full_call_span).unwrap_or_else(|_| {
fn_def_id.map_or("".to_string(), |fn_def_id| {
tcx.item_name(fn_def_id).to_string()
})
})
),
error_span,
)
};
let mut needs_comma = false;
for (expected_idx, provided_idx) in matched_inputs.iter_enumerated() {
if needs_comma {
Expand Down Expand Up @@ -1088,7 +1099,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
suggestion += ")";
err.span_suggestion_verbose(
error_span,
suggestion_span,
&suggestion_text,
suggestion,
Applicability::HasPlaceholders,
Expand Down
2 changes: 2 additions & 0 deletions src/doc/rustc/src/platform-support/fuchsia.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ Finally, run the component:

```sh
${SDK_PATH}/tools/${ARCH}/ffx component run \
/core/ffx-laboratory:hello_fuchsia \
fuchsia-pkg://hello-fuchsia/hello_fuchsia_manifest#meta/hello_fuchsia.cm
```

Expand All @@ -579,6 +580,7 @@ passed.
```sh
${SDK_PATH}/tools/${ARCH}/ffx component run \
--recreate \
/core/ffx-laboratory:hello_fuchsia \
fuchsia-pkg://hello-fuchsia/hello_fuchsia_manifest#meta/hello_fuchsia.cm
```

Expand Down
13 changes: 5 additions & 8 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -778,14 +778,6 @@ pre, .rustdoc.source .example-wrap {
margin-bottom: .6em;
}

.content .impl-items > .item-info {
margin-left: 40px;
}

.methods > .item-info, .content .impl-items > .item-info {
margin-top: -8px;
}

.impl-items {
flex-basis: 100%;
}
Expand Down Expand Up @@ -2035,6 +2027,11 @@ in storage.js plus the media query with (min-width: 701px)
#main-content > div > details.rustdoc-toggle > summary::before {
left: -11px;
}

/* Align summary-nested and unnested item-info gizmos. */
.content .impl-items > .item-info {
margin-left: 34px;
}
}

@media print {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/json/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ impl FromWithTcx<clean::Type> for Type {
},
QPath(box clean::QPathData { assoc, self_type, trait_, .. }) => Type::QualifiedPath {
name: assoc.name.to_string(),
args: Box::new(assoc.args.clone().into_tcx(tcx)),
args: Box::new(assoc.args.into_tcx(tcx)),
self_type: Box::new(self_type.into_tcx(tcx)),
trait_: trait_.into_tcx(tcx),
},
Expand Down
10 changes: 10 additions & 0 deletions src/test/rustdoc-gui/item-info-alignment.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This test ensures that the "item-info" looks about the same
// whether or not it's inside a toggle.
goto: file://|DOC_PATH|/lib2/struct.ItemInfoAlignmentTest.html

// First, we try it in "desktop" mode.
size: (1200, 870)
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x"))
// Next, we try it in "mobile" mode (max-width: 700px).
size: (650, 650)
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x"))
10 changes: 10 additions & 0 deletions src/test/rustdoc-gui/src/lib2/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,13 @@ where
type Output;
fn index(&self, index: Idx) -> &Self::Output;
}

pub struct ItemInfoAlignmentTest;

impl ItemInfoAlignmentTest {
/// This method has docs
#[deprecated]
pub fn foo() {}
#[deprecated]
pub fn bar() {}
}
10 changes: 5 additions & 5 deletions src/test/ui/argument-suggestions/basic.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ LL | fn extra() {}
help: remove the extra argument
|
LL | extra();
| ~~~~~~~
| ~~

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

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

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

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

error: aborting due to 6 previous errors

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/argument-suggestions/complex.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LL | fn complex(_i: u32, _s: &str, _e: E, _f: F, _g: G, _x: X, _y: Y, _z: Z ) {}
help: did you mean
|
LL | complex(/* u32 */, &"", /* E */, F::X2, G{}, X {}, Y {}, Z {});
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to previous error

Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/argument-suggestions/exotic-calls.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LL | fn foo<T: Fn()>(t: T) {
help: remove the extra argument
|
LL | t();
| ~~~
| ~~

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

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

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

error: aborting due to 4 previous errors

Expand Down
28 changes: 14 additions & 14 deletions src/test/ui/argument-suggestions/extra_arguments.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LL | fn empty() {}
help: remove the extra argument
|
LL | empty();
| ~~~~~~~
| ~~

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

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

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

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

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

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

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

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

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

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

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

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

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

error: aborting due to 14 previous errors

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/argument-suggestions/issue-96638.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ LL | fn f(_: usize, _: &usize, _: usize) {}
help: provide the argument
|
LL | f(/* usize */, &x, /* usize */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/argument-suggestions/issue-97197.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LL | pub fn g(a1: (), a2: bool, a3: bool, a4: bool, a5: bool, a6: ()) -> () {}
help: provide the arguments
|
LL | g((), /* bool */, /* bool */, /* bool */, /* bool */, ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/argument-suggestions/issue-97484.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LL | foo(&&A, B, C, D, &E, F, G);
help: remove the extra arguments
|
LL | foo(&&A, D, /* &E */, G);
| ~~~~~~~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~~~~~~~

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/argument-suggestions/issue-98894.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LL | (|_, ()| ())(if true {} else {return;});
help: provide the argument
|
LL | (|_, ()| ())(if true {} else {return;}, ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/argument-suggestions/issue-98897.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LL | (|_, ()| ())([return, ()]);
help: provide the argument
|
LL | (|_, ()| ())([return, ()], ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~~~~~~

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/argument-suggestions/issue-99482.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LL | let f = |_: (), f: fn()| f;
help: provide the argument
|
LL | let _f = f((), main);
| ~~~~~~~~~~~
| ~~~~~~~~~~

error: aborting due to previous error

Expand Down
Loading

0 comments on commit ae0030b

Please sign in to comment.