Commit Graph

254621 Commits

Author SHA1 Message Date
Ross Smyth
6580a22726 Allow test targets to be set via CLI args 2024-05-08 18:05:26 -04:00
bors
87293c9585 Auto merge of #124910 - matthiaskrgr:rollup-lo1uvdn, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #123344 (Remove braces when fixing a nested use tree into a single item)
 - #124587 (Generic `NonZero` post-stabilization changes.)
 - #124775 (crashes: add lastest batch of crash tests)
 - #124869 (Make sure we don't deny macro vars w keyword names)
 - #124876 (Simplify `use crate::rustc_foo::bar` occurrences.)
 - #124892 (Update cc crate to v1.0.97)
 - #124903 (Ignore empty RUSTC_WRAPPER in bootstrap)
 - #124909 (Reapply the part of #124548 that bors forgot)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-08 21:47:34 +00:00
Matthias Krüger
782ef18168
Rollup merge of #124909 - compiler-errors:struct-tail-leftovers, r=compiler-errors
Reapply the part of #124548 that bors forgot

https://github.com/rust-lang/rust/pull/124548#issuecomment-2101311205
r? compiler-errors
2024-05-08 23:33:28 +02:00
Matthias Krüger
18639db87c
Rollup merge of #124903 - Skepfyr:rustc-wrapper, r=clubby789
Ignore empty RUSTC_WRAPPER in bootstrap

This change ignores the RUSTC_WRAPPER_REAL environment variable if it's set to the empty string. This matches cargo behaviour and allows users to easily shadow a globally set RUSTC_WRAPPER (which they might have set for non-rustc projects).

I hit this because I have RUSTC_WRAPPER set to `sccache` in my fish universal env vars, and I can only shadow those locally with an empty string, I can't unset it entirely.
2024-05-08 23:33:27 +02:00
Matthias Krüger
294ac1b57d
Rollup merge of #124892 - jfgoog:update-cc, r=workingjubilee
Update cc crate to v1.0.97
2024-05-08 23:33:27 +02:00
Matthias Krüger
3e22ea9e2f
Rollup merge of #124876 - nnethercote:rm-use-crate-rustc_foo, r=compiler-errors
Simplify `use crate::rustc_foo::bar` occurrences.

