Commit Graph

270653 Commits

Author SHA1 Message Date
bjorn3
8a0053e9e1 Use a BufWriter in emit_module to reduce syscall overhead
For the coercions rustc-perf benchmark without this commit reduces the
total amount of time it takes to emit the object file from 270ms to
27ms.
2024-11-08 16:43:25 +01:00
Augie Fackler
8fcc020a0c try_question_mark_nop: update test for LLVM 20
llvm/llvm-project@dd116369f6 changes the
IR of this test in a way that I don't think is bad, but needs adjusting.

r? @nikic
@rustbot label: +llvm-main
2024-11-08 10:43:06 -05:00
Ralf Jung
d7aceeea71
Merge pull request #4004 from YohDeadfall/thread-name-ice-fix
Get/set thread name shims return errors for invalid handles
2024-11-08 15:19:51 +00:00
bjorn3
c637a84ad4 Add finish_ongoing_codegen timer in join_codegen to match cg_llvm 2024-11-08 16:14:09 +01:00
Ralf Jung
c8e089edc8
Merge pull request #4018 from YohDeadfall/ecx-name-standardization
Standardized variable names for InterpCx
2024-11-08 15:03:24 +00:00
Yoh Deadfall
1254d8e75e Get/set thread name shims return errors for invalid handles 2024-11-08 17:54:10 +03:00
bjorn3
6ffab47e55 Use lld with non-LLVM backends
On arm64, Cranelift used to produce object files that don't work with
lld. This has since been fixed. The GCC backend should always produce
object files that work with lld unless lld for whatever reason drops GCC
support. Most of the other more niche backends don't use cg_ssa's linker
code at all. If they do and don't work with lld, they can always disable
lld usage using a cli argument.

Without this commit using cg_clif is by default in a non-trivial amount
of cases a perf regression on Linux due to ld.bfd being a fair bit
slower than lld. It is possible to explicitly enable it without this
commit, but most users are unlikely to do this.
2024-11-08 15:20:20 +01:00
onur-ozkan
2e0afc8b71 respect to global download-rustc default in non-dist profiles
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-11-08 16:26:00 +03:00
onur-ozkan
cce6f03754 use download-rustc="if-unchanged" as default whenever possible
"whenever possible" means applying it if `download-rustc` isn't explicitly set and
the source is Git-managed.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-11-08 16:23:59 +03:00
onur-ozkan
76b6090df5 read repository information configs at an earlier stage
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-11-08 16:23:07 +03:00
Zalathar
730626dbd9 Don't use LLVMRustStringWriteImpl outside of RawRustStringOstream 2024-11-08 22:31:32 +11:00
bors
209799f3b9 Auto merge of #132717 - RalfJung:rustc_safe_intrinsic, r=compiler-errors
remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic functions instead

This brings us one step closer towards removing support for `extern "rust-intrinsic"` blocks, in favor of `#[rustc_intrinsic]` functions.

Also move `#[rustc_intrinsic]` under the `intrinsics` feature gate, to match the `extern "rust-intrinsic"` style.
2024-11-08 10:28:47 +00:00
Philipp Krones
0aafd6552b
Clippy: cfg out validate_diag on release builds 2024-11-08 10:49:54 +01:00
Zalathar
3c30fe3423 coverage: Restrict empty-span expansion to only cover { and } 2024-11-08 20:43:08 +11:00
Zalathar
996bdabc2a coverage: Remove unhelpful code for handling multiple files per function
Functions currently can't have mappings in multiple files, and if that ever
changes (e.g. to properly support expansion regions), this code will need to be
completely overhauled anyway.
2024-11-08 20:43:08 +11:00
Zalathar
3f9c54caf0 coverage: Add GlobalFileId for stricter type-checking of file IDs
We already had a dedicated `LocalFileId` index type, but previously we used a
raw `u32` for global file IDs, because index types were harder to pass through
FFI.
2024-11-08 20:43:08 +11:00
Zalathar
7c76995950 coverage: Pass ExtractedHirInfo to make_source_region
This isn't strictly necessary, but makes it easier to distinguish `body_span`
from the specific `span` being processed.
2024-11-08 20:38:35 +11:00
Mikael Urankar
f7580c6f48 Drop "gnu" in the target env for FreeBSD armv6/7
FreeBSD is not a GNU system
2024-11-08 09:29:52 +01:00
Ralf Jung
00354ddaa6 remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic functions instead 2024-11-08 09:16:00 +01:00
Ralf Jung
e3010e84db remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic functions instead 2024-11-08 09:16:00 +01:00
bors
6295686a37 Auto merge of #132762 - Zalathar:rollup-qfgz165, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - #132161 ([StableMIR] A few fixes to pretty printing)
 - #132389 (coverage: Simplify parts of coverage graph creation)
 - #132452 (coverage: Extract safe FFI wrapper functions to `llvm_cov`)
 - #132590 (Simplify FFI calls for `-Ztime-llvm-passes` and `-Zprint-codegen-stats`)
 - #132738 (Initialize channel `Block`s directly on the heap)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-08 08:00:08 +00:00
