Commit Graph

271064 Commits

Author SHA1 Message Date
chansuke
b496873020 Update the doc comment of ASCII_CASE_MASK 2024-11-10 22:24:06 +09:00
bors
c22887b4d9 Auto merge of #132846 - jieyouxu:revert-132772, r=jieyouxu
Revert #132772 to fix unknown git commit hash

Reverts #132772 to address #132845, we seem to have unintentionally omitted commit hash.

r? `@onur-ozkan`
2024-11-10 12:43:44 +00:00
Jieyou Xu
c4c6d2b8d5 Temporarily disable version-verbose-commit-hash to force revert through 2024-11-10 20:31:18 +08:00
Jieyou Xu
c0cee4e36b Revert "Rollup merge of #132772 - onur-ozkan:download-rustc-default, r=jieyouxu"
This reverts commit c435fa8c4b, reversing
changes made to 88acd493f9.

Seems to have unintentionally omitted commit hash leading to
<https://github.com/rust-lang/rust/pull/132772>.
2024-11-10 20:31:18 +08:00
Ralf Jung
b2d1874dc2 elem_offset / subslice_range: use addr() instead of 'as usize' 2024-11-10 13:03:25 +01:00
Ralf Jung
881f2ec1b0
Merge pull request #4022 from RalfJung/linux-futex
fix linux-futex test being accidentally disabled
2024-11-10 12:01:30 +00:00
Ralf Jung
e8a3ffee49 fix linux-futex test being accidentally disabled 2024-11-10 12:36:40 +01:00
Ralf Jung
23054c5dfc move all mono-time checks into their own folder, and their own query 2024-11-10 12:12:12 +01:00
bjorn3
e8b10297b5 Fix error message for direct usage of sess.opts.crate_types 2024-11-10 10:37:53 +00:00
Ralf Jung
673d9c3e85
Merge pull request #3971 from RalfJung/futex-virtual
store futexes in per-allocation data rather than globally
2024-11-10 10:26:23 +00:00
Ralf Jung
d1a4812164 store futexes in per-allocation data rather than globally 2024-11-10 11:01:57 +01:00
bors
c24e166527 Auto merge of #132840 - matthiaskrgr:rollup-ibarl2r, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - #132136 (ABI compatibility: remove section on target features)
 - #132816 (Dont suggest `use<impl Trait>` when we have an edition-2024-related borrowck issue)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-10 09:31:15 +00:00
Ralf Jung
a839fbf0a1
Merge pull request #4021 from RalfJung/rustup
Rustup
2024-11-10 09:29:44 +00:00
Ralf Jung
353f8e1323 ensure that all publicly reachable const fn have const stability info 2024-11-10 10:16:26 +01:00
Ralf Jung
e96808162a ensure that all publicly reachable const fn have const stability info 2024-11-10 10:16:26 +01:00
Matthias Krüger
c1f3c7078a
Rollup merge of #132816 - compiler-errors:2024-apit, r=jieyouxu
Dont suggest `use<impl Trait>` when we have an edition-2024-related borrowck issue

#131186 implements some machinery to detect in borrowck when we may have RPIT overcaptures due to edition 2024, and suggests adding `+ use<'a, T>` to go back to the edition 2021 capture rules. However, we weren't filtering out cases when there are APITs in scope.

This PR implements a more sophisticated diagnostic where we will suggest turning any APITs in scope into type parameters, and applies this to both the borrowck error note, and to the `impl_trait_overcaptures` migration lint.

cc #132809
2024-11-10 10:09:52 +01:00
Matthias Krüger
94cc01af15
Rollup merge of #132136 - RalfJung:target-feature-abi-compat, r=Mark-Simulacrum
ABI compatibility: remove section on target features

Once https://github.com/rust-lang/rust/pull/127731 lands, we will properly diagnose ABI issues caused by target feature mismatch (at least on tier 1 targets). So I'd say we can remove the corresponding part of the docs here -- this is now something the compiler can take care of, so programmers don't need to be concerned. For now this is just a lint, but that's just a transition period, like in prior cases where we fix I-unsound bugs by adding a new check that goes through the "future incompatibility" stages. We have decided that it's actually a bug that we have ABI risks around target features, and we shouldn't document that bug as-if it was intended behavior.