They can just be written as `use rustc_foo::bar`, which is far more standard. (I didn't even know that a `crate::` prefix was valid.)

r? ``@eholk``
2024-05-08 23:33:26 +02:00
Matthias Krüger
952f12ea7a
Rollup merge of #124869 - compiler-errors:keyword, r=Nilstrieb
Make sure we don't deny macro vars w keyword names

`$async:ident`, etc are all valid.

Fixes #124862
2024-05-08 23:33:26 +02:00
Matthias Krüger
812fb24e79
Rollup merge of #124775 - matthiaskrgr:boom, r=jieyouxu
crashes: add lastest batch of crash tests
2024-05-08 23:33:25 +02:00
Matthias Krüger
d8a3a69ad1
Rollup merge of #124587 - reitermarkus:use-generic-nonzero, r=dtolnay
Generic `NonZero` post-stabilization changes.

Tracking issue: https://github.com/rust-lang/rust/issues/120257

r? ``@dtolnay``
2024-05-08 23:33:25 +02:00
Matthias Krüger
d30af5e168
Rollup merge of #123344 - pietroalbini:pa-unused-imports, r=Nilstrieb
Remove braces when fixing a nested use tree into a single item

[Back in 2019](https://github.com/rust-lang/rust/pull/56645) I added rustfix support for the `unused_imports` lint, to automatically remove them when running `cargo fix`. For the most part this worked great, but when removing all but one childs of a nested use tree it turned `use foo::{Unused, Used}` into `use foo::{Used}`. This is slightly annoying, because it then requires you to run `rustfmt` to get `use foo::Used`.

This PR automatically removes braces and the surrouding whitespace when all but one child of a nested use tree are unused. To get it done I had to add the span of the nested use tree to the AST, and refactor a bit the code I wrote back then.

A thing I noticed is, there doesn't seem to be any `//@ run-rustfix` test for fixing the `unused_imports` lint. I created a test in `tests/suggestions` (is that the right directory?) that for now tests just what I added in the PR. I can followup in a separate PR to add more tests for fixing `unused_lints`.

This PR is best reviewed commit-by-commit.
2024-05-08 23:33:24 +02:00
Veera
21ccec0cc8 Fix Error Messages for break Inside Coroutines
Previously, `break` inside `gen` blocks and functions
were incorrectly identified to be enclosed by a closure.

This PR fixes it by displaying an appropriate error message
for async blocks, async closures, async functions, gen blocks,
gen closures, gen functions, async gen blocks, async gen closures
and async gen functions.

Note: gen closure and async gen closure are not supported by the
compiler yet but I have added an error message here assuming that
they might be implemented in the future.

Also, fixes grammar in a few places by replacing
`inside of a $coroutine` with `inside a $coroutine`.
2024-05-08 17:32:25 -04:00
Gurinder Singh
cacc0829ff Handle normalization failure in struct_tail_erasing_lifetimes
Fixes an ICE that occurred when the struct in question has an error
2024-05-08 17:24:17 -04:00
Ben Kimock
0ca1a94b2b Handle field projections like slice indexing in invalid_reference_casting 2024-05-08 17:21:06 -04:00
bors
2e1d417e70 Auto merge of #3580 - tiif:feat/malloc0-non-null-pointer, r=RalfJung
Implement non-null pointer for malloc(0)

Use non-null pointer for malloc(0) as mentioned in  #3576 to detect leaks and double free of ``malloc(0)`` addresses.
2024-05-08 20:50:38 +00:00
tiif
4ab79e5622 Implement non-null pointer for malloc(0) 2024-05-09 04:34:32 +08:00
bors
ec1b69852f Auto merge of #124795 - scottmcm:simplify-slice-from-raw-parts, r=joboet
Avoid a cast in `ptr::slice_from_raw_parts(_mut)`

Casting to `*const ()` or `*mut ()` is no longer needed after https://github.com/rust-lang/rust/pull/123840 so let's make the MIR smaller (and more inline-able, as seen in the tests).

If [ACP#362](https://github.com/rust-lang/libs-team/issues/362) goes through we can keep calling `ptr::from_raw_parts(_mut)` in these also without the cast, but that hasn't had any libs-api attention yet, so I'm not waiting on it.
2024-05-08 19:37:57 +00:00
Markus Reiter
bd8e565e16
Use generic NonZero. 2024-05-08 21:37:55 +02:00
Markus Reiter
7531eafa7e
Simplify suggestion. 2024-05-08 21:37:54 +02:00
Markus Reiter
3fe0be9e38
Simplify clippy lint. 2024-05-08 21:37:54 +02:00
Markus Reiter
767711b905
Use generic NonZero in examples. 2024-05-08 21:37:53 +02:00
Jack Rickard
c7003f57ea
Ignore empty RUSTC_WRAPPER in bootstrap
This change ignores the RUSTC_WRAPPER_REAL environment variable if it's
set to the empty string. This matches cargo behaviour and allows users
to easily shadow a globally set RUSTC_WRAPPER (which they might have set
for non-rustc projects).
2024-05-08 19:42:25 +01:00
bors
c3202afa28 Auto merge of #124890 - matthiaskrgr:rollup-25iq88h, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #124548 (Handle normalization failure in `struct_tail_erasing_lifetimes`)
 - #124761 (Fix insufficient logic when searching for the underlying allocation)
 - #124864 (rustdoc: use stability, instead of features, to decide what to show)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-08 17:28:17 +00:00
Xavier Denis
d4c6c772c3 Make a minimal amount of region APIs public 2024-05-08 19:22:04 +02:00
Ralf Jung
281aa50e3f bootstrap: add comments for the automatic dry run 2024-05-08 19:11:17 +02:00
bors
15305a764d Auto merge of #3589 - RalfJung:io-error, r=RalfJung
io::Error handling: keep around the full io::Error for longer so we can give better errors

This should help with the error message in https://github.com/rust-lang/miri/issues/3587.
2024-05-08 16:23:17 +00:00
Ralf Jung
1601b27d1c io::Error handling: keep around the full io::Error for longer so we can give better errors 2024-05-08 18:03:29 +02:00
James Farrell
fbc2abd6be Update cc crate to v1.0.97 2024-05-08 15:06:35 +00:00
Marcondiro
bbdf97254a
fix #124714 str.to_lowercase sigma handling 2024-05-08 17:05:10 +02:00
Matthias Krüger
5347652fdf
Rollup merge of #124864 - notriddle:notriddle/feature-flags-are-not-stability-markers, r=fmease
rustdoc: use stability, instead of features, to decide what to show

Fixes #124635

To decide if internal items should be inlined in a doc page, check if the crate is itself internal, rather than if it has the rustc_private feature flag. The standard library uses internal items, but is not itself internal and should not show internal items on its docs pages.
2024-05-08 17:03:10 +02:00
Matthias Krüger
9fce3dc685
Rollup merge of #124761 - Urgau:ref-casting_bigger_slice_index, r=jieyouxu
Fix insufficient logic when searching for the underlying allocation

This PR fixes the logic inside the `invalid_reference_casting` lint, when trying to lint on bigger memory layout casts.

More specifically when looking for the "underlying allocation" we were wrongly assuming that when we got `&mut slice[index]` that `slice[index]` was the allocation, but it's not.

Fixes https://github.com/rust-lang/rust/issues/124685
2024-05-08 17:03:09 +02:00
Matthias Krüger
e997508ecb
Rollup merge of #124548 - gurry:113272-ice-failed-to-normalize, r=compiler-errors
Handle normalization failure in `struct_tail_erasing_lifetimes`

Fixes #113272

The ICE occurred because the struct being normalized had an error. This PR adds some defensive code to guard against that.
2024-05-08 17:03:08 +02:00
Guillaume Gomez
c078a44247 Migrate run-make/rustdoc-map-file to rmake 2024-05-08 16:58:12 +02:00
bors
720ff0d683 Auto merge of #3583 - RalfJung:readme, r=saethlin
README: update introduction

For some time now, we have (to my knowledge) been able to detect all the UB that rustc actually exploits. I think it's time to advertise that.

We also haven't had the problem of "not every nightly has Miri" for a while.

`@rust-lang/miri` what do you think?
2024-05-08 11:40:40 +00:00
bors
e3029d220f Auto merge of #124858 - alexcrichton:some-wasi-changes, r=michaelwoerister
rustc: Some small changes for the wasm32-wasip2 target

This commit has a few changes for the wasm32-wasip2 target. The first two are aimed at improving the compatibility of using `clang` as an external linker driver on this target. The default target to LLVM is updated to match the Rust target and additionally the `-fuse-ld=lld` argument is dropped since that otherwise interferes with clang's own linker detection. The only linker on wasm targets is LLD but on the wasip2 target a wrapper around LLD, `wasm-component-ld`, is used to drive the process and perform steps necessary for componentization.

The final commit changes the output of all objects on the wasip2 target to being PIC by default. This improves compatibilty with shared libaries but notably does not mean that there's a turnkey solution for shared libraries. The hope is that by having the standard libray work both with and without dynamic libraries will make experimentation easier.
2024-05-08 11:39:26 +00:00
bors
1fef1524f2 Auto merge of #124879 - workingjubilee:rollup-1k77hyz, r=workingjubilee
Rollup of 4 pull requests

Successful merges:

 - #124470 (std::net: Socket::new_raw now set to SO_NOSIGPIPE on freebsd.)
 - #124782 (add note about `AlreadyExists` to `create_new`)
 - #124788 (Convert instances of `target_os = "macos"` to `target_vendor = "apple"`)
 - #124838 (next_power_of_two: add a doctest to show what happens on 0)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-08 09:29:57 +00:00
Jubilee
ceb5ec3ad9
Rollup merge of #124838 - RalfJung:next_power_of_two, r=scottmcm
next_power_of_two: add a doctest to show what happens on 0
2024-05-08 00:37:11 -07:00
Jubilee
037c62a196
Rollup merge of #124788 - madsmtm:reduce-target_os-macos, r=workingjubilee
Convert instances of `target_os = "macos"` to `target_vendor = "apple"`

https://github.com/rust-lang/rust/pull/124491 migrated towards using `target_vendor = "apple"` more, as there's very little difference between iOS, tvOS, watchOS and visionOS. In that PR, I only did the changes where the standard library already had fixes for iOS, that I could confidently apply to the other targets.

However, there's actually also not that big of a gap between macOS and the aforementioned platforms - so in this PR, I've gone through a few of the instances of `target_os = "macos"` and replaced it with `target_vendor = "apple"` to improve support on those platforms, see the commits for details.

r? workingjubilee

CC `@thomcc` `@simlay` (do tell me if I should stop pinging you on these Apple PRs)

`@rustbot` label O-apple
2024-05-08 00:37:10 -07:00
Jubilee
40926fdc19
Rollup merge of #124782 - anatawa12:docs-create-new-already-exists, r=workingjubilee
add note about `AlreadyExists` to `create_new`

Fixes #119244
2024-05-08 00:37:10 -07:00
Jubilee
bc42f25b04
Rollup merge of #124470 - devnexen:no_sigpipe_fbsd, r=workingjubilee
std::net: Socket::new_raw now set to SO_NOSIGPIPE on freebsd.
2024-05-08 00:37:09 -07:00
bors
7aa17df0f4 Auto merge of #124695 - erickt:bump-fuchsia, r=tmandry
Fuchsia test runner: fixup script

This commit fixes several issues in the fuchsia-test-runner.py script:

1. Migrate from `pm` to `ffx` for package management, as `pm` is now deprecated. Furthermore, the `pm` calls used in this script no longer work at Fuchsia's HEAD. This is the largest change in this commit, and impacts all steps around repository management (creation and registration of the repo, as well as package publishing).

2. Allow for `libtest` to be either statically or dynamically linked. The script assumed it was dynamically linked, but the current Rust behavior at HEAD is to statically link it.

3. Minor cleanup to use `ffx --machine json` rather than string parsing.

4. Minor cleanup to the docs around the script.
2024-05-08 07:18:35 +00:00
Nicholas Nethercote
b68b92041c Simplify use crate::rustc_foo::bar occurrences.
They can just be written as `use rustc_foo::bar`, which is far more
standard. (I didn't even know that a `crate::` prefix was valid.)
2024-05-08 16:57:31 +10:00
bors
5ce96b1d0f Auto merge of #124779 - workingjubilee:debug-formatting-my-beloved, r=compiler-errors
Improve `rustc_parse::Parser`'s debuggability

The main event is the final commit where I add `Parser::debug_lookahead`. Everything else was basically cleaning up things that bugged me (debugging, as it were) until I felt comfortable enough to actually work on it.

The motivation is that it's annoying as hell to try to figure out how the debug infra works in rustc without having basic queries like `debug!(?parser);` come up "empty". However, Parser has a lot of fields that are mostly irrelevant for most debugging, like the entire ParseSess. I think `Parser::debug_lookahead` with a capped lookahead might be fine as a general-purpose Debug impl, but this adapter version was suggested to allow more choice, and admittedly, it's a refined version of what I was already handrolling just to get some insight going.
2024-05-08 05:11:18 +00:00
Michael Howell
6d6f67a98c rustdoc: use stability, instead of features, to decide what to show
To decide if internal items should be inlined in a doc page,
check if the crate is itself internal, rather than if it has
the rustc_private feature flag. The standard library uses
internal items, but is not itself internal and should not show
internal items on its docs pages.
2024-05-07 20:47:19 -07:00
Michael Goulet
7dbdbaaa8e Fix ICEs in diagnostic::on_unimplemented 2024-05-07 23:13:44 -04:00
Michael Goulet
a8f2e33eec Add more ICEs due to malformed diagnostic::on_unimplemented 2024-05-07 23:13:44 -04:00
bors
32dd3795bc Auto merge of #124873 - weihanglo:update-cargo, r=weihanglo
Update cargo

10 commits in 05364cb2f61a2c2b091e061c1f42b207dfb5f81f..0ca60e940821c311c9b25a6423b59ccdbcea218f
2024-05-03 16:48:59 +0000 to 2024-05-08 01:54:25 +0000
- chore: Add cargo-lints to unstable docs (rust-lang/cargo#13881)
- test: clean up unnecessary uses of `match_exact` (rust-lang/cargo#13879)
- docs(ref): Correct heading level of `[lints]` documentation (rust-lang/cargo#13878)
- Fix: Build only the specified artifact library when multiple types are available (rust-lang/cargo#13842)
- docs: add missing CARGO_MAKEFLAGS env for plugins (rust-lang/cargo#13872)
- Add more documentation to `cargo::rustc-check-cfg` (rust-lang/cargo#13869)
- fix(toml): Remove unstable rejrected frontmatter syntax for cargo script (rust-lang/cargo#13861)
- Update UI example code in contributor guide (rust-lang/cargo#13864)
- style(test): Remove check-cfg warning (rust-lang/cargo#13865)
- Fix global_cache_tracker::max_download_size test flakiness (rust-lang/cargo#13860)

r? ghost
2024-05-08 03:01:24 +00:00
Nicholas Nethercote
55b6ff8e41 Remove extern crate tracing.
`use` is a nicer way of doing things.
2024-05-08 12:52:31 +10:00
Weihang Lo
78de4f3fef
Update cargo 2024-05-07 22:27:48 -04:00
Julien
79cf61a9ae Update Makefiles with explanatory comments 2024-05-07 22:12:36 -04:00
Jubilee Young
5e67a3783c compiler: add Parser::debug_lookahead
I tried debugging a parser-related issue but found it annoying to not be
able to easily peek into the Parser's token stream.

Add a convenience fn that offers an opinionated view into the parser,
but one that is useful for answering basic questions about parser state.
2024-05-07 19:10:29 -07:00