Stuart Cook
4b904ceb46
Rollup merge of #132738 - cuviper:channel-heap-init, r=ibraheemdev
Initialize channel `Block`s directly on the heap

The channel's `Block::new` was causing a stack overflow because it held
32 item slots, instantiated on the stack before moving to `Box::new`.
The 32x multiplier made modestly-large item sizes untenable.

That block is now initialized directly on the heap.

Fixes #102246

try-job: test-various
2024-11-08 18:51:30 +11:00
Stuart Cook
3a48d80155
Rollup merge of #132590 - Zalathar:z-timings-stats, r=jieyouxu
Simplify FFI calls for `-Ztime-llvm-passes` and `-Zprint-codegen-stats`

The existing code for these unstable LLVM-infodump flags was jumping through hoops to pass an allocated C string across the FFI boundary, when it's much simpler to just write to a `&RustString` instead.
2024-11-08 18:51:30 +11:00
Stuart Cook
758a904764
Rollup merge of #132452 - Zalathar:llvm-cov-wrappers, r=jieyouxu
coverage: Extract safe FFI wrapper functions to `llvm_cov`

This PR takes all of the inline `unsafe` calls in coverage codegen, and all the safe wrapper functions in `coverageinfo/mod.rs`, and moves them to a new `llvm_cov` submodule that is dedicated to safe FFI wrapper functions. This reduces the mixing of abstraction levels in the rest of coverage codegen.

As a follow-up, this PR also tidies up the names and signatures of several of the coverage FFI functions.
2024-11-08 18:51:29 +11:00
Stuart Cook
1b55244aa2
Rollup merge of #132389 - Zalathar:graph-tweaks, r=jieyouxu
coverage: Simplify parts of coverage graph creation

This is a combination of three semi-related simplifications to how coverage graphs are created, grouped into one PR to avoid conflicts.

There are no observable changes to the output of any of the coverage tests.
2024-11-08 18:51:29 +11:00
Stuart Cook
5043c574ac
Rollup merge of #132161 - celinval:smir-fix-indent, r=compiler-errors
[StableMIR] A few fixes to pretty printing

Improve identation, and a few other rvalue printing

try-job: x86_64-msvc
try-job: test-various
2024-11-08 18:51:28 +11:00
Ralf Jung
35a913b968 pointee_info_at: fix logic for recursing into enums 2024-11-08 07:35:29 +01:00
Michael Goulet
97dfe8b871 Manually register some bounds for a better span 2024-11-08 04:56:08 +00:00
Michael Goulet
e4c1a0016c Get rid of check_opaque_type_well_formed 2024-11-08 03:46:27 +00:00
bors
78bb5ee79e Auto merge of #132756 - workingjubilee:rollup-bed2akn, r=workingjubilee
Rollup of 10 pull requests

Successful merges:

 - #130586 (Set "symbol name" in raw-dylib import libraries to the decorated name)
 - #131913 (Add `{ignore,needs}-{rustc,std}-debug-assertions` directive support)
 - #132095 (Fix #131977 parens mangled in shared mut static lint suggestion)
 - #132131 ([StableMIR] API to retrieve definitions from crates)
 - #132639 (core: move intrinsics.rs into intrinsics folder)
 - #132696 (Compile `test_num_f128` conditionally on `reliable_f128_math` config)
 - #132737 (bootstrap: Print better message if lock pid isn't available)
 - #132739 (Fix `librustdoc/scrape_examples.rs` formatting)
 - #132740 (Update test for LLVM 20's new vector splat syntax)
 - #132741 (Update mips64 data layout to match LLVM 20 change)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-08 03:32:51 +00:00
Jubilee
97dbab9124
Rollup merge of #132741 - zmodem:mips_data_layout, r=nikic
Update mips64 data layout to match LLVM 20 change