Cc `@rust-lang/opsem` `@chorman0773` `@veluca93`
2024-11-10 10:09:52 +01:00
Ralf Jung
a01f37c7f4 Merge from rustc 2024-11-10 10:03:57 +01:00
Ralf Jung
686eeb83e9 honor rustc_const_stable_indirect in non-staged_api crate with -Zforce-unstable-if-unmarked 2024-11-10 10:01:27 +01:00
Ralf Jung
ce7a56072b Preparing for merge from rustc 2024-11-10 10:01:05 +01:00
Taiki Endo
965a2801a0 Stabilize Arm64EC inline assembly 2024-11-10 17:43:46 +09:00
bors
668959740f Auto merge of #132831 - workingjubilee:rollup-6fdif44, r=workingjubilee
Rollup of 6 pull requests

Successful merges:

 - #131258 (Stabilize s390x inline assembly)
 - #132801 (interpret: get_alloc_info: also return mutability)
 - #132823 (require const_impl_trait gate for all conditional and trait const calls)
 - #132824 (Update grammar in wasm-c-abi's compiler flag documentation)
 - #132825 (Exclude relnotes-tracking-issue from needs-triage)
 - #132828 (Additional tests to ensure let is rejected during parsing)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-10 05:54:13 +00:00
Michael Goulet
8d871b7687 Deny capturing late-bound ty/ct params in nested opaques 2024-11-10 04:30:33 +00:00
Michael Goulet
58abbaf077 Revert "Skip late-bound lifetimes when crossing an AnonConst."
This reverts commit a7f609504c.
2024-11-10 04:30:33 +00:00
Jubilee
c19d56c902
Rollup merge of #132828 - est31:let_chains_parsing_tests, r=compiler-errors
Additional tests to ensure let is rejected during parsing

