Commit Graph

231 Commits

Author SHA1 Message Date
Nicholas Nethercote
20046ceb40 Sort PRINT_KINDS.
Alphabetical order is nicer than random order.
2023-11-30 17:28:29 +11:00
Nilstrieb
0346765100 Bless run-make tests
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
Nicholas Nethercote
5c462a32bd Remove support for compiler plugins.
They've been deprecated for four years.

This commit includes the following changes.
- It eliminates the `rustc_plugin_impl` crate.
- It changes the language used for lints in
  `compiler/rustc_driver_impl/src/lib.rs` and
  `compiler/rustc_lint/src/context.rs`. External lints are now called
  "loaded" lints, rather than "plugins" to avoid confusion with the old
  plugins. This only has a tiny effect on the output of `-W help`.
- E0457 and E0498 are no longer used.
- E0463 is narrowed, now only relating to unfound crates, not plugins.
- The `plugin` feature was moved from "active" to "removed".
- It removes the entire plugins chapter from the unstable book.
- It removes quite a few tests, mostly all of those in
  `tests/ui-fulldeps/plugin/`.

Closes #29597.
2023-11-04 08:50:46 +11:00
Zalathar
76103a8f6e Remove support for alias -Z symbol-mangling-version 2023-11-02 18:41:33 +11:00
bors
31ffe48723 Auto merge of #116035 - lqd:mcp-510-target-specs, r=petrochenkov
Allow target specs to use an LLD flavor, and self-contained linking components

This PR allows:
- target specs to use an LLD linker-flavor: this is needed to switch `x86_64-unknown-linux-gnu` to using LLD, and is currently not possible because the current flavor json serialization fails to roundtrip on the modern linker-flavors. This can e.g. be seen in https://github.com/rust-lang/rust/pull/115622#discussion_r1321312880 which explains where an `Lld::Yes` is ultimately deserialized into an `Lld::No`.
- target specs to declare self-contained linking components: this is needed to switch `x86_64-unknown-linux-gnu` to using `rust-lld`
- adds an end-to-end test of a custom target json simulating `x86_64-unknown-linux-gnu` being switched to using `rust-lld`
- disables codegen backends from participating because they don't support `-Zgcc-ld=lld` which is the basis of mcp510.

r? `@petrochenkov:` if the approach discussed https://github.com/rust-lang/rust/pull/115622#discussion_r1329403467 and on zulip would work for you: basically, see if we can emit only modern linker flavors in the json specs, but accept both old and new flavors while reading them, to fix the roundtrip issue.

The backwards compatible `LinkSelfContainedDefault` variants are still serialized and deserialized in `crt-objects-fallback`, while the spec equivalent of e.g. `-Clink-self-contained=+linker` is serialized into a different json object (with future-proofing to incorporate `crt-objects-fallback`  in the future).

---

I've been test-driving this in https://github.com/rust-lang/rust/pull/113382 to test actually switching `x86_64-unknown-linux-gnu`  to `rust-lld` (and fix what needs to be fixed in CI, bootstrap, etc), and it seems to work fine.
2023-10-27 02:11:36 +00:00
Daniel Cheng
8fa800db61 Mark .rmeta files as /SAFESEH on x86 Windows.
Chrome links .rlibs with /WHOLEARCHIVE or -Wl,--whole-archive to prevent
the linker from discarding static initializers. This works well, except
on Windows x86, where lld complains:

  error: /safeseh: lib.rmeta is not compatible with SEH

The fix is simply to mark the .rmeta as SAFESEH aware. This is trivially
true, since the metadata file does not contain any executable code.
2023-10-24 13:42:28 -07:00
Zalathar
6af9fef085 coverage: Emit the filenames section before encoding per-function mappings
Most coverage metadata is encoded into two sections in the final executable.
The `__llvm_covmap` section mostly just contains a list of filenames, while the
`__llvm_covfun` section contains encoded coverage maps for each instrumented
function.