LLVM changed the data layout in https://github.com/llvm/llvm-project/pull/112084
2024-11-07 18:48:26 -08:00
Jubilee
e2d429e22f
Rollup merge of #132740 - zmodem:simd_syntax_update, r=durin42
Update test for LLVM 20's new vector splat syntax

that was introduced in https://github.com/llvm/llvm-project/pull/112548
2024-11-07 18:48:25 -08:00
Jubilee
a1c4d9e42f
Rollup merge of #132739 - GuillaumeGomez:cleanup-scrape-code, r=notriddle
Fix `librustdoc/scrape_examples.rs` formatting

Still working on the intra-doc link feature. This time I encountered this file and it bothered me a bit so fixing formatting. :3

r? ````@notriddle````
2024-11-07 18:48:25 -08:00
Jubilee
5b554613ed
Rollup merge of #132737 - clubby789:lock-no-pid, r=jieyouxu
bootstrap: Print better message if lock pid isn't available

Not actually sure why, but sometimes the PID isn't available so we print
```
WARNING: build directory locked by process , waiting for lock
```
This makes the message a bit nicer in this case
2024-11-07 18:48:24 -08:00
Jubilee
c9009ae8c8
Rollup merge of #132696 - fortanix:raoul/rte-235-fix_fmodl_missing_symbol_issue, r=tgross35
Compile `test_num_f128` conditionally on `reliable_f128_math` config

With #132434 merged, our internal SGX CI started failing with:
```
05:27:34   = note: rust-lld: error: undefined symbol: fmodl
05:27:34           >>> referenced by arith.rs:617 (core/src/ops/arith.rs:617)
05:27:34           >>>               /home/jenkins/workspace/rust-sgx-ci/rust/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-fortanix-unknown-sgx/release/deps/std-5d5f11eb008c9091.std.d8141acc61ab7ac8-cgu.10.rcgu.o:(std::num::test_num::h7dd9449f6c01fde8)
05:27:34           >>> did you mean: fmodf
05:27:34           >>> defined in: /home/jenkins/workspace/rust-sgx-ci/rust/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-fortanix-unknown-sgx/release/deps/libcompiler_builtins-0376f439a2ebf305.rlib(compiler_builtins-0376f439a2ebf305.compiler_builtins.c22db39d25d6f802-cgu.148.rcgu.o)
```
This originated from the `test_num_f128` test not having the required conditional compilation. This PR fixes that issue.

cc: ````@jethrogb,```` ````@workingjubilee````
2024-11-07 18:48:23 -08:00
Jubilee
0683e031a8
Rollup merge of #132639 - RalfJung:intrinsics, r=workingjubilee,Amanieu
core: move intrinsics.rs into intrinsics folder

This makes the rustbot notification we have set up for this folder in `triagebot.toml` actually work. Also IMO it makes more sense to have it all in one folder.
2024-11-07 18:48:23 -08:00
Jubilee
4036472749
Rollup merge of #132131 - celinval:smir-crate-defs, r=compiler-errors
[StableMIR] API to retrieve definitions from crates

Add functions to retrieve function definitions and static items from all crates (local and external).

For external crates, we're still missing items from trait implementation and primitives.

r? ````@compiler-errors:```` Do you know what is the best way to retrieve the associated items for primitives and trait implementations for external crates? Thanks!
2024-11-07 18:48:22 -08:00
Jubilee
6c0e8ef86a
Rollup merge of #132095 - gechelberger:fix-131977, r=wesleywiser
Fix #131977 parens mangled in shared mut static lint suggestion

Resolves #131977 for static mut references after discussion with
Esteban & Jieyou on [t-compiler/help](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/linting.20with.20parens.20in.20the.20HIR).

This doesn't do anything to change the underlying issue if there are other expressions that generate lint suggestions which need to be applied within parentheses.
2024-11-07 18:48:21 -08:00
Jubilee
93e9ec05a9
Rollup merge of #131913 - jieyouxu:only_debug_assertions, r=onur-ozkan
Add `{ignore,needs}-{rustc,std}-debug-assertions` directive support

Add `{ignore,needs}-{rustc,std}-debug-assertions` compiletest directives and retire the old `{ignore,only}-debug` directives. The old `{ignore,only}-debug` directives were ambiguous because you could have std built with debug assertions but rustc not built with debug assertions or vice versa. If we want to support the use case of controlling test run based on if rustc was built with debug assertions, then having `{ignore,only}-debug` will be very confusing.

