Commit Graph

263092 Commits

Author SHA1 Message Date
ltdk 0257f42089 Add tracking issue to core-pattern-type 2024-08-07 20:43:05 -04:00
Alex Macleod 17de8fbd06 lintcheck: disable doc links 2024-08-08 00:39:30 +00:00
bors 86e7875c13 Auto merge of #128793 - matthiaskrgr:rollup-ork16t0, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #128363 (Migrate `pdb-buildinfo-cl-cmd` and `pgo-indirect-call-promotion` `run-make` tests to rmake)
 - #128384 (Add tests to ensure MTE tags are preserved across FFI boundaries)
 - #128636 (migrate `thumb-none-cortex-m` to rmake)
 - #128696 (Migrate `staticlib-dylib-linkage` `run-make` test to rmake)

Failed merges:

 - #128407 (Migrate `min-global-align` and `no-alloc-shim` `run-make` tests to rmake)
 - #128639 (migrate `thumb-none-qemu` to rmake)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-07 22:30:29 +00:00
Jeff Martin 5db9d43207 Fuchsia Test Runner: enable ffx repository server
The default repository server setting has changed on Fuchsia (default is
newly "false"). Now, in order to start the repository server, the config
`repository.server.enabled` must be set to true.
2024-08-07 16:08:41 -04:00
bors 8b3870784f Auto merge of #128796 - matthiaskrgr:rollup-r7l68ph, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #128221 (Add implied target features to target_feature attribute)
 - #128261 (impl `Default` for collection iterators that don't already have it)
 - #128353 (Change generate-copyright to generate HTML, with cargo dependencies included)
 - #128679 (codegen: better centralize function declaration attribute computation)
 - #128732 (make `import.vis` is immutable)
 - #128755 (Integrate crlf directly into related test file instead via of .gitattributes)
 - #128772 (rustc_codegen_ssa: Set architecture for object crate for 32-bit SPARC)
 - #128782 (unused_parens: do not lint against parens around &raw)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-07 20:00:29 +00:00
Felix Rath a70c9e1f86 refactor(rustc_expand::mbe): Don't require full ExtCtxt when not necessary 2024-08-07 21:58:05 +02:00
bors f2deab375c Auto merge of #13232 - Alexendoo:path-prefix, r=flip1995
Add path prefixes back when compiling `clippy_dev` and `lintcheck`

`cargo dev` and `cargo lintcheck` use `--manifest-path` to select the package to compile, with this Cargo changes the CWD to the package's containing directory meaning paths in diagnostics start from e.g. `src/` instead of `clippy_dev/src/`

Lintcheck uses a `--remap-path-prefix` trick when linting crates to re-add the directory name in diagnostics:

5ead90f13a/lintcheck/src/main.rs (L93-L94)

5ead90f13a/lintcheck/src/main.rs (L102-L103)

It works well as far as I can tell, when absolute paths appear they stay absolute and do not have the prefix added

[`profile-rustflags`](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-rustflags-option) allows us to set per package `RUSTFLAGS` in order to use the same trick on the `clippy_dev` and `lintcheck` packages themselves

Now when you run into warnings/errors the filename will be correctly clickable

Before
```
error[E0425]: cannot find value `moo` in this scope
  --> src/lib.rs:41:5
   |
41 |     moo;
   |     ^^^ not found in this scope
```

After
```
error[E0425]: cannot find value `moo` in this scope
  --> clippy_dev/src/lib.rs:41:5
   |
41 |     moo;
   |     ^^^ not found in this scope
```

r? `@flip1995`

changelog: none
2024-08-07 18:53:50 +00:00
Matthias Krüger aba506b12a
Rollup merge of #128782 - RalfJung:raw-addr-of-parens, r=compiler-errors
unused_parens: do not lint against parens around &raw

