Commit Graph

2594 Commits

Author SHA1 Message Date
bors 6d05f12170 Auto merge of #129346 - nnethercote:fix-double-handling-in-collect_tokens, r=petrochenkov
Fix double handling in `collect_tokens`

Double handling of AST nodes can occur in `collect_tokens`. This is when an inner call to `collect_tokens` produces an AST node, and then an outer call to `collect_tokens` produces the same AST node. This can happen in a few places, e.g. expression statements where the statement delegates `HasTokens` and `HasAttrs` to the expression. It will also happen more after #124141.

This PR fixes some double handling cases that cause problems, including #129166.

r? `@petrochenkov`
2024-09-08 05:35:23 +00:00
Matthias Krüger 8a60d0a5ec
Rollup merge of #101339 - the8472:ci-randomize-debug, r=Mark-Simulacrum
enable -Zrandomize-layout in debug CI builds

This builds rustc/libs/tools with `-Zrandomize-layout` on *-debug CI runners.

Only a handful of tests and asserts break with that enabled, which is promising. One test was fixable, the rest is dealt with by disabling them through new cargo features or compiletest directives.

The config.toml flag `rust.randomize-layout` defaults to false, so it has to be explicitly enabled for now.
2024-09-05 03:47:39 +02:00
Rémy Rakic d30b5f0003 update `object` dependency to deduplicate `wasmparser` 2024-09-01 15:36:44 +00:00
Matthias Krüger 62b8fdb7da
Rollup merge of #129619 - sunshowers:update-stacker, r=Mark-Simulacrum
Update stacker to 0.1.17

The main new feature is support for detecting the current stack size on illumos. (See [my blog post] for the context which led to this.)

[my blog post]: https://sunshowers.io/posts/rustc-segfault-illumos/

try-job: x86_64-mingw
2024-09-01 03:58:04 +02:00
The 8472 5bf8eeb9f3 disable size asserts in the compiler when randomizing layouts 2024-08-31 23:56:45 +02:00
Alex Crichton 99558dc7f4 Update the `wasm-component-ld` binary dependency
This keeps it up-to-date by moving from 0.5.6 to 0.5.7. While here I've
additionally updated some other wasm-related dependencies in the
workspace to keep them up-to-date and try to avoid duplicate versions as
well.
2024-08-29 14:39:12 -07:00
Rain ea6df5c147 Update stacker to 0.1.17
The main new feature is support for detecting the current stack size on
illumos. (See my blog post [1] for the context which led to this.)

[1]: https://sunshowers.io/posts/rustc-segfault-illumos/
2024-08-28 15:02:41 -07:00
Matthias Krüger a8a242c0ec
Rollup merge of #129526 - compiler-errors:fx, r=lqd
Use `FxHasher` on new solver unconditionally

r? lqd

This should actually fix the inference problem in ad855fe6db, since `HashSet::default` was not inferring the hasher when `HashSet` was coming from the stdlib due to the way that defaulted types/inference vars work. You could cherry-pick this on top of your PR alternatively.
2024-08-26 01:49:02 +02:00
Michael Goulet 1c58522068 Use FxHasher on new solver unconditionally 2024-08-25 16:37:15 -04:00
Matthias Krüger c6f7b1f390
Rollup merge of #129511 - GuillaumeGomez:update-minifier, r=notriddle
Update minifier to 0.3.1

It adds support for escaped characters.

PR is https://github.com/GuillaumeGomez/minifier-rs/pull/111.

r? ````@notriddle````
2024-08-25 16:51:06 +02:00
bors 89103466d7 Auto merge of #129531 - Jarcho:clippyup, r=Manishearth
Clippy subtree update

r? `@Manishearth`
2024-08-25 11:56:57 +00:00
Jason Newcomb 6c3f43d5cc Merge commit '0f8eabd6231366bfc1bb1464601297c2d48f8f68' into clippyup 2024-08-24 18:33:44 -04:00
Matthias Krüger 2a7f2da422
Rollup merge of #129290 - tgross35:pin-cc, r=Mark-Simulacrum
Pin `cc` to 1.0.105

`cc` 1.0.106 removes support for Visual Studio 12. Pin to 1.0.105 so we don't drop support yet.

Fixes: https://github.com/rust-lang/rust/pull/128722#issuecomment-2297605573
2024-08-24 22:14:13 +02:00
Guillaume Gomez c36b5634cf Update minifier to 0.3.1 2024-08-24 18:34:28 +02:00
Nicholas Nethercote 1fdabfbebb Avoid double-handling of attributes in `collect_tokens`.
By keeping track of attributes that have been previously processed.