The catch is that each per-function record also needs to contain a hash of the
filenames list that it refers to. Historically this was handled by assembling
most of the per-function data into a temporary list, then assembling the
filenames buffer, then using the filenames hash to emit the per-function data,
and then finally emitting the filenames table itself.

However, now that we build the filenames table up-front (via a separate
traversal of the per-function data), we can hash and emit that part first, and
then emit each of the per-function records immediately after building. This
removes the awkwardness of having to temporarily store nearly-complete
per-function records.
2023-10-22 23:17:15 +11:00
Matthias Krüger
31865b7bfb
Rollup merge of #116992 - estebank:issue-69492, r=oli-obk
Mention the syntax for `use` on `mod foo;` if `foo` doesn't exist

Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`.

Fix #69492.
2023-10-21 21:23:01 +02:00
Esteban Küber
2cca435717 Mention the syntax for use on mod foo; if foo doesn't exist
Newcomers might get confused that `mod` is the only way of defining
scopes, and that it can be used as if it were `use`.

Fix #69492.
2023-10-21 15:56:01 +00:00
bors
94c4e5c411 Auto merge of #115214 - Urgau:rfc-3127-trim-paths, r=compiler-errors
Implement rustc part of RFC 3127 trim-paths

This PR implements (or at least tries to) [RFC 3127 trim-paths](https://github.com/rust-lang/rust/issues/111540), the rustc part. That is `-Zremap-path-scope` with all of it's components/scopes.

`@rustbot` label: +F-trim-paths
2023-10-19 19:09:29 +00:00
Rémy Rakic
fe7a843278 add end-to-end test of custom target using rust-lld
starting from the x86_64-unknown-linux-gnu specs, we add the lld linker
flavor and self-contained linker component
2023-10-18 11:33:40 +00:00
bors
6d7160ce97 Auto merge of #116814 - estebank:windows-ice-path, r=petrochenkov
Use `YYYY-MM-DDTHH_MM_SS` as datetime format for ICE dump files

Windows paths do not support `:`, so use a datetime format in ICE dump paths that Windows will accept.

CC #116809, fix #115180.
2023-10-18 07:45:56 +00:00
Ben Kimock
33b0e4be06 Automatically enable cross-crate inlining for small functions 2023-10-17 19:53:51 -04:00
Esteban Küber
e1aa5adc78 Use YYYY-MM-DDTHH_MM_SS as datetime format for ICE dump files
Windows paths do not support `:`, so use a datetime format in ICE dump
paths that Windows will accept.

Fix #116809, fix #115180.
2023-10-17 17:31:47 +00:00
Urgau
5c41de113e Test -Zremap-path-scope=split-debuginfo with -Csplit-debuginfo=packed 2023-10-17 10:11:31 +02:00
Urgau
0b2fd2bd88 Adjust tests for MacOS having different -Csplit-debuginfo default
MacOS (and all apple targets) have -Csplit-debuginfo=packed as default
instead of "off" like all other targets (well there is Windows, but we
don't test it in those tests), also -Csplit-debuginfo is not stable on
all targets so we only set in on Darwin where is matters.
2023-10-17 10:11:31 +02:00
Urgau
ab92dc3786 [RFC 3127 - Trim Paths]: Adjust tests for -Zremap-path-scope 2023-10-17 10:11:31 +02:00
bors
8de6f99e32 Auto merge of #116264 - reez12g:issue-109728, r=Mark-Simulacrum
add test for wasm linker override=clang

addressing https://github.com/rust-lang/rust/issues/109728
2023-10-14 16:57:02 +00:00
reez12g
4fa4758fe2 add test for wasm linker override=clang 2023-10-09 11:42:23 +09:00
bors
ab039f79b8 Auto merge of #116514 - petrochenkov:nogccld, r=lqd
linker: Remove `-Zgcc-ld` option

It is subsumed by `-Clinker-flavor=*-lld-cc -Clink-self-contained=+linker` options now.

r? `@lqd`
2023-10-08 09:04:57 +00:00
Vadim Petrochenkov
b563595c6e linker: Remove -Zgcc-ld option
It is subsumed by `-Clinker-flavor=*-lld-cc -Clink-self-contained=+linker` options now
2023-10-08 10:05:25 +03:00
Martin Nordholts
d9a7afec8b tests/run-make: Use RUSTC_TEST_OP in more places 2023-10-07 08:30:40 +02:00
Martin Nordholts
88966c4773 tests/run-make: Move RUSTC_TEST_OP to tools.mk
To reduce duplication. A follow-up commit will begin using it in even
more places.
2023-10-07 08:30:40 +02:00
Martin Nordholts
f96541e9a9 tests/run-make: Remove wrong blessing advice
run-make tests are not special but can be blessed like other tests, like
this:

    ./x.py test --bless tests/run-make/unknown-mod-stdin
2023-10-07 08:27:05 +02:00
bors
64fa0c34d7 Auto merge of #115304 - Enselic:trailing-gt, r=cjgillot
Allow file names to end with '>'

The [`rustc_span::FileName`](https://doc.rust-lang.org/stable/nightly-rustc/rustc_span/enum.FileName.html) enum already differentiates between real files and "fake" files such as `<anon>`. We do not need to artificially forbid real file names from ending in `>`.

Closes #73419
2023-10-06 14:57:09 +00:00
Martin Nordholts
8a1be9942d Allow file names to end with '>'
The `rustc_span::FileName` enum already differentiates between real
files and "fake" files such as `<anon>`. We do not need to artificially
forbid real file names from ending in `>`.
2023-10-05 20:17:48 +02:00
bors
56ada88e7e Auto merge of #113301 - Be-ing:stabilize_bundle_whole-archive, r=petrochenkov
stabilize combining +bundle and +whole-archive link modifiers

Per discussion on https://github.com/rust-lang/rust/issues/108081 combining +bundle and +whole-archive already works and can be stabilized independently of other aspects of the packed_bundled_libs feature. There is no risk of regression because this was not previously allowed.

r? `@petrochenkov`
2023-09-29 15:51:48 +00:00
bors
42ca6e4e57 Auto merge of #104385 - BlackHoleFox:apple-minimum-bumps, r=petrochenkov
Raise minimum supported Apple OS versions

This implements the proposal to raise the minimum supported Apple OS versions as laid out in the now-completed MCP (https://github.com/rust-lang/compiler-team/issues/556).

As of this PR, rustc and the stdlib now support these versions as the baseline:
- macOS: 10.12 Sierra
- iOS: 10
- tvOS: 10
- watchOS: 5 (Unchanged)

In addition to everything this breaks indirectly, these changes also erase the `armv7-apple-ios` target (currently tier 3) because the oldest supported iOS device now uses ARMv7s. Not sure what the policy around tier3 target removal is but shimming it is not an option due to the linker refusing.

[Per comment](https://github.com/rust-lang/compiler-team/issues/556#issuecomment-1297175073), this requires a FCP to merge. cc `@wesleywiser.`
2023-09-24 02:35:05 +00:00
BlackHoleFox
58bbca958d Raise minimum supported macOS to 10.12 2023-09-23 19:14:25 -05:00
bors
aadb5718dd Auto merge of #116001 - fmease:validate-crate-name-extern-cli-opt, r=est31
[breaking change] Validate crate name in `--extern` [MCP 650]

Reject non-ASCII-identifier crate names passed to the CLI option `--extern` (`rustc`, `rustdoc`).
Implements [MCP 650](https://github.com/rust-lang/compiler-team/issues/650) (except that we only allow ASCII identifiers not arbitrary Rust identifiers).
Fixes #113035.

[As mentioned on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Disallow.20non-identifier-valid.20--extern.20cr.E2.80.A6.20compiler-team.23650/near/376826988), doing a crater run probably doesn't make sense since it wouldn't yield anything. Most users don't interact with `rustc` directly but only ever through Cargo which always passes a valid crate name to `--extern` when it invokes `rustc` and `rustdoc`. In any case, the user wouldn't be able to use such a crate name in the source code anyway.

Note that I'm not using [`rustc_session::output::validate_crate_name`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/output/fn.validate_crate_name.html) (used for `--crate-name` and `#![crate_name]`) since the latter doesn't reject non-ASCII crate names and ones that start with a digit.

