| author | bors <bors@rust-lang.org> 2025-08-11 19:28:22 UTC |
| committer | bors <bors@rust-lang.org> 2025-08-11 19:28:22 UTC |
| log | 1ebbd87a62ce96a72b22da61b7c2c43893534842 |
| tree | 0587f93980bd61549e648c04d57c1531f45aaefa |
| parent | 6355cd39c81e9699b1925c58d2ed3165bcab1715 |
| parent | c2915051bdd532c8ed36b3a79d60b5d6502ff592 |
Rollup of 4 pull requests
Successful merges:
- rust-lang/rust#144966 ( Improve suggestion for "missing function argument" on multiline call)
- rust-lang/rust#145111 (remove some unused private trait impls)
- rust-lang/rust#145221 (Fix Cargo cross-compilation (take two))
- rust-lang/rust#145247 (Update `sysinfo` version to `0.37.0`)
r? `@ghost`
`@rustbot` modify labels: rollup11 files changed, 100 insertions(+), 45 deletions(-)
Cargo.lock+2-2| ... | ... | @@ -5284,9 +5284,9 @@ dependencies = [ |
| 5284 | 5284 | |
| 5285 | 5285 | [[package]] |
| 5286 | 5286 | name = "sysinfo" |
| 5287 | version = "0.36.1" | |
| 5287 | version = "0.37.0" | |
| 5288 | 5288 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 5289 | checksum = "252800745060e7b9ffb7b2badbd8b31cfa4aa2e61af879d0a3bf2a317c20217d" | |
| 5289 | checksum = "07cec4dc2d2e357ca1e610cfb07de2fa7a10fc3e9fe89f72545f3d244ea87753" | |
| 5290 | 5290 | dependencies = [ |
| 5291 | 5291 | "libc", |
| 5292 | 5292 | "objc2-core-foundation", |
compiler/rustc_borrowck/src/polonius/legacy/facts.rs-16| ... | ... | @@ -184,22 +184,6 @@ where |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | impl<A, B, C, D> FactRow for (A, B, C, D) | |
| 188 | where | |
| 189 | A: FactCell, | |
| 190 | B: FactCell, | |
| 191 | C: FactCell, | |
| 192 | D: FactCell, | |
| 193 | { | |
| 194 | fn write( | |
| 195 | &self, | |
| 196 | out: &mut dyn Write, | |
| 197 | location_table: &PoloniusLocationTable, | |
| 198 | ) -> Result<(), Box<dyn Error>> { | |
| 199 | write_row(out, location_table, &[&self.0, &self.1, &self.2, &self.3]) | |
| 200 | } | |
| 201 | } | |
| 202 | ||
| 203 | 187 | fn write_row( |
| 204 | 188 | out: &mut dyn Write, |
| 205 | 189 | location_table: &PoloniusLocationTable, |
compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs+44-6| ... | ... | @@ -1589,26 +1589,64 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 1589 | 1589 | // e.g. `reuse HasSelf::method;` should suggest `reuse HasSelf::method($args);`. |
| 1590 | 1590 | full_call_span.shrink_to_hi() |
| 1591 | 1591 | }; |
| 1592 | ||
| 1593 | // Controls how the arguments should be listed in the suggestion. | |
| 1594 | enum ArgumentsFormatting { | |
| 1595 | SingleLine, | |
| 1596 | Multiline { fallback_indent: String, brace_indent: String }, | |
| 1597 | } | |
| 1598 | let arguments_formatting = { | |
| 1599 | let mut provided_inputs = matched_inputs.iter().filter_map(|a| *a); | |
| 1600 | if let Some(brace_indent) = source_map.indentation_before(suggestion_span) | |
| 1601 | && let Some(first_idx) = provided_inputs.by_ref().next() | |
| 1602 | && let Some(last_idx) = provided_inputs.by_ref().next() | |
| 1603 | && let (_, first_span) = provided_arg_tys[first_idx] | |
| 1604 | && let (_, last_span) = provided_arg_tys[last_idx] | |
| 1605 | && source_map.is_multiline(first_span.to(last_span)) | |
| 1606 | && let Some(fallback_indent) = source_map.indentation_before(first_span) | |
| 1607 | { | |
| 1608 | ArgumentsFormatting::Multiline { fallback_indent, brace_indent } | |
| 1609 | } else { | |
| 1610 | ArgumentsFormatting::SingleLine | |
| 1611 | } | |
| 1612 | }; | |
| 1613 | ||
| 1592 | 1614 | let mut suggestion = "(".to_owned(); |
| 1593 | 1615 | let mut needs_comma = false; |
| 1594 | 1616 | for (expected_idx, provided_idx) in matched_inputs.iter_enumerated() { |
| 1595 | 1617 | if needs_comma { |
| 1596 | suggestion += ", "; | |
| 1597 | } else { | |
| 1598 | needs_comma = true; | |
| 1618 | suggestion += ","; | |
| 1619 | } | |
| 1620 | match &arguments_formatting { | |
| 1621 | ArgumentsFormatting::SingleLine if needs_comma => suggestion += " ", | |
| 1622 | ArgumentsFormatting::SingleLine => {} | |
| 1623 | ArgumentsFormatting::Multiline { .. } => suggestion += "\n", | |
| 1599 | 1624 | } |
| 1600 | let suggestion_text = if let Some(provided_idx) = provided_idx | |
| 1625 | needs_comma = true; | |
| 1626 | let (suggestion_span, suggestion_text) = if let Some(provided_idx) = provided_idx | |
| 1601 | 1627 | && let (_, provided_span) = provided_arg_tys[*provided_idx] |
| 1602 | 1628 | && let Ok(arg_text) = source_map.span_to_snippet(provided_span) |
| 1603 | 1629 | { |
| 1604 | arg_text | |
| 1630 | (Some(provided_span), arg_text) | |
| 1605 | 1631 | } else { |
| 1606 | 1632 | // Propose a placeholder of the correct type |
| 1607 | 1633 | let (_, expected_ty) = formal_and_expected_inputs[expected_idx]; |
| 1608 | ty_to_snippet(expected_ty, expected_idx) | |
| 1634 | (None, ty_to_snippet(expected_ty, expected_idx)) | |
| 1609 | 1635 | }; |
| 1636 | if let ArgumentsFormatting::Multiline { fallback_indent, .. } = | |
| 1637 | &arguments_formatting | |
| 1638 | { | |
| 1639 | let indent = suggestion_span | |
| 1640 | .and_then(|span| source_map.indentation_before(span)) | |
| 1641 | .unwrap_or_else(|| fallback_indent.clone()); | |
| 1642 | suggestion += &indent; | |
| 1643 | } | |
| 1610 | 1644 | suggestion += &suggestion_text; |
| 1611 | 1645 | } |
| 1646 | if let ArgumentsFormatting::Multiline { brace_indent, .. } = arguments_formatting { | |
| 1647 | suggestion += ",\n"; | |
| 1648 | suggestion += &brace_indent; | |
| 1649 | } | |
| 1612 | 1650 | suggestion += ")"; |
| 1613 | 1651 | err.span_suggestion_verbose( |
| 1614 | 1652 | suggestion_span, |
compiler/rustc_symbol_mangling/src/export.rs+1-8| ... | ... | @@ -21,7 +21,7 @@ macro_rules! default_hash_impl { |
| 21 | 21 | }; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | default_hash_impl! { i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize, } | |
| 24 | default_hash_impl! { u8, u64, usize, } | |
| 25 | 25 | |
| 26 | 26 | impl<'tcx> AbiHashStable<'tcx> for bool { |
| 27 | 27 | #[inline] |
| ... | ... | @@ -37,13 +37,6 @@ impl<'tcx> AbiHashStable<'tcx> for str { |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | impl<'tcx> AbiHashStable<'tcx> for String { | |
| 41 | #[inline] | |
| 42 | fn abi_hash(&self, tcx: TyCtxt<'tcx>, hasher: &mut StableHasher) { | |
| 43 | self[..].abi_hash(tcx, hasher); | |
| 44 | } | |
| 45 | } | |
| 46 | ||
| 47 | 40 | impl<'tcx> AbiHashStable<'tcx> for Symbol { |
| 48 | 41 | #[inline] |
| 49 | 42 | fn abi_hash(&self, tcx: TyCtxt<'tcx>, hasher: &mut StableHasher) { |
src/bootstrap/Cargo.lock+2-2| ... | ... | @@ -730,9 +730,9 @@ dependencies = [ |
| 730 | 730 | |
| 731 | 731 | [[package]] |
| 732 | 732 | name = "sysinfo" |
| 733 | version = "0.36.0" | |
| 733 | version = "0.37.0" | |
| 734 | 734 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 735 | checksum = "aab138f5c1bb35231de19049060a87977ad23e04f2303e953bc5c2947ac7dec4" | |
| 735 | checksum = "07cec4dc2d2e357ca1e610cfb07de2fa7a10fc3e9fe89f72545f3d244ea87753" | |
| 736 | 736 | dependencies = [ |
| 737 | 737 | "libc", |
| 738 | 738 | "memchr", |
src/bootstrap/Cargo.toml+1-1| ... | ... | @@ -58,7 +58,7 @@ walkdir = "2.4" |
| 58 | 58 | xz2 = "0.1" |
| 59 | 59 | |
| 60 | 60 | # Dependencies needed by the build-metrics feature |
| 61 | sysinfo = { version = "0.36.0", default-features = false, optional = true, features = ["system"] } | |
| 61 | sysinfo = { version = "0.37.0", default-features = false, optional = true, features = ["system"] } | |
| 62 | 62 | |
| 63 | 63 | # Dependencies needed by the `tracing` feature |
| 64 | 64 | tracing = { version = "0.1", optional = true, features = ["attributes"] } |
src/bootstrap/src/core/build_steps/tool.rs+2| ... | ... | @@ -857,7 +857,9 @@ impl Step for Cargo { |
| 857 | 857 | fn run(self, builder: &Builder<'_>) -> ToolBuildResult { |
| 858 | 858 | builder.build.require_submodule("src/tools/cargo", None); |
| 859 | 859 | |
| 860 | builder.std(self.build_compiler, builder.host_target); | |
| 860 | 861 | builder.std(self.build_compiler, self.target); |
| 862 | ||
| 861 | 863 | builder.ensure(ToolBuild { |
| 862 | 864 | build_compiler: self.build_compiler, |
| 863 | 865 | target: self.target, |
src/tools/opt-dist/Cargo.toml+1-1| ... | ... | @@ -10,7 +10,7 @@ log = "0.4" |
| 10 | 10 | anyhow = "1" |
| 11 | 11 | humantime = "2" |
| 12 | 12 | humansize = "2" |
| 13 | sysinfo = { version = "0.36.0", default-features = false, features = ["disk"] } | |
| 13 | sysinfo = { version = "0.37.0", default-features = false, features = ["disk"] } | |
| 14 | 14 | fs_extra = "1" |
| 15 | 15 | camino = "1" |
| 16 | 16 | tar = "0.4" |
tests/ui/argument-suggestions/issue-100478.stderr+10-6| ... | ... | @@ -75,12 +75,16 @@ LL | fn foo(p1: T1, p2: Arc<T2>, p3: T3, p4: Arc<T4>, p5: T5, p6: T6, p7: T7, p8 |
| 75 | 75 | | ^^^ ----------- |
| 76 | 76 | help: provide the argument |
| 77 | 77 | | |
| 78 | LL - foo( | |
| 79 | LL - | |
| 80 | LL - p1, //p2, | |
| 81 | LL - p3, p4, p5, p6, p7, p8, | |
| 82 | LL - ); | |
| 83 | LL + foo(p1, /* Arc<T2> */, p3, p4, p5, p6, p7, p8); | |
| 78 | LL ~ foo( | |
| 79 | LL + p1, | |
| 80 | LL + /* Arc<T2> */, | |
| 81 | LL + p3, | |
| 82 | LL + p4, | |
| 83 | LL + p5, | |
| 84 | LL + p6, | |
| 85 | LL + p7, | |
| 86 | LL + p8, | |
| 87 | LL ~ ); | |
| 84 | 88 | | |
| 85 | 89 | |
| 86 | 90 | error: aborting due to 4 previous errors |
tests/ui/fn/fn-arg-count-mismatch-diagnostics.rs+12| ... | ... | @@ -46,9 +46,21 @@ impl Bar { |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | fn function_with_lots_of_arguments(a: i32, b: char, c: i32, d: i32, e: i32, f: i32) {} | |
| 50 | ||
| 49 | 51 | fn main() { |
| 50 | 52 | foo(1, 2, 3); |
| 51 | 53 | //~^ ERROR function takes 4 arguments but 3 |
| 52 | 54 | bar(1, 2, 3); |
| 53 | 55 | //~^ ERROR function takes 6 arguments but 3 |
| 56 | ||
| 57 | let variable_name = 42; | |
| 58 | function_with_lots_of_arguments( | |
| 59 | variable_name, | |
| 60 | variable_name, | |
| 61 | variable_name, | |
| 62 | variable_name, | |
| 63 | variable_name, | |
| 64 | ); | |
| 65 | //~^^^^^^^ ERROR this function takes 6 arguments but 5 arguments were supplied [E0061] | |
| 54 | 66 | } |
tests/ui/fn/fn-arg-count-mismatch-diagnostics.stderr+25-3| ... | ... | @@ -52,7 +52,7 @@ LL | <$from>::$method(8, /* u8 */) |
| 52 | 52 | | ++++++++++ |
| 53 | 53 | |
| 54 | 54 | error[E0061]: this function takes 4 arguments but 3 arguments were supplied |
| 55 | --> $DIR/fn-arg-count-mismatch-diagnostics.rs:50:5 | |
| 55 | --> $DIR/fn-arg-count-mismatch-diagnostics.rs:52:5 | |
| 56 | 56 | | |
| 57 | 57 | LL | foo(1, 2, 3); |
| 58 | 58 | | ^^^--------- argument #4 of type `isize` is missing |
| ... | ... | @@ -68,7 +68,7 @@ LL | foo(1, 2, 3, /* isize */); |
| 68 | 68 | | +++++++++++++ |
| 69 | 69 | |
| 70 | 70 | error[E0061]: this function takes 6 arguments but 3 arguments were supplied |
| 71 | --> $DIR/fn-arg-count-mismatch-diagnostics.rs:52:5 | |
| 71 | --> $DIR/fn-arg-count-mismatch-diagnostics.rs:54:5 | |
| 72 | 72 | | |
| 73 | 73 | LL | bar(1, 2, 3); |
| 74 | 74 | | ^^^--------- three arguments of type `i32`, `i32`, and `i32` are missing |
| ... | ... | @@ -83,6 +83,28 @@ help: provide the arguments |
| 83 | 83 | LL | bar(1, 2, 3, /* i32 */, /* i32 */, /* i32 */); |
| 84 | 84 | | +++++++++++++++++++++++++++++++++ |
| 85 | 85 | |
| 86 | error: aborting due to 5 previous errors | |
| 86 | error[E0061]: this function takes 6 arguments but 5 arguments were supplied | |
| 87 | --> $DIR/fn-arg-count-mismatch-diagnostics.rs:58:5 | |
| 88 | | | |
| 89 | LL | function_with_lots_of_arguments( | |
| 90 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 91 | LL | variable_name, | |
| 92 | LL | variable_name, | |
| 93 | | ------------- argument #2 of type `char` is missing | |
| 94 | | | |
| 95 | note: function defined here | |
| 96 | --> $DIR/fn-arg-count-mismatch-diagnostics.rs:49:4 | |
| 97 | | | |
| 98 | LL | fn function_with_lots_of_arguments(a: i32, b: char, c: i32, d: i32, e: i32, f: i32) {} | |
| 99 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------- | |
| 100 | help: provide the argument | |
| 101 | | | |
| 102 | LL | function_with_lots_of_arguments( | |
| 103 | LL | variable_name, | |
| 104 | LL ~ /* char */, | |
| 105 | LL ~ variable_name, | |
| 106 | | | |
| 107 | ||
| 108 | error: aborting due to 6 previous errors | |
| 87 | 109 | |
| 88 | 110 | For more information about this error, try `rustc --explain E0061`. |