This fixes the `macro-rules-derive-cfg.stdout` test, and is necessary
for #124141 which removes nonterminals.

Also shrink the `SmallVec` inline size used in `IntervalSet`. 2 gives
slightly better perf than 4 now that there's an `IntervalSet` in
`Parser`, which is cloned reasonably often.
2024-08-24 06:57:47 +10:00
bors eef00c8be8 Auto merge of #128507 - Oneirical:testart-from-scratch, r=jieyouxu
Migrate `libtest-thread-limit` `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).

Please try, but **only if normal CI is green**:

// try-job: armhf-gnu // <- failed on this
try-job: aarch64-gnu
2024-08-23 18:30:21 +00:00
Oneirical 318dfb405f rewrite libtest-thread-limit to rmake 2024-08-23 10:29:27 -04:00
bors 5ad98b4026 Auto merge of #129257 - ChrisDenton:rename-null-descriptor, r=jieyouxu
Allow rust staticlib to work with MSVC's /WHOLEARCHIVE

This fixes #129020 by renaming the `__NULL_IMPORT_DESCRIPTOR` to prevent conflicts.

try-job: dist-i686-msvc
2024-08-22 15:53:02 +00:00
Chris Denton 40af2143f1
Make import libraries compatible with wholearchive 2024-08-20 13:43:33 +00:00
Trevor Gross a5f6c15571 Pin `cc` to 1.0.105
`cc` 1.0.106 removes support for Visual Studio 12. Pin to 1.0.105 so we
don't drop support yet.

Fixes: https://github.com/rust-lang/rust/pull/128722#issuecomment-2297605573
2024-08-19 22:24:46 -04:00
Xiretza c864238baf Update annotate-snippets to 0.11 2024-08-19 20:22:07 +00:00
Trevor Gross 7240da01ee Run `cargo update` with the new v2 resolver
v2 resolves some dependencies differently, and we adjusted some
dependency versions. Run `cargo update` to make sure everything is in
sync.
2024-08-18 14:00:50 -05:00
许杰友 Jieyou Xu (Joe) c4cf437fa1
Rollup merge of #129164 - ChrisDenton:comdat, r=jieyouxu
Use `ar_archive_writer` for writing COFF import libs on all backends

This is mostly the same as the llvm backend but with the cranelift version copy/pasted in place of the LLVM library.

try-job: x86_64-msvc
try-job: i686-msvc
try-job: i686-mingw
try-job: aarch64-gnu
try-job: aarch64-apple
try-job: test-various
try-job: armhf-gnu
2024-08-18 14:55:22 +08:00
Chris Denton 0156eb57a1
Always use ar_archive_writer for import libs 2024-08-17 19:10:46 +00:00
Guillaume Gomez 6b1637c477 Reexport `serde_json` crate from run-make-support to give it access to `run-make` tests 2024-08-16 16:32:07 +02:00
Josh Stone ce67e68cce Update `indexmap` and use `IndexMap::append` 2024-08-13 16:16:57 -07:00
Philipp Krones 8be2688e45
Update Cargo.lock 2024-08-08 19:14:09 +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
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
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
Jonathan Pallant 4e24e9b1ad
Update to rinja 0.3 2024-08-06 12:03:37 +01:00
Jonathan Pallant 30ac7c9a81
generate-copyright: Render Node with rinja too. 2024-08-06 11:11:05 +01:00
Jonathan Pallant dbab595d78
generate-copyright: use cargo-metadata 2024-08-06 11:04:55 +01:00
Jonathan Pallant ba0d6c9739
Update generate-copyright
This tool now scans for cargo dependencies and includes any important looking license files.

We do this because cargo package metadata is not sufficient - the Apache-2.0 license says you have to include any NOTICE file, for example. And authors != copyright holders (cargo has the former, we must include the latter).
2024-08-06 11:04:55 +01:00
Ralf Jung f6edc8a07c update lockfile 2024-08-05 20:39:56 +02:00
bors 176e545209 Auto merge of #128534 - bjorn3:split_stdlib_workspace, r=Mark-Simulacrum
Move the standard library to a separate workspace

This ensures that the Cargo.lock packaged for it in the rust-src component is up-to-date, allowing rust-analyzer to run cargo metadata on the standard library even when the rust-src component is stored in a read-only location as is necessary for loading crates.io dependencies of the standard library.

This also simplifies tidy's license check for runtime dependencies as it can now look at all entries in library/Cargo.lock without having to filter for just the dependencies of runtime crates. In addition this allows removing an exception in check_runtime_license_exceptions that was necessary due to the compiler enabling a feature on the object crate which pulls in a dependency not allowed for the standard library.

While cargo workspaces normally enable dependencies of multiple targets to be reused, for the standard library we do not want this reusing to prevent conflicts between dependencies of the sysroot and of tools that are built using this sysroot. For this reason we already use an unstable cargo feature to ensure that any dependencies which would otherwise be shared get a different -Cmetadata argument as well as using separate build dirs.

This doesn't change the situation around vendoring. We already have several cargo workspaces that need to be vendored. Adding another one doesn't change much.

There are also no cargo profiles that are shared between the root workspace and the library workspace anyway, so it doesn't add any extra work when changing cargo profiles.
2024-08-04 18:40:03 +00:00
Guillaume Gomez cb7c596681 Update rinja version to 0.3.0 2024-08-04 01:08:10 +02:00
DianQK 8b9d7b1489
Simplify match based on the cast result of `IntToInt`. 2024-08-03 10:55:43 +08:00
bjorn3 1f3be75f56 Move the standard library to a separate workspace
This ensures that the Cargo.lock packaged for it in the rust-src
component is up-to-date, allowing rust-analyzer to run cargo metadata on
the standard library even when the rust-src component is stored in a
read-only location as is necessary for loading crates.io dependencies of
the standard library.

This also simplifies tidy's license check for runtime dependencies as it
can now look at all entries in library/Cargo.lock without having to
filter for just the dependencies of runtime crates. In addition this
allows removing an exception in check_runtime_license_exceptions that
was necessary due to the compiler enabling a feature on the object crate
which pulls in a dependency not allowed for the standard library.

While cargo workspaces normally enable dependencies of multiple targets
to be reused, for the standard library we do not want this reusing to
prevent conflicts between dependencies of the sysroot and of tools that
are built using this sysroot. For this reason we already use an unstable
cargo feature to ensure that any dependencies which would otherwise be
shared get a different -Cmetadata argument as well as using separate
build dirs.

This doesn't change the situation around vendoring. We already have
several cargo workspaces that need to be vendored. Adding another one
doesn't change much.

There are also no cargo profiles that are shared between the root
workspace and the library workspace anyway, so it doesn't add any extra
work when changing cargo profiles.
2024-08-02 10:48:12 +00:00
Guillaume Gomez f44958679a Update sysinfo version to 0.31.2 2024-08-01 16:39:55 +02:00
Michael Howell f3661dce09 rustdoc: word wrap CamelCase in the item list table
This is an alternative to ee6459d652.
That is, it fixes the issue that affects the very long type names
in https://docs.rs/async-stripe/0.31.0/stripe/index.html#structs.

This is, necessarily, a pile of nasty heuristics.
We need to balance a few issues:

- Sometimes, there's no real word break.
  For example, `BTreeMap` should be `BTree<wbr>Map`,
  not `B<wbr>Tree<wbr>Map`.

- Sometimes, there's a legit word break,
  but the name is tiny and the HTML overhead isn't worth it.
  For example, if we're typesetting `TyCtx`,
  writing `Ty<wbr>Ctx` would have an HTML overhead of 50%.
  Line breaking inside it makes no sense.
2024-07-29 08:45:50 -07:00
bors 80d8270d84 Auto merge of #125016 - nicholasbishop:bishop-cb-112, r=tgross35
Update compiler_builtins to 0.1.114

The `weak-intrinsics` feature was removed from compiler_builtins in https://github.com/rust-lang/compiler-builtins/pull/598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.

In https://github.com/rust-lang/compiler-builtins/pull/593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
2024-07-29 07:41:33 +00:00
Nicholas Bishop ecf2963baf Update compiler_builtins to 0.1.114
The `weak-intrinsics` feature was removed from compiler_builtins in
https://github.com/rust-lang/compiler-builtins/pull/598, so dropped the
`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.

