Commit Graph

268305 Commits

Author SHA1 Message Date
Ralf Jung
8d0a0b000c remove outdated comment now that Miri is on CI 2024-10-13 12:30:23 +02:00
Ralf Jung
2ae3b1b09a sys/windows: remove miri hack that is only needed for win7 2024-10-13 12:30:23 +02:00
Ralf Jung
90e4f10f6c switch unicode-data back to 'static' 2024-10-13 11:53:06 +02:00
许杰友 Jieyou Xu (Joe)
40ca4d8cd3 Special case error message for a build-fail test that failed check build 2024-10-13 15:59:55 +08:00
Ralf Jung
1ebfd97051 merge const_ipv4 / const_ipv6 feature gate into 'ip' feature gate 2024-10-13 09:55:34 +02:00
Zalathar
3c6ed4e541 Move debugger setup code out of lib.rs 2024-10-13 17:55:46 +11:00
bors
ecf2d1fa4b Auto merge of #131635 - tgross35:rollup-df8il2t, r=tgross35
Rollup of 7 pull requests

Successful merges:

 - #131120 (Stabilize `const_option`)
 - #131334 (Enable sanitizers for loongarch64-unknown-*)
 - #131358 (force "HEAD" for non-CI and `git_upstream_merge_base` for CI environment)
 - #131418 (Use throw intrinsic from stdarch in wasm libunwind)
 - #131579 (Remap path prefix in the panic message of `tests/ui/meta/revision-bad.rs`)
 - #131591 (add latest crash tests)
 - #131626 (remove a couple of redundant String to String conversion)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-13 03:59:00 +00:00
Trevor Gross
39071fdc58
Rollup merge of #131626 - matthiaskrgr:dont_string, r=lqd
remove a couple of redundant String to String conversion
2024-10-12 21:38:38 -05:00
Trevor Gross
ae8342aa90
Rollup merge of #131591 - matthiaskrgr:crashtests, r=jieyouxu
add latest crash tests
2024-10-12 21:38:37 -05:00
Trevor Gross
507dd637a3
Rollup merge of #131579 - jieyouxu:ui-panic-username, r=compiler-errors
Remap path prefix in the panic message of `tests/ui/meta/revision-bad.rs`

Otherwise `error-pattern` on the test run stderr can incorrectly match if the paths in panic backtrace has a matching substring (like if we look for `bar` in the error pattern, but the username is `baron`).

Tested locally by checking run output `./x test .\tests\ui\meta\revision-bad.rs -- -- --nocapture`:

```
--- stderr -------------------------------
thread 'main' panicked at remapped\meta\revision-bad.rs:14:5:
foo
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
------------------------------------------
```

Fixes #130996.
2024-10-12 21:38:37 -05:00
Trevor Gross
415e61c209
Rollup merge of #131418 - coolreader18:wasm-exc-use-stdarch, r=bjorn3
Use throw intrinsic from stdarch in wasm libunwind

Tracking issue: #118168

This is a very belated followup to #121438; now that rust-lang/stdarch#1542 is merged, we can use the intrinsic exported from `core::arch` instead of defining it inline. I also cleaned up the cfgs a bit and added a more detailed comment.
2024-10-12 21:38:36 -05:00
Trevor Gross
ef96679505
Rollup merge of #131358 - onur-ozkan:129528, r=Mark-Simulacrum
force "HEAD" for non-CI and `git_upstream_merge_base` for CI environment

