Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #107020

Closed
wants to merge 20 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

atouchet and others added 20 commits December 28, 2022 21:47
Improve Markdown styling in README

Update Readme to use consistent line lengths. Also update some formatting and links. (Followup to rust-lang#105553).

r? `@workingjubilee`
…tebank

Add 'static lifetime suggestion when GAT implied 'static requirement from HRTB

Fix for issue rust-lang#105507

The problem:
When generic associated types (GATs) are from higher-ranked trait bounds (HRTB), they are implied 'static requirement (see
[Implied 'static requirement from higher-ranked trait bounds](https://blog.rust-lang.org/2022/10/28/gats-stabilization.html#implied-static-requirement-from-higher-ranked-trait-bounds) for more details). If the user did not explicitly specify the `'static` lifetime when using the GAT, the current error message will only point out the type `does not live long enough` where the type is used, but not where the GAT is specified and how to fix the problem.

The solution:
Add notes at the span where the problematic GATs are specified and suggestions of how to fix the problem by adding `'static` lifetime at the right spans.
…piler-errors

dont randomly use `_` to print out const generic arguments

const generics seem to get printed out as `_` for no reason a lot of the time, as someone who spends a lot of time with const generics this has gotten ✨ very annoying ✨. Latest example would be rust-lang#106423 where the ICE messaged formatted a `ty::Const` containing no infer vars, as `_`.

For some reason printing of the const argument on arrays was custom instead of using the existing logic for printing `ty::Const`. Additionally the existing logic for printing `ty::Const` would print out `_` for anon consts that are in a separate crate leading to weird diagnostics (see second commit). There ought to be less cases of consts randomly getting printed as `_` hiding valuable info now.
…stebank

Remove overlapping parts of multipart suggestions

This PR adds a debug assertion that the parts of a single substitution cannot overlap, fixes a overlapping substitution from the testsuite, and fixes rust-lang#106870.

Note that a single suggestion can still have multiple overlapping substitutions / possible edits, we just don't suggest overlapping replacements in a single edit anymore.

I've also included a fix for an unrelated bug where rustfix for `explicit_outlives_requirements` would produce multiple trailing commas for a where clause.
…est, r=cuviper

bump failing assembly & codegen tests from LLVM 14 to LLVM 15

These tests need LLVM 15.

Found by ``@Robert-Cunningham`` in rust-lang#100601 (comment)

Passed tests at 006506e93fc80318ebfd7939fe1fd4dc19ecd8cb in https://github.com/rust-lang/rust/actions/runs/3942442730/jobs/6746104740.
…div, r=GuillaumeGomez

rustdoc: instead of `.setting-name { width: 100% }`, use default div CSS

This has no discernible change in appearance.
Add heapsort fallback in `select_nth_unstable`

Addresses rust-lang#102451 and rust-lang#106933.

`slice::select_nth_unstable` uses a quick select implementation based on the same pattern defeating quicksort algorithm that `slice::sort_unstable` uses. `slice::sort_unstable` uses a recursion limit and falls back to heapsort if there were too many bad pivot choices, to ensure O(n log n) worst case running time (known as introsort). However, `slice::select_nth_unstable` does not have such a fallback strategy, which leads to it having a worst case running time of O(n²) instead. rust-lang#102451 links to a playground which generates pathological inputs that show this quadratic behavior. On my machine, a randomly generated slice of length `1 << 19` takes ~200µs to calculate its median, whereas a pathological input of the same length takes over 2.5s. This PR adds an iteration limit to `select_nth_unstable`, falling back to heapsort, which ensures an O(n log n) worst case running time (introselect). With this change, there was no noticable slowdown for the random input, but the same pathological input now takes only ~1.2ms. In the future it might be worth implementing something like Median of Medians or Fast Deterministic Selection instead, which guarantee O(n) running time for all possible inputs. I've left this as a `FIXME` for now and only implemented the heapsort fallback to minimize the needed code changes.

I still think we should clarify in the `select_nth_unstable` docs that the worst case running time isn't currently O(n) (the original reason that rust-lang#102451 was opened), but I think it's a lot better to be able to guarantee O(n log n) instead of O(n²) for the worst case.
@rustbot rustbot added A-meta Area: Issues & PRs about the rust-lang/rust repository itself S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Jan 18, 2023
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=7

@bors
Copy link
Contributor

bors commented Jan 18, 2023

📌 Commit 545ec30 has been approved by matthiaskrgr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 18, 2023
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

---- compile_test stdout ----
diff of stderr:

 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("val='{}'", local_i32);
    |
    |
    = note: `-D clippy::uninlined-format-args` implied by `-D warnings`
    |
    |
 LL -     println!("val='{}'", local_i32);
 LL +     println!("val='{local_i32}'");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("val='{   }'", local_i32); // 3 spaces
    |
 help: change this to
    |
    |
 LL -     println!("val='{   }'", local_i32); // 3 spaces
 LL +     println!("val='{local_i32}'"); // 3 spaces
    |
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("val='{    }'", local_i32); // tab
    |
 help: change this to
    |
    |
 LL -     println!("val='{    }'", local_i32); // tab
 LL +     println!("val='{local_i32}'"); // tab
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("val='{     }'", local_i32); // space+tab
    |
 help: change this to
    |
    |
 LL -     println!("val='{     }'", local_i32); // space+tab
 LL +     println!("val='{local_i32}'"); // space+tab
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("val='{     }'", local_i32); // tab+space
    |
 help: change this to
    |
    |
 LL -     println!("val='{     }'", local_i32); // tab+space
 LL +     println!("val='{local_i32}'"); // tab+space
 
 
 error: variables can be used directly in the `format!` string
    |
 LL | /     println!(
 LL | /     println!(
 LL | |         "val='{
 LL | |     }'",
 LL | |         local_i32
 LL | |     );
 
 
 error: variables can be used directly in the `format!` string
    |
 LL |     println!("{}", local_i32);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    |
 help: change this to
    |
 LL -     println!("{}", local_i32);
 LL +     println!("{local_i32}");
 
 
 error: variables can be used directly in the `format!` string
    |
 LL |     println!("{}", fn_arg);
    |     ^^^^^^^^^^^^^^^^^^^^^^
    |
    |
 help: change this to
    |
 LL -     println!("{}", fn_arg);
 LL +     println!("{fn_arg}");
 
 
 error: variables can be used directly in the `format!` string
    |
 LL |     println!("{:?}", local_i32);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    |
 help: change this to
    |
 LL -     println!("{:?}", local_i32);
 LL +     println!("{local_i32:?}");
 
 
 error: variables can be used directly in the `format!` string
    |
 LL |     println!("{:#?}", local_i32);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    |
 help: change this to
    |
 LL -     println!("{:#?}", local_i32);
 LL +     println!("{local_i32:#?}");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("{:4}", local_i32);
    |
 help: change this to
    |
    |
 LL -     println!("{:4}", local_i32);
 LL +     println!("{local_i32:4}");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("{:04}", local_i32);
    |
 help: change this to
    |
    |
 LL -     println!("{:04}", local_i32);
 LL +     println!("{local_i32:04}");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("{:<3}", local_i32);
    |
 help: change this to
    |
    |
 LL -     println!("{:<3}", local_i32);
 LL +     println!("{local_i32:<3}");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("{:#010x}", local_i32);
    |
 help: change this to
    |
    |
 LL -     println!("{:#010x}", local_i32);
 LL +     println!("{local_i32:#010x}");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("{:.1}", local_f64);
    |
 help: change this to
    |
    |
 LL -     println!("{:.1}", local_f64);
 LL +     println!("{local_f64:.1}");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("{} {}", local_i32, local_f64);
    |
 help: change this to
    |
    |
 LL -     println!("{} {}", local_i32, local_f64);
 LL +     println!("{local_i32} {local_f64}");
 
 
 error: variables can be used directly in the `format!` string
    |
 LL |     println!("{}", val);
    |     ^^^^^^^^^^^^^^^^^^^
    |
    |
 help: change this to
    |
 LL -     println!("{}", val);
 LL +     println!("{val}");
 
 
 error: variables can be used directly in the `format!` string
    |
 LL |     println!("{}", v = val);
    |     ^^^^^^^^^^^^^^^^^^^^^^^
    |
    |
 help: change this to
    |
 LL -     println!("{}", v = val);
 LL +     println!("{val}");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("val='{/t }'", local_i32);
    |
 help: change this to
    |
    |
 LL -     println!("val='{/t }'", local_i32);
 LL +     println!("val='{local_i32}'");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("val='{/n }'", local_i32);
    |
 help: change this to
    |
    |
 LL -     println!("val='{/n }'", local_i32);
 LL +     println!("val='{local_i32}'");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("val='{local_i32}'", local_i32 = local_i32);
    |
 help: change this to
    |
    |
 LL -     println!("val='{local_i32}'", local_i32 = local_i32);
 LL +     println!("val='{local_i32}'");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("val='{local_i32}'", local_i32 = fn_arg);
    |
 help: change this to
    |
    |
 LL -     println!("val='{local_i32}'", local_i32 = fn_arg);
 LL +     println!("val='{fn_arg}'");
 
 
 error: variables can be used directly in the `format!` string
    |
 LL |     println!("{0}", local_i32);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    |
 help: change this to
    |
 LL -     println!("{0}", local_i32);
 LL +     println!("{local_i32}");
 
 
 error: variables can be used directly in the `format!` string
    |
 LL |     println!("{0:?}", local_i32);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    |
 help: change this to
    |
 LL -     println!("{0:?}", local_i32);
 LL +     println!("{local_i32:?}");
 
 
 error: variables can be used directly in the `format!` string
    |
 LL |     println!("{0:#?}", local_i32);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    |
 help: change this to
    |
 LL -     println!("{0:#?}", local_i32);
 LL +     println!("{local_i32:#?}");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("{0:04}", local_i32);
    |
 help: change this to
    |
    |
 LL -     println!("{0:04}", local_i32);
 LL +     println!("{local_i32:04}");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("{0:<3}", local_i32);
    |
 help: change this to
    |
    |
 LL -     println!("{0:<3}", local_i32);
 LL +     println!("{local_i32:<3}");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("{0:#010x}", local_i32);
    |
 help: change this to
    |
    |
 LL -     println!("{0:#010x}", local_i32);
 LL +     println!("{local_i32:#010x}");
 
 
 error: variables can be used directly in the `format!` string
    |
    |
 LL |     println!("{0:.1}", local_f64);
    |
 help: change this to
    |
    |
 LL -     println!("{0:.1}", local_f64);
 LL +     println!("{local_f64:.1}");
 
 
-error: variables can be used directly in the `format!` string
-   |
-   |
-LL |     println!("{0} {0}", local_i32);
-   |
-help: change this to
-   |
-   |
-LL -     println!("{0} {0}", local_i32);
-LL +     println!("{local_i32} {local_i32}");
+thread 'rustc' panicked at 'assertion failed: `(left == right)`
+  left: `None`,
+  left: `None`,
+ right: `Some([SubstitutionPart { span: $DIR/uninlined_format_args.rs:78:23: 78:34 (#0), snippet: "" }, SubstitutionPart { span: $DIR/uninlined_format_args.rs:78:23: 78:34 (#0), snippet: "" }])`: suggestion must not have overlapping parts', /checkout/compiler/rustc_errors/src/diagnostic.rs:646:9
 
 
-error: variables can be used directly in the `format!` string
-   |
-   |
-LL |     println!("{1} {} {0} {}", local_i32, local_f64);
-   |
-help: change this to
-   |
-   |
-LL -     println!("{1} {} {0} {}", local_i32, local_f64);
-LL +     println!("{local_f64} {local_i32} {local_i32} {local_f64}");
+error: internal compiler error: unexpected panic
 
 
-error: variables can be used directly in the `format!` string
-   |
-   |
-LL |     println!("{0} {1}", local_i32, local_f64);
-   |
-help: change this to
-   |
-   |
-LL -     println!("{0} {1}", local_i32, local_f64);
-LL +     println!("{local_i32} {local_f64}");
+note: the compiler unexpectedly panicked. this is a bug.
 
 
-error: variables can be used directly in the `format!` string
-   |
-   |
-LL |     println!("{1} {0}", local_i32, local_f64);
-   |
-help: change this to
-   |
-   |
-LL -     println!("{1} {0}", local_i32, local_f64);
-LL +     println!("{local_f64} {local_i32}");
+note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new
 
 
-error: variables can be used directly in the `format!` string
-   |
-   |
-LL |     println!("{1} {0} {1} {0}", local_i32, local_f64);
-   |
-help: change this to
-   |
-   |
-LL -     println!("{1} {0} {1} {0}", local_i32, local_f64);
-LL +     println!("{local_f64} {local_i32} {local_f64} {local_i32}");
-   |
+note: Clippy version: clippy 0.1.68 (842d70d5 2023-01-18)
 
-error: variables can be used directly in the `format!` string
-   |
-   |
-LL |     println!("{v}", v = local_i32);
-   |
-help: change this to
-   |
-   |
-LL -     println!("{v}", v = local_i32);
-LL +     println!("{local_i32}");
-
-
-error: variables can be used directly in the `format!` string
-   |
-   |
-LL |     println!("{local_i32:0$}", width);
-   |
-help: change this to
-   |
-   |
-LL -     println!("{local_i32:0$}", width);
-LL +     println!("{local_i32:width$}");
-
-
-error: variables can be used directly in the `format!` string
-   |
-   |
-LL |     println!("{local_i32:w$}", w = width);
-   |
-help: change this to
-   |
-   |
-LL -     println!("{local_i32:w$}", w = width);
-LL +     println!("{local_i32:width$}");
-
-
-error: variables can be used directly in the `format!` string
-   |
-   |
-LL |     println!("{local_i32:.0$}", prec);
-   |
-help: change this to
-   |
-   |
-LL -     println!("{local_i32:.0$}", prec);
-LL +     println!("{local_i32:.prec$}");
-
-
-error: variables can be used directly in the `format!` string
-   |
-   |
-LL |     println!("{local_i32:.p$}", p = prec);
-   |
-help: change this to
-   |
-   |
-LL -     println!("{local_i32:.p$}", p = prec);
-LL +     println!("{local_i32:.prec$}");
-
-
-error: variables can be used directly in the `format!` string
-   |
-   |
-LL |     println!("{:0$}", v = val);
-   |
-help: change this to
-   |
-   |
-LL -     println!("{:0$}", v = val);
-LL +     println!("{val:val$}");
-
-
-error: variables can be used directly in the `format!` string
-   |
-   |
-LL |     println!("{0:0$}", v = val);
-   |
-help: change this to
-   |
-   |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Issues & PRs about the rust-lang/rust repository itself rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants