Commit Graph

252155 Commits

Author SHA1 Message Date
surechen
c8490a0608 skip unused_parens's suggestion for Paren in macro.
fixes #120642
2024-04-10 17:56:43 +08:00
Oli Scherer
f2465f8f20 Use trait solver to answer questions instead of manually writing a trait solver 2024-04-10 05:22:43 +00:00
Oli Scherer
1cbe92716f Only avoid anon consts during instantiation 2024-04-10 04:49:27 +00:00
bors
b14d8b2ef2 Auto merge of #122812 - dtolnay:mode, r=workingjubilee
Show mode_t as octal in std::fs Debug impls

Example:

```rust
fn main() {
    println!("{:?}", std::fs::metadata("Cargo.toml").unwrap().permissions());
}
```

- Before: `Permissions(FilePermissions { mode: 33204 })`

- ~~After: `Permissions(FilePermissions { mode: 0o100664 })`~~

- After: `Permissions(FilePermissions { mode: 0o100664 (-rw-rw-r--) })`

~~I thought about using the format from `ls -l` (`-rw-rw-r--`, `drwxrwxr-x`) but I am not sure how transferable the meaning of the higher bits between different unix systems, and anyway starting the value with a leading negative-sign seems objectionable.~~
2024-04-10 04:47:56 +00:00
Michael Howell
3a007dbea9 rustdoc: update test cases 2024-04-09 20:22:13 -07:00
bors
1c77f7378e Auto merge of #123708 - matthiaskrgr:rollup-uf9w1e9, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #121884 (Port exit-code run-make test to use rust)
 - #122200 (Unconditionally show update nightly hint on ICE)
 - #123568 (Clean up tests/ui by removing `does-nothing.rs`)
 - #123609 (Don't use bytepos offsets when computing semicolon span for removal)
 - #123612 (Set target-abi module flag for RISC-V targets)
 - #123633 (Store all args in the unsupported Command implementation)
 - #123668 (async closure coroutine by move body MirPass refactoring)

Failed merges:

 - #123701 (Only assert for child/parent projection compatibility AFTER checking that theyre coming from the same place)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-10 02:43:17 +00:00
Michael Howell
87faa212fb rustdoc: remove unused 16x16 favicon
According to <https://caniuse.com/?search=svg%20favicon>,
SVG favicons are supported in everything but Safari.

When I actually try it in Safari, it's downloading all
three favicons, and nothing looks different when I disable
the 16x16 one.

<https://dev.to/masakudamatsu/favicon-nightmare-how-to-maintain-sanity-3al7>,
which is linked from caniuse above, recommends an ico.
However, the reason they recommend it is the apps that
only support /favicon.ico exactly, and rustdoc can't assume
it will be installed to the site root, so it's unfortunately
up to the webmaster to make sure it's set up.
2024-04-09 19:35:23 -07:00
Michael Howell
13235dce5d rustdoc: load icons from css instead of inline
This cuts the HTML overhead for a page by about 1KiB,
significantly reducing the overall size of the docs bundle.
2024-04-09 19:35:23 -07:00
Matthias Krüger
df068dba0a
Rollup merge of #123668 - oli-obk:by_move_body_golfing, r=compiler-errors
async closure coroutine by move body MirPass refactoring

Unsure about the last commit, but I think the other changes help in simplifying the control flow
2024-04-10 04:27:41 +02:00
Matthias Krüger
a3f10a47d9
Rollup merge of #123633 - bjorn3:unsupported_command_data, r=jhpratt
Store all args in the unsupported Command implementation

This allows printing them in the Debug impl as well as getting them again using the get_args() method. This allows programs that would normally spawn another process to more easily show which program they would have spawned if not for the fact that the target doesn't support spawning child processes without requiring intrusive changes to keep the args. For example rustc compiled to wasi will show the full linker invocation that would have been done.
2024-04-10 04:27:40 +02:00
Matthias Krüger
2ddf984594
Rollup merge of #123612 - kxxt:riscv-target-abi, r=jieyouxu,nikic,DianQK
Set target-abi module flag for RISC-V targets