cc ````@matthiaskrgr````

Closes #123987.

r? bootstrap (or compiler tbh)
2024-11-07 18:48:21 -08:00
Jubilee
60e8ab6ba8
Rollup merge of #130586 - dpaoliello:fixrawdylib, r=wesleywiser
Set "symbol name" in raw-dylib import libraries to the decorated name

`windows-rs` received a bug report that mixing raw-dylib generated and the Windows SDK import libraries was causing linker failures: <https://github.com/microsoft/windows-rs/issues/3285>

The root cause turned out to be #124958, that is we are not including the decorated name in the import library and so the import name type is also not being correctly set.

This change modifies the generation of import libraries to set the "symbol name" to the fully decorated name and correctly marks the import as being data vs function.

Note that this also required some changes to how the symbol is named within Rust: for MSVC we now need to use the decorated name but for MinGW we still need to use partially decorated (or undecorated) name.

Fixes #124958

Passing i686 MSVC and MinGW build: <https://github.com/rust-lang/rust/actions/runs/11000433888?pr=130586>

r? `@ChrisDenton`
2024-11-07 18:48:20 -08:00
Josh Stone
9827c6dc2c This test needs threads 2024-11-07 18:18:34 -08:00
Zalathar
b8377e5844 Simplify command-line-argument declarations in librustdoc 2024-11-08 12:46:39 +11:00
Zalathar
001013c63c Simplify command-line-option declarations in the compiler 2024-11-08 12:46:39 +11:00
Zalathar
584c8200de Use a method to apply RustcOptGroup to getopts::Options 2024-11-08 12:46:39 +11:00
Zalathar
8f7f9b93b2 Add a run-make test for rustc --help and similar 2024-11-08 12:46:39 +11:00
Taiki Endo
ab62a352ba Stabilize s390x inline assembly 2024-11-08 10:46:00 +09:00
bors
5b20c45999 Auto merge of #128849 - estebank:issue-89143, r=jackh726
Tweak detection of multiple crate versions to be more encompassing

Previously, we only emitted the additional context if the type was in the same crate as the trait that appeared multiple times in the dependency tree. Now, we look at all traits looking for two with the same name in different crates with the same crate number, and we are more flexible looking for the types involved. This will work even if the type that implements the wrong trait version is from a different crate entirely.

```
error[E0277]: the trait bound `CustomErrorHandler: ErrorHandler` is not satisfied because the trait comes from a different crate version
 --> src/main.rs:5:17
  |
5 |     cnb_runtime(CustomErrorHandler {});
  |                 ^^^^^^^^^^^^^^^^^^^^^ the trait `ErrorHandler` is not implemented for `CustomErrorHandler`
  |
note: there are multiple different versions of crate `c` in the dependency graph
 --> /home/gh-estebank/testcase-rustc-crate-version-mismatch/c-v0.2/src/lib.rs:1:1
  |
1 | pub trait ErrorHandler {}
  | ^^^^^^^^^^^^^^^^^^^^^^ this is the required trait
  |
 ::: src/main.rs:1:5
  |
1 | use b::CustomErrorHandler;
  |     - one version of crate `c` is used here, as a dependency of crate `b`
2 | use c::cnb_runtime;
  |     - one version of crate `c` is used here, as a direct dependency of the current crate
  |
 ::: /home/gh-estebank/testcase-rustc-crate-version-mismatch/b/src/lib.rs:1:1
  |
1 | pub struct CustomErrorHandler {}
  | ----------------------------- this type doesn't implement the required trait
  |
 ::: /home/gh-estebank/testcase-rustc-crate-version-mismatch/c-v0.1/src/lib.rs:1:1
  |
1 | pub trait ErrorHandler {}
  | ---------------------- this is the found trait
  = note: two types coming from two different versions of the same crate are different types even if they look the same
  = help: you can use `cargo tree` to explore your dependency tree
```

Fix #89143.
2024-11-08 00:34:48 +00:00
Celina G. Val
dd6ddcb18e [StableMIR] A few fixes to pretty printing
Improve identation, and a few other rvalue printing
2024-11-07 16:16:38 -08:00
Philipp Krones
2ab848b756
Update Cargo.lock 2024-11-07 22:37:09 +01:00
Philipp Krones
40aec58abb
Merge commit 'f712eb5cdccd121d0569af12f20e6a0fabe4364d' into clippy-subtree-update 2024-11-07 22:37:01 +01:00