Commit Graph

266487 Commits

Author SHA1 Message Date
bors
2836482241 Auto merge of #129283 - saethlin:unreachable-allocas, r=scottmcm
Don't alloca for unused locals

We already have a concept of mono-unreachable basic blocks; this is primarily useful for ensuring that we do not compile code under an `if false`. But since we never gave locals the same analysis, a large local only used under an `if false` will still have stack space allocated for it.

There are 3 places we traverse MIR during monomorphization: Inside the collector, `non_ssa_locals`, and the walk to generate code. Unfortunately, https://github.com/rust-lang/rust/pull/129283#issuecomment-2297925578 indicates that we cannot afford the expense of tracking reachable locals during the collector's traversal, so we do need at least two mono-reachable traversals. And of course caching is of no help here because the benchmarks that regress are incr-unchanged; they don't do any codegen.

This fixes the second problem in https://github.com/rust-lang/rust/issues/129282, and brings us anther step toward `const if` at home.
2024-09-21 13:48:14 +00:00
bors
f48c99a004 Auto merge of #130599 - jieyouxu:snake_case_binary_cleanup, r=petrochenkov
Explain why `non_snake_case` is skipped for binary crates and cleanup tests

- Explain `non_snake_case` lint is skipped for bin crate names because binaries are not intended to be distributed or consumed like library crates (#45127).
- Coalesce the bunch of tests into a single one but with revisions, which is easier to compare the differences for `non_snake_case` behavior with respect to crate types.

Follow-up to #121749 with some more comments and test cleanup.

cc `@saethlin` who bumped into one of the tests and was confused why it was `only-x86_64-unknown-linux-gnu`.

try-job: dist-i586-gnu-i586-i686-musl
2024-09-21 11:16:38 +00:00
Folkert de Vries
ac9a49f62d mark E0775 as no longer emitte by the compiler 2024-09-21 13:09:09 +02:00
Folkert
4d75a4f0f2 disallow cmse ABIs on unsupported platforms 2024-09-21 13:05:23 +02:00
Folkert
a41c209ef3 Add assembly test for the cmse unstable features
verifies that the correct return instructions are emitted.

Co-authored-by: Tamme Dittrich <tamme@tweedegolf.com>
2024-09-21 13:05:23 +02:00
Folkert
a33dcb3607 add test that accepts a C-cmse-nonsecure-call function pointer 2024-09-21 13:05:23 +02:00
Folkert
5722a80782 remove #[cmse_nonsecure_entry] 2024-09-21 13:05:21 +02:00
Folkert de Vries
90300ef40b add C-cmse-nonsecure-entry ABI 2024-09-21 13:04:14 +02:00
Folkert de Vries
1ddd67a79a add C-cmse-nonsecure-entry ABI 2024-09-21 13:04:14 +02:00
Gabriel Bjørnager Jensen
f48c5ec235 Mark and implement 'char::encode_utf16' as const; Rewrite 'encode_utf16_raw'; 2024-09-21 12:53:28 +02:00
EqualMa
d44a5fd00b
Fix docs of compare_bytes 2024-09-21 18:27:49 +08:00
bors
a3fea24971 Auto merge of #3901 - RalfJung:rustup, r=RalfJung
Rustup

This has a larger large "fmt" diff, probably there was a bug rustfmt update. For some reason the automatic `./miri fmt` on CI failed so this PR had to be created by hand -- it is unclear to me why this occurred.
2024-09-21 07:44:18 +00:00
Ralf Jung
7d9a4a7d3a fmt (with a huge diff for some reason) 2024-09-21 09:40:40 +02:00
Ralf Jung
90854b7670 Merge from rustc 2024-09-21 09:29:53 +02:00
Ralf Jung
c7e6284cf9 Preparing for merge from rustc 2024-09-21 09:29:28 +02:00
Ralf Jung
b94f2931b3 ABI compatibility: mention Result guarantee 2024-09-21 09:17:31 +02:00
bors
74fd001cda Auto merge of #130649 - matthiaskrgr:rollup-57zc7lz, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #129718 (add guarantee about remove_dir and remove_file error kinds)
 - #130598 (Add recursion limit to FFI safety lint)
 - #130642 (Pass the current cargo to `run-make` tests)
 - #130644 (Only expect valtree consts in codegen)
 - #130645 (Normalize consts in writeback when GCE is enabled)
 - #130646 (compiler: factor out `OVERFLOWING_LITERALS` impl)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-21 07:00:52 +00:00
Elli Howard
50b8915e6d
Add --enable-profiler to armhf dist
Adds the --enable-profiler flag to the RUST_CONFIGURE_ARGS for armhf distribution for Linux.  This enables running coverage for tests
2024-09-20 22:48:36 -07:00
许杰友 Jieyou Xu (Joe)
9ae1fb4329 Coalesce non_snake_case crate test set with revisions 2024-09-21 05:39:54 +00:00
许杰友 Jieyou Xu (Joe)
43ede7331d Explain why non_snake_case is skipped for binary crates 2024-09-21 05:24:26 +00:00
Matthias Krüger
5770ba8686
Rollup merge of #130646 - workingjubilee:literally-factorize-int-lint, r=compiler-errors
compiler: factor out `OVERFLOWING_LITERALS` impl

This puts it into `rustc_lint/src/types/literal.rs`. It then uses the fact that it's easier to navigate the logic to identify something that can easily be factored out, as an instance of "why".
2024-09-21 07:22:50 +02:00
Matthias Krüger
e6cf3bd267
Rollup merge of #130645 - compiler-errors:normalize-gce-writeback, r=BoxyUwU
Normalize consts in writeback when GCE is enabled

GCE lazily normalizes its unevaluated consts. This PR ensures that, like the new solver with its lazy norm types, we can assume that the writeback results are fully normalized.

This is important since we're trying to eliminate unnecessary calls to `ty::Const::{eval,normalize}` since they won't work with mGCE. Previously, we'd keep those consts unnormalized in writeback all the way through MIR build, and they'd only get normalized if we explicitly called `ty::Const::{eval,normalize}`, or during codegen since that calls `normalize_erasing_regions` (which invokes the `QueryNormalizer`, which evaluates the const accordingly).

This hack can (hopefully obviously) be removed when mGCE is implemented and we yeet the old GCE; it's only reachable with the GCE flag anyways, so I'm not worried about the implications here.

r? `@BoxyUwU`
2024-09-21 07:22:49 +02:00
Matthias Krüger
ff6cd18a75
Rollup merge of #130644 - compiler-errors:consts-in-codegen, r=BoxyUwU
Only expect valtree consts in codegen

Turn a bunch of `Const::eval_*` calls into `Const::try_to_*` calls, which implicitly assert that we only have valtrees by the time we get to codegen.

r? `@BoxyUwU`
2024-09-21 07:22:49 +02:00
Matthias Krüger
43366285f4
Rollup merge of #130642 - cuviper:run-make-cargo, r=jieyouxu
Pass the current cargo to `run-make` tests

A couple tests were using `BOOTSTRAP_CARGO` with `-Zbuild-std`, but that
stage0 cargo might not always be in sync with in-tree changes. In
particular, those tests started failing on the beta branch because the
older cargo couldn't find the library `Cargo.lock`, and then couldn't
build the latest version of `compiler_builtins` that had nightly changes.

Fixes #130634
r? `@saethlin`
2024-09-21 07:22:48 +02:00
Matthias Krüger
28ace83b11
Rollup merge of #130598 - gurry:130310-improper-types-stack-overflow, r=compiler-errors
Add recursion limit to FFI safety lint

Fixes #130310

Now we check against `tcx.recursion_limit()` and raise an error if it the limit is reached instead of overflowing the stack.
2024-09-21 07:22:47 +02:00
Matthias Krüger
f2290c23fc
Rollup merge of #129718 - lolbinarycat:remove_dir-docs, r=Noratrieb
add guarantee about remove_dir and remove_file error kinds

approved in ACP https://github.com/rust-lang/libs-team/issues/433
2024-09-21 07:22:47 +02:00
Ben Kimock
aa28ee1718 Fix clippy 2024-09-21 01:07:00 -04:00
Ben Kimock
523f8f8398 Compute reachable locals as part of non_ssa_locals 2024-09-21 01:07:00 -04:00
Ben Kimock
0ea5dc506f Don't alloca for unused locals 2024-09-21 01:06:59 -04:00
onur-ozkan
f23d0b9c9d move enzyme flags from general cargo to rustc-specific cargo
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-21 07:35:27 +03:00
Michael Goulet
af24d0b660 Resolve self type alias in impl for RTN 2024-09-20 22:18:57 -04:00
Michael Goulet
174c3f9519 Add missing diagnostics and flesh out tests 2024-09-20 22:18:57 -04:00
Michael Goulet
7c8e281f73 Flesh out some TODOs 2024-09-20 22:18:57 -04:00
Michael Goulet
51b51bb570 Implement RTN in resolve_bound_vars and HIR ty lowering 2024-09-20 22:18:57 -04:00
Michael Goulet
19881b5a5a Conditionally allow lowering RTN (..) in paths 2024-09-20 22:18:57 -04:00
Michael Goulet
6d788a18c5 Resolve RTN for TyKind::Path ending in (..) 2024-09-20 22:18:57 -04:00
okaneco
b94c5a169b Avoid re-validating UTF-8 in FromUtf8Error::into_utf8_lossy
Refactor `into_utf8_lossy` to copy valid UTF-8 bytes into the buffer,
avoiding double validation of bytes.
Add tests that mirror the `String::from_utf8_lossy` tests
2024-09-20 20:56:07 -04:00
Michael Goulet
c0d1a1305d Only expect mono consts in CFI 2024-09-20 20:38:13 -04:00
Michael Goulet
d3f270b542 Normalize transparent struct field type in CFI 2024-09-20 20:38:13 -04:00
Michael Goulet
460abead20 Do not unnecessarily eval consts in codegen 2024-09-20 20:38:11 -04:00
Michael Goulet
914193c8f4 Do not unnecessarily eval consts in codegen 2024-09-20 20:38:11 -04:00
Michael Goulet
920a973bdb Don't emit spurious error for pattern matched array with erroneous len const 2024-09-20 20:26:20 -04:00
Michael Goulet
a9a8f79f86 Normalize unevaluated consts in GCE 2024-09-20 20:24:22 -04:00
Jubilee Young
844edfe449 compiler: reuse {un,}signed_fit in get_type_suggestion (nfc)
no need for a weird macro when a self-explanatory `match` will do.
2024-09-20 17:19:27 -07:00
Josh Stone
4e53640b17 Pass the current cargo to run-make tests
A couple tests were using `BOOTSTRAP_CARGO` with `-Zbuild-std`, but that
stage0 cargo might not always be in sync with in-tree changes. In
particular, those tests started failing on the beta branch because the
older cargo couldn't find the library `Cargo.lock`, and then couldn't
build the latest version of `compiler_builtins` that had nightly changes.
2024-09-20 15:47:36 -07:00
bors
c0838c8ebe Auto merge of #130632 - weihanglo:update-cargo, r=weihanglo
Update cargo

16 commits in a9a418d1a22f29e7dfd034e3b93f15657e608a29..eaee77dc1584be45949b75e4c4c9a841605e3a4b
2024-09-15 19:13:12 +0000 to 2024-09-19 21:10:23 +0000
- fix(complete): Harden `--target` completions (rust-lang/cargo#14564)
- Cleanup duplicated check-cfg lint logic (rust-lang/cargo#14567)
- Revert "remove reference to incomplete crates.io feature from docs" (rust-lang/cargo#14562)
- feat: Add custom completer for `cargo help &lt;TAB&gt;` (rust-lang/cargo#14557)
- docs(unstable): Expand on completion documentation (rust-lang/cargo#14563)
- feat: Add custom completer for `cargo build --example=&lt;TAB&gt;` (rust-lang/cargo#14531)
- remove reference to incomplete crates.io feature from docs (rust-lang/cargo#14561)
- fix(complete): Fix problems on my machine (rust-lang/cargo#14558)
- feat: Add custom completer for completing benchmark names (rust-lang/cargo#14532)
- refactor(info): Use the `shell.note` to print the note (rust-lang/cargo#14554)
- feat: Add custom completer for completing test names (rust-lang/cargo#14548)
- Suggest `cargo info` command in the `cargo search` result (rust-lang/cargo#14537)
- feat: Add custom completer for completing target triple (rust-lang/cargo#14535)
- feat: Add custom completer for `cargo -Z &lt;TAB&gt;` (rust-lang/cargo#14536)
- feat: Add custom completer for completing installed binaries (rust-lang/cargo#14534)
- feat: Add custom completer for completing bin names (rust-lang/cargo#14533)

r? ghost
2024-09-20 22:47:08 +00:00
Jubilee Young
2db62e6893 compiler: factor OVERFLOWING_LITERALS impl into a file (nfc)
no functional changes should arise, just moves the lint impl details out
of a very crowded file with lots of different lints in it.
2024-09-20 15:26:01 -07:00
bors
da889684c8 Auto merge of #130631 - GuillaumeGomez:rollup-jpgy1iv, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #128209 (Remove macOS 10.10 dynamic linker bug workaround)
 - #130526 (Begin experimental support for pin reborrowing)
 - #130611 (Address diagnostics regression for `const_char_encode_utf8`.)
 - #130614 (Add arm64e-apple-tvos target)
 - #130617 (bail if there are too many non-region infer vars in the query response)
 - #130619 (Fix scraped examples height)
 - #130624 (Add `Vec::as_non_null`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-20 19:51:45 +00:00
Weihang Lo
2fa97d714e
Update cargo 2024-09-20 15:06:27 -04:00
nora
c72264157b
Remove double spaces 2024-09-20 19:55:28 +02:00