Commit Graph

270532 Commits

Author SHA1 Message Date
bors
b73478b6ee Auto merge of #132807 - bjorn3:sync_cg_clif-2024-11-09, r=bjorn3
Subtree sync for rustc_codegen_cranelift

Apart from a perf optimization for some crates (https://github.com/rust-lang/rustc_codegen_cranelift/pull/1541) not much changed this time as the last sync was less than a week ago.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2024-11-09 14:53:55 +00:00
bjorn3
c94f759f10 Merge commit '1fa693ca4462fc1f790693464cf765ad693616af' into sync_cg_clif-2024-11-09 2024-11-09 13:48:06 +00:00
bjorn3
1fa693ca44 Rustup to rustc 1.84.0-nightly (59cec72a5 2024-11-08) 2024-11-09 13:28:28 +00:00
bors
80445576d0 Auto merge of #132800 - matthiaskrgr:rollup-c1kkj56, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #132552 (Add v9, v8plus, and leoncasa target feature to sparc and use v8plus in create_object_file)
 - #132745 (pointee_info_at: fix logic for recursing into enums)
 - #132777 (try_question_mark_nop: update test for LLVM 20)
 - #132785 (rustc_target: more target string fixes for LLVM 20)
 - #132794 (Use a separate dir for r-a builds consistently in helix config)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-09 12:23:47 +00:00
bjorn3
cc7d30ab57 Sync from rust 59cec72a57 2024-11-09 11:18:02 +00:00
bjorn3
e9ac680447
Merge pull request #1541 from rust-lang/perf_opts
Use a BufWriter in emit_module to reduce syscall overhead
2024-11-09 12:14:06 +01:00
Matthias Krüger
70a59ae1a1
Rollup merge of #132794 - WaffleLapkin:helix-improved-config, r=jieyouxu
Use a separate dir for r-a builds consistently in helix config

r? `@jieyouxu`
cc `@mrkajetanp`

Previously config used `build-rust-analyzer` for rustfmt and proc macros server, while not using it for actual `x check` commands.

This PR:
- Replaces the build dir with `build/rust-analyzer`
  - This is just my preference
  - Although I do think this is the nicest option: the directory is already git-ignored, `rm -fr ./build` removes everything, etc
- Uses said directory with the `x check` commands in helix r-a config
- Adds instructions on how to build rustfmt and proc macro server to the config

As of note, this is not what other configs do (like vscode's), however this _is_ what I would actually suggest to people (and what I'm actually using).
2024-11-09 10:52:05 +01:00
Matthias Krüger
a393566108
Rollup merge of #132785 - durin42:llvm-20-more-alignments, r=nikic
rustc_target: more target string fixes for LLVM 20

LLVM continues to clean these up, and we continue to make this consistent. This is similar to 9caced7bad and e985396145.

`@rustbot` label: +llvm-main
2024-11-09 10:52:05 +01:00
Matthias Krüger
2829c2725a
Rollup merge of #132777 - durin42:llvm-20-poison-prop, r=nikic
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-09 10:52:04 +01:00
Matthias Krüger
6e05afd744
Rollup merge of #132745 - RalfJung:pointee-info-inside-enum, r=DianQK
pointee_info_at: fix logic for recursing into enums

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

The logic in `pointee_info_at` was likely written at a time when the null pointer optimization was the *only* enum layout optimization -- and as `Variant::Multiple` kept getting expanded, nobody noticed that the logic is now unsound.

The job of this function is to figure out whether there is a dereferenceable-or-null and aligned pointer at a given offset inside a type. So when we recurse into a multi-variant enum, we better make sure that all the other enum variants must be null! This is the part that was forgotten, and this PR adds it.

The reason this didn't explode in many ways so far is that our references only have 1 niche value (null), so it's not possible on stable to have a multi-variant enum with a dereferenceable pointer and other enum variants that are not null. But with `rustc_layout_scalar_valid_range` attributes one can force such a layout, and if `@the8472's` work on alignment niches ever lands, that will make this possible on stable.
2024-11-09 10:52:03 +01:00
Matthias Krüger
b9d4ef16c9
Rollup merge of #132552 - taiki-e:sparc-target-feature, r=workingjubilee
Add v9, v8plus, and leoncasa target feature to sparc and use v8plus in create_object_file

This adds the following three unstable target features:

- `v9`: SPARC-V9 instructions ([LLVM definition][sparc-v9])
  - Relevant to https://github.com/rust-lang/rust/pull/131222#issuecomment-2453310963
  - Relevant to https://github.com/rust-lang/rust/pull/132472#discussion_r1832606081
  - This is also needed to implement https://github.com/taiki-e/atomic-maybe-uninit/pull/31 (depends on inline assembly support) more robustly.
- `v8plus`: SPARC-V8+ ABI ([LLVM definition][sparc-v8plus])
  - This is added in LLVM 20. In LLVM 19 and older, it is emulated to work the same way as LLVM in each LLVM version.
  - See https://github.com/rust-lang/rust/issues/132585#issuecomment-2453926257 for more.
- `leoncasa`: CASA instruction[^1] of LEON3 and LEON4 processors ([LLVM definition][sparc-leoncasa], LLVM feature name: `hasleoncasa`)
  - This is needed to implement https://github.com/taiki-e/atomic-maybe-uninit/pull/31 (depends on inline assembly support) more robustly.

[^1]: Atomic CAS instruction

[sparc-v9]: f5e4ffaa49/llvm/lib/Target/Sparc/Sparc.td (L37-L39)
[sparc-v8plus]: f5e4ffaa49/llvm/lib/Target/Sparc/Sparc.td (L37-L39)
[sparc-leoncasa]: https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/LeonFeatures.td#L32-L37
2024-11-09 10:52:03 +01:00
bors
4b198d6871 Auto merge of #132584 - Zalathar:includes, r=cuviper
Trim and tidy includes in `rustc_llvm`

These includes tend to accumulate over time, and are usually only removed when something breaks in a new LLVM version, so it's nice to clean them up manually once in a while.

General strategy used for this PR:
- Remove all includes from `LLVMWrapper.h` that aren't needed by the header itself, transplanting them to individual source files as necessary.
- For each source file, temporarily remove each include if doing so doesn't cause a compile error.
- If a “required” include looks like it shouldn't be needed, try replacing it with its sub-includes, then trim that list.
- After doing all of the above, go back and re-add any removed include if the file does actually use things defined in that header, even if the header happens to also be included by something else.
2024-11-09 09:46:08 +00:00
bors
62bb2ac03e Auto merge of #132798 - workingjubilee:rollup-qxvmmqo, r=workingjubilee
Rollup of 5 pull requests

Successful merges:

 - #132755 (Do not reveal opaques in the param-env, we got lazy norm instead)
 - #132757 (Get rid of `check_opaque_type_well_formed`)
 - #132760 (Don't suggest `.into_iter()` on iterators)
 - #132778 (update io::Error::into_inner to acknowledge io::Error::other)
 - #132780 (use verbose for path separator suggestion)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-09 07:11:33 +00:00
Jubilee
c4922f12fd
Rollup merge of #132780 - compiler-errors:verbose, r=estebank
use verbose for path separator suggestion

A single `-` of suggestion underlining that is adjacent to a much more significant `^^^` underlying of the LHS path component is hard to distinguish. IMO this presents much more cleanly when it's verbose, especially because it's a *replacment* suggestion.

r? estebank
2024-11-08 20:46:15 -08:00
Jubilee
dc647392d6
Rollup merge of #132778 - lolbinarycat:io-Error-into_inner-docs, r=cuviper
update io::Error::into_inner to acknowledge io::Error::other
2024-11-08 20:46:13 -08:00
Jubilee
b598849941
Rollup merge of #132760 - dianne:iter-into-iter, r=lcnr
Don't suggest `.into_iter()` on iterators

This makes the the suggestion to call `.into_iter()` only consider unsatisfied `Iterator` bounds for the receiver type itself. That way, it ignores predicates generated by trying to auto-ref the receiver (the result of which usually won't implement `Iterator`).

Fixes #127511

Unfortunately, the error in that case is still confusing: it labels `Iterator` as an unsatisfied bound because `&impl Iterator: Iterator` can't be satisfied, despite that not being required or helpful. I'd like to handle that in a separate PR. ~~I'm hoping fixing #124802 will fix it too.~~ It doesn't look connected to that issue. Still, I think it'd be clearest to visually distinguish unsatisfied predicates from different attempts at `pick_method`; I'll make a PR for that soon.
2024-11-08 20:46:12 -08:00
Jubilee
7a4970476e
Rollup merge of #132757 - compiler-errors:yeet-check-wf, r=lcnr
Get rid of `check_opaque_type_well_formed`

Instead, replicate it by improving the span of the opaque in `check_opaque_meets_bounds`.

This has two consequences:
1. We now prefer "concrete type differs" errors, since we'll hit those first before we check the opaque is WF.
2. Spans have gotten slightly worse.

Specifically, (2.) could be improved by adding a new obligation cause that explains that the definition's environment has stronger assumptions than the declaration.

r? lcnr
2024-11-08 20:46:12 -08:00
Jubilee
1077c08ad5
Rollup merge of #132755 - compiler-errors:reveal-param, r=lcnr
Do not reveal opaques in the param-env, we got lazy norm instead

r? lcnr
2024-11-08 20:46:11 -08:00
bors
012ae13d6a Auto merge of #132549 - Zalathar:rust-string, r=cuviper
Make `RustString` an extern type to avoid `improper_ctypes` warnings

Currently, any FFI function that uses `&RustString` needs to also add `#[ignore(improper_ctypes)]` to silence a warning.

The warning is not _completely_ bogus, because `RustString` contains `Vec<u8>` and therefore does not have a guaranteed layout. But we have no way of telling the lint that this doesn't matter, because the C++ code only uses that pointer opaquely and never relies on its underlying layout.

Ideally there would be some way to silence `improper_ctypes` at the type-definition site. But because there isn't, casting to and from a separate extern type is better than having to annotate every single use site.
2024-11-09 04:43:51 +00:00
Michael Goulet
13ab08d7dc Do not reveal opaques in the param-env, we got lazy norm instead 2024-11-09 03:55:07 +00:00
dianne
cea82ed162 Don't suggest .into_iter() on iterators 2024-11-08 17:43:13 -08:00
Maybe Lapkin
22069682ed Use a separate dir for r-a builds consistently in helix config 2024-11-09 01:27:29 +01:00
Zalathar
89d7efaf8f Make RustString an extern type to avoid improper_ctypes warnings 2024-11-09 11:07:44 +11:00
Augie Fackler
a10e744faf rustc_target: more target string fixes for LLVM 20
LLVM continues to clean these up, and we continue to make this
consistent. This is similar to 9caced7bad
and e985396145.

@rustbot label: +llvm-main
2024-11-08 16:54:35 -05:00
bors
328b759142 Auto merge of #132764 - MikaelUrankar:freebsd_armv7, r=workingjubilee
Drop "gnu" in the target env for FreeBSD armv6/7

FreeBSD is not a GNU system
2024-11-08 21:42:45 +00:00
Taiki Endo
c059eb7750 Add v8plus target feature to sparc and use it in create_object_file 2024-11-09 03:22:09 +09:00
Taiki Endo
400a690b5f Add v9 and leoncasa target feature to sparc 2024-11-09 03:17:24 +09:00
Michael Goulet
0e481b44f5 use verbose for path separator suggestion 2024-11-08 16:58:19 +00:00
bors
59cec72a57 Auto merge of #132746 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`
2024-11-08 16:49:13 +00:00
binarycat
b004cac72e update io::Error::into_inner to acknowlage io::Error::other 2024-11-08 10:43:34 -06:00
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
bjorn3
c637a84ad4 Add finish_ongoing_codegen timer in join_codegen to match cg_llvm 2024-11-08 16:14:09 +01: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
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