Commit Graph

268507 Commits

Author SHA1 Message Date
Andreas Molzer
c128b4c433 Fix typo thing->thin referring to pointer 2024-10-13 02:35:09 +02: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
Mark Rousskov
5b2985f8df Add explicit link to PR 2024-10-12 15:20:58 -04:00
Mark Rousskov
276d112d66 Add stabilized APIs 2024-10-12 15:20:06 -04:00
Yoh Deadfall
a495a79db9 Fixed get thread name behavior for FreeBSD 2024-10-12 21:39:30 +03:00
Yoh Deadfall
56c0612003 Fixed pthread get/set name for macOS 2024-10-12 21:38:54 +03: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
Mark Rousskov
cae29b2fc3 Import another update 2024-10-12 10:48:43 -04:00
GnomedDev
8de8f46f78 Swap PredicateObligation to ThinVec 2024-10-12 15:17:16 +01:00
GnomedDev
7ec06b0d1d Swap Vec<PredicateObligation> to type alias 2024-10-12 15:17:08 +01:00
GnomedDev
1ac72b94bc Add ExtractIf for ThinVec 2024-10-12 15:17:03 +01: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
CastilloDel
497100a13c Emit an error for unstable attributes that reference already stable features
Add missing error annotations and .stderr file

Acknowledge comments
2024-10-12 10:19:24 +02:00
Jubilee Young
187c8b0ce9 library: Stabilize const_replace
Depends on stabilizing `const_ptr_write`.

Const-stabilizes:
- `core::mem::replace`
- `core::ptr::replace`
2024-10-12 00:02:38 -07:00
Jubilee Young
ddc367ded7 library: Stabilize const_ptr_write
Const-stabilizes:
- `write`
- `write_bytes`
- `write_unaligned`

In the following paths:
- `core::ptr`
- `core::ptr::NonNull`
- pointer `<*mut T>`

Const-stabilizes the internal `core::intrinsics`:
- `write_bytes`
- `write_via_move`
2024-10-12 00:02:36 -07:00
Jubilee Young
9a523001e3 library: Stabilize const_intrinsic_forget
This is an implicit requirement of stabilizing `const_ptr_write`.

Const-stabilizes the internal `core::intrinsics`:
- `forget`
2024-10-12 00:02:09 -07:00
onur-ozkan
4454fa998c add new CI step: "setup upstream remote"
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-10-12 08:58:39 +03:00