As an aside, I've also thought about getting rid of `validate_crate_name` entirely in a separate PR (with another MCP) in favor of `is_ascii_ident` to reject more weird `--crate-name`s, `#![crate_name]`s and file names but I think that would lead to a lot of actual breakage, namely because of file names starting with a digit. In `tests/ui` 9 tests would be impacted for example.

CC `@estebank`
r? `@est31`
2023-09-22 19:57:07 +00:00
David Tolnay
3dcc8fcab5
Delete obsolete --disable-per-crate-search rustdoc flag 2023-09-20 22:09:48 -07:00
León Orell Valerian Liehr
8d81d5a909
Validate crate name in CLI option --extern 2023-09-20 18:50:40 +02:00
bors
42f5828b01 Auto merge of #115627 - compiler-errors:icedump-no-std, r=m-ou-se
Don't modify libstd to dump rustc ICEs

Do a much simpler thing and just dump a `std::backtrace::Backtrace` to file.

r? `@estebank` `@oli-obk`

Fixes #115610
2023-09-19 16:56:25 +00:00
bors
8ed1d4a02d Auto merge of #114750 - Enselic:metadata-dep-info, r=compiler-errors
Make `.rmeta` file in `dep-info` have correct name (`lib` prefix)

Since `filename_for_metadata()` and
`OutputFilenames::path(OutputType::Metadata)` had different logic for the name of the metadata file, the `.d` file contained a file name different from the actual name used. Share the logic to fix the out-of-sync name.

