Commit graph

2506 commits

Author SHA1 Message Date
klensy 124837d463 move QueryKeyStringCache from rustc_middle to rustc_query_impl, where it actually used
also allows to drop measureme dep on rustc_middle
2024-04-11 14:33:48 +03:00
Ralf Jung 385c363bdf update compiler_builtins to 0.1.109 2024-04-10 14:34:52 +02:00
bjorn3 dacfbfccc5 Update ar_archive_writer to 0.2.0
This adds a whole bunch of tests checking for any difference with llvm's
archive writer. It also fixes two mistakes in the porting from C++ to
Rust. The first one causes a divergence for Mach-O archives which may or
may not be harmless. The second will definitively cause issues, but only
applies to thin archives, which rustc currently doesn't create.
2024-04-09 17:45:02 +00:00
David Tolnay 224edac7a1
Update cc dependency to fix compile family detection warning 2024-04-08 13:00:16 -07:00
Ramon de C Valle 1f0f2c4007 sanitizers: Create the rustc_sanitizers crate
Create the rustc_sanitizers crate and move the source code for the CFI
and KCFI sanitizers to it.

Co-authored-by: David Wood <agile.lion3441@fuligin.ink>
2024-04-08 12:05:41 -07:00
github-actions 4035c24175 cargo update
Updating expect-test v1.4.1 -> v1.5.0
    Updating getrandom v0.2.12 -> v0.2.13
    Updating h2 v0.3.25 -> v0.3.26 (latest: v0.4.4)
    Updating pest v2.7.8 -> v2.7.9
    Updating pest_derive v2.7.8 -> v2.7.9
    Updating pest_generator v2.7.8 -> v2.7.9
    Updating pest_meta v2.7.8 -> v2.7.9
    Updating pulldown-cmark v0.10.0 -> v0.10.2
    Updating rustversion v1.0.14 -> v1.0.15
    Updating strsim v0.11.0 -> v0.11.1
    Updating syn v2.0.57 -> v2.0.58
    Updating ui_test v0.22.2 -> v0.22.3
note: pass `--verbose` to see 86 unchanged dependencies behind latest
2024-04-07 00:16:57 +00:00
bors 01f7f3a1ff Auto merge of #123321 - clubby789:cargo-uupdate, r=Mark-Simulacrum
Bump dependencies

Follow up for #123252
Unfortunately this file needs to be manually bumped when any dependencies are bumped in the main lockfile

```
    Updating autocfg v1.1.0 -> v1.2.0
    Updating chrono v0.4.35 -> v0.4.37
    Updating clap v4.5.3 -> v4.5.4
    Updating clap_derive v4.5.3 -> v4.5.4
    Updating handlebars v5.1.0 -> v5.1.2
    Updating itoa v1.0.10 -> v1.0.11
    Updating memoffset v0.9.0 -> v0.9.1
    Updating openssl-sys v0.9.101 -> v0.9.102
    Updating pin-project-lite v0.2.13 -> v0.2.14
    Updating r-efi v4.3.0 -> v4.4.0
    Updating regex-syntax v0.8.2 -> v0.8.3
    Updating security-framework v2.9.2 -> v2.10.0
    Updating security-framework-sys v2.9.1 -> v2.10.0
    Updating serde_json v1.0.114 -> v1.0.115
    Updating syn v2.0.55 -> v2.0.57
    Updating tokio v1.36.0 -> v1.37.0
```
2024-04-06 10:57:13 +00:00
Philipp Krones a809a72667
Update Cargo.lock 2024-04-04 19:53:00 +02:00
Matthias Krüger 31900b4c13
Rollup merge of #123378 - ferrocene:hoverbear/bump-sysinfo-to-0.30.8, r=Nilstrieb
Update sysinfo to 0.30.8

Fixes a Mac specific issue when using `metrics = true` in `config.toml`.

```config.toml
# Collect information and statistics about the current build and writes it to
# disk. Enabling this or not has no impact on the resulting build output. The
# schema of the file generated by the build metrics feature is unstable, and
# this is not intended to be used during local development.
metrics = true
```

During repeated builds, as the generated `metrics.json` grew, eventually `refresh_cpu()` would be called in quick enough succession (specifically: under 200ms) that a divide by zero would occur, leading to a `NaN` which would not be serialized, then when the `metrics.json` was re-read it would fail to parse.