When rust-lang/rust is configured as remote, some of the git logic (for tracking changed files) that uses get_closest_merge_commit starts to produce annoying results as the upstream branch becomes outdated quickly (since it isn't updated with git pull). We can rely on HEAD for non-CI environments as we specifically treat bors commits as merge commits, which also exist on upstream. As for CI environments, we should use `git_upstream_merge_base` to correctly track modified files as bors commits may be in `HEAD` but not yet on the upstream remote.

This is also an alternative fix for https://github.com/rust-lang/rust/issues/129528 since https://github.com/rust-lang/rust/pull/131331 reverts the previous fix attempts.
2024-10-12 21:38:36 -05:00
Trevor Gross
d576cdda7e
Rollup merge of #131334 - heiher:loong-sanitizers, r=Mark-Simulacrum
Enable sanitizers for loongarch64-unknown-*

Enable sanitizers for `loongarch64-unknown-linux-{gnu,musl,ohos}` targets.
2024-10-12 21:38:35 -05:00
Trevor Gross
c8b2f7e458
Rollup merge of #131120 - tgross35:stabilize-const_option, r=RalfJung
Stabilize `const_option`

This makes the following API stable in const contexts:

```rust
impl<T> Option<T> {
    pub const fn as_mut(&mut self) -> Option<&mut T>;
    pub const fn expect(self, msg: &str) -> T;
    pub const fn unwrap(self) -> T;
    pub const unsafe fn unwrap_unchecked(self) -> T;
    pub const fn take(&mut self) -> Option<T>;
    pub const fn replace(&mut self, value: T) -> Option<T>;
}

impl<T> Option<&T> {
    pub const fn copied(self) -> Option<T>
    where T: Copy;
}

impl<T> Option<&mut T> {
    pub const fn copied(self) -> Option<T>
    where T: Copy;
}

impl<T, E> Option<Result<T, E>> {
    pub const fn transpose(self) -> Result<Option<T>, E>
}

impl<T> Option<Option<T>> {
    pub const fn flatten(self) -> Option<T>;
}
```

The following functions make use of the unstable `const_precise_live_drops` feature:

- `expect`
- `unwrap`
- `unwrap_unchecked`
- `transpose`
- `flatten`

Fixes: <https://github.com/rust-lang/rust/issues/67441>
2024-10-12 21:38:35 -05:00
许杰友 Jieyou Xu (Joe)
9f0f0352f7 Error on trying to use revisions in run-make tests
Currently `run-make` tests do not support revisions.
2024-10-13 08:29:53 +08:00
Zalathar
f51088021c Remove the one thing that was checking a directive's original_line 2024-10-13 09:41:40 +11:00
Zalathar
4d59c33780 Rename HeaderLine to DirectiveLine 2024-10-13 09:41:39 +11:00
printfn
46b41b4fc8 Update unicode-width to 0.2.0 2024-10-12 21:57:50 +00:00
Trevor Gross
19f6c17df4 Stabilize const_option
This makes the following API stable in const contexts:

    impl<T> Option<T> {
        pub const fn as_mut(&mut self) -> Option<&mut T>;
        pub const fn expect(self, msg: &str) -> T;
        pub const fn unwrap(self) -> T;
        pub const unsafe fn unwrap_unchecked(self) -> T;
        pub const fn take(&mut self) -> Option<T>;
        pub const fn replace(&mut self, value: T) -> Option<T>;
    }

    impl<T> Option<&T> {
        pub const fn copied(self) -> Option<T>
        where T: Copy;
    }

    impl<T> Option<&mut T> {
        pub const fn copied(self) -> Option<T>
        where T: Copy;
    }

    impl<T, E> Option<Result<T, E>> {
        pub const fn transpose(self) -> Result<Option<T>, E>
    }

    impl<T> Option<Option<T>> {
        pub const fn flatten(self) -> Option<T>;
    }

The following functions make use of the unstable
`const_precise_live_drops` feature:

- `expect`
- `unwrap`
- `unwrap_unchecked`
- `transpose`
- `flatten`

Fixes: <https://github.com/rust-lang/rust/issues/67441>
2024-10-12 17:07:13 -04:00
bors
ef4e8259b5 Auto merge of #131628 - matthiaskrgr:rollup-imbojxz, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #128784 (Check ABI target compatibility for function pointers)
 - #130965 (make `Step` doc-comments more clear)
 - #131239 (Don't assume traits used as type are trait objs in 2021 edition)
 - #131277 (Handle `clippy` cases of `rustc::potential_query_instability` lint)
 - #131503 (More clearly document Stdin::read_line)
 - #131567 (Emit an error for unstable attributes that reference already stable features)
 - #131599 (Shallowly match opaque key in storage)
 - #131617 (remove const_cow_is_borrowed feature gate)

Failed merges:

 - #131616 (merge const_ipv4 / const_ipv6 feature gate into 'ip' feature gate)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-12 21:03:01 +00:00
Matthias Krüger
de72917050
Rollup merge of #131617 - RalfJung:const_cow_is_borrowed, r=tgross35
remove const_cow_is_borrowed feature gate

The two functions guarded by this are still unstable, and there's no reason to require a separate feature gate for their const-ness -- we can just have `cow_is_borrowed` cover both kinds of stability.

Cc #65143
2024-10-12 23:00:59 +02:00
Matthias Krüger
e1df397582
Rollup merge of #131599 - compiler-errors:storage, r=lcnr
Shallowly match opaque key in storage

Using a full eq on the key *and* the hidden type means that in cases where we first ambiguously register a `?t` hidden type then constrain that `?t` to be a type that doesn't actually satisfy its bounds, we end up with bogus entries in the opaque type storage. We should commit to the type in the storage if it's registered.

r? lcnr
2024-10-12 23:00:58 +02:00
Matthias Krüger
b9e083f86b
Rollup merge of #131567 - CastilloDel:reject-unstable-with-accepted-features, r=jieyouxu
Emit an error for unstable attributes that reference already stable features

Closes https://github.com/rust-lang/rust/issues/129814
2024-10-12 23:00:58 +02:00
Matthias Krüger
c0f16828a1
Rollup merge of #131503 - theemathas:stdin_read_line_docs, r=Mark-Simulacrum
More clearly document Stdin::read_line

These are common pitfalls for beginners, so I think it's worth making the subtleties more visible.
2024-10-12 23:00:57 +02:00
Matthias Krüger
d547f2c7eb
Rollup merge of #131277 - ismailarilik:handle-potential-query-instability-lint-for-clippy, r=xFrednet
Handle `clippy` cases of `rustc::potential_query_instability` lint

This PR removes `#![allow(rustc::potential_query_instability)]` line from [`src/tools/clippy/clippy_lints/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/src/tools/clippy/clippy_lints/src/lib.rs#L30) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors.

A somewhat tracking issue: https://github.com/rust-lang/rust/issues/84447
2024-10-12 23:00:57 +02:00
Matthias Krüger
663da00876
Rollup merge of #131239 - VulnBandit:trait-vulnerability, r=lcnr
Don't assume traits used as type are trait objs in 2021 edition

Fixes #127548

When you use a trait as a type, the compiler automatically assumes you meant to use a trait object, which is not always the case.
This PR fixes the bug where you don't need a trait object, so the error message was changed to:
```
error[E0782]: expected a type, found a trait
```
Also fixes some ICEs:
Fixes https://github.com/rust-lang/rust/issues/120241
Fixes https://github.com/rust-lang/rust/issues/120482
Fixes https://github.com/rust-lang/rust/issues/125512
2024-10-12 23:00:56 +02:00
Matthias Krüger
ba75f24888
Rollup merge of #130965 - onur-ozkan:bootstrap-step-trait-doc, r=Mark-Simulacrum
make `Step` doc-comments more clear

Aiming to improve complicated `Step` documentation. Once we merge this, I will update [this page](https://rustc-dev-guide.rust-lang.org/building/bootstrapping/how-bootstrap-does-it.html?highlight=Step#synopsis-of--step) too.
2024-10-12 23:00:56 +02:00
Matthias Krüger
57be141f8a
Rollup merge of #128784 - tdittr:check-abi-on-fn-ptr, r=compiler-errors
Check ABI target compatibility for function pointers

Tracking issue: https://github.com/rust-lang/rust/issues/130260
Related tracking issue: #87678

Compatibility of an ABI for a target was previously only performed on function definitions and `extern` blocks. This PR adds it also to function pointers to be consistent.

This might have broken some of the `tests/ui/` depending on the platform, so a try run seems like a good idea.

Also this might break existing code, because we now emit extra errors. Does this require a crater run?

# Example
```rust
// build with: --target=x86_64-unknown-linux-gnu

// These raise E0570
extern "thiscall" fn foo() {}
extern "thiscall" { fn bar() }

// This did not raise any error
fn baz(f: extern "thiscall" fn()) { f() }
```

# Open Questions
* [x] Should this report a future incompatibility warning like #87678 ?
* [ ] Is this the best place to perform the check?
2024-10-12 23:00:55 +02:00
Matthias Krüger
4bc21e318c remove a couple of redundant String to String conversion 2024-10-12 22:07:46 +02:00
bors
6b9676b454 Auto merge of #131612 - tgross35:rollup-zy3yg4p, r=tgross35
Rollup of 7 pull requests

Successful merges:

 - #130870 (Add suggestion for removing invalid path sep `::` in fn def)
 - #130954 (Stabilize const `ptr::write*` and `mem::replace`)
 - #131233 (std: fix stdout-before-main)
 - #131590 (yeet some clones)
 - #131596 (mark InterpResult as must_use)
 - #131597 (Take a display name for `tool_check_step!`)
 - #131605 (`LLVMConstInt` only allows integer types)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-12 18:28:39 +00:00
Ralf Jung
a0661ec331 remove const_cow_is_borrowed feature gate 2024-10-12 19:48:28 +02:00
Trevor Gross
1b98ae02d8
Rollup merge of #131605 - DianQK:llvm-const-int, r=the8472
`LLVMConstInt` only allows integer types

See https://github.com/llvm/llvm-project/blob/llvmorg-19.1.1/llvm/lib/IR/Core.cpp#L1535-L1546.

r? the8472
2024-10-12 11:08:45 -05:00
Trevor Gross
1e0c5ffdf1
Rollup merge of #131597 - jieyouxu:explicit-check-name, r=Kobzol
Take a display name for `tool_check_step!`

The tool build step already takes a display name, make the tool check step also take a display name to better represent the tool name. I.e. instead of `src/tools/cargo-miri` becoming `cargomiri`, it now becomes `cargo-miri`.

Fixes #131592.
2024-10-12 11:08:45 -05:00
Trevor Gross
421abc81cd
Rollup merge of #131596 - RalfJung:interp-result-must-use, r=jieyouxu
mark InterpResult as must_use

This was forgotten in https://github.com/rust-lang/rust/pull/130885
2024-10-12 11:08:44 -05:00
Trevor Gross
1fb64355c8
Rollup merge of #131590 - matthiaskrgr:clones3, r=compiler-errors
yeet some clones
2024-10-12 11:08:43 -05:00
Trevor Gross
ca3c822068
Rollup merge of #131233 - joboet:stdout-before-main, r=tgross35
std: fix stdout-before-main

Fixes #130210.

Since #124881, `ReentrantLock` uses `ThreadId` to identify threads. This has the unfortunate consequence of breaking uses of `Stdout` before main: Locking the `ReentrantLock` that synchronizes the output will initialize the thread ID before the handle for the main thread is set in `rt::init`. But since that would overwrite the current thread ID, `thread::set_current` triggers an abort.

This PR fixes the problem by using the already initialized thread ID for constructing the main thread handle and allowing `set_current` calls that do not change the thread's ID.
2024-10-12 11:08:43 -05:00
Trevor Gross
8a86f1dd8c
Rollup merge of #130954 - workingjubilee:stabilize-const-mut-fn, r=RalfJung
Stabilize const `ptr::write*` and `mem::replace`

Since `const_mut_refs` and `const_refs_to_cell` have been stabilized, we may now also stabilize the ability to write to places during const evaluation inside our library API. So, we now propose the `const fn` version of `ptr::write` and its variants. This allows us to also stabilize `mem::replace` and `ptr::replace`.
- const `mem::replace`: https://github.com/rust-lang/rust/issues/83164#issuecomment-2338660862
- const `ptr::write{,_bytes,_unaligned}`: https://github.com/rust-lang/rust/issues/86302#issuecomment-2330275266

Their implementation requires an additional internal stabilization of `const_intrinsic_forget`, which is required for `*::write*` and thus `*::replace`. Thus we const-stabilize the internal intrinsics `forget`, `write_bytes`, and `write_via_move`.
2024-10-12 11:08:42 -05:00
Trevor Gross
63a91db022
Rollup merge of #130870 - surechen:fix_130791, r=compiler-errors
Add suggestion for removing invalid path sep `::` in fn def

Add suggestion for removing invalid path separator `::` in function definition.

for example: `fn invalid_path_separator::<T>() {}`

fixes #130791
2024-10-12 11:08:42 -05:00
bors
e200c7f2e1 Auto merge of #131448 - DianQK:fixes-131164, r=onur-ozkan
Update LLVM submodule

Fixes (maybe after beta backport) #131164.

r? nikic
2024-10-12 15:40:46 +00:00
DianQK
1efffe720d
LLVMConstInt only allows integer types 2024-10-12 23:02:15 +08:00
DianQK
4441a89750
Update LLVM submodule 2024-10-12 21:42:13 +08:00
DianQK
49202c7b47
Ignore the download_ci_llvm test 2024-10-12 21:42:11 +08:00
Michael Goulet
470e9fa1af Shallowly match opaque key in storage 2024-10-12 09:10:07 -04:00
Ralf Jung
89623439f7 mark InterpResult as must_use 2024-10-12 13:13:50 +02:00
许杰友 Jieyou Xu (Joe)
52090f0715 Take a display name for tool_check_step! 2024-10-12 19:12:19 +08:00
joboet
9f91c5099f
std: fix stdout-before-main
Fixes #130210.

Since #124881, `ReentrantLock` uses `ThreadId` to identify threads. This has the unfortunate consequence of breaking uses of `Stdout` before main: Locking the `ReentrantLock` that synchronizes the output will initialize the thread ID before the handle for the main thread is set in `rt::init`. But since that would overwrite the current thread ID, `thread::set_current` triggers an abort.

This PR fixes the problem by using the already initialized thread ID for constructing the main thread handle and allowing `set_current` calls that do not change the thread's ID.
2024-10-12 13:01:36 +02:00
Ralf Jung
bc4366b099 miri: avoid cloning AllocExtra 2024-10-12 12:14:28 +02:00
Matthias Krüger
bcd71624d5 add latest crash tests 2024-10-12 11:29:38 +02:00
Matthias Krüger
e5906e1591 yeet some clones 2024-10-12 10:59:12 +02:00
bors
8f8bee4f60 Auto merge of #131581 - tgross35:rollup-vul4kol, r=tgross35
Rollup of 7 pull requests

Successful merges:

 - #124874 (intrinsics fmuladdf{32,64}: expose llvm.fmuladd.* semantics)
 - #130962 (Migrate lib's `&Option<T>` into `Option<&T>`)
 - #131289 (stabilize duration_consts_float)
 - #131310 (Support clobber_abi in MSP430 inline assembly)
 - #131546 (Make unused_parens's suggestion considering expr's attributes.)
 - #131565 (Remove deprecation note in the `non_local_definitions` lint)
 - #131576 (Flatten redundant test module `run_make_support::diff::tests::tests`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-12 08:31:43 +00:00