In https://github.com/rust-lang/compiler-builtins/pull/593, some
builtins for f16/f128 were added. These don't work for all compiler
backends, so add a `compiler-builtins-no-f16-f128` feature and disable
it for cranelift and gcc. Also disable it for LLVM targets that don't
support it.
2024-07-28 20:43:07 -04:00
Guillaume Gomez 19feb90d69
Rollup merge of #127860 - klensy:dedup, r=Mark-Simulacrum
deps: dedup object, wasmparser, wasm-encoder

* dedups one `object`, additional dupe will be removed, with next `thorin-dwp` update
* `wasmparser` pinned to minor versions, so full merge isn't possible
* same with `wasm-encoder`

Turned off some features for `wasmparser` (see features https://github.com/bytecodealliance/wasm-tools/blob/v1.208.1/crates/wasmparser/Cargo.toml) in `run-make-support`, looks working?
2024-07-28 20:07:45 +02:00
klensy 58c9999f25 dedup object
waiting on thorin-dwp update

dedup one wasmparser

run-make-support: drop some features for wasmparser

dedupe wasm-encoder
2024-07-28 17:21:07 +03:00
bors 48bbe123c2 Auto merge of #128193 - flip1995:clippy-subtree-update, r=matthiaskrgr
Clippy subtree update

r? `@Manishearth`

Updates Cargo.lock due to the Clippy version update and the ui_test bump to v0.24
2024-07-26 03:36:34 +00:00
bors 2f26b2a99a Auto merge of #127042 - GrigorenkoPV:derivative, r=compiler-errors
Switch from `derivative` to `derive-where`

This is a part of the effort to get rid of `syn 1.*` in compiler's dependencies: #109302

Derivative has not been maintained in nearly 3 years[^1]. It also depends on `syn 1.*`.

This PR replaces `derivative` with `derive-where`[^2], a not dead alternative, which uses `syn 2.*`.

A couple of `Debug` formats have changed around the skipped fields[^3], but I doubt this is an issue.

[^1]: https://github.com/mcarton/rust-derivative/issues/117
[^2]: https://lib.rs/crates/derive-where
[^3]: See the changes in `tests/ui`
2024-07-25 22:50:58 +00:00
bors 7120fdac7a Auto merge of #126963 - runtimeverification:smir_serde_derive, r=celinval
Add basic Serde serialization capabilities to Stable MIR

This PR adds basic Serde serialization capabilities to Stable MIR. It is intentionally minimal (just wrapping all stable MIR types with a Serde `derive`), so that any important design decisions can be discussed before going further. A simple test is included with this PR to validate that JSON can actually be emitted.

## Notes

When I wrapped the Stable MIR error types in `compiler/stable_mir/src/error.rs`, it caused test failures (though I'm not sure why) so I backed those out.

## Future Work

So, this PR will support serializing basic stable MIR, but it _does not_ support serializing interned values beneath `Ty`s and `AllocId`s, etc... My current thinking about how to handle this is as follows:

1.  Add new `visited_X` fields to the `Tables` struct for each interned category of interest.

2.  As serialization is occuring, serialize interned values as usual _and_ also record the interned value we referenced in `visited_X`.

    (Possibly) In addition, if an interned value recursively references other interned values, record those interned values as well.

3.  Teach the stable MIR `Context` how to access the `visited_X` values and expose them with wrappers in `stable_mir/src/lib.rs` to users (e.g. to serialize and/or further analyze them).

### Pros

This approach does not commit to any specific serialization format regarding interned values or other more complex cases, which avoids us locking into any behaviors that may not be desired long-term.

### Cons

The user will need to manually handle serializing interned values.

### Alternatives

1.  We can directly provide access to the underlying `Tables` maps for interned values; the disadvantage of this approach is that it either requires extra processing for users to filter out to only use the values that they need _or_ users may serialize extra values that they don't need. The advantage is that the implementation is even simpler. The other pros/cons are similar to the above.

2.  We can directly serialize interned values by expanding them in-place. The pro is that this may make some basic inputs easier to consume. However, the cons are that there will need to be special provisions for dealing with cyclical values on both the producer and consumer _and_ global values will possibly need to be de-duplicated on the consumer side.
2024-07-25 20:27:51 +00:00
Philipp Krones 0949ff928a
Update Cargo.lock 2024-07-25 18:29:27 +02:00
Matthias Krüger cce2db06c0
Rollup merge of #127528 - estebank:ascii-control-chars, r=oli-obk
Replace ASCII control chars with Unicode Control Pictures

Replace ASCII control chars like `CR` with Unicode Control Pictures like `␍`:

```
error: bare CR not allowed in doc-comment
  --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:3:32
   |
LL | /// doc comment with bare CR: '␍'
   |                                ^
```

Centralize the checking of unicode char width for the purposes of CLI display in one place. Account for the new replacements. Remove unneeded tracking of "zero-width" unicode chars, as we calculate these in the `SourceMap` as needed now.
2024-07-25 04:43:19 +02:00