Without this fix, the `.d` file contained

    dash-separated_something-extra.rmeta: dash-separated.rs

instead of

    libdash_separated_something-extra.rmeta: dash-separated.rs

which is the name of the file that is actually written by the compiler.

Worth noting: It took me several iterations to get all tests to pass, so I am relatively confident that this PR does not break anything.

Closes #68839
2023-09-17 11:45:53 +00:00
Michael Howell
7e86fd61e8 rustdoc: merge theme css into rustdoc.css
Based on
https://github.com/rust-lang/rust/pull/115812#issuecomment-1717960119

Having them in separate files used to make more sense, before the
migration to CSS variables made the theme files as small as they are
nowadays. This is already how docs.rs and mdBook do it.
2023-09-15 07:40:17 -07:00
bors
7e0261e7ea Auto merge of #115735 - bjorn3:better_list_crate_metadata, r=wesleywiser
Extend rustc -Zls

This makes it show a lot more things and thus a lot more useful.
2023-09-13 10:23:57 +00:00
DianQK
b99ace4179
Add a test for #108030
Closes #108030.
This issue has been resolved in LLVM 17.
2023-09-11 22:01:55 +08:00
bjorn3
4deb072e79 Fix tests 2023-09-10 15:50:48 +00:00
Augie Fackler
78d805cd87 tests: use warning output from rustc to catch missing compression
Using `ld.lld` may have been clever, but that was getting the /system/
ld.lld, not one we may have built as part of building llvm. By using the
warning message coming directly from rustc we now correctly skip the
zlib and zstd tests when the support is missing.
2023-09-08 11:30:24 -04:00
Augie Fackler
af9e55068c debuginfo: add compiler option to allow compressed debuginfo sections
LLVM already supports emitting compressed debuginfo. In debuginfo=full
builds, the debug section is often a large amount of data, and it
typically compresses very well (3x is not unreasonable.) We add a new
knob to allow debuginfo to be compressed when the matching LLVM
functionality is present. Like clang, if a known-but-disabled
compression mechanism is requested, we disable compression and emit
uncompressed debuginfo sections.