In the original stabilization PR, @ `compiler-errors` has [pointed out](https://github.com/rust-lang/rust/pull/94927#issuecomment-1165156328) that #97295 wasn't enough to address the concerns about having `let` in expressions being rejected at parsing time, instead of later.

Thankfully, since then the situation has been greatly improved by #115677. This PR adds some additional tests to `disallowed-positions.rs`, and adds two additional revisions to the "normal" case which is now given the `feature` name:

* `no_feature`: Added to incorporate `disallowed-positions-without-feature-gate.rs` into the file, reducing duplication.
* `nothing`: like feature, but all functions are cfg'd out. Ensures that the errors are really emitted during parsing.

cc tracking issue #53667
2024-11-09 20:28:46 -08:00
Jubilee
0ba177083f
Rollup merge of #132825 - Noratrieb:Noratrieb-patch-1, r=clubby789
Exclude relnotes-tracking-issue from needs-triage
2024-11-09 20:28:45 -08:00
Jubilee
b93b0c7011
Rollup merge of #132824 - kadenlnelson:patch/wasi-c-abi-doc, r=workingjubilee
Update grammar in wasm-c-abi's compiler flag documentation

This PR adjusts the grammar of the `wasm-c-abi` compiler flag documentation. See the inline comments within the PR for details.
2024-11-09 20:28:45 -08:00
Jubilee
d4c81c6987
Rollup merge of #132823 - RalfJung:conditional-const-calls, r=fee1-dead,compiler-errors
require const_impl_trait gate for all conditional and trait const calls

Alternative to https://github.com/rust-lang/rust/pull/132786.

`@compiler-errors`  this is basically what I meant with my proposals. I found it's easier to express this in code than English. ;)

r? `@compiler-errors`
2024-11-09 20:28:44 -08:00
Jubilee
61f51931b2
Rollup merge of #132801 - RalfJung:alloc-mutability, r=oli-obk
interpret: get_alloc_info: also return mutability

This will be needed for https://github.com/rust-lang/miri/pull/3971

This then tuned into a larger refactor where we introduce a new type for the `get_alloc_info` return data, and we move some code to methods on `GlobalAlloc` to avoid duplicating it between the validity check and `get_alloc_info`.
2024-11-09 20:28:43 -08:00
Jubilee
2f98dcf9ba
Rollup merge of #131258 - taiki-e:s390x-stabilize-asm, r=Amanieu
Stabilize s390x inline assembly

This stabilizes inline assembly for s390x (SystemZ).

Corresponding reference PR: https://github.com/rust-lang/reference/pull/1643

---

From the requirements of stabilization mentioned in https://github.com/rust-lang/rust/issues/93335

> Each architecture needs to be reviewed before stabilization:

> - It must have clobber_abi.

Done in https://github.com/rust-lang/rust/pull/130630.

> - It must be possible to clobber every register that is normally clobbered by a function call.

Done in the PR that added support for clobber_abi.

> - Generally review that the exposed register classes make sense.

The followings can be used as input/output:

- `reg` (`r[0-10]`, `r[12-14]`): General-purpose register

- `reg_addr` (`r[1-10]`, `r[12-14]`): General-purpose register except `r0` which is evaluated as zero in an address context

  This class is needed because `r0`, which may be allocated when using the `reg` class, cannot be used as a register in certain contexts. This is identical to the `a` constraint in LLVM and GCC. See https://github.com/rust-lang/rust/pull/119431 for details.

- `freg` (`f[0-15]`): Floating-point register

The followings are clobber-only:

- `vreg` (`v[0-31]`): Vector register

  Technically `vreg` should be able to accept `#[repr(simd)]` types as input/output if the unstable `vector` target feature added is enabled, but `core::arch` has no s390x vector type and both `#[repr(simd)]` and `core::simd` are unstable. Everything related is unstable, so the fact that this is currently a clobber-only should not be considered a stabilization blocker. (https://github.com/rust-lang/rust/issues/130869 tracks unstable stuff here)

- `areg` (`a[2-15]`): Access register

All of the above register classes except `reg_addr` are needed for `clobber_abi`.

The followings cannot be used as operands for inline asm (see also [getReservedRegs](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp#L258-L282) and [SystemZELFRegisters](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/SystemZ/SystemZRegisterInfo.h#L107-L128) in LLVM):

- `r11`: frame pointer
- `r15`: stack pointer
- `a0`, `a1`: Reserved for system use
- `c[0-15]` (control register)  Reserved by the kernel

Although not listed in the above requirements, `preserves_flags` is implemented in https://github.com/rust-lang/rust/pull/111331.

---

cc ``@uweigand``

r? ``@Amanieu``

``@rustbot`` label +O-SystemZ +A-inline-assembly
2024-11-09 20:28:43 -08:00
Kaden Nelson
2ac1c1868f Update grammar in wasm-c-abi's compiler flag documentation
Co-authored-by: Jubilee <workingjubilee@gmail.com>
2024-11-09 22:27:21 -06:00
bors
7660aed73d Auto merge of #132173 - veluca93:abi_checks, r=RalfJung,compiler-errors
Emit warning when calling/declaring functions with unavailable vectors.

On some architectures, vector types may have a different ABI depending on whether the relevant target features are enabled. (The ABI when the feature is disabled is often not specified, but LLVM implements some de-facto ABI.)

As discussed in rust-lang/lang-team#235, this turns out to very easily lead to unsound code.

This commit makes it a post-monomorphization future-incompat warning to declare or call functions using those vector types in a context in which the corresponding target features are disabled, if using an ABI for which the difference is relevant. This ensures that these functions are always called with a consistent ABI.

See the [nomination comment](https://github.com/rust-lang/rust/pull/127731#issuecomment-2288558187) for more discussion.

Part of #116558

r? RalfJung
2024-11-10 02:52:25 +00:00
Zalathar
925dfc8608 coverage: Pass a LocalFileId to CoverageSpan::from_source_region 2024-11-10 11:58:44 +11:00
bors
303fc0527a Auto merge of #132829 - weihanglo:update-cargo, r=weihanglo
Update cargo

16 commits in 0310497822a7a673a330a5dd068b7aaa579a265e..4a2d8dc636445b276288543882e076f254b3ae95
2024-11-01 19:27:56 +0000 to 2024-11-09 19:10:33 +0000
- test: adjust `cargo_test_env` to unblock rust submodule update (rust-lang/cargo#14803)
- feat(warnings): add build.warnings option (rust-lang/cargo#14388)
- Revert "feat: Add `CARGO_RUSTC_CURRENT_DIR`" (rust-lang/cargo#14799)
- CI: make the `lint-docs` job required (rust-lang/cargo#14797)
- Switch CI from bors to merge queue (rust-lang/cargo#14718)
- docs(test):  Document Execs assertions based on port effort (rust-lang/cargo#14793)
- fix(test): Make redactions consistent with snapbox (rust-lang/cargo#14790)
- test(gc): Update remaining unordered tests to snapbox (rust-lang/cargo#14785)
- Normalize the `target` paths (rust-lang/cargo#14497)
- rustfix: replace special-case duplicate handling with error (rust-lang/cargo#14782)
- test: Update some emaining unordered tests to snapbox (rust-lang/cargo#14781)
- Change config paths to only check CARGO_HOME for cargo-script (rust-lang/cargo#14749)
- Enable transfer feature in triagebot (rust-lang/cargo#14777)
- Add transactional semantics to `rustfix` (rust-lang/cargo#14747)
- doc: fix `GlobalContext` reference (rust-lang/cargo#14773)
- chore: update handlebars to v6, fix build error (rust-lang/cargo#14772)
2024-11-10 00:23:56 +00:00
est31
935bf6995f Add more places where expressions can occur 2024-11-10 01:18:35 +01:00
est31
7312b41239 Unify disallowed-positions test files into one file
Also make the file have a third mode for where everything is cfg'd out to make sure it's an early error.
2024-11-10 01:18:00 +01:00
Weihang Lo
be30861174
Update cargo 2024-11-09 18:12:21 -05:00
Ralf Jung
f235b6f9c6 give a hint which feature is missing 2024-11-09 23:32:06 +01:00
Ralf Jung
822762c966 require const_impl_trait gate for all conditional and trait const calls 2024-11-09 23:02:20 +01:00
nora
2b469607b4
Exclude relnotes-tracking-issue from needs-triage 2024-11-09 22:45:17 +01:00
bjorn3
0a619dbc5d Pass owned CodegenResults to link_binary
After link_binary the temporary files referenced by CodegenResults are
deleted, so calling link_binary again with the same CodegenResults
should not be allowed.
2024-11-09 21:22:00 +00:00
bjorn3
cb44c0c8b6 Add a default implementation for CodegenBackend::link
As a side effect this should add raw-dylib support to cg_gcc as the
default ArchiveBuilderBuilder that is used implements
create_dll_import_lib. I haven't tested if the raw-dylib support
actually works however.
2024-11-09 20:42:56 +00:00
bors
4adafcf40a Auto merge of #132815 - matthiaskrgr:rollup-nti992u, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #132341 (Reject raw lifetime followed by `'`, like regular lifetimes do)
 - #132363 (Enforce that raw lifetimes must be valid raw identifiers)
 - #132744 (add regression test for #90781)
 - #132754 (Simplify the internal API for declaring command-line options)
 - #132772 (use `download-rustc="if-unchanged"` as a global default)
 - #132774 (Use lld with non-LLVM backends)
 - #132799 (Make `Ty::primitive_symbol` recognize `str`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-09 19:52:46 +00:00
Michael Goulet
a1f9d5bfba Dont suggest use<APIT> 2024-11-09 19:41:53 +00:00
Michael Goulet
ad20906065 Suggest turning APITs into generics in opaque overcaptures 2024-11-09 19:18:22 +00:00
Alona Enraght-Moony
c496af64ed Add as_slice/into_slice for IoSlice/IoSliceMut.
Co-authored-by: Mike Pedersen <mike@mikepedersen.dk>
Co-authored-by: Nathan West <Lucretiel@gmail.com>
2024-11-09 18:52:29 +00:00
Matthias Krüger
3aa1a24799
Rollup merge of #132799 - zachs18:str-primitive-symbol, r=compiler-errors
Make `Ty::primitive_symbol` recognize `str`

Make `Ty::primitive_symbol` recognize `str`, which makes `str` eligible for the "expected primitive, found local type" (and vice versa) [diagnostic](https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs#L1430-L1437) that already exists for other primitives.

<details><summary> diagnostic difference</summary>

```rs
#[allow(non_camel_case_types)]
struct str;

fn foo() {
    let _: &str = "hello";
    let _: &core::primitive::str = &str;
}
```

`rustc --crate-type lib --edition 2021 a.rs`

Current nightly:

```rs
error[E0308]: mismatched types
 --> a.rs:5:19
  |
5 |     let _: &str = "hello";
  |            ----   ^^^^^^^ expected `str`, found a different `str`
  |            |
  |            expected due to this
  |
  = note: expected reference `&str`
             found reference `&'static str`

error[E0308]: mismatched types
 --> a.rs:6:36
  |
6 |     let _: &core::primitive::str = &str;
  |            ---------------------   ^^^^ expected `str`, found a different `str`
  |            |
  |            expected due to this
  |
  = note: expected reference `&str` (`str`)
             found reference `&str` (`str`)

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0308`.
```

With this patch:

```rs
error[E0308]: mismatched types
 --> a.rs:5:19
  |
5 |     let _: &str = "hello";
  |            ----   ^^^^^^^ expected `str`, found a different `str`
  |            |
  |            expected due to this
  |
  = note: str and `str` have similar names, but are actually distinct types
  = note: str is a primitive defined by the language
note: `str` is defined in the current crate
 --> a.rs:2:1
  |
2 | struct str;
  | ^^^^^^^^^^

error[E0308]: mismatched types
 --> a.rs:6:36
  |
6 |     let _: &core::primitive::str = &str;
  |            ---------------------   ^^^^ expected `str`, found a different `str`
  |            |
  |            expected due to this
  |
  = note: str and `str` have similar names, but are actually distinct types
  = note: str is a primitive defined by the language
note: `str` is defined in the current crate
 --> a.rs:2:1
  |
2 | struct str;
  | ^^^^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0308`.
```

</details>
2024-11-09 19:16:46 +01:00
Matthias Krüger
9b47807b13
Rollup merge of #132774 - bjorn3:cranelift_lld, r=lqd
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-09 19:16:45 +01:00
Matthias Krüger
c435fa8c4b
Rollup merge of #132772 - onur-ozkan:download-rustc-default, r=jieyouxu
use `download-rustc="if-unchanged"` as a global default

If `download-rustc` isn't explicitly set and the source is Git-managed, it should be totally okay to utilize "if-unchanged" behaviour. The "dist" profile already sets `download-rustc` to `false`, so this shouldn’t impact anything on CI.

This also resolves an unhandled case where `bootstrap` unexpectedly panics if `"if-unchanged"` was used with a non-Git source. Now we exits gracefully with an error message pointing the problem.
2024-11-09 19:16:45 +01:00
Matthias Krüger
88acd493f9
Rollup merge of #132754 - Zalathar:opts, r=GuillaumeGomez,jieyouxu
Simplify the internal API for declaring command-line options

The internal APIs for declaring command-line options are old, and intimidatingly complex. This PR replaces them with a single function that takes explicit `stability` and `kind` arguments, making it easier to see how each option is handled, and whether it is treated as stable or unstable.

We also don't appear to have any tests for the output of `rustc --help` and similar, so I've added a run-make test to verify that this PR doesn't change any output. (There is already a similar run-make test for rustdoc's help output.)

---

The librustdoc changes are simply adjusting to updated compiler APIs; no functional change intended.

---

A side-effect of these changes is that rustfmt can once again format the entirety of these option declaration lists, which it was not doing before.
2024-11-09 19:16:44 +01:00