Fixes cross-language LTO on RISC-V targets (Fixes #121924)
2024-04-10 04:27:40 +02:00
Matthias Krüger
4bc891aebf
Rollup merge of #123609 - compiler-errors:greek-question-mark, r=jieyouxu
Don't use bytepos offsets when computing semicolon span for removal

Causes problems when we recover confusable characters w/ a different byte width

Fixes #123607
2024-04-10 04:27:39 +02:00
Matthias Krüger
c14b468cca
Rollup merge of #123568 - Oneirical:delete-tests, r=wesleywiser
Clean up tests/ui by removing `does-nothing.rs`

In [a previous PR](https://github.com/rust-lang/rust/pull/123297#issuecomment-2039887806), it was suggested that this test be removed:

> it's testing a basic diagnostic for an unknown variable (added over a decade ago for https://github.com/rust-lang/rust/issues/154) that is already covered by probably dozens or hundreds of other tests.

It was then suggested that [opening a new PR](https://github.com/rust-lang/rust/pull/123563#discussion_r1554654102) for this would be more organized.

I'm setting this as a draft, as:

1. The tests/ui directory is rather disorganized, a large quantity of tests are not even contained inside their own directories. This PR could turn into "clean up the UI tests directory", if I were to place everything into categories (for example, everything related to CLI flags could get placed in a cli directory).
2. This will have a merge conflict with #123563 should that get merged. I trust that _this time_, I won't run into [The Incident](https://github.com/rust-lang/rust/pull/123297#issuecomment-2041137569) while rebasing. Edit: Yay, I did it properly!
2024-04-10 04:27:39 +02:00
Matthias Krüger
7dd24d88ab
Rollup merge of #122200 - jieyouxu:unconditional-nightly-update-hint, r=estebank
Unconditionally show update nightly hint on ICE

Instead of trying to guess if a update nightly hint should be shown (by checking for system time, querying version and channel info etc.), just show the update nightly hint for nightly compilers. This avoids breaking tests that match on ICE test outputs on nightly/dev channels.

> Another issue is that the outdated nightly hint triggers for ICE tests, causing a mismatch with the test expectation. There doesn't seem to be any env var to suppress this.

See <https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/stage0.20compiletest.20broken/near/425543681> for context.
2024-04-10 04:27:38 +02:00
Matthias Krüger
a79b2437af
Rollup merge of #121884 - 5225225:rmake-exit-code, r=jieyouxu
Port exit-code run-make test to use rust

As part of https://github.com/rust-lang/rust/issues/121876

~~As draft because formatting will fail because `x fmt` isn't working for me for some reason, I'll debug that later, just opening this now for review, will mark as ready when formatting is fixed~~ (misleading message from x fmt)

cc `@jieyouxu`
2024-04-10 04:27:38 +02:00
David Tolnay
caf3766eaf
Show mode_t as octal in std::fs Debug impls 2024-04-09 18:12:41 -07:00
Esteban Küber
796be88062 Use fn ptr signature instead of {closure@..} in infer error
When suggesting a type on inference error, do not use `{closure@..}`.
Instead, replace with an appropriate `fn` ptr.

On the error message, use `short_ty_string` and write long types to
disk.

```
error[E0284]: type annotations needed for `Select<{closure@lib.rs:2782:13}, _, Expression<'_>, _>`
  --> crates/lang/src/parser.rs:41:13
   |
41 |         let lit = select! {
   |             ^^^
42 |             Token::Int(i) = e => Expression::new(Expr::Lit(ast::Lit::Int(i.parse().unwrap())), e.span()),
   |                                                                                                  ---- type must be known at this point
   |
   = note: the full type name has been written to '/home/gh-estebank/iowo/target/debug/deps/lang-e2d6e25819442273.long-type-4587393693885174369.txt'
   = note: cannot satisfy `<_ as chumsky::input::Input<'_>>::Span == SimpleSpan`
help: consider giving `lit` an explicit type, where the type for type parameter `I` is specified
   |
41 |         let lit: Select<for<'a, 'b> fn(tokens::Token<'_>, &'a mut MapExtra<'_, 'b, _, _>) -> Option<Expression<'_>>, _, Expression<'_>, _> = select! {
   |                +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
```

instead of

```
error[E0284]: type annotations needed for `Select<{closure@/home/gh-estebank/.cargo/registry/src/index.crates.io-6f17d22bba15001f/chumsky-1.0.0-alpha.6/src/lib.rs:2782:13: 2782:28}, _, Expression<'_>, _>`
  --> crates/lang/src/parser.rs:41:13
   |
41 |         let lit = select! {
   |             ^^^
42 |             Token::Int(i) = e => Expression::new(Expr::Lit(ast::Lit::Int(i.parse().unwrap())), e.span()),
   |                                                                                                  ---- type must be known at this point
   |
   = note: cannot satisfy `<_ as chumsky::input::Input<'_>>::Span == SimpleSpan`
help: consider giving `lit` an explicit type, where the type for type parameter `I` is specified
   |
41 |         let lit: Select<{closure@/home/gh-estebank/.cargo/registry/src/index.crates.io-6f17d22bba15001f/chumsky-1.0.0-alpha.6/src/lib.rs:2782:13: 2782:28}, _, Expression<'_>, _> = select! {
   |                ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
```

Fix #123630.
2024-04-10 00:41:27 +00:00
bors
93c131eba0 Auto merge of #122918 - jieyouxu:port-backtrace-line-tables-only, r=workingjubilee
Port backtrace's `line-tables-only` test over to rustc

Part of #122899.
2024-04-10 00:40:34 +00:00
Oneirical
cbf150177f remove does-nothing.rs
fix: restore issues_entry_limit
2024-04-09 20:26:40 -04:00
Esteban Küber
a983dd8563 Tweak value suggestions in borrowck and hir_analysis
Unify the output of `suggest_assign_value` and `ty_kind_suggestion`.

Ideally we'd make these a single function, but doing so would likely require modify the crate dependency tree.
2024-04-09 23:37:13 +00:00
Michael Howell
dac788f0a1 rustdoc: reduce size of <head> with preload loop 2024-04-09 16:31:26 -07:00
Urgau
0c3f5cce89 Further cleanup cfgs in the UI test suite
This commit does three things:
 1. replaces (the last remaining) never true cfgs by the FALSE cfg
 2. fix derive-helper-configured.rs (typo in directive)
 3. and comment some current unused #[cfg_attr] (missing revisions)
2024-04-09 23:58:18 +02:00
Chris Denton
19f04a7d68
Add comment on UTF-16 surrogates 2024-04-09 20:20:32 +00:00
Chris Denton
952d432666
Windows: set main thread name without reencoding 2024-04-09 20:20:31 +00:00
Chris Denton
b48e7e5496
Add const UTF-8 to UTF-16 conversion macros
`wide_str!` creates a null terminated UTF-16 string whereas `utf16!` just creates a UTF-16 string without adding a null.
2024-04-09 20:20:19 +00:00
bors
8b2459c1f2 Auto merge of #123683 - pietroalbini:pa-cve-2024-24576-nightly, r=pietroalbini
Backport fix of CVE-2024-24576

See https://blog.rust-lang.org/2024/04/09/cve-2024-24576.html

r? `@ghost`
2024-04-09 19:56:18 +00:00
Oli Scherer
e14e7954ae Iterate over parent captures first, as there is a 1:N mapping of parent captures to child captures 2024-04-09 19:51:11 +00:00
Oli Scherer
bf497b8347 Add a FIXME 2024-04-09 19:51:11 +00:00
Santiago Pastorino
30c546aee1
Handle const generic pattern types 2024-04-09 16:42:45 -03:00
5225225
de79a6c084
run-make: make arg take AsRef<OsStr> instead of str 2024-04-09 19:55:06 +01:00
Michael Howell
5f84f4bdc9 rustdoc: clean up type alias code 2024-04-09 11:39:26 -07:00
Santiago Pastorino
a2bdb994d3
Add const generics failing test for pattern types 2024-04-09 15:14:02 -03:00
Michael Goulet
3253c021cb Add a helper for extending a span to include any trailing whitespace 2024-04-09 14:06:09 -04:00
Michael Goulet
a439eb259d Don't use bytepos offsets when computing semicolon span for removal 2024-04-09 14:06:08 -04:00
Pietro Albini
2f24f17755
allow the test bat files in tidy 2024-04-09 18:17:21 +01:00
Michael Goulet
da2b714ba1 Clarifying comment 2024-04-09 12:17:34 -04:00
Michael Goulet
a9e262a32d Split back out unused_lifetimes -> redundant_lifetimes 2024-04-09 12:17:34 -04:00
Michael Goulet
ee78eab62b Lint redundant lifetimes in impl header 2024-04-09 12:17:34 -04:00
Michael Goulet
2d813547bf Move check to wfcheck 2024-04-09 12:17:34 -04:00
Michael Goulet
ceff692a02 Fix stage 2 2024-04-09 12:17:34 -04:00
Michael Goulet
535151ed03 Add comments 2024-04-09 12:17:34 -04:00
Michael Goulet
89409494e3 Actually, just reuse the UNUSED_LIFETIMES lint 2024-04-09 12:15:27 -04:00
Michael Goulet
03c901fd35 Add redundant_lifetime_args lint 2024-04-09 12:15:27 -04:00
Scott McMurray
c6dde9d8a7 Put the NONTEMPORAL case first
That's how it was in `store_with_flags` before this PR, so let's do that here too just to be sure we get the right thing.
2024-04-09 08:51:33 -07:00
Scott McMurray
b5376ba601 Remove my scalar_copy_backend_type optimization attempt
I added this back in 111999, but I no longer think it's a good idea
- It had to get scaled back to only power-of-two things to not break a bunch of targets
- LLVM seems to be getting better at memcpy removal anyway
- Introducing vector instructions has seemed to sometimes (115515) make autovectorization worse

So this removes it from the codegen crates entirely, and instead just tries to use <https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/traits/builder/trait.BuilderMethods.html#method.typed_place_copy> instead of direct `memcpy` so things will still use load/store for immediates.
2024-04-09 08:51:32 -07:00
bors
033becf83c Auto merge of #123485 - madsmtm:use-libc-copyfile, r=joboet
macOS: Use `libc` definitions for copyfile

`COPYFILE_ALL` is not yet exposed in `libc`, but the rest of what we need is, so use those definitions instead of manually defining them.

The definitions were added in https://github.com/rust-lang/libc/pull/2667 and https://github.com/rust-lang/libc/pull/3346.
2024-04-09 14:15:09 +00:00
许杰友 Jieyou Xu (Joe)
09dab389e2 tests: bless ui and rustdoc-ui tests for ICE messages 2024-04-09 13:58:52 +00:00
bjorn3
b4a395bcce Fix dead code warning 2024-04-09 13:44:53 +00:00
许杰友 Jieyou Xu (Joe)
c7e77befd8 driver: unconditionally show update nightly hint 2024-04-09 13:37:27 +00:00
bors
ff24ef91fc Auto merge of #123676 - GuillaumeGomez:rollup-1hurixy, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #123254 (Do not allocate for ZST ThinBox (attempt 2 using const_allocate))
 - #123626 (Add MC/DC support to coverage test tools)
 - #123638 (rustdoc: synthetic auto: filter out clauses from the implementor's ParamEnv)
 - #123653 (Split `non_local_definitions` lint tests in separate test files)
 - #123658 (Stop making any assumption about the projections applied to the upvars in the `ByMoveBody` pass)
 - #123662 (Don't rely on upvars being assigned just because coroutine-closure kind is assigned)
 - #123665 (Fix typo in `Future::poll()` docs)
 - #123672 (compiletest: unset `RUSTC_LOG_COLOR`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-09 12:11:23 +00:00