That error looks like this (collected from Ferrocene's CI):

```
   Compiling rustdoc-tool v0.0.0 (/Users/distiller/project/src/tools/rustdoc)
    Finished release [optimized] target(s) in 38.37s
thread 'main' panicked at src/utils/metrics.rs:180:21:
serde_json::from_slice::<JsonRoot>(&contents) failed with invalid type: null, expected f64 at line 1 column 9598
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Build completed unsuccessfully in 0:00:40

Exited with code exit status 1
```

Related: https://github.com/GuillaumeGomez/sysinfo/pull/1236
2024-04-02 21:22:04 +02:00
Ana Hobden b626f01310
Update sysinfo to 0.30.8
Fixes a Mac specific issue when using `build-metrics = true` in `config.toml`
2024-04-02 10:59:05 -07:00
Guillaume Gomez 3aab05eecb
Rollup merge of #122614 - notriddle:notriddle/search-desc, r=GuillaumeGomez
rustdoc-search: shard the search result descriptions

## Preview

This makes no visual changes to rustdoc search. It's a pure perf improvement.

<details><summary>old</summary>

Preview: <http://notriddle.com/rustdoc-html-demo-10/doc/std/index.html?search=vec>

WebPageTest Comparison with before branch on a sort of worst case (searching `vec`, winds up downloading most of the shards anyway): <https://www.webpagetest.org/video/compare.php?tests=240317_AiDc61_2EM,240317_AiDcM0_2EN>

Waterfall diagram:
![image](https://github.com/rust-lang/rust/assets/1593513/39548f0c-7ad6-411b-abf8-f6668ff4da18)

</details>

Preview: <http://notriddle.com/rustdoc-html-demo-10/doc2/std/index.html?search=vec>

WebPageTest Comparison with before branch on a sort of worst case (searching `vec`, winds up downloading most of the shards anyway): <https://www.webpagetest.org/video/compare.php?tests=240322_BiDcCH_13R,240322_AiDcJY_104>

![image](https://github.com/rust-lang/rust/assets/1593513/4be1f9ff-c3ff-4b96-8f5b-b264df2e662d)

## Description

r? `@GuillaumeGomez`

The descriptions are, on almost all crates[^1], the majority of the size of the search index, even though they aren't really used for searching. This makes it relatively easy to separate them into their own files.

Additionally, this PR pulls out information about whether there's a description into a bitmap. This allows us to sort, truncate, *then* download.

This PR also bumps us to ES8. Out of the browsers we support, all of them support async functions according to caniuse.

https://caniuse.com/async-functions

[^1]:
    <https://microsoft.github.io/windows-docs-rs/>, a crate with
    44MiB of pure names and no descriptions for them, is an outlier
    and should not be counted. But this PR should improve it, by replacing a long line of empty strings with a compressed bitmap with a single Run section. Just not very much.

## Detailed sizes

```console
$ cat test.sh
set -ex
cp ../search-index*.js search-index.js
awk 'FNR==NR {a++;next} FNR<a-3' search-index.js{,} | awk 'NR>1 {gsub(/\],\\$/,""); gsub(/^\["[^"]+",/,""); print} {next}' | sed -E "s:\\\\':':g" > search-index.json
jq -c '.t' search-index.json > t.json
jq -c '.n' search-index.json > n.json
jq -c '.q' search-index.json > q.json
jq -c '.D' search-index.json > D.json
jq -c '.e' search-index.json > e.json
jq -c '.i' search-index.json > i.json
jq -c '.f' search-index.json > f.json
jq -c '.c' search-index.json > c.json
jq -c '.p' search-index.json > p.json
jq -c '.a' search-index.json > a.json
du -hs t.json n.json q.json D.json e.json i.json f.json c.json p.json a.json
$ bash test.sh
+ cp ../search-index1.78.0.js search-index.js
+ awk 'FNR==NR {a++;next} FNR<a-3' search-index.js search-index.js
+ awk 'NR>1 {gsub(/\],\\$/,""); gsub(/^\["[^"]+",/,""); print} {next}'
+ sed -E 's:\\'\'':'\'':g'
+ jq -c .t search-index.json
+ jq -c .n search-index.json
+ jq -c .q search-index.json
+ jq -c .D search-index.json
+ jq -c .e search-index.json
+ jq -c .i search-index.json
+ jq -c .f search-index.json
+ jq -c .c search-index.json
+ jq -c .p search-index.json
+ jq -c .a search-index.json
+ du -hs t.json n.json q.json D.json e.json i.json f.json c.json p.json a.json
64K     t.json
800K    n.json
8.0K    q.json
4.0K    D.json
16K     e.json
192K    i.json
544K    f.json
4.0K    c.json
36K     p.json
20K     a.json
```

These are, roughly, the size of each section in the standard library (this tool actually excludes libtest, for parsing-json-with-awk reasons, but libtest is tiny so it's probably not important).

t = item type, like "struct", "free fn", or "type alias". Since one byte is used for every item, this implies that there are approximately 64 thousand items in the standard library.

n = name, and that's now the largest section of the search index with the descriptions removed from it

q = parent *module* path, stored parallel to the items within

D = the size of each description shard, stored as vlq hex numbers

e = empty description bit flags, stored as a roaring bitmap

i = parent *type* index as a link into `p`, stored as decimal json numbers; used only for associated types; might want to switch to vlq hex, since that's shorter, but that would be a separate pr

f = function signature, stored as lists of lists that index into `p`

c = deprecation flag, stored as a roaring bitmap

p = parent *type*, stored separately and linked into from `i` and `f`

a = alias, as [[key, value]] pairs

## Search performance

http://notriddle.com/rustdoc-html-demo-11/perf-shard/index.html

For example, in stm32f4:

<table><thead><tr><th>before<th>after</tr></thead>
<tbody><tr><td>

```
Testing T -> U ... in_args = 0, returned = 0, others = 200
wall time = 617

Testing T, U ... in_args = 0, returned = 0, others = 200
wall time = 198

Testing T -> T ... in_args = 0, returned = 0, others = 200
wall time = 282

Testing crc32 ... in_args = 0, returned = 0, others = 0
wall time = 426

Testing spi::pac ... in_args = 0, returned = 0, others = 0
wall time = 673
```

</td><td>

```
Testing T -> U ... in_args = 0, returned = 0, others = 200
wall time = 716

Testing T, U ... in_args = 0, returned = 0, others = 200
wall time = 207

Testing T -> T ... in_args = 0, returned = 0, others = 200
wall time = 289

Testing crc32 ... in_args = 0, returned = 0, others = 0
wall time = 418

Testing spi::pac ... in_args = 0, returned = 0, others = 0
wall time = 687
```

</td></tr><tr><td>

```
user: 005.345 s
sys:  002.955 s
wall: 006.899 s
child_RSS_high:     583664 KiB
group_mem_high:     557876 KiB
```

</td><td>

```
user: 004.652 s
sys:  000.565 s
wall: 003.865 s
child_RSS_high:     538696 KiB
group_mem_high:     511724 KiB
```

</td></tr>

</table>

This perf tester is janky and unscientific enough that the apparent differences might just be noise. If it's not an order of magnitude, it's probably not real.

## Future possibilities

* Currently, results are not shown until the descriptions are downloaded. Theoretically, the description-less results could be shown. But actually doing that, and making sure it works properly, would require extra work (we have to be careful to avoid layout jumps).
* More than just descriptions can be sharded this way. But we have to be careful to make sure the size wins are worth the round trips. Ideally, data that’s needed only for display should be sharded while data needed for search isn’t.
* [Full text search](https://internals.rust-lang.org/t/full-text-search-for-rustdoc-and-doc-rs/20427) also needs this kind of infrastructure. A good implementation might store a compressed bloom filter in the search index, then download the full keyword in shards. But, we have to be careful not just of the amount readers have to download, but also of the amount that [publishers](https://gist.github.com/notriddle/c289e77f3ed469d1c0238d1d135d49e1) have to store.
2024-04-02 18:18:50 +02:00
clubby789 629d69412a Bump dependencies 2024-04-01 13:06:32 +00:00
bors defef8658e Auto merge of #122972 - beetrees:use-align-type, r=fee1-dead
Use the `Align` type when parsing alignment attributes

Use the `Align` type in `rustc_attr::parse_alignment`, removing the need to call `Align::from_bytes(...).unwrap()` later in the compilation process.
2024-04-01 03:16:45 +00:00
beetrees 6e5f1dacf3
Use the Align type when parsing alignment attributes 2024-04-01 03:05:55 +01:00
klensy 71ea506d3d bump tracing-tree to 0.3
Only change is https://github.com/davidbarsky/tracing-tree/pull/76
dedupes tracing-log
dupes nu-ansi-term
2024-03-30 17:39:43 +03:00
bors c98ea0d808 Auto merge of #111769 - saethlin:ctfe-backtrace-ctrlc, r=RalfJung
Print a backtrace in const eval if interrupted

Demo:
```rust
#![feature(const_eval_limit)]
#![const_eval_limit = "0"]

const OW: u64 = {
    let mut res: u64 = 0;
    let mut i = 0;
    while i < u64::MAX {
        res = res.wrapping_add(i);
        i += 1;
    }
    res
};

fn main() {
    println!("{}", OW);
}
```
```
╭ ➜ ben@archlinux:~/rust
╰ ➤ rustc +stage1 spin.rs
^Cerror[E0080]: evaluation of constant value failed
 --> spin.rs:8:33
  |
8 |         res = res.wrapping_add(i);
  |                                 ^ Compilation was interrupted

note: erroneous constant used
  --> spin.rs:15:20
   |
15 |     println!("{}", OW);
   |                    ^^

note: erroneous constant used
  --> spin.rs:15:20
   |
15 |     println!("{}", OW);
   |                    ^^
   |
   = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0080`.
```
2024-03-26 00:04:03 +00:00
Matthias Krüger fe0222be07
Rollup merge of #123005 - maurer:cfi-arbitrary-receivers, r=compiler-errors
CFI: Support complex receivers

Right now, we only support rewriting `&self` and `&mut self` into `&dyn MyTrait` and `&mut dyn MyTrait`. This expands it to handle the full gamut of receivers by calculating the receiver based on *substitution* rather than based on a rewrite. This means that, for example, `Arc<Self>` will become `Arc<dyn MyTrait>` appropriately with this change.

This approach also allows us to support associated type constraints as well, so we will correctly rewrite `&self` into `&dyn MyTrait<T=i32>`, for example.

r? ```@workingjubilee```
2024-03-25 11:00:14 +01:00
Matthew Maurer 40f41e7e89 CFI: Support arbitrary receivers
Previously, we only rewrote `&self` and `&mut self` receivers. By
instantiating the method from the trait definition, we can make this
work work with arbitrary legal receivers instead.
2024-03-24 22:46:48 +00:00
github-actions 1848b46c0b cargo update
Updating aho-corasick v1.1.2 -> v1.1.3
    Updating backtrace v0.3.69 -> v0.3.71
    Updating bitflags v2.4.2 -> v2.5.0
    Updating bytes v1.5.0 -> v1.6.0
    Updating cargo-platform v0.1.7 -> v0.1.8
    Updating fastrand v2.0.1 -> v2.0.2
    Updating indexmap v2.2.5 -> v2.2.6
    Updating libz-sys v1.1.15 -> v1.1.16
    Updating rayon v1.9.0 -> v1.10.0
    Updating reqwest v0.11.26 -> v0.11.27 (latest: v0.12.1)
    Updating rustix v0.38.31 -> v0.38.32
    Updating smallvec v1.13.1 -> v1.13.2
    Updating syn v2.0.53 -> v2.0.55
    Updating uuid v1.7.0 -> v1.8.0
note: pass `--verbose` to see 87 unchanged dependencies behind latest
2024-03-24 12:09:28 +00:00
bors b3df0d7e5e Auto merge of #122580 - saethlin:compiler-builtins-can-panic, r=pnkfelix
"Handle" calls to upstream monomorphizations in compiler_builtins

This is pretty cooked, but I think it works.

compiler-builtins has a long-standing problem that at link time, its rlib cannot contain any calls to `core`. And yet, in codegen we _love_ inserting calls to symbols in `core`, generally from various panic entrypoints.

I intend this PR to attack that problem as completely as possible. When we generate a function call, we now check if we are generating a function call from `compiler_builtins` and whether the callee is a function which was not lowered in the current crate, meaning we will have to link to it.

If those conditions are met, actually generating the call is asking for a linker error. So we don't. If the callee diverges, we lower to an abort with the same behavior as `core::intrinsics::abort`. If the callee does not diverge, we produce an error. This means that compiler-builtins can contain panics, but they'll SIGILL instead of panicking. I made non-diverging calls a compile error because I'm guessing that they'd mostly get into compiler-builtins by someone making a mistake while working on the crate, and compile errors are better than linker errors. We could turn such calls into aborts as well if that's preferred.
2024-03-22 16:55:11 +00:00
Matthias Krüger 7481c0eab5
Rollup merge of #122820 - oli-obk:no_ord_def_id, r=estebank
Stop using `<DefId as Ord>` in various diagnostic situations

work towards https://github.com/rust-lang/rust/issues/90317

Reverts part of https://github.com/rust-lang/rust/pull/106281, as it sorts constants and that's problematic since it can contain `ParamConst`, which contains `DefId`s
2024-03-22 11:37:01 +01:00
Michael Howell 28db4ccda7 rustdoc-search: compressed bitmap to sort, then load desc
This adds a bit more data than "pure sharding" by
including information about which items have no description
at all. This way, it can sort the results, then truncate,
then finally download the description.

With the "e" bitmap: 2380KiB

Without the "e" bitmap: 2364KiB
2024-03-21 17:57:01 -07:00
Philipp Krones 8e53d53356
Update Cargo.lock 2024-03-21 22:20:59 +01:00
Oli Scherer cda209bf43 Stop ConstraintCategory Ord impl from relying on Ty's Ord impl. 2024-03-21 10:45:30 +00:00
Ben Kimock 2f6fb234de Add a test 2024-03-20 23:36:05 -04:00
Nadrieril d697dd44d1 Add a crate-custom test harness 2024-03-19 02:22:43 +01:00
Ben Kimock 9e0d1a3284 Print a backtrace in const eval if interrupted 2024-03-17 11:55:20 -04:00
github-actions c486d2d920 cargo update
Updating ahash v0.8.10 -> v0.8.11
    Updating anyhow v1.0.80 -> v1.0.81
    Updating basic-toml v0.1.8 -> v0.1.9
    Updating bumpalo v3.15.3 -> v3.15.4
      Adding cfg_aliases v0.1.1
    Updating chrono v0.4.34 -> v0.4.35
    Updating clap v4.5.1 -> v4.5.3
    Updating clap_builder v4.5.1 -> v4.5.2
    Updating clap_derive v4.5.0 -> v4.5.3
    Updating color-eyre v0.6.2 -> v0.6.3
    Updating ctrlc v3.4.2 -> v3.4.4
    Updating env_logger v0.11.2 -> v0.11.3
    Updating h2 v0.3.24 -> v0.3.25
      Adding heck v0.5.0
    Updating http v0.2.11 -> v0.2.12
    Updating js-sys v0.3.68 -> v0.3.69
    Updating libloading v0.8.2 -> v0.8.3
    Updating new_debug_unreachable v1.0.4 -> v1.0.6
    Updating nix v0.27.1 -> v0.28.0
    Updating proc-macro2 v1.0.78 -> v1.0.79
    Updating reqwest v0.11.24 -> v0.11.26
    Updating syn v2.0.52 -> v2.0.53
    Updating sysinfo v0.30.6 -> v0.30.7
    Updating thiserror v1.0.57 -> v1.0.58
    Updating thiserror-impl v1.0.57 -> v1.0.58
    Updating wasm-bindgen v0.2.91 -> v0.2.92
    Updating wasm-bindgen-backend v0.2.91 -> v0.2.92
    Updating wasm-bindgen-futures v0.4.41 -> v0.4.42
    Updating wasm-bindgen-macro v0.2.91 -> v0.2.92
    Updating wasm-bindgen-macro-support v0.2.91 -> v0.2.92
    Updating wasm-bindgen-shared v0.2.91 -> v0.2.92
    Updating web-sys v0.3.68 -> v0.3.69
2024-03-17 00:26:01 +00:00
Ben Kimock 5f4f2526b8 Handle calls to upstream monomorphizations in compiler_builtins 2024-03-16 15:22:05 -04:00
Chris Denton ceef59fa2b
Rollup merge of #122390 - ChrisDenton:bindgen, r=Mark-Simulacrum
Bump windows-bindgen to 0.55.0

windows-bindgen is the crate used to generate std's Windows API bindings.

Not many changes for us, it's mostly just simplifying the generate code (e.g. no more `-> ()`). The one substantial change is some structs now use `i8` byte arrays instead of `u8`. However, this only impacts one test.
2024-03-16 18:27:33 +00:00
Oli Scherer 746e4eff26 Test and implement reachability for trait objects and generic parameters of functions 2024-03-14 14:10:45 +00:00
Chris Denton 8e870c8ed1
Bump windows-bindgen to 0.55.0 2024-03-12 16:05:58 +00:00
Chris Denton b25203e30f
Bump windows-bindgen to 0.54.0 2024-03-12 16:05:58 +00:00
bors dc2ffa4054 Auto merge of #122036 - alexcrichton:test-wasm-with-wasi, r=oli-obk
Test wasm32-wasip1 in CI, not wasm32-unknown-unknown

This commit changes CI to no longer test the `wasm32-unknown-unknown` target and instead test the `wasm32-wasip1` target. There was some discussion of this in a [Zulip thread], and the motivations for this PR are:

* Runtime failures on `wasm32-unknown-unknown` print nothing, meaning all you get is "something failed". In contrast `wasm32-wasip1` can print to stdout/stderr.

* The unknown-unknown target is missing lots of pieces of libstd, and while `wasm32-wasip1` is also missing some pieces (e.g. threads) it's missing fewer pieces. This means that many more tests can be run.

Overall my hope is to improve the debuggability of wasm failures on CI and ideally be a bit less of a maintenance burden.

This commit specifically removes the testing of `wasm32-unknown-unknown` and replaces it with testing of `wasm32-wasip1`. Along the way there were a number of other archiectural changes made as well, including:

* A new `target.*.runtool` option can now be specified in `config.toml` which is passed as `--runtool` to `compiletest`. This is used to reimplement execution of WebAssembly in a less-wasm-specific fashion.

* The default value for `runtool` is an ambiently located WebAssembly runtime found on the system, if any. I've implemented logic for Wasmtime.

* Existing testing support for `wasm32-unknown-unknown` and Emscripten has been removed. I'm not aware of Emscripten testing being run any time recently and otherwise `wasm32-wasip1` is in theory the focus now.

* I've added a new `//@ needs-threads` directive for `compiletest` and classified a bunch of wasm-ignored tests as needing threads. In theory these tests can run on `wasm32-wasi-preview1-threads`, for example.

* I've tried to audit all existing tests that are either `ignore-emscripten` or `ignore-wasm*`. Many now run on `wasm32-wasip1` due to being able to emit error messages, for example. Many are updated with comments as to why they can't run as well.

* The `compiletest` output matching for `wasm32-wasip1` automatically uses "match a subset" mode implemented in `compiletest`. This is because WebAssembly runtimes often add extra information on failure, such as the `unreachable` instruction in `panic!`, which isn't able to be matched against the golden output from native platforms.

* I've ported most existing `run-make` tests that use custom Node.js wrapper scripts to the new run-make-based-in-Rust infrastructure. To do this I added `wasmparser` as a dependency of `run-make-support` for the various wasm tests to use that parse wasm files. The one test that executed WebAssembly now uses `wasmtime`-the-CLI to execute the test instead. I have not ported over an exception-handling test as Wasmtime doesn't implement this yet.

* I've updated the `test` crate to print out timing information for WASI targets as it can do that (gets a previously ignored test now passing).

* The `test-various` image now builds a WASI sysroot for the WASI target and additionally downloads a fixed release of Wasmtime, currently the latest one at 18.0.2, and uses that for testing.

[Zulip thread]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Have.20wasm.20tests.20ever.20caused.20problems.20on.20CI.3F/near/424317944
2024-03-12 00:03:54 +00:00
Alex Crichton 7141379559 Convert some WebAssembly run-make tests to Rust
This commit rewrites a number of `run-make` tests centered around wasm
to instead use `rmake.rs` and additionally use the `wasm32-wasip1`
target instead of `wasm32-unknown-unknown`. Testing no longer requires
Node.js and additionally uses the `wasmparser` crate from crates.io to
parse outputs and power assertions.
2024-03-11 09:36:35 -07:00
Kjetil Kjeka 222ce4fdb8 LLVM Bitcode Linker: Added crate 2024-03-11 13:35:35 +01:00
bors 3521a2f2f3 Auto merge of #122246 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`

`@WaffleLapkin` when this lands, setting `MIRI_TEMP` should not be needed any more on the dev desktops.
2024-03-10 09:40:39 +00:00
Guillaume Boisseau bc3bc2ba6b
Rollup merge of #121584 - klensy:itertools-up, r=Mark-Simulacrum
bump itertools to 0.12

still depend on 0.11 (temporary dupes version):
* <del>clippy</del>, https://github.com/rust-lang/rust-clippy/pull/12346
* rustfmt, sigh, https://github.com/rust-lang/rustfmt/pull/6093

https://github.com/rust-itertools/itertools/blob/v0.12.1/CHANGELOG.md

removed unused `derive_more` dep from `rustc_middle`
2024-03-09 21:40:08 +01:00
Ralf Jung 9a308d45cf update lockfile 2024-03-09 18:56:52 +01:00
Matthias Krüger a979f971b4
Rollup merge of #121813 - Urgau:misc-non_local_defs-lint, r=cjgillot
Misc improvements to non local defs lint implementation

This PR is a collection of small improvements I found when I [needlessly tried](https://www.github.com/rust-lang/rust/pull/120393#issuecomment-1971787475) to fix a "perf-regression" in the lint implementation.

I recommend looking at each commit individually.
2024-03-09 16:21:15 +01:00
bors 9d272a1b05 Auto merge of #122102 - Urgau:optimize-symbol-integer, r=cjgillot
Optimize `Symbol::integer` by utilizing in-place formatting

This PR optimize `Symbol::integer` by utilizing `itoa` in-place formatting instead of going through a dynamically allocated `String` and the format machinery.

<details>

For some context: I was profiling `rustc --check-cfg` with callgrind and due to the way we currently setup all the targets and we end-up calling `Symbol::integer` multiple times for all the targets. Using `itoa` reduced the number of instructions.

</details>
2024-03-09 08:47:57 +00:00
klensy 2de98c8b7e remove unused derive_more dep 2024-03-08 12:34:14 +03:00
klensy 52501c2a75 bump itertools to 0.12
still depend on 0.11:
* clippy
* rustfmt, sigh
2024-03-08 12:34:05 +03:00
Urgau 20200f65ca Remove useless smallvec dependency in rustc_lint::non_local_def 2024-03-07 07:54:15 +01:00
Daniel Paoliello a6a556c2a9 Add arm64ec-pc-windows-msvc target
Introduces the `arm64ec-pc-windows-msvc` target for building Arm64EC ("Emulation Compatible") binaries for Windows.

For more information about Arm64EC see <https://learn.microsoft.com/en-us/windows/arm/arm64ec>.

Tier 3 policy:

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

I will be the maintainer for this target.

> Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.

Target uses the `arm64ec` architecture to match LLVM and MSVC, and the `-pc-windows-msvc` suffix to indicate that it targets Windows via the MSVC environment.

> Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it.

Target name exactly specifies the type of code that will be produced.

> If possible, use only letters, numbers, dashes and underscores for the name. Periods (.) are known to cause issues in Cargo.

Done.

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

> The target must not introduce license incompatibilities.

Uses the same dependencies, requirements and licensing as the other `*-pc-windows-msvc` targets.

> Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).

Understood.

> The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements.

> Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary runtime libraries supplied by the platform and commonly used by other applications built for the target, but those libraries must not be required for code generation for the target; cross-compilation to the target must not require such libraries at all. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3.

> "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users.

Uses the same dependencies, requirements and licensing as the other `*-pc-windows-msvc` targets.

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.

> This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements.

Understood, I am not a member of the Rust team.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

Both `core` and `alloc` are supported.

Support for `std` dependends on making changes to the standard library, `stdarch` and `backtrace` which cannot be done yet as the bootstrapping compiler raises a warning ("unexpected `cfg` condition value") for `target_arch = "arm64ec"`.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.

Documentation is provided in src/doc/rustc/src/platform-support/arm64ec-pc-windows-msvc.md

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via @) to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.

> Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications.

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

> In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target.

Understood.
2024-03-06 17:49:37 -08:00
Urgau 33ef4b963b Optimize Symbol::integer by utilizing itoa in-place formatting 2024-03-06 19:39:36 +01:00
Jason Newcomb ea9ae30671 Convert SpannedTypeVisitor to use VisitorResult 2024-03-05 13:30:46 -05:00
Jason Newcomb be9b125d41 Convert TypeVisitor and DefIdVisitor to use VisitorResult 2024-03-05 13:28:15 -05:00
bors a09d91b04a Auto merge of #121877 - estebank:fancy-svg, r=compiler-errors
On tests that specify `--color=always` emit SVG file with stderr output

Leverage `anstyle-svg`, as `cargo` does now, to emit `.svg` files instead of `.stderr` files for tests that explicitly enable color output. This will make reviewing changes to the graphical output of tests much more human friendly.

<img src="https://raw.githubusercontent.com/rust-lang/rust/b4bdb56f86e136ca63bf71dca3034200c6c25900/tests/ui/error-emitter/highlighting.svg">
2024-03-03 06:40:56 +00:00
github-actions 8ef1981716 cargo update
Updating ahash v0.8.8 -> v0.8.10
    Updating annotate-snippets v0.10.1 -> v0.10.2
    Updating anstream v0.6.11 -> v0.6.13
    Updating anyhow v1.0.79 -> v1.0.80
    Updating bumpalo v3.14.0 -> v3.15.3
    Updating clap v4.5.0 -> v4.5.1
    Updating clap_builder v4.5.0 -> v4.5.1
    Updating clap_complete v4.5.0 -> v4.5.1
    Updating crossbeam-channel v0.5.11 -> v0.5.12
    Updating darling v0.20.6 -> v0.20.8
    Updating darling_core v0.20.6 -> v0.20.8
    Updating darling_macro v0.20.6 -> v0.20.8
    Updating dlmalloc v0.2.5 -> v0.2.6
    Updating indexmap v2.2.3 -> v2.2.5
    Updating libloading v0.8.1 -> v0.8.2
    Updating log v0.4.20 -> v0.4.21
    Updating mio v0.8.10 -> v0.8.11
    Updating normpath v1.1.1 -> v1.2.0
    Updating openssl v0.10.63 -> v0.10.64
    Updating openssl-sys v0.9.99 -> v0.9.101
    Updating pest v2.7.7 -> v2.7.8
    Updating pest_derive v2.7.7 -> v2.7.8
    Updating pest_generator v2.7.7 -> v2.7.8
    Updating pest_meta v2.7.7 -> v2.7.8
    Updating pkg-config v0.3.29 -> v0.3.30
    Updating rayon v1.8.1 -> v1.9.0
 Downgrading regex v1.9.4 -> v1.8.4
    Updating regex-automata v0.3.7 -> v0.3.9
    Updating reqwest v0.11.23 -> v0.11.24
      Adding rustls-pemfile v1.0.4
    Updating ryu v1.0.16 -> v1.0.17
    Updating semver v1.0.21 -> v1.0.22
    Updating serde v1.0.196 -> v1.0.197
    Updating serde_derive v1.0.196 -> v1.0.197
    Updating serde_json v1.0.113 -> v1.0.114
    Updating socket2 v0.5.5 -> v0.5.6
    Updating syn v2.0.48 -> v2.0.52
      Adding sync_wrapper v0.1.2
    Updating sysinfo v0.30.5 -> v0.30.6
    Updating tempfile v3.10.0 -> v3.10.1
    Updating thread_local v1.1.7 -> v1.1.8
    Updating unicode-normalization v0.1.22 -> v0.1.23
    Updating unicode-script v0.5.5 -> v0.5.6
    Updating walkdir v2.4.0 -> v2.5.0
    Updating windows-targets v0.52.0 -> v0.52.4
    Updating windows_aarch64_gnullvm v0.52.0 -> v0.52.4
    Updating windows_aarch64_msvc v0.52.0 -> v0.52.4
    Updating windows_i686_gnu v0.52.0 -> v0.52.4
    Updating windows_i686_msvc v0.52.0 -> v0.52.4
    Updating windows_x86_64_gnu v0.52.0 -> v0.52.4
    Updating windows_x86_64_gnullvm v0.52.0 -> v0.52.4
    Updating windows_x86_64_msvc v0.52.0 -> v0.52.4
2024-03-03 00:16:16 +00:00
Esteban Kuber b4bdb56f86 On tests that specify --color=always emit SVG file with stderr output
Leverage `anstyle-svg`, as `cargo` does now, to emit `.svg` files
instead of `.stderr` files for tests that explicitly enable color
output. This will make reviewing changes to the graphical output of
tests much more human friendly.
2024-03-02 22:47:17 +00:00
Matthias Krüger 9b2644030a
Rollup merge of #121815 - nnethercote:mv-gather_comments, r=est31
Move `gather_comments`.

To the module where it is used, so it doesn't have to be `pub`.

r? ```@est31```
2024-03-02 10:09:36 +01:00
bors 17edacef07 Auto merge of #113026 - jieyouxu:run-make-v2, r=bjorn3
Introduce `run-make` V2 infrastructure, a `run_make_support` library and port over 2 tests as example

## Preface

See [issue #40713: Switch run-make tests from Makefiles to rust](https://github.com/rust-lang/rust/issues/40713) for more context.

## Basic Description of `run-make` V2

`run-make` V2 aims to eliminate the dependency on `make` and `Makefile`s for building `run-make`-style tests. Makefiles are replaced by *recipes* (`rmake.rs`). The current implementation runs `run-make` V2 tests in 3 steps:

1. We build the support library `run_make_support` which the `rmake.rs` recipes depend on as a tool lib.
2. We build the recipe `rmake.rs` and link in the support library.
3. We run the recipe to build and run the tests.

`rmake.rs` is basically a replacement for `Makefile`, and allows running arbitrary Rust code. The support library is built using cargo, and so can depend on external crates if desired.

The infrastructure implemented by this PR is very barebones, and is the minimally required infrastructure needed to build, run and pass the two example `run-make` tests ported over to the new infrastructure.

### Example `run-make` V2 test

```rs
// ignore-tidy-linelength

extern crate run_make_support;

use std::path::PathBuf;

use run_make_support::{aux_build, rustc};

fn main() {
    aux_build()
        .arg("--emit=metadata")
        .arg("stable.rs")
        .run();
    let mut stable_path = PathBuf::from(env!("TMPDIR"));
    stable_path.push("libstable.rmeta");
    let output = rustc()
        .arg("--emit=metadata")
        .arg("--extern")
        .arg(&format!("stable={}", &stable_path.to_string_lossy()))
        .arg("main.rs")
        .run();

    let stderr = String::from_utf8_lossy(&output.stderr);
    let version = include_str!(concat!(env!("S"), "/src/version"));
    let expected_string = format!("stable since {}", version.trim());
    assert!(stderr.contains(&expected_string));
}
```

## Follow Up Work

- [ ] Adjust rustc-dev-guide docs
2024-03-01 16:43:57 +00:00
Nicholas Nethercote 69f2c9c101 Move gather_comments.
To the module where it is used, so it doesn't have to be `pub`.
2024-03-01 08:34:42 +11:00
Matthias Krüger 509972089b
Rollup merge of #121464 - alexcrichton:fix-wasm64, r=wesleywiser
rustc: Fix wasm64 metadata object files

It looks like LLD will detect object files being either 32 or 64-bit depending on any memory present. LLD will additionally reject 32-bit objects during a 64-bit link. Previously metadata objects did not have any memories in them which led LLD to conclude they were 32-bit objects which broke 64-bit targets for wasm.

This commit fixes this by ensuring that for 64-bit targets there's a memory object present to get LLD to detect it's a 64-bit target. Additionally this commit moves away from a hand-crafted wasm encoder to the `wasm-encoder` crate on crates.io as the complexity grows for the generated object file.

Closes #121460
2024-02-29 20:50:03 +01:00
许杰友 Jieyou Xu (Joe) 48e9f92ce2
Add supporting infrastructure for run-make V2 tests 2024-02-29 16:30:38 +00:00
Guillaume Gomez ad74598dbc
Rollup merge of #121765 - hermit-os:errno, r=ChrisDenton
add platform-specific function to get the error number for HermitOS

Extending `std` to get the last error number for HermitOS.

HermitOS is a tier 3 platform and this PR changes only files, wich are related to the tier 3 platform.
2024-02-29 14:33:51 +01:00
Stefan Lankes 3726cbb5fe add platform-specific function to get the error number for HermitOS
Extending `std` to get the last error number for HermitOS.

HermitOS is a tier 3 platform and this PR changes only files,
wich are related to the tier 3 platform.
2024-02-28 23:01:56 +01:00
Guillaume Gomez a62cfe04d6
Rollup merge of #121695 - oli-obk:split_ty_utils, r=compiler-errors
Split rustc_type_ir to avoid rustc_ast from depending on it

unblocks #121576

and resolves a FIXME in `rustc_ast`'s `Cargo.toml`

The new crate is tiny, but it will get bigger in #121576
2024-02-28 16:04:53 +01:00
Oli Scherer 8a6d3535f7 Split rustc_type_ir to avoid rustc_ast from depending on it 2024-02-27 18:11:23 +00:00
Philipp Krones f99056bd87
Update Cargo.lock 2024-02-27 15:50:23 +01:00
bors b0d3e04ca9 Auto merge of #120393 - Urgau:rfc3373-non-local-defs, r=WaffleLapkin
Implement RFC 3373: Avoid non-local definitions in functions

This PR implements [RFC 3373: Avoid non-local definitions in functions](https://github.com/rust-lang/rust/issues/120363).
2024-02-25 19:11:06 +00:00
bors 710048f790 Auto merge of #121579 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2024-02-25 08:20:01 +00:00
Ralf Jung 9577051174 bump rustc-build-sysroot 2024-02-25 08:17:20 +01:00
Alex Crichton 646e8e7291 rustc: Fix wasm64 metadata object files
It looks like LLD will detect object files being either 32 or 64-bit
depending on any memory present. LLD will additionally reject 32-bit
objects during a 64-bit link. Previously metadata objects did not have
any memories in them which led LLD to conclude they were 32-bit objects
which broke 64-bit targets for wasm.

This commit fixes this by ensuring that for 64-bit targets there's a
memory object present to get LLD to detect it's a 64-bit target.
Additionally this commit moves away from a hand-crafted wasm encoder to
the `wasm-encoder` crate on crates.io as the complexity grows for the
generated object file.

Closes #121460
2024-02-23 13:13:01 -08:00
bors 6dadb6eb23 Auto merge of #121448 - klensy:bump-22-02-24, r=clubby789
bump few deps

Bumps `sysinfo`, `tabled`; dedupes `env_logger`; drops `is-terminal`
https://github.com/zhiburt/tabled/blob/v0.15.1/CHANGELOG.md
https://github.com/GuillaumeGomez/sysinfo/blob/v0.30.5/CHANGELOG.md
2024-02-23 07:42:50 +00:00
klensy 53efefb3c2 dedupe env_logger, drop is-terminal 2024-02-22 14:35:21 +03:00
klensy 15bc68118f bump tabled 2024-02-22 14:17:59 +03:00
klensy 0b44330c38 bump sysinfo 2024-02-22 14:01:13 +03:00
Matthias Krüger 64dbc3f38f
Rollup merge of #121392 - bjorn3:unify_dylib_loading, r=petrochenkov
Unify dylib loading between proc macros and codegen backends

As bonus this makes the errors when failing to load a proc macro more informative to match the backend loading errors. In addition it makes it slightly easier to patch rustc to work on platforms that don't support dynamic linking like wasm.
2024-02-21 22:48:59 +01:00
bjorn3 f25c90a83f Unify dylib loading between proc macros and codegen backends
As bonus this makes the errors when failing to load a proc macro more
informative to match the backend loading errors. In addition it makes it
slightly easier to patch rustc to work on platforms that don't support
dynamic linking like wasm.
2024-02-21 11:17:07 +00:00
Alex Crichton 6181f3a566 wasm: Store rlib metadata in wasm object files
The goal of this commit is to remove warnings using LLVM tip-of-tree
`wasm-ld`. In llvm/llvm-project#78658 the `wasm-ld` LLD driver no longer
looks at archive indices and instead looks at all the objects in
archives. Previously `lib.rmeta` files were simply raw rustc metadata
bytes, not wasm objects, meaning that `wasm-ld` would emit a warning
indicating so.

WebAssembly targets previously passed `--fatal-warnings` to `wasm-ld` by
default which meant that if Rust were to update to LLVM 18 then all wasm
targets would not work. This immediate blocker was resolved in
rust-lang/rust#120278 which removed `--fatal-warnings` which enabled a
theoretical update to LLVM 18 for wasm targets. This current state is
ok-enough for now because rustc squashes all linker output by default if
it doesn't fail. This means, for example, that rustc squashes all the
linker warnings coming out of `wasm-ld` about `lib.rmeta` files with
LLVM 18. This again isn't a pressing issue because the information is
all hidden, but it runs the risk of being annoying if another linker
error were to happen and then the output would have all these unrelated
warnings that couldn't be fixed.

Thus, this PR comes into the picture. The goal of this PR is to resolve
these warnings by using the WebAssembly object file format on wasm
targets instead of using raw rustc metadata. When I first implemented
the rlib-in-objects scheme in #84449 I remember either concluding that
`wasm-ld` would either include the metadata in the output or I thought
we didn't have to do anything there at all. I think I was wrong on both
counts as `wasm-ld` does not include the metadata in the final output
unless the object is referenced and we do actually need to do something
to resolve these warnings.

This PR updates the object file format containing rustc metadata on
WebAssembly targets to be an actual WebAssembly file. This enables the
`wasm` feature of the `object` crate to be able to read the custom
section in the same manner as other platforms, but currently `object`
doesn't support writing wasm object files so a handwritten encoder is
used instead.

The only caveat I know of with this is that if `wasm-ld` does indeed
look at the object file then the metadata will be included in the final
output. I believe the only thing that could cause that at this time is
`--whole-archive` which I don't think is passed for rlibs. I would
clarify that I'm not 100% certain about this, however.
2024-02-20 09:31:50 -08:00
bors c9c83cca51 Auto merge of #121265 - klensy:bump-18-02-24, r=Mark-Simulacrum
bump some deps

First commit dedupes darling* crates and remove one more syn 1.* dep
Second one bumps windows crate to 0.52
2024-02-18 16:54:15 +00:00
klensy 35fe26757a windows bump to 0.52 2024-02-18 16:02:16 +03:00
klensy 5e2a7ac47a opt-dist: bump derive_builder to dedupe darling* and remove one more syn 1.* dep 2024-02-18 14:40:19 +03:00
bors 12b5498f3b Auto merge of #120023 - klensy:tidy-alloc, r=Mark-Simulacrum
tidy: reduce allocs

this reduces allocs in tidy from (dhat output)

```
==31349== Total:     1,365,199,543 bytes in 4,774,213 blocks
==31349== At t-gmax: 10,975,708 bytes in 66,093 blocks
==31349== At t-end:  2,880,947 bytes in 12,332 blocks
==31349== Reads:     5,210,008,956 bytes
==31349== Writes:    1,280,920,127 bytes
```
to
```
==66633== Total:     791,565,538 bytes in 3,503,144 blocks
==66633== At t-gmax: 10,914,511 bytes in 65,997 blocks
==66633== At t-end:  395,531 bytes in 941 blocks
==66633== Reads:     4,249,388,949 bytes
==66633== Writes:    814,119,580 bytes
```

<del>by wrapping regex and updating `ignore` (effect probably not only from `ignore`, didn't measured)</del>

also moves one more regex into `Lazy` to reduce regex rebuilds.
2024-02-17 16:22:44 +00:00
Urgau 6170394313 Implement RFC3373 non local definitions lint 2024-02-17 13:59:45 +01:00
Ralf Jung fd5a84b529 update lockfile 2024-02-17 13:02:04 +01:00
klensy 12f9de7d0e tidy: wrap regexes with lazy_static
yes, once_cell better, but ...

this reduces from

==31349== Total:     1,365,199,543 bytes in 4,774,213 blocks
==31349== At t-gmax: 10,975,708 bytes in 66,093 blocks
==31349== At t-end:  2,880,947 bytes in 12,332 blocks
==31349== Reads:     5,210,008,956 bytes
==31349== Writes:    1,280,920,127 bytes

to

==47796== Total:     821,467,407 bytes in 3,955,595 blocks
==47796== At t-gmax: 10,976,209 bytes in 66,100 blocks
==47796== At t-end:  2,944,016 bytes in 12,490 blocks
==47796== Reads:     4,788,959,023 bytes
==47796== Writes:    975,493,639 bytes

miropt-test-tools: remove regex usage

this removes regex usage and slightly refactors ext stripping in one case
2024-02-17 12:29:05 +03:00
Matthias Krüger 71466ca804
Rollup merge of #120982 - momvart:smir-61-foreign_kind, r=oli-obk
Add APIs for fetching foreign items

Closes https://github.com/rust-lang/project-stable-mir/issues/61
2024-02-15 09:20:18 +01:00
clubby789 9b73db3f1c cargo update 2024-02-13 21:24:16 +00:00
clubby789 ed8850010a Bump proc-macro2, syn and quote
This disables the `proc_macro_span` feature which unfortunately makes our
diagnostic derive macro diagnostics a little worse.
2024-02-13 21:03:34 +00:00
clubby789 6ac3b57fc8 Bump time and allow new dependencies 2024-02-13 21:03:34 +00:00
clubby789 4de3a3af4a Bump indexmap
`swap` has been deprecated in favour of `swap_remove` - the behaviour
is the same though.
2024-02-13 21:03:34 +00:00
Nikita Popov edfbe6351d Update compiler-builtins
This is necessary to pull in a number of compiler-rt build fixes.
2024-02-13 10:33:40 +01:00
Mohammad Omidvar 213748749e Add APIs for fetching foreign items including foreign modules, their ABIs, and their items 2024-02-12 19:44:35 +00:00
Matthias Krüger 9bbd146e86
Rollup merge of #120729 - ehuss:update-mdbook, r=Mark-Simulacrum
Update mdbook to 0.4.37

This updates mdbook to 0.4.37.
Changelog: https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-0437

The primary change is the update to pulldown-cmark which has a large number of markdown parsing changes. There shouldn't be any significant changes to the rendering of any of the books (I have posted some PRs to fix some minor issues to the ones that were affected).
2024-02-11 08:25:43 +01:00
Matthias Krüger 317c372284
Rollup merge of #120846 - petrochenkov:jobs, r=oli-obk
Update jobserver-rs to 0.1.28

Fixes the issues found in https://github.com/rust-lang/rust/issues/120515 besides the diagnostic wording.
2024-02-10 00:58:38 +01:00
Matthias Krüger 5250abaeb8
Rollup merge of #120806 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`
2024-02-09 19:21:17 +01:00
Vadim Petrochenkov 83f3bc4271 Update jobserver-rs to 0.1.28 2024-02-09 19:13:07 +03:00
Eric Huss 776590b14e Switch linkchecker to use html5ever for html parsing.
The existing regex-based HTML parsing was just too primitive to
correctly handle HTML content. Some books have legitimate `href="…"`
text which should not be validated because it is part of the text, not
actual HTML.
2024-02-08 14:23:40 -08:00
Philipp Krones 4ec9eec9e8
Update Cargo.lock 2024-02-08 20:25:09 +01:00
Oli Scherer 4389a1cc42 Stop using hir_ty_to_ty in rustc_privacy 2024-02-07 14:59:26 +00:00
Eric Huss 51f20b4f6b Update mdbook to 0.4.37 2024-02-06 20:22:13 -08:00
bors ff95e52665 Auto merge of #120326 - tmandry:abort-in-tests, r=cuviper
Actually abort in -Zpanic-abort-tests

When a test fails in panic=abort, it can be useful to have a debugger or other tooling hook into the `abort()` call for debugging. Doing this some other way would require it to hard code details of Rust's panic machinery.

There's no reason we couldn't have done this in the first place; using a single exit code for "success" or "failed" was just simpler. Now we are aware of the special exit codes for posix and windows platforms, logging a special error if an unrecognized code is used on those platforms, and falling back to just "failure" on other platforms.

This continues to account for `#[should_panic]` inside the test process itself, so there's no risk of misinterpreting a random call to `abort()` as an expected panic. Any exit code besides `TR_OK` is logged as a test failure.

As an added benefit, this would allow us to support panic=immediate_abort (but not `#[should_panic]`), without noise about unexpected exit codes when a test fails.
2024-02-06 04:15:41 +00:00
bors ea37e8091f Auto merge of #117372 - Amanieu:stdarch_update, r=Mark-Simulacrum
Update stdarch submodule

Splits up #27731 into multiple tracking issues.

Closes #27731
2024-02-05 15:41:40 +00:00
Aphek ee8703315e Update libc to 0.2.153 2024-02-01 23:58:42 -03:00
Tyler Mandry f622e832d4 Actually abort in panic-abort-tests 2024-01-30 18:19:49 -08:00
Guillaume Gomez f35504dbf2
Rollup merge of #120443 - GuillaumeGomez:footnote-def-improvement, r=fmease
Fixes footnote handling in rustdoc

Fixes #100638.

You can now declare footnotes like this:

```rust
//! Reference to footnotes A[^1], B[^2] and C[^3].
//!
//! [^1]: Footnote A.
//! [^2]: Footnote B.
//! [^3]: Footnote C.
```

r? `@notriddle`
2024-01-30 11:19:18 +01:00
Amanieu d'Antras a00ec2d93b Update ahash dependency to 0.8.7 2024-01-30 03:34:28 +00:00
Guillaume Gomez 1bdeeef0d5 Update pulldown-cmark version to 0.9.5 2024-01-29 14:14:03 +01:00
Dylan DPC 5de94a3c80
Rollup merge of #120420 - lnicola:rm-pattern-analysis-derivative, r=Nilstrieb
Stop using derivative in rustc_pattern_analysis

CC #109302, https://github.com/rust-lang/rust-analyzer/pull/16420#discussion_r1464357157

r? ````@Nadrieril````
2024-01-29 12:56:53 +00:00
Nicholas Nethercote 5d9dfbd08f Stop using String for error codes.
Error codes are integers, but `String` is used everywhere to represent
them. Gross!

This commit introduces `ErrCode`, an integral newtype for error codes,
replacing `String`. It also introduces a constant for every error code,
e.g. `E0123`, and removes the `error_code!` macro. The constants are
imported wherever used with `use rustc_errors::codes::*`.

With the old code, we have three different ways to specify an error code
at a use point:
```
error_code!(E0123)  // macro call

struct_span_code_err!(dcx, span, E0123, "msg");  // bare ident arg to macro call

\#[diag(name, code = "E0123")]  // string
struct Diag;
```

With the new code, they all use the `E0123` constant.
```
E0123  // constant

struct_span_code_err!(dcx, span, E0123, "msg");  // constant

\#[diag(name, code = E0123)]  // constant
struct Diag;
```

The commit also changes the structure of the error code definitions:
- `rustc_error_codes` now just defines a higher-order macro listing the
  used error codes and nothing else.
- Because that's now the only thing in the `rustc_error_codes` crate, I
  moved it into the `lib.rs` file and removed the `error_codes.rs` file.
- `rustc_errors` uses that macro to define everything, e.g. the error
  code constants and the `DIAGNOSTIC_TABLES`. This is in its new
  `codes.rs` file.
2024-01-29 07:41:41 +11:00
bors 6b4f1c5e78 Auto merge of #120201 - clubby789:dep-update, r=dtolnay
Bump some deps with syn 1.0 dependencies

cc #109302

`cargo update`ing `unic-langid` and `object` removes two dependencies on Syn 1.0.
2024-01-27 14:19:12 +00:00
Laurențiu Nicola f5c78955c8 Stop using derivative in rustc_pattern_analysis 2024-01-27 14:21:01 +02:00
Matthias Krüger 37b9022cef
Rollup merge of #120345 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`

Closes https://github.com/rust-lang/rust-clippy/issues/12148
2024-01-26 14:43:32 +01:00
Philipp Krones d7a0182157
Update Cargo.lock 2024-01-25 19:17:52 +01:00
Matthias Krüger eeac90cbba
Rollup merge of #120288 - clubby789:bump-askama, r=GuillaumeGomez
Bump `askama` version

Ran into this while looking at #112865 and thought it would be useful to fix it now. Some more details in [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Askama.20parser.20changes)
2024-01-25 17:39:27 +01:00
Josh Stone 8f3af4c6e2 rustc_data_structures: use either instead of itertools 2024-01-24 15:36:57 -08:00
clubby789 da336190e3 Bump askama version 2024-01-24 01:04:34 +00:00
clubby789 c7517206ea Bump openssl version 2024-01-21 23:52:35 +00:00
clubby789 527f903a42 Bump ctrlc version 2024-01-21 23:51:33 +00:00
clubby789 b50b333a0f Bump uniq-langid version 2024-01-21 17:19:31 +00:00
clubby789 56bc5525b3 Bump object version 2024-01-21 17:19:29 +00:00
bors 159bdc1e93 Auto merge of #108359 - Zoxc:side-effects-tweak, r=cjgillot
Avoid code generation for ThinVec<Diagnostic>'s destructor in the query system

This avoids 2 instances of the destructor of `ThinVec<Diagnostic>` from being included in `execute_job`. It also outlines the cold branch in `store_side_effects` / `store_side_effects_for_anon_node`.
2024-01-20 15:20:15 +00:00
John Kåre Alsaker 862011e1ca Avoid code generation for ThinVec<Diagnostic>'s destructor in the query system 2024-01-20 13:43:05 +01:00
Matthias Krüger ae09415fa4
Rollup merge of #119815 - nagisa:nagisa/polishes-libloading-use-somewhat, r=bjorn3
Format sources into the error message when loading codegen backends

cc https://github.com/rust-lang/rustc_codegen_cranelift/issues/1447
cc `@bjorn3`
2024-01-19 19:27:00 +01:00
Matthias Krüger 3a3242a0f9
Rollup merge of #120039 - Nadrieril:remove-idx, r=compiler-errors
pat_analysis: Don't rely on contiguous `VariantId`s outside of rustc

Today's pattern_analysis uses `BitSet` and `IndexVec` on the provided enum variant ids, which only makes sense if these ids count the variants from 0. In rust-analyzer, the variant ids are global interning ids, which would make `BitSet` and `IndexVec` ridiculously wasteful. In this PR I add some shims to use `FxHashSet`/`FxHashMap` instead outside of rustc.

r? ```@compiler-errors```
2024-01-17 20:21:23 +01:00
bors 25b706cde3 Auto merge of #119111 - michaelwoerister:measureme-11, r=Mark-Simulacrum
Update measureme crate to version 11

perf.rlo has been updated to use 11.0.0 already, so it should be able to handle the new file format.

r? `@Mark-Simulacrum`

Fixes https://github.com/rust-lang/rust/issues/99282
Fixes https://github.com/rust-lang/rust/issues/119103
2024-01-17 09:32:03 +00:00
Nadrieril 19d6f068ee Don't rely on contiguous VariantIds outside of rustc 2024-01-17 03:09:06 +01:00
Matthias Krüger b6f68a7fca
Rollup merge of #119971 - compiler-errors:zip-eq, r=nnethercote
Use `zip_eq` to enforce that things being zipped have equal sizes

Some `zip`s are best enforced to be equal, since size mismatches suggest deeper bugs in the compiler.
2024-01-15 08:44:49 +01:00
bors 9567c3ee73 Auto merge of #119581 - Nadrieril:detangle-arena, r=compiler-errors
Exhaustiveness: remove the need for arena-allocation within the algorithm

After https://github.com/rust-lang/rust/pull/119688, exhaustiveness checking doesn't need access to the arena anymore. This simplifies the lifetime story and makes it compile on stable without the extra dependency.

r? `@compiler-errors`
2024-01-15 00:04:09 +00:00
Michael Goulet c811662fb0 Use zip_eq to enforce that things being zipped have equal sizes 2024-01-14 20:01:12 +00:00
bors 665d2c6f2c Auto merge of #119796 - androm3da:bcain/compiler_builtins_0_1_105, r=Mark-Simulacrum
Update compiler_builtins to 0.1.105

This provides the builtins for the hexagon architecture.
2024-01-14 19:15:37 +00:00
Michael Woerister ac58f9ae03 Update measureme crate to version 11 2024-01-13 16:32:03 +01:00
Nadrieril db36304102 rustc_pattern_analysis no longer needs to be passed an arena 2024-01-12 18:55:27 +01:00
bors 2b1365b34f Auto merge of #119735 - lcnr:provisional-cache-readd, r=compiler-errors
next solver: provisional cache

this adds the cache removed in #115843. However, it should now correctly track whether a provisional result depends on an inductive or coinductive stack.

While working on this, I was using the following doc: https://hackmd.io/VsQPjW3wSTGUSlmgwrDKOA. I don't think it's too helpful to understanding this, but am somewhat hopeful that the inline comments are more useful.

There are quite a few future perf improvements here. Given that this is already very involved I don't believe it is worth it (for now). While working on this PR one of my few attempts to significantly improve perf ended up being unsound again because I was not careful enough 

r? `@compiler-errors`
2024-01-12 07:04:42 +00:00
Matthias Krüger fe97e93166
Rollup merge of #119448 - klensy:annotate-snippets-0.10, r=davidtwco
annotate-snippets: update to 0.10

Ports `annotate-snippets` to 0.10, temporary dupes versions; other crates left that depends on 0.9 is `ui_test` and `rustfmt`.
2024-01-11 19:42:49 +01:00
Simonas Kazlauskas fcaeb45421 deps: deduplicate the version of libloading used
The changelog can be found here:
https://docs.rs/libloading/latest/libloading/changelog/r0_8_0/index.html
2024-01-10 17:18:10 +02:00
Brian Cain d5c39d0638 Update compiler_builtins to 0.1.105
This provides the builtins for the hexagon architecture.
2024-01-09 20:30:56 -08:00
Guillaume Gomez 3da96aed94
Rollup merge of #118680 - djkoloski:shell_argfiles, r=compiler-errors
Add support for shell argfiles

Closes https://github.com/rust-lang/compiler-team/issues/684
2024-01-09 17:52:21 +01:00
Guillaume Gomez 87b0de6cb7
Rollup merge of #118645 - Patryk27:bump-compiler-builtins, r=Nilstrieb,dtolnay
chore: Bump compiler_builtins

Actually closes https://github.com/rust-lang/rust/issues/118079.
2024-01-09 17:52:20 +01:00
Guillaume Gomez 4a24b5bc05
Rollup merge of #117556 - obeis:static-mut-ref-lint, r=davidtwco
Disallow reference to `static mut` and adding `static_mut_ref` lint

Closes #114447

r? `@scottmcm`
2024-01-09 13:23:15 +01:00
lcnr 88271deac2 avoid always rerunning in case of a cycle 2024-01-09 11:19:34 +01:00
Matthias Krüger 91fcc17117
Rollup merge of #119734 - RalfJung:miri, r=RalfJung
Miri subtree update

r? ``@ghost``
2024-01-09 05:33:23 +01:00
David Koloski 684aa2c9d1 Add support for shell argfiles 2024-01-08 15:25:55 -05:00
Ralf Jung 0ddccf933a update lockfile 2024-01-08 11:21:50 +01:00
Mark Rousskov be0293f468 Remove crossbeam-channel
The standard library's std::sync::mpsc basically is a crossbeam channel,
and for the use case here will definitely suffice. This drops this
dependency from librustc_driver.
2024-01-07 19:16:13 -05:00
klensy 5b153b52a2 annotate-snippets: update to 0.10 2024-01-07 16:53:32 +03:00
Obei Sideg 2c088f9520 Disallow reference to static mut for expressions
Add `E0796` error code.
Add `static_mut_ref` lint.

This is the idea for the 2024 edition.
2024-01-06 06:31:35 +03:00
bjorn3 6ed37bdc42 Avoid specialization for the Span Encodable and Decodable impls 2023-12-31 20:42:17 +00:00
Nilstrieb ffafcd8819 Update to bitflags 2 in the compiler
This involves lots of breaking changes. There are two big changes that
force changes. The first is that the bitflag types now don't
automatically implement normal derive traits, so we need to derive them
manually.

Additionally, bitflags now have a hidden inner type by default, which
breaks our custom derives. The bitflags docs recommend using the impl
form in these cases, which I did.
2023-12-30 18:17:28 +01:00
Philipp Krones 0217ac9da6
Update Cargo.lock 2023-12-28 19:33:21 +01:00
bors 2df6406b88 Auto merge of #118431 - sjwang05:issue-44695, r=estebank
Emit better suggestions for `&T == T` and `T == &T`

Fixes #40660
Fixes #44695
2023-12-26 21:34:24 +00:00
Guillaume Gomez c2dcfc762d Update sysinfo sub-dependency version to 0.29.11 2023-12-25 22:45:38 +01:00
Guillaume Gomez 51dff45aa3 Update sysinfo version to 0.30.1 2023-12-25 22:44:49 +01:00
Nadrieril c6aa16c469 Use derivative for better derive bounds 2023-12-23 00:04:20 +01:00
bors 3a539c0889 Auto merge of #118842 - Nadrieril:librarify-further, r=compiler-errors
Make exhaustiveness usable outside of rustc

With this PR, `rustc_pattern_analysis` compiles on stable (with the `stable` feature)! `rust-analyzer` will be able to use it to provide match-related diagnostics and refactors.

Two questions:
- Should I name the feature `nightly` instead of `rustc` for consistency with other crates? `rustc` makes more sense imo.
- `typed-arena` is an optional dependency but tidy made me add it to the allow-list anyway. Can I avoid that somehow?

r? `@compiler-errors`
2023-12-19 17:15:04 +00:00
sjwang05 2618e0f805
Provide better suggestions for T == &T and &T == T 2023-12-16 19:56:50 -08:00
Philipp Krones b92ab506d3
Update Cargo.lock 2023-12-16 14:13:12 +01:00