Requested by `@tmandry` in https://github.com/rust-lang/rust/pull/127679: with `&raw` one somewhat regularly has to write code like `(&raw const (*myptr).field).method()`, so parentheses around the expression are often required. To avoid churn between adding and removing parentheses as method calls appear and disappear, the proposal was made to silence the lint for unnecessary parentheses around `&raw` expressions. This PR implements that.
2024-08-07 20:28:20 +02:00
Matthias Krüger 04ab8e385c
Rollup merge of #128772 - glaubitz:sparc-elf-fix, r=nagisa
rustc_codegen_ssa: Set architecture for object crate for 32-bit SPARC

The `object` crate was recently updated to recognize the 32-bit SPARC ELF targets `EM_SPARC` and `EM_SPARC32PLUS`, so the proper architecture for 32-bit SPARC can now be set in `rustc_codegen_ssa`.

r? nagisa
2024-08-07 20:28:19 +02:00
Matthias Krüger e5a3c32ffa
Rollup merge of #128755 - yaahc:jj-crlf, r=estebank
Integrate crlf directly into related test file instead via of .gitattributes

resolves https://github.com/rust-lang/rust/issues/128708

This PR seeks to resolve a contributor papercut when using jj to manage the git repo locally which does not support .gitattributes. It does so by integrating the crlf characters directly into the related test and disabling Git's end of line normalization logic across platforms for that specific file, instead of configuring git to always check out the files with alternative eol characters.

related documentation: https://git-scm.com/docs/gitattributes#Documentation/gitattributes.txt-Unset-1
2024-08-07 20:28:19 +02:00
Matthias Krüger 8f5b50d4ba
Rollup merge of #128732 - bvanjoi:immutable-import-vis, r=petrochenkov
make `import.vis` is immutable

r? `@petrochenkov`
2024-08-07 20:28:18 +02:00
Matthias Krüger 8f39b86a6a
Rollup merge of #128679 - RalfJung:codegen-fn-attrs, r=nikic
codegen: better centralize function declaration attribute computation

For some reason, the codegen backend has two functions that compute which attributes a function declaration gets: `apply_attrs_llfn` and `attributes::from_fn_attrs`. They are called in different places, on entirely different layers of abstraction.

To me the code seems cleaner if we centralize this entirely in `apply_attrs_llfn`, so that's what this PR does.
2024-08-07 20:28:18 +02:00
Matthias Krüger e34229508a
Rollup merge of #128353 - ferrocene:jonathanpallant/add-dependencies-to-copyright-file, r=Kobzol
Change generate-copyright to generate HTML, with cargo dependencies included

`x.py run generate-copyright` now produces `build/COPYRIGHT.html`. This includes a new format for in-tree dependencies, and also adds out-of-tree cargo dependencies.

After consulting expert opinion, I have elected to include every top-level:

* `*NOTICE*`
* `*AUTHOR*`
* `*LICENSE*`
* `*LICENCE*`, and
* `*COPYRIGHT*` file I can find - case-insensitive.

This is because the cargo package metadata's `author` field is not a list of copyright holders and does not meet the requirements of the Apache-2.0 license (which says you must include a NOTICE file with the binary if one was supplied by the author) nor the MIT license (which says you must include 'the above copyright notice').

I believe it would be appropriate to include this file with every Rust release, in order to do an even better job of appropriately recognising the efforts of the authors of the first-party and third-party libraries we are using here.