The API is different enough on older LLVMs we just pretend the support
is missing on LLVM older than 16.
2023-09-08 10:45:29 -04:00
bors
9be4eac264 Auto merge of #113492 - nebulark:pr_96475, r=petrochenkov
Add CL and CMD into to pdb debug info

Partial fix for https://github.com/rust-lang/rust/issues/96475

The Arg0 and CommandLineArgs of the MCTargetOptions cpp class are not set within bb548f9645/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp (L378)

This causes LLVM to not  neither output any compiler path (cl) nor the arguments that were used when invoking it (cmd) in the PDB file.

This fix adds the missing information to the target machine so LLVM can use it.
2023-09-08 10:06:40 +00:00
Florian Schmiderer
4cdc633301 Add missing Debuginfo to PDB debug file on windows.
Set Arg0 and CommandLineArgs in MCTargetoptions so LLVM outputs correct CL and CMD in LF_DEBUGINFO instead of empty/invalid values.
2023-09-08 00:28:40 +02:00
Urgau
caf6ce5ea2 Stabilize PATH option for --print KIND=PATH
Description of the `PATH` option:
> A filepath may optionally be specified for each requested information
> kind, in the format `--print KIND=PATH`, just like for `--emit`. When
> a path is specified, information will be written there instead of to
> stdout.
2023-09-07 15:07:30 +02:00
Michael Goulet
8ad2379407 Don't modify libstd to dump rustc ICEs 2023-09-07 04:16:06 +00:00
Martin Nordholts
04d81ba153 Make .rmeta file in dep-info have correct name (lib prefix)
Since `filename_for_metadata()` and
`OutputFilenames::path(OutputType::Metadata)` had different logic for
the name of the metadata file, the `.d` file contained a file name
different from the actual name used. Share the logic to fix the
out-of-sync name.

Closes 68839.
2023-09-03 07:14:12 +02:00
Lukas Wirth
76ee9acc61 ignore-cross-compile remaining tests that run binaries 2023-08-30 13:45:57 +02:00
Guillaume Gomez
5cbc00fb7e
Rollup merge of #115135 - GuillaumeGomez:no-html-source-flag, r=notriddle
Rustdoc: Add unstable --no-html-source flag

Fixes https://github.com/rust-lang/rust/issues/115060.

This is the equivalent of `#![doc(no_html_source)]` but on the command-line. It disables the generation of the source pages (and of the links pointing to them as well).

The motivation behind this is to enable to reduce documentation size when generating it in some locations without enforcing this to end users or adding a new feature to enable/disable the crate attribute.

r? `@notriddle`
2023-08-23 17:46:35 +02:00
Guillaume Gomez
73ccfc5683 Update run-make/issue-88756-default-output test 2023-08-23 16:33:07 +02:00
bors
ff55fa3026 Auto merge of #113124 - nbdd0121:eh_frame, r=cjgillot
Add MIR validation for unwind out from nounwind functions + fixes to make validation pass

`@Nilstrieb`  This is the MIR validation you asked in https://github.com/rust-lang/rust/pull/112403#discussion_r1222739722.

Two passes need to be fixed to get the validation to pass:
* `RemoveNoopLandingPads` currently unconditionally introduce a resume block (even there is none to begin with!), changed to not do that
* Generator state transform introduces a `assert` which may unwind, and its drop elaboration also introduces many new `UnwindAction`s, so in this case run the AbortUnwindingCalls after the transformation.

I believe this PR should also fix Rust-for-Linux/linux#1016, cc `@ojeda`

r? `@Nilstrieb`
2023-08-20 09:58:52 +00:00
Gary Guo
cec8e09edf Run AbortUnwindingCalls after generator transform 2023-08-18 13:51:42 +01:00