The output includes something like 524 copies of the Apache-2.0 text because they are not all identical. I think I count about 50 different variations by shasum - some differ in whitespace, while some have the boilerplate block at the bottom erroneously modified (don't modify the copy in the license, modify the copy you paste into your own source code!). Running `gzip` on the HTML file largely makes this problem go away, and the average browser is far happier with a ~6 MiB HTML file than the average Markdown viewer is with a ~6 MiB markdown file. But, if someone wants to, do they could submit a follow-up which de-dups the license text files and adds back-links to earlier identical copies (for some value of 'identical copy').

```console
$ xpy run generate-copyright
$ cd build
$ gzip -c COPYRIGHT.html > COPYRIGHT.gz
$ xz -c COPYRIGHT.html > COPYRIGHT.xz
$ ls -lh COPYRIGHT.*
-rw-r--r--  1 jonathan  staff   241K 29 Jul 17:19 COPYRIGHT.gz
-rw-r--r--@ 1 jonathan  staff   6.6M 29 Jul 11:30 COPYRIGHT.html
-rw-r--r--  1 jonathan  staff    59K 29 Jul 17:19 COPYRIGHT.xz
```

Here's an example [COPYRIGHT.gz](https://github.com/user-attachments/files/16416147/COPYRIGHT.gz).
2024-08-07 20:28:17 +02:00
Matthias Krüger 2ee9678338
Rollup merge of #128261 - clarfonthey:iter-default, r=dtolnay
impl `Default` for collection iterators that don't already have it

There is a pretty strong precedent for implementing `Default` for collection iterators, and this does so for some where this implementation was missed.

I don't think this needs a separate ACP (since this precedent already exists, and these feel like they were just missed), however, it *will* need an FCP since these implementations are instantly stable.
2024-08-07 20:28:16 +02:00
Matthias Krüger 904f5795a0
Rollup merge of #128221 - calebzulawski:implied-target-features, r=Amanieu
Add implied target features to target_feature attribute

See [zulip](https://rust-lang.zulipchat.com/#narrow/stream/208962-t-libs.2Fstdarch/topic/Why.20would.20target-feature.20include.20implied.20features.3F) for some context.  Adds implied target features, e.g. `#[target_feature(enable = "avx2")]` acts like `#[target_feature(enable = "avx2,avx,sse4.2,sse4.1...")]`.  Fixes #128125, fixes #128426

The implied feature sets are taken from [the rust reference](https://doc.rust-lang.org/reference/attributes/codegen.html?highlight=target-fea#x86-or-x86_64), there are certainly more features and targets to add.

Please feel free to reassign this to whoever should review it.

r? ``@Amanieu``
2024-08-07 20:28:16 +02:00
Jane Losare-Lusby 5212c75907 Add -Zerror-metrics=PATH to save diagnostic metadata to disk 2024-08-07 11:16:55 -07:00
Ralf Jung 273c67db83 codegen: better centralize function attribute computation 2024-08-07 19:49:48 +02:00
Matthias Krüger 26787a8c0d
Rollup merge of #128696 - Oneirical:second-linkage-rampage, r=jieyouxu
Migrate `staticlib-dylib-linkage` `run-make` test to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

I'm quite sure this has the same issue as the one brought up in [this discussion](https://github.com/rust-lang/rust/pull/128407#discussion_r1702439172), so I elected to keep the ignore MSVC.

try-job: aarch64-apple
try-job: x86_64-gnu-llvm-17
try-job: armhf-gnu
2024-08-07 19:35:07 +02:00
Matthias Krüger 38dc3b2621
Rollup merge of #128636 - folkertdev:rmake-thumb-none-cortex-m, r=jieyouxu
migrate `thumb-none-cortex-m` to rmake

tracking issue: https://github.com/rust-lang/rust/issues/121876

I'll leave some comments/questions inline

r? ```@jieyouxu```

try-job: armhf-gnu
try-job: dist-various-1
try-job: test-various
2024-08-07 19:35:06 +02:00
Matthias Krüger b817900087
Rollup merge of #128384 - dheaton-arm:mte-test, r=jieyouxu
Add tests to ensure MTE tags are preserved across FFI boundaries

Added run-make tests to verify that, between a Rust-C FFI boundary in both directions, any MTE tags included in a pointer are preserved for the following pointer types, as well as any information stored using TBI:
- int
- float
- string
- function

try-job: aarch64-gnu
2024-08-07 19:35:05 +02:00
Matthias Krüger a36bf74d66
Rollup merge of #128363 - Oneirical:not-to-be-undertestimated, r=jieyouxu
Migrate `pdb-buildinfo-cl-cmd` and `pgo-indirect-call-promotion` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Please try:

try-job: x86_64-msvc
try-job: x86_64-mingw
try-job: i686-msvc
try-job: i686-mingw
try-job: x86_64-gnu-llvm-17
try-job: aarch64-apple
2024-08-07 19:35:04 +02:00
bors ce20e15f01 Auto merge of #126158 - Urgau:disallow-cfgs, r=petrochenkov
Disallow setting some built-in cfg via set the command-line

This PR disallow users from setting some built-in cfg via set the command-line in order to prevent incoherent state, eg. `windows` cfg active but target is Linux based.

This implements MCP https://github.com/rust-lang/compiler-team/issues/610, with the caveat that we disallow cfgs no matter if they make sense or not, since I don't think it's useful to allow users to set a cfg that will be set anyway. It also complicates the implementation.

------

The `explicit_builtin_cfgs_in_flags` lint detects builtin cfgs set via the `--cfg` flag.

*(deny-by-default)*

### Example

```text
rustc --cfg unix
```

```rust,ignore (needs command line option)
fn main() {}
```

This will produce:

```text
error: unexpected `--cfg unix` flag
  |
  = note: config `unix` is only supposed to be controlled by `--target`
  = note: manually setting a built-in cfg can and does create incoherent behaviours
  = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default
```

### Explanation

Setting builtin cfgs can and does produce incoherent behaviour, it's better to the use the appropriate `rustc` flag that controls the config. For example setting the `windows` cfg but on Linux based target.

-----

r? `@petrochenkov`
cc `@jyn514`

try-job: aarch64-apple
try-job: test-various
try-job: armhf-gnu
try-job: x86_64-msvc
try-job: x86_64-mingw
try-job: i686-msvc
try-job: i686-mingw
try-job: x86_64-gnu-llvm-17
try-job: dist-various-1
2024-08-07 17:32:16 +00:00
Oneirical 7d1a97fae9 rewrite pgo-indirect-call-promotion to rmake 2024-08-07 12:57:34 -04:00
Oneirical 7e5a2ea583 rewrite pdb-buildinfo-cl-cmd to rmake 2024-08-07 12:57:26 -04:00
tiif 8eaef3eca0 Add test 2024-08-08 00:41:39 +08:00
Alex Macleod 8225f2a793 Add path prefixes back when compiling `clippy_dev` and `lintcheck` 2024-08-07 16:37:05 +00:00
Jason Newcomb 8bcecfff95 Handle or patterns in `single_match` and `single_match_else` 2024-08-07 11:40:15 -04:00
Jason Newcomb 514824ff9d Refactor `single_match` 2024-08-07 11:32:06 -04:00
bohan 8c06dc4dda make `import.vis` is not mutable 2024-08-07 22:13:23 +08:00
bors 8d0066922b Auto merge of #128783 - GuillaumeGomez:rollup-2kvpg7s, r=GuillaumeGomez
Rollup of 9 pull requests

Successful merges:

 - #128206 (Make create_dll_import_lib easier to implement)
 - #128424 (minor `effects` cleanups)
 - #128527 (More information for fully-qualified suggestion when there are multiple impls)
 - #128656 (Enable msvc for run-make/rust-lld)
 - #128683 (bootstrap: clear miri's ui test deps when rustc changes)
 - #128700 (Migrate `simd-ffi` `run-make` test to rmake)
 - #128753 (Don't arbitrarily choose one upper bound for hidden captured region error message)
 - #128757 (Migrate `pgo-gen-lto` `run-make` test to rmake)
 - #128758 (Specify a minimum supported version for VxWorks)

Failed merges:

 - #128679 (codegen: better centralize function declaration attribute computation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-07 14:10:46 +00:00
Guillaume Gomez 920cb642a4
Rollup merge of #128758 - devnexen:vxworks_release_min, r=tgross35
Specify a minimum supported version for VxWorks

Document that VxWorks 7 is the minimum supported version.
2024-08-07 15:59:40 +02:00
Guillaume Gomez c0efd51396
Rollup merge of #128757 - Oneirical:calm-before-the-sltorm, r=jieyouxu
Migrate `pgo-gen-lto` `run-make` test to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

This one is so easy, I'm surprised I missed it.

try-job: aarch64-apple
try-job: x86_64-msvc
try-job: x86_64-mingw
try-job: i686-msvc
try-job: i686-mingw
try-job: x86_64-gnu-llvm-17
2024-08-07 15:59:39 +02:00
Guillaume Gomez 888d157417
Rollup merge of #128753 - compiler-errors:arbitrary-upper, r=spastorino
Don't arbitrarily choose one upper bound for hidden captured region error message

You could argue that the error message is objectively worse, even though it's more accurate. I guess we could also add a note explaining like "cannot capture the intersection of two regions" or something, though I'm not sure if that is confusing due to being totally technical jargon.

This addresses the fact that #128752 says "add `+ 'b`" even though it does nothing to fix the issue. It doesn't fix the issue's root cause, though.

r? `@spastorino`
2024-08-07 15:59:38 +02:00
Guillaume Gomez f739c00f4a
Rollup merge of #128700 - Oneirical:i-ffind-these-tests-quite-simdple, r=jieyouxu
Migrate `simd-ffi` `run-make` test to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

try-job: x86_64-msvc
try-job: x86_64-mingw
try-job: i686-msvc
try-job: armhf-gnu
try-job: test-various
try-job: aarch64-apple
try-job: x86_64-gnu-llvm-17
2024-08-07 15:59:38 +02:00
Guillaume Gomez 37dfe41da0
Rollup merge of #128683 - RalfJung:miri-ui-test-deps, r=onur-ozkan
bootstrap: clear miri's ui test deps when rustc changes

`@onur-ozkan` I hope this makes sense... it's quite hard to test this, but it did at least cause one rebuild of the right files for me, and then it doesn't seem to keep rebuilding, so at first sight this look at least better than the status quo.
2024-08-07 15:59:37 +02:00
Guillaume Gomez a05f187b15
Rollup merge of #128656 - ChrisDenton:rust-lld, r=lqd
Enable msvc for run-make/rust-lld

This is simply a matter of using the right argument for lld-link.

As a bonus, I also fixed a typo.

try-job: i686-msvc
try-job: x86_64-msvc
2024-08-07 15:59:37 +02:00
Guillaume Gomez 493233ce29
Rollup merge of #128527 - estebank:ambiguity-suggestion, r=Nadrieril
More information for fully-qualified suggestion when there are multiple impls

```
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
  --> $DIR/E0283.rs:30:21
   |
LL |     fn create() -> u32;
   |     ------------------- `Coroutine::create` defined here
...
LL |     let cont: u32 = Coroutine::create();
   |                     ^^^^^^^^^^^^^^^^^^^ cannot call associated function of trait
   |
help: use a fully-qualified path to a specific available implementation
   |
LL |     let cont: u32 = <Impl as Coroutine>::create();
   |                     ++++++++          +
LL |     let cont: u32 = <AnotherImpl as Coroutine>::create();
   |                     +++++++++++++++          +
```
2024-08-07 15:59:36 +02:00
Guillaume Gomez a6caceee4d
Rollup merge of #128424 - fee1-dead-contrib:fx-clean, r=oli-obk
minor `effects` cleanups

* remove the fixme comment about not needing defaults because it turns out we do need defaults (if I made it None instead it would ice a bunch of tests)
* remove the part that special cased trait args when lowering them. This is now historical because effects doesn't add host args to traits anymore (we use associated types now)
2024-08-07 15:59:35 +02:00
Guillaume Gomez 355eb9c79f
Rollup merge of #128206 - bjorn3:import_lib_writing_refactor, r=jieyouxu
Make create_dll_import_lib easier to implement

This will make it easier to implement raw-dylib support in cg_clif and cg_gcc. This PR doesn't yet include an create_dll_import_lib implementation for cg_clif as I need to correctly implement dllimport in cg_clif first before raw-dylib can work at all with cg_clif.

Required for https://github.com/rust-lang/rustc_codegen_cranelift/issues/1345
2024-08-07 15:59:35 +02:00
Jason Newcomb 16633a2d7b Replace `in_constant` with `is_in_const_context`. Use only the state in `LateContext` to avoid walking the HIR tree. 2024-08-07 09:57:27 -04:00
Ralf Jung c1897960c0 unused_parens: do not lint against parens around &raw 2024-08-07 15:29:00 +02:00
Ralf Jung 2b584dc777 bootstrap: clear miri's ui test deps when rustc changes 2024-08-07 14:38:27 +02:00
Urgau c0c57b3e29 Disallow setting built-in cfgs via set the command-line 2024-08-07 14:08:34 +02:00
Urgau eedb32dd12 Make `Span` optional in `BufferedEarlyLint` 2024-08-07 14:08:34 +02:00
bors 9bad7ba324 Auto merge of #128196 - Oneirical:poltergeist-manitestation, r=jieyouxu
Migrate `cross-lang-lto-upstream-rlibs`, `long-linker-command-lines` and `long-linker-command-lines-cmd-exe` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

The `long-linker` tests are certainly doing something... interesting - they summon `rustc` calls with obscene quantities of arguments and check that this is appropriately handled. I removed the `RUSTC_ORIGINAL` magic - it's equivalent to `RUSTC` in `tools.mk`, so what is the purpose? Making it so the massive pile of flags doesn't modify rustc itself and start leaking into other tests? Tell me what you think.

Please try:

try-job: x86_64-msvc
try-job: i686-msvc
try-job: x86_64-mingw
try-job: i686-mingw
try-job: aarch64-apple
try-job: test-various
try-job: x86_64-gnu-debug
try-job: x86_64-gnu-llvm-17
2024-08-07 10:58:10 +00:00
bjorn3 f58e737554 Update ar_archive_writer to 0.3.3
Version 0.3.1 has added support for writing import libraries. Version
0.3.2 fixed creating archives containing members of import libraries.
Version 0.3.3 fixed building on big-endian systems.
2024-08-07 10:52:02 +00:00
Trevor Gross 6b3feb49c6 Mark `{f32,f64}::{next_up,next_down,midpoint}` inline
Most float functions are marked `#[inline]` so any float symbols used by
these functions only need to be provided if the function itself is used.
RFL recently noticed that `next_up`, `next_down`, and `midpoint` for
`f32` and `f64` are not inline, which causes linker errors when building
with certain configurations [1].

Add the missing attributes so the symbols should no longer be required.

Cc: Gary Guo <gary@garyguo.net>
Reported-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/all/20240806150619.192882-1-ojeda@kernel.org/ [1]
2024-08-07 03:24:55 -05:00
John Paul Adrian Glaubitz d1d21ede82 rustc_codegen_ssa: Set architecture for object crate for 32-bit SPARC
The object crate was recently updated to recognize the 32-bit SPARC
ELF targets EM_SPARC and EM_SPARC32PLUS, so the proper architecture
for 32-bit SPARC can now be set in rustc_codegen_ssa.
2024-08-07 09:56:28 +02:00
David Carlier c8eacd617e
Specify a minimum supported version for VxWorks 2024-08-07 07:24:19 +01:00
bors 6a2cd0d50c Auto merge of #128768 - tgross35:rollup-aaq1ny7, r=tgross35
Rollup of 7 pull requests

Successful merges:

 - #128107 (Migrate `raw-dylib-alt-calling-convention`, `raw-dylib-c` and `redundant-libs` `run-make` tests to rmake)
 - #128362 (add test for symbol visibility of `#[naked]` functions)
 - #128417 (Add `f16` and `f128` math functions)
 - #128638 (run-make: enable msvc for `link-dedup`)
 - #128647 (Enable msvc for link-args-order)
 - #128649 (run-make: Enable msvc for `no-duplicate-libs` and `zero-extend-abi-param-passing`)
 - #128766 (Trivial grammar fix in const keyword docs)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-07 06:01:57 +00:00