Commit Graph

39149 Commits

Author SHA1 Message Date
Jubilee
2ac56db8a2
Rollup merge of #129712 - randomPoison:trusty-tier-3-fix, r=saethlin
Correct trusty targets to be tier 3

The Trusty targets were added in https://github.com/rust-lang/rust/pull/129490, but in that PR I accidentally marked them as tier 2. This PR corrects the target metadata to mark them as tier 3.
2024-08-28 19:12:55 -07:00
Jubilee
472d164a49
Rollup merge of #129689 - compiler-errors:impl-lifetime, r=michaelwoerister
Move `'tcx` lifetime off of impl and onto methods for `CrateMetadataRef`

Unconstrained type and const variables are not allowed, but unconstrained lifetimes are. This is not very good style, though, and it leads to unnecessary captures of a lifetime in edition 2024 (not that it matters, but it does trigger the edition migration lint).
2024-08-28 19:12:54 -07:00
Jubilee
d2418cb888
Rollup merge of #129467 - dingxiangfei2009:smart-pointer-relax-pointee, r=compiler-errors
derive(SmartPointer): assume pointee from the single generic and better error messages

Fix #129465

Actually RFC says that `#[pointee]` can be inferred when there is no ambiguity, or there is only one generic type parameter so to say.

cc ```@Darksonn```

r? ```@compiler-errors```
2024-08-28 19:12:52 -07:00
Jubilee
9d5f794312
Rollup merge of #129401 - workingjubilee:partial-initialization-of-stabilization, r=dtolnay,joboet
Partially stabilize `feature(new_uninit)`

Finished comment period: https://github.com/rust-lang/rust/issues/63291#issuecomment-2183022955

The following API has been stabilized from https://github.com/rust-lang/rust/issues/63291

```rust
impl<T> Box<T> { pub fn new_uninit() -> Box<MaybeUninit<T>> {…} }
impl<T> Rc<T> { pub fn new_uninit() -> Rc<MaybeUninit<T>> {…} }
impl<T> Arc<T> { pub fn new_uninit() -> Arc<MaybeUninit<T>> {…} }

impl<T> Box<[T]> { pub fn new_uninit_slice(len: usize) -> Box<[MaybeUninit<T>]> {…} }
impl<T> Rc<[T]> { pub fn new_uninit_slice(len: usize) -> Rc<[MaybeUninit<T>]> {…} }
impl<T> Arc<[T]> { pub fn new_uninit_slice(len: usize) -> Arc<[MaybeUninit<T>]> {…} }

impl<T> Box<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Box<T> {…} }
impl<T> Box<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Box<[T]> {…} }
impl<T> Rc<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Rc<T> {…} }
impl<T> Rc<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Rc<[T]> {…} }
impl<T> Arc<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Arc<T> {…} }
impl<T> Arc<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Arc<[T]> {…} }
```

The remaining API is split between new issues
- `new_zeroed_alloc`: https://github.com/rust-lang/rust/issues/129396
- `box_uninit_write`: https://github.com/rust-lang/rust/issues/129397

All relevant code is thus either stabilized or split out of that issue, so this closes #63291 as, with the FCP concluded, that issue has served its purpose.

try-job: x86_64-rust-for-linux
2024-08-28 19:12:52 -07:00
Jubilee
26f75a65d7
Rollup merge of #129343 - estebank:time-version, r=jieyouxu
Emit specific message for time<=0.3.35

```
error[E0282]: type annotations needed for `Box<_>`
  --> /home/gh-estebank/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.34/src/format_description/parse/mod.rs:83:9
   |
83 |     let items = format_items
   |         ^^^^^
...
86 |     Ok(items.into())
   |              ---- type must be known at this point
   |
   = note: this is an inference error on `time` caused by a change in Rust 1.80.0; update `time` to version `>=0.3.36`
```

Partially mitigate the fallout from https://github.com/rust-lang/rust/issues/127343. Although the biggest benefit of this would have been if we had had this in 1.80 before it became stable, the long-tail of that change will be felt for a *long* time, so better late than never.

We can also emit an even more targeted error instead of this inference failure.
2024-08-28 19:12:50 -07:00
Jubilee
2572e0e8c9
Rollup merge of #129170 - artemagvanian:span-to-location, r=celinval
Add an ability to convert between `Span` and `visit::Location`

AFAIK, there is no way to create a `Location` from a `Span` because its only field is private. This makes it impossible to use visitor methods like `visit_statement` or `visit_terminator`.

This PR adds an implementation for`From<Span>` for `Location` to fix this.

r? ```@celinval```
2024-08-28 19:12:50 -07:00
Jubilee
4c8c9e092d
Rollup merge of #128192 - mrkajetanp:feature-detect, r=Amanieu
rustc_target: Add various aarch64 features

Add various aarch64 features already supported by LLVM and Linux.
Additionally include some comment fixes to ensure consistency of feature names with the Arm ARM.
Compiler support for features added to stdarch by https://github.com/rust-lang/stdarch/pull/1614.
Tracking issue for unstable aarch64 features is https://github.com/rust-lang/rust/issues/127764.

List of added features:

- FEAT_CSSC
- FEAT_ECV
- FEAT_FAMINMAX
- FEAT_FLAGM2
- FEAT_FP8
- FEAT_FP8DOT2
- FEAT_FP8DOT4
- FEAT_FP8FMA
- FEAT_HBC
- FEAT_LSE128
- FEAT_LSE2
- FEAT_LUT
- FEAT_MOPS
- FEAT_LRCPC3
- FEAT_SVE_B16B16
- FEAT_SVE2p1
- FEAT_WFxT
- FEAT_SME
- FEAT_SME_F16F16
- FEAT_SME_F64F64
- FEAT_SME_F8F16
- FEAT_SME_F8F32
- FEAT_SME_FA64
- FEAT_SME_I16I64
- FEAT_SME_LUTv2
- FEAT_SME2
- FEAT_SME2p1
- FEAT_SSVE_FP8DOT2
- FEAT_SSVE_FP8DOT4
- FEAT_SSVE_FP8FMA

FEAT_FPMR is added in the first commit and then removed in a separate one to highlight it being removed from upstream LLVM 19. The intention is for it to be detectable at runtime through stdarch but not have a corresponding Rust compile-time feature.
2024-08-28 19:12:49 -07:00
Ben Kimock
950437a035 Use a reduced recursion limit in the MIR inliner's cycle breaker 2024-08-28 19:52:23 -04:00
Nicole LeGare
d8129a1c01 Correct trusty targets to be tier 3 2024-08-28 16:15:36 -07:00
bors
acb4e8b625 Auto merge of #127537 - veluca93:struct_tf, r=BoxyUwU
Implement a first version of RFC 3525: struct target features

This PR is an attempt at implementing https://github.com/rust-lang/rfcs/pull/3525, behind a feature gate `struct_target_features`.

There's obviously a few tasks that ought to be done before this is merged; in no particular order:
- add proper error messages
- add tests
- create a tracking issue for the RFC
- properly serialize/deserialize the new target_features field in `rmeta` (assuming I even understood that correctly :-))

That said, as I am definitely not a `rustc` expert, I'd like to get some early feedback on the overall approach before fixing those things (and perhaps some pointers for `rmeta`...), hence this early PR :-)

Here's an example piece of code that I have been using for testing - with the new code, the calls to intrinsics get correctly inlined:
```rust
#![feature(struct_target_features)]

use std::arch::x86_64::*;

/*
// fails to compile
#[target_feature(enable = "avx")]
struct Invalid(u32);
*/

#[target_feature(enable = "avx")]
struct Avx {}

#[target_feature(enable = "sse")]
struct Sse();

/*
// fails to compile
extern "C" fn bad_fun(_: Avx) {}
*/

/*
// fails to compile
#[inline(always)]
fn inline_fun(_: Avx) {}
*/

trait Simd {
    fn do_something(&self);
}

impl Simd for Avx {
    fn do_something(&self) {
        unsafe {
            println!("{:?}", _mm256_setzero_ps());
        }
    }
}

impl Simd for Sse {
    fn do_something(&self) {
        unsafe {
            println!("{:?}", _mm_setzero_ps());
        }
    }
}

struct WithAvx {
    #[allow(dead_code)]
    avx: Avx,
}

impl Simd for WithAvx {
    fn do_something(&self) {
        unsafe {
            println!("{:?}", _mm256_setzero_ps());
        }
    }
}

#[inline(never)]
fn dosomething<S: Simd>(simd: &S) {
    simd.do_something();
}

fn main() {
    /*
    // fails to compile
    Avx {};
    */

    if is_x86_feature_detected!("avx") {
        let avx = unsafe { Avx {} };
        dosomething(&avx);
        dosomething(&WithAvx { avx });
    }
    if is_x86_feature_detected!("sse") {
        dosomething(&unsafe { Sse {} })
    }
}
```

Tracking:

- https://github.com/rust-lang/rust/issues/129107
2024-08-28 22:54:55 +00:00
Esteban Küber
b013a3ddf0 Emit specific message for time<0.3.35 inference failure
```
error[E0282]: type annotations needed for `Box<_>`
  --> ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.34/src/format_description/parse/mod.rs:83:9
   |
83 |     let items = format_items
   |         ^^^^^
...
86 |     Ok(items.into())
   |              ---- type must be known at this point
   |
   = note: this is an inference error on crate `time` caused by a change in Rust 1.80.0; update `time` to version `>=0.3.35`
```

Partially address #127343.
2024-08-28 22:53:02 +00:00
Kornel
88b9edc9db
fmt-debug option
Allows disabling `fmt::Debug` derive and debug formatting.
2024-08-28 23:32:40 +01:00
Rain
ea6df5c147 Update stacker to 0.1.17
The main new feature is support for detecting the current stack size on
illumos. (See my blog post [1] for the context which led to this.)

[1]: https://sunshowers.io/posts/rustc-segfault-illumos/
2024-08-28 15:02:41 -07:00
Ding Xiang Fei
39148351bd
derive(SmartPointer): assume pointee from the single generic and better error messages 2024-08-29 01:39:52 +08:00
Michael Goulet
19296ca23c Move 'tcx lifetime off of impl and onto methods 2024-08-28 11:44:58 -04:00
Matthias Krüger
4854fa799d
Rollup merge of #129686 - Zalathar:source-region, r=compiler-errors
coverage: Rename `CodeRegion` to `SourceRegion`

LLVM uses the word "code" to refer to a particular kind of coverage mapping. This unrelated usage of the word is confusing, and makes it harder to introduce types whose names correspond to the LLVM classification of coverage kinds.

No functional changes.
2024-08-28 17:12:21 +02:00
Matthias Krüger
472c9645fb
Rollup merge of #129667 - dev-ardi:rustc_driver-cleanup, r=michaelwoerister
Rustc driver cleanup

This adds a few comments to the driver to clarify a bit what's happening and does some cleanup.
2024-08-28 17:12:19 +02:00
Matthias Krüger
5c2996d750
Rollup merge of #129666 - RalfJung:raw-eq-align, r=compiler-errors
interpret: add missing alignment check in raw_eq

The intrinsic requires alignment, but we forgot to check for that in Miri and const-eval.
2024-08-28 17:12:19 +02:00
Matthias Krüger
29188a54b3
Rollup merge of #129657 - jswrenn:transmute-name, r=compiler-errors
Rename `BikeshedIntrinsicFrom` to `TransmuteFrom`

As our implementation of MCP411 nears completion and we begin to solicit testing, it's no longer reasonable to expect testers to type or remember `BikeshedIntrinsicFrom`. The name degrades the ease-of-reading of documentation, and the overall experience of using compiler safe transmute.

Tentatively, we'll instead adopt `TransmuteFrom`.

This name seems to be the one most likely to be stabilized, after discussion on Zulip [1]. We may want to revisit the ordering of `Src` and `Dst` before stabilization, at which point we'd likely consider `TransmuteInto` or `Transmute`.

[1] https://rust-lang.zulipchat.com/#narrow/stream/216762-project-safe-transmute/topic/What.20should.20.60BikeshedIntrinsicFrom.60.20be.20named.3F

Tracking Issue: https://github.com/rust-lang/rust/issues/99571

r​? `@compiler-errors`
2024-08-28 17:12:18 +02:00
Matthias Krüger
39e840f804
Rollup merge of #129613 - RalfJung:interpret-target-feat, r=saethlin
interpret: do not make const-eval query result depend on tcx.sess

The check against calling functions with missing target features uses `tcx.sess` to determine which target features are available. However, this can differ between different crates in a crate graph, so the same const-eval query can come to different conclusions about whether a constant evaluates successfully or not -- which is bad, we should consistently get the same result everywhere.
2024-08-28 17:12:17 +02:00
Matthias Krüger
3456b1d245
Rollup merge of #129608 - RalfJung:const-eval-ub-checks, r=saethlin
const-eval: do not make UbChecks behavior depend on current crate's flags

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

Let's see if we can get away with just always enabling these checks.
2024-08-28 17:12:17 +02:00
Matthias Krüger
99453cea9d
Rollup merge of #129421 - jdonszelmann:naked-repr-align-functions, r=workingjubilee,compiler-errors
add repr to the allowlist for naked functions

Fixes #129412 (combining unstable features #90957 (`#![feature(naked_functions)]`) and #82232 (`#![feature(fn_align)]`)
2024-08-28 17:12:11 +02:00
Zalathar
46e1b5b6dd coverage: Rename CodeRegion to SourceRegion
LLVM uses the word "code" to refer to a particular kind of coverage mapping.
This unrelated usage of the word is confusing, and makes it harder to introduce
types whose names correspond to the LLVM classification of coverage kinds.
2024-08-28 22:17:42 +10:00
Zalathar
5e162a8f48 coverage: Simplify some debug logging 2024-08-28 22:07:57 +10:00
Zalathar
f61f34f4b8 coverage: CodeRegion is never stored in an arena
This might have been left over when coverage regions were stored in individual
MIR statements, instead of a separate table attached to the MIR body.
2024-08-28 22:03:48 +10:00
Orion Gonzalez
c35e01e48e clarify what term can be 2024-08-28 13:11:02 +02:00
Orion Gonzalez
a007d349a1 clarify a few things 2024-08-28 13:11:02 +02:00
Orion Gonzalez
b218623ea0 cleanup make_input 2024-08-28 13:03:18 +02:00
Orion Gonzalez
ddcb073c53 replace is_some() -> unwrap with if let 2024-08-28 13:03:15 +02:00
Luca Versari
7eb4cfeace Implement RFC 3525. 2024-08-28 09:54:23 +02:00
bors
748c54848d Auto merge of #129546 - compiler-errors:no-pred-on, r=fee1-dead
Get rid of `predicates_defined_on`

This is the uncontroversial part of #129532. This simply inlines the `predicates_defined_on` into into `predicates_of`. Nothing should change here logically.
2024-08-28 04:41:43 +00:00
bors
d9a2cc4dae Auto merge of #128506 - compiler-errors:by-move-body, r=cjgillot
Stop storing a special inner body for the coroutine by-move body for async closures

...and instead, just synthesize an item which is treated mostly normally by the MIR pipeline.

This PR does a few things:
* We synthesize a new `DefId` for the by-move body of a closure, which has its `mir_built` fed with the output of the `ByMoveBody` MIR transformation, and some other relevant queries.
* This has the `DefKind::ByMoveBody`, which we use to distinguish it from "real" bodies (that come from HIR) which need to be borrowck'd. Introduce `TyCtxt::is_synthetic_mir` to skip over `mir_borrowck` which is called by `mir_promoted`; borrowck isn't really possible to make work ATM since it heavily relies being called on a body generated from HIR, and is redundant by the construction of the by-move-body.
* Remove the special `PassManager` hacks for handling the inner `by_move_body` stored within the coroutine's mir body. Instead, this body is fed like a regular MIR body, so it's goes through all of the `tcx.*_mir` stages normally (build -> promoted -> ...etc... -> optimized) .
* Remove the `InstanceKind::ByMoveBody` shim, since now we have a "regular" def id, we can just use `InstanceKind::Item`. This also allows us to remove the corresponding hacks from codegen, such as in `fn_sig_for_fn_abi` .

Notable remarks:
* ~~I know it's kind of weird to be using `DefKind::Closure` here, since it's not a distinct closure but just a new MIR body. I don't believe it really matters, but I could also use a different `DefKind`... maybe one that we could use for synthetic MIR bodies in general?~~ edit: We're doing this now.
2024-08-27 23:30:24 +00:00
bors
1f12b9b0fd Auto merge of #129665 - matthiaskrgr:rollup-hy23k7d, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #129507 (make it possible to enable const_precise_live_drops per-function)
 - #129581 (exit: explain our expectations for the exit handlers registered in a Rust program)
 - #129634 (Fix tidy to allow `edition = "2024"` in `Cargo.toml`)
 - #129635 (Use unsafe extern blocks throughout the compiler)
 - #129645 (Fix typos in floating-point primitive type docs)
 - #129648 (More `unreachable_pub`)
 - #129649 (ABI compat check: detect unadjusted ABI mismatches)
 - #129652 (fix Pointer to reference conversion docs)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-27 20:57:15 +00:00
Vadim Petrochenkov
05bd36de50 linker: Better support alternative static library naming on MSVC
Previously `libname.a` naming was supported as a fallback when producing rlibs, but not when producing executables or dynamic libraries
2024-08-27 22:13:31 +03:00
Vadim Petrochenkov
a1c36c6ae9 linker: Synchronize native library search in rustc and linker 2024-08-27 22:13:31 +03:00
bors
ab869e094a Auto merge of #129513 - cjgillot:fast-source-span, r=petrochenkov
Do not call source_span when not tracking dependencies.

Split from https://github.com/rust-lang/rust/pull/127241
2024-08-27 18:33:26 +00:00
Ralf Jung
e17be955bb interpret: add missing alignment check in raw_eq 2024-08-27 19:29:52 +02:00
Jubilee Young
2535a0f776 compiler: Remove feature(new_uninit) 2024-08-27 10:17:05 -07:00
Matthias Krüger
5e226dd18b
Rollup merge of #129649 - RalfJung:unadjusted-abi-mismatch, r=petrochenkov
ABI compat check: detect unadjusted ABI mismatches
2024-08-27 18:59:30 +02:00
Matthias Krüger
489eb230dd
Rollup merge of #129648 - nnethercote:unreachable_pub-2, r=Urgau
More `unreachable_pub`

Add `unreachable_pub` checking to some more compiler crates. A follow-up to #126013.

r? ``@Urgau``
2024-08-27 18:59:29 +02:00
Matthias Krüger
3299e30abc
Rollup merge of #129635 - compiler-errors:unsafe-blocks, r=spastorino
Use unsafe extern blocks throughout the compiler

Making this change in preparation for edition 2024.

r? spastorino
2024-08-27 18:59:28 +02:00
Matthias Krüger
849c240c1e
Rollup merge of #129507 - RalfJung:per-fn-const_precise_live_drops, r=wesleywiser
make it possible to enable const_precise_live_drops per-function

This makes const_precise_live_drops work with rustc_allow_const_fn_unstable so that we can stabilize individual functions that rely on const_precise_live_drops.

The goal is that we can use that to stabilize some of https://github.com/rust-lang/rust/issues/67441 without having to stabilize const_precise_live_drops.
2024-08-27 18:59:27 +02:00
jdonszelmann
c3000ad3ba
add repr to the allowlist for naked functions, and test that it works 2024-08-27 17:17:47 +02:00
Jack Wrenn
1ad218f3af safe transmute: Rename BikeshedIntrinsicFrom to TransmuteFrom
As our implementation of MCP411 nears completion and we begin to
solicit testing, it's no longer reasonable to expect testers to
type or remember `BikeshedIntrinsicFrom`. The name degrades the
ease-of-reading of documentation, and the overall experience of
using compiler safe transmute.

Tentatively, we'll instead adopt `TransmuteFrom`.

This name seems to be the one most likely to be stabilized, after
discussion on Zulip [1]. We may want to revisit the ordering of
`Src` and `Dst` before stabilization, at which point we'd likely
consider `TransmuteInto` or `Transmute`.

[1] https://rust-lang.zulipchat.com/#narrow/stream/216762-project-safe-transmute/topic/What.20should.20.60BikeshedIntrinsicFrom.60.20be.20named.3F
2024-08-27 14:05:54 +00:00
Kajetan Puchalski
3a0fbb5d4e rustc_codegen_llvm: Filter out unavailable LLVM features
Convert to_llvm_features to return Option<LLVMFeature> so that it can
return None if the requested feature is not available for the current
LLVM version.

Add match rules to filter out aarch64 features not available in LLVM 17.
2024-08-27 11:13:01 +01:00
Kajetan Puchalski
4fc4019cbc rustc_target: Remove fpmr target feature
FEAT_FPMR has been removed from upstream LLVM as of LLVM 19.
Remove the feature from the target features list and temporarily hack
the LLVM codegen to always enable it until the minimum LLVM version is
bumped to 19.
2024-08-27 11:11:47 +01:00
Kajetan Puchalski
c3518067c7 rustc_target: Add SME aarch64 features
Add SME aarch64 features already supported by LLVM and Linux.

This commit adds compiler support for the following features:

- FEAT_SME
- FEAT_SME_F16F16
- FEAT_SME_F64F64
- FEAT_SME_F8F16
- FEAT_SME_F8F32
- FEAT_SME_FA64
- FEAT_SME_I16I64
- FEAT_SME_LUTv2
- FEAT_SME2
- FEAT_SME2p1
- FEAT_SSVE_FP8DOT2
- FEAT_SSVE_FP8DOT4
- FEAT_SSVE_FP8FMA
2024-08-27 11:11:47 +01:00
Kajetan Puchalski
4f847bd326 rustc_target: Add various aarch64 features
Add various aarch64 features already supported by LLVM and Linux.

The features are marked as unstable using a newly added symbol, i.e.
aarch64_unstable_target_feature.

Additionally include some comment fixes to ensure consistency of
feature names with the Arm ARM and support for architecture version
target features up to v9.5a.

This commit adds compiler support for the following features:

- FEAT_CSSC
- FEAT_ECV
- FEAT_FAMINMAX
- FEAT_FLAGM2
- FEAT_FP8
- FEAT_FP8DOT2
- FEAT_FP8DOT4
- FEAT_FP8FMA
- FEAT_FPMR
- FEAT_HBC
- FEAT_LSE128
- FEAT_LSE2
- FEAT_LUT
- FEAT_MOPS
- FEAT_LRCPC3
- FEAT_SVE_B16B16
- FEAT_SVE2p1
- FEAT_WFxT
2024-08-27 11:11:47 +01:00
Ralf Jung
ab7b03e3f4 ABI compat check: detect unadjusted ABI mismatches 2024-08-27 09:04:59 +02:00
Trevor Gross
8ea70e9537
Rollup merge of #129536 - beetrees:f16-f128-inline-asm-aarch64, r=Amanieu
Add `f16` and `f128` inline ASM support for `aarch64`

Adds `f16` and `f128` inline ASM support for `aarch64`. SIMD vector types are taken from [the ARM intrinsics list](https://developer.arm.com/architectures/instruction-sets/intrinsics/#f:`@navigationhierarchiesreturnbasetype=[float]&f:@navigationhierarchieselementbitsize=[16]&f:@navigationhierarchiesarchitectures=[A64]).` Based on the work of `@lengrongfu` in #127043.

Relevant issue: #125398
Tracking issue: #116909

`@rustbot` label +F-f16_and_f128

try-job: aarch64-gnu
try-job: aarch64-apple
2024-08-27 01:46:53 -05:00
Trevor Gross
3c131a3f54
Rollup merge of #129490 - randomPoison:trusty-os-support, r=Urgau
Add Trusty OS as tier 3 target

This PR adds support for the [Trusty secure operating system](https://source.android.com/docs/security/features/trusty) as a Tier 3 supported target. This upstreams [the patch that we have been using](https://cs.android.com/android/platform/superproject/+/master:external/rust/crates/libc/patches/trusty.patch;l=1;drc=122e586e93a534160230dc10ae3474cf31dd8f7f) internally. This also revives https://github.com/rust-lang/rust/pull/103895 which was closed due to inactivity, and is being resumed now that time allows.

And MCP has already been done for adding this platform: rust-lang/compiler-team/issues/568

# Target Tier Policy Acknowledgements

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

- Nicole LeGare (``@randomPoison)``
- Stephen Crane (``@rinon)``
- As a fallback trusty-dev-team@google.com can be contacted

> Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.

The two new Trusty targets, `aarch64-unknown-trusty` and `armv7-unknown-trusty` both follow the existing naming convention for similar targets.

> Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it.

👍

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

There are no known legal issues or license incompatibilities.

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.

👍

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

This PR only adds the targets for the platform. `std` support will be added once platform support is added to the libc crate, which depends on the language targets being added to rustc.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.

👍

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via ``@)`` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.

👍

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

👍

> Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target. (Having support in a fork of the backend is not sufficient, it must be upstream.)

👍
2024-08-27 01:46:52 -05:00
Trevor Gross
42cd3c60df
Rollup merge of #129418 - petrochenkov:libsearch2, r=jieyouxu
rustc: Simplify getting sysroot library directory

It was very non-obvious that `sess.target_tlib_path`, `make_target_lib_path(...)`, and `sess.target_filesearch(...).search_paths()` result in the same sysroot library directory paths.
They are however, indeed the same, because `sess.target_tlib_path` is initialized to `make_target_lib_path(...)` on `Session` creation, and they are used interchangeably.

There are still some redundant calls to `make_target_lib_path` and other inconsistent ways to obtain sysroot directories, but fixing that requires some behavior changes, while this PR is a pure refactoring.
Some places in the compiler even disagree on the number of sysroots - 1 (explicit `--sysroot` *or* default sysroot), 2 (explicit `--sysroot` *and* default sysroot), or an unclear number of `sysroot_candidates` every of which is considered.
The logic currently using `sess.target_tlib_path` or equivalents assumes one sysroot.
2024-08-27 01:46:51 -05:00
Trevor Gross
427019e37f
Rollup merge of #128942 - RalfJung:interpret-weak-memory, r=saethlin
miri weak memory emulation: put previous value into initial store buffer

Fixes https://github.com/rust-lang/miri/issues/2164 by doing a read before each atomic write so that we can initialize the store buffer. The read suppresses memory access hooks and UB exceptions, to avoid otherwise influencing the program behavior. If the read fails, we store that as `None` in the store buffer, so that when an atomic read races with the first atomic write to some memory and previously the memory was uninitialized, we can report UB due to reading uninit memory.

``@cbeuw`` this changes a bit the way we initialize the store buffers. Not sure if you still remember all this code, but if you could have a look to make sure this still makes sense, that would be great. :)

r? ``@saethlin``
2024-08-27 01:46:51 -05:00
Trevor Gross
d2ff033302
Rollup merge of #128731 - RalfJung:simd-shuffle-vector, r=workingjubilee
simd_shuffle intrinsic: allow argument to be passed as vector

See https://github.com/rust-lang/rust/issues/128738 for context.

I'd like to get rid of [this hack](6c0b89dfac/compiler/rustc_codegen_ssa/src/mir/block.rs (L922-L935)). https://github.com/rust-lang/rust/pull/128537 almost lets us do that since constant SIMD vectors will then be passed as immediate arguments. However, simd_shuffle for some reason actually takes an *array* as argument, not a vector, so the hack is still required to ensure that the array becomes an immediate (which then later stages of codegen convert into a vector, as that's what LLVM needs).

This PR prepares simd_shuffle to also support a vector as the `idx` argument. Once this lands, stdarch can hopefully be updated to pass `idx` as a vector, and then support for arrays can be removed, which finally lets us get rid of that hack.
2024-08-27 01:46:50 -05:00
Trevor Gross
9c26ebe32e
Rollup merge of #126985 - Mrmaxmeier:dwarf-embed-source, r=davidtwco
Implement `-Z embed-source` (DWARFv5 source code embedding extension)

Implement https://github.com/rust-lang/compiler-team/issues/764 MCP which adds an unstable flag that exposes LLVM's [DWARFv5 source code embedding](https://dwarfstd.org/issues/180201.1.html) support.
2024-08-27 01:46:49 -05:00
Nicholas Nethercote
22cdd632f1 Add warn(unreachable_pub) to rustc_llvm. 2024-08-27 15:28:26 +10:00
Nicholas Nethercote
e7f1922abd Add warn(unreachable_pub) to rustc_lint_defs. 2024-08-27 15:25:49 +10:00
Nicholas Nethercote
f10284162f Add warn(unreachable_pub) to rustc_lint. 2024-08-27 15:24:11 +10:00
Nicholas Nethercote
6c84c55c9f Add warn(unreachable_pub) to rustc_lexer. 2024-08-27 15:12:46 +10:00
Nicholas Nethercote
a941a4be77 Add warn(unreachable_pub) to rustc_interface. 2024-08-27 15:11:54 +10:00
Nicholas Nethercote
688792715b Add warn(unreachable_pub) to rustc_infer. 2024-08-27 14:47:56 +10:00
Nicholas Nethercote
46fe09f3f3 Add warn(unreachable_pub) to rustc_index. 2024-08-27 14:33:24 +10:00
Nicholas Nethercote
37becf7bdc Add warn(unreachable_pub) to rustc_incremental. 2024-08-27 14:30:20 +10:00
Nicholas Nethercote
7fc0444340 Add warn(unreachable_pub) to rustc_hir_typeck. 2024-08-27 14:22:07 +10:00
Nicholas Nethercote
3aae994ca2 Add warn(unreachable_pub) to rustc_hir_pretty. 2024-08-27 13:25:40 +10:00
Nicholas Nethercote
5acf4e7b4b Add warn(unreachable_pub) to rustc_hir_analysis. 2024-08-27 13:14:50 +10:00
Nicholas Nethercote
bffa2244ed Add warn(unreachable_pub) to rustc_hir. 2024-08-27 12:59:20 +10:00
Nicholas Nethercote
fa18140994 Add warn(unreachable_pub) to rustc_graphviz. 2024-08-27 12:58:29 +10:00
Nicholas Nethercote
a510813e03 Add warn(unreachable_pub) to rustc_fluent_macro. 2024-08-27 12:56:54 +10:00
Nicholas Nethercote
0d8d05c07f Add warn(unreachable_pub) to rustc_feature. 2024-08-27 12:55:54 +10:00
Nicholas Nethercote
df5fbf05a1 Add warn(unreachable_pub) to rustc_expand.
Plus a tiny bit of reformatting.
2024-08-27 12:40:38 +10:00
Nicholas Nethercote
5fd503ab44 Add warn(unreachable_pub) to rustc_errors. 2024-08-27 12:03:37 +10:00
Nicholas Nethercote
2b5621280c Add warn(unreachable_pub) to rustc_error_messages. 2024-08-27 11:52:08 +10:00
Nicholas Nethercote
d607cfb336 Add warn(unreachable_pub) to rustc_error_codes. 2024-08-27 11:49:59 +10:00
Nicholas Nethercote
e81fad2b4d Add warn(unreachable_pub) to rustc_driver_impl. 2024-08-27 11:47:25 +10:00
Michael Goulet
38e62b9841 Use unsafe extern blocks throughout the compiler 2024-08-26 19:51:05 -04:00
Michael Goulet
93295ff6dc Remove some unnecessary TODOs 2024-08-26 18:44:20 -04:00
Michael Goulet
4609841c07 Stop using a special inner body for the coroutine by-move body for async closures 2024-08-26 18:44:19 -04:00
Matthias Krüger
b3b6baf833
Rollup merge of #129626 - compiler-errors:explicit-named, r=fmease
Remove `ParamMode::ExplicitNamed`

This was introduced as a hack to improve a diagnostics suggestion in #61679. It was subsequently broken, but also it was an incomplete hack that I don't believe we need to support, so let's just remove it.
2024-08-27 00:42:02 +02:00
Matthias Krüger
3d8d9da6a0
Rollup merge of #129625 - compiler-errors:generic-args-mode, r=fmease
Rename `ParenthesizedGenericArgs` to `GenericArgsMode`

A bit easier to digest name. Broken out of a PR implementing return type notation.
2024-08-27 00:42:02 +02:00
Matthias Krüger
90a1b6d158
Rollup merge of #129622 - bjorn3:less_unstable, r=lqd
Remove a couple of unused feature enables
2024-08-27 00:42:01 +02:00
Matthias Krüger
53f5294c0f
Rollup merge of #129340 - stephen-lazaro:u/slazaro/issue-129274, r=compiler-errors
Remove Duplicate E0381 Label

Aims to resolve https://github.com/rust-lang/rust/issues/129274, and adds a test for the case.

Essentially, we are duplicating this span for some reason. For now, I'm just using a set to collect the spans rather than the vec. I imagine there's probably no real reason to inspect duplicates in this area, but if I'm wrong I can adjust to collect "seen spans" in just the point where this label is applied.

I'm not sure why it's producing duplicate spans. Looks like this has been this way for a while? I think it gives the duplicate label on 1.75.0 for example.
2024-08-27 00:42:00 +02:00
Matthias Krüger
d4d4b6b4fa
Rollup merge of #129250 - estebank:issue-129205, r=compiler-errors
Do not ICE on non-ADT rcvr type when looking for crate version collision

When looking for multiple versions of the same crate, do not blindly construct the receiver type.

Follow up to #128786.
Fixes #129205
Fixes #129216
2024-08-27 00:42:00 +02:00
Matthias Krüger
29923b6801
Rollup merge of #129032 - jswrenn:transmute-method, r=compiler-errors
Document & implement the transmutation modeled by `BikeshedIntrinsicFrom`

Documents that `BikeshedIntrinsicFrom` models transmute-via-union, which is slightly more expressive than the transmute-via-cast implemented by `transmute_copy`. Additionally, we provide an implementation of transmute-via-union as a method on the `BikeshedIntrinsicFrom` trait with additional documentation on the boundary between trait invariants and caller obligations.

Whether or not transmute-via-union is the right kind of transmute to model remains up for discussion [1]. Regardless, it seems wise to document the present behavior.

[1] https://rust-lang.zulipchat.com/#narrow/stream/216762-project-safe-transmute/topic/What.20'kind'.20of.20transmute.20to.20model.3F/near/426331967

Tracking Issue: https://github.com/rust-lang/rust/issues/99571

r? `@compiler-errors`

cc `@scottmcm,` `@Lokathor`
2024-08-27 00:41:59 +02:00
Matthias Krüger
110c3df7fd
Rollup merge of #126013 - nnethercote:unreachable_pub, r=Urgau
Add `#[warn(unreachable_pub)]` to a bunch of compiler crates

By default `unreachable_pub` identifies things that need not be `pub` and tells you to make them `pub(crate)`. But sometimes those things don't need any kind of visibility. So they way I did these was to remove the visibility entirely for each thing the lint identifies, and then add `pub(crate)` back in everywhere the compiler said it was necessary. (Or occasionally `pub(super)` when context suggested that was appropriate.) Tedious, but results in more `pub` removal.

There are plenty more crates to do but this seems like enough for a first PR.

r? `@compiler-errors`
2024-08-27 00:41:57 +02:00
Michael Goulet
c61f85b6dd Don't make pattern nonterminals match statement nonterminals 2024-08-26 18:30:15 -04:00
Michael Goulet
2db1d2e261 Rename ParenthesizedGenericArgs to GenericArgsMode 2024-08-26 16:48:13 -04:00
Michael Goulet
b4d3fa4829 Remove ParamMode::ExplicitNamed 2024-08-26 16:47:52 -04:00
bjorn3
4e1555462f Remove a couple of unused feature enables 2024-08-26 19:52:14 +00:00
Esteban Küber
00c435d9b3 Do not ICE on non-ADT rcvr type when looking for crate version collision
When looking for multiple versions of the same crate, do not blindly construct the receiver type.

Follow up to #128786. Fix #129205.
2024-08-26 13:02:21 -04:00
Matthias Krüger
114e60ff79
Rollup merge of #129600 - traviscross:TC/tie-impl_trait_overcaptures-to-rust-2024, r=compiler-errors
Tie `impl_trait_overcaptures` lint to Rust 2024

The `impl_trait_overcaptures` lint is part of the migration to Rust 2024 and the Lifetime Capture Rules 2024.  Now that we've stabilized precise capturing (RFC 3617), let's tie this lint to the `rust_2024_compatibility` lint group.

Tracking:

- https://github.com/rust-lang/rust/issues/117587

r? `@compiler-errors`
2024-08-26 17:25:34 +02:00
Matthias Krüger
1d58ac0ff7
Rollup merge of #129597 - bvanjoi:resolve, r=petrochenkov
mv `build_reduced_graph_for_external_crate_res` into Resolver

`build_reduced_graph_for_external_crate_res` is only related to `Resolver`, so move it there.

r? `@petrochenkov`
2024-08-26 17:25:34 +02:00
Ralf Jung
7a290fce90 interpret: do not make const-eval query result depend on tcx.sess 2024-08-26 17:08:52 +02:00
Ralf Jung
7ea2981605 const-eval: do not make UbChecks behavior depend on current crate's flags 2024-08-26 13:56:40 +02:00
bors
22572d0994 Auto merge of #129508 - RalfJung:transient-locals, r=cjgillot
const checking: properly compute the set of transient locals

For const-checking the MIR of a const/static initializer, we have to know the set of "transient" locals. The reason for this is that creating a mutable (or interior mutable) reference to a transient local is "safe" in the sense that this reference cannot possibly end up in the final value of the const -- even if it is turned into a raw pointer and stored in a union, we will see that pointer during interning and reliably reject it as dangling.

So far, we determined the set of transient locals as "locals that have a `StorageDead` somewhere". But that's not quite right -- if we had MIR like
```rust
StorageLive(_5);
StorageDead(_5);
StorageLive(_5);
// no further storage annotations for _5
```
Then we'd consider `_5` to be "transient", but it is not actually transient.

We do not currently generate such MIR, but I feel uneasy relying on subtle invariants like this. So this PR implements a proper analysis for computing the set of "transient" locals: a local is "transient" if it is guaranteed dead at all `Return` terminators.

Cc `@cjgillot`
2024-08-26 08:44:10 +00:00
Travis Cross
6982785f18 Tie impl_trait_overcaptures lint to Rust 2024
The `impl_trait_overcaptures` lint is part of the migration to Rust
2024 and the Lifetime Capture Rules 2024.  Now that we've stabilized
precise capturing (RFC 3617), let's tie this lint to the
`rust_2024_compatibility` lint group.
2024-08-26 06:46:56 +00:00
bohan
c31b9fa425 mv build_reduced_graph_for_external_crate_res into Resolver 2024-08-26 09:24:42 +08:00
Matthias Krüger
d6a3aa4fc4
Rollup merge of #129590 - compiler-errors:ref-tykind, r=fmease
Avoid taking reference of &TyKind

It's already a ref anyways. Just a tiny cleanup here.
2024-08-26 01:49:04 +02:00
Matthias Krüger
0a8e305d91
Rollup merge of #129553 - RalfJung:const-stability, r=compiler-errors
add back test for stable-const-can-only-call-stable-const

This got accidentally removed in https://github.com/rust-lang/rust/pull/128596 (file `tests/ui/internal/internal-unstable-const.rs`). The test has little to do with "allow internal unstable" though, so add it in a file that already tests various const stability things.

Also tweak the help that suggests to add `rustc_allow_const_fn_unstable` to make it clear that this needs team approval, since it is a fairly big gun.
2024-08-26 01:49:03 +02:00
Matthias Krüger
c6e00680ac
Rollup merge of #129544 - mu001999-contrib:dead-code/clean, r=compiler-errors
Removes dead code from the compiler

Detected by #128637
2024-08-26 01:49:03 +02:00
Matthias Krüger
a8a242c0ec
Rollup merge of #129526 - compiler-errors:fx, r=lqd
Use `FxHasher` on new solver unconditionally

r? lqd

This should actually fix the inference problem in ad855fe6db, since `HashSet::default` was not inferring the hasher when `HashSet` was coming from the stdlib due to the way that defaulted types/inference vars work. You could cherry-pick this on top of your PR alternatively.
2024-08-26 01:49:02 +02:00
Matthias Krüger
aa26e1ad97
Rollup merge of #129525 - notriddle:notriddle/fake-variadic-tuple-array, r=GuillaumeGomez
rustdoc: clean up tuple <-> primitive conversion docs

This adds a minor missing feature to `fake_variadic`, so that it can render `impl From<(T,)> for [T; 1]` correctly.
2024-08-26 01:49:02 +02:00
Matthias Krüger
ae21236530
Rollup merge of #129519 - compiler-errors:lowering-flags, r=fmease
Remove redundant flags from `lower_ty_common` that can be inferred from the HIR

...and then get rid of `lower_ty_common`.

r? ``@fmease`` or re-roll if you're busy!
2024-08-26 01:49:01 +02:00
Matthias Krüger
6228bd6ef6
Rollup merge of #129405 - surechen:fix_span_x, r=cjgillot
Fixing span manipulation and indentation of the suggestion introduced by #126187

According to comments:
https://github.com/rust-lang/rust/pull/128084#issuecomment-2295254576
https://github.com/rust-lang/rust/pull/126187/files#r1634897691
2024-08-26 01:49:00 +02:00
Matthias Krüger
621f2726fb
Rollup merge of #129288 - compiler-errors:unsafe-fn-coercion, r=lcnr
Use subtyping for `UnsafeFnPointer` coercion, too

I overlooked this in #129059, which changed MIR typechecking to use subtyping for other fn pointer coercions.

Fixes #129285
2024-08-26 01:49:00 +02:00
Michael Goulet
1c58522068 Use FxHasher on new solver unconditionally 2024-08-25 16:37:15 -04:00
Michael Goulet
ecd2d11573 Remove redundant flags that can be inferred from the HIR 2024-08-25 16:21:00 -04:00
Michael Goulet
48f43fa0ed Avoid taking reference of &TyKind 2024-08-25 16:02:29 -04:00
Matthias Krüger
86d5c53362
Rollup merge of #129523 - lqd:stable-type-ir, r=compiler-errors
Make `rustc_type_ir` build on stable

This PR fixes a handful of issues that appear in `rustc_type_ir` when trying to build the new solver on stable.

r? ```@compiler-errors```
```@bors``` rollup
2024-08-25 16:51:06 +02:00
Matthias Krüger
9c59e97ded
Rollup merge of #129487 - GrigorenkoPV:repr_transparent_external_private_fields, r=compiler-errors
repr_transparent_external_private_fields: special-case some std types

Fixes #129470

```@rustbot``` label +A-lint +L-repr_transparent_external_private_fields
2024-08-25 16:51:05 +02:00
Matthias Krüger
0e2523eaf8
Rollup merge of #129416 - workingjubilee:partial-move-from-stabilization, r=dtolnay
library: Move unstable API of new_uninit to new features

- `new_zeroed` variants move to `new_zeroed_alloc`
- the `write` fn moves to `box_uninit_write`

The remainder will be stabilized in upcoming patches, as it was decided to only stabilize `uninit*` and `assume_init`.
2024-08-25 16:51:04 +02:00
Matthias Krüger
7edbd6353b
Rollup merge of #129091 - RalfJung:box_as_ptr, r=Amanieu
add Box::as_ptr and Box::as_mut_ptr methods

Unstably implements https://github.com/rust-lang/libs-team/issues/355. Tracking issue: https://github.com/rust-lang/rust/issues/129090.

r? libs-api
2024-08-25 16:51:03 +02:00
surechen
8750e24247 Fixing span manipulation and indentation of the suggestion introduced by #126187
According to comments:
https://github.com/rust-lang/rust/pull/128084#issuecomment-2295254576
https://github.com/rust-lang/rust/pull/126187/files#r1634897691
2024-08-25 20:30:06 +08:00
Ralf Jung
ba24121ad6 tweak rustc_allow_const_fn_unstable hint, and add back test for stable-const-can-only-call-stable-const 2024-08-25 13:50:55 +02:00
Ralf Jung
5412499ad5 make it possible to enable const_precise_live_drops per-function 2024-08-25 13:49:16 +02:00
Ralf Jung
74a21425cc dont iterate over the bitset 2024-08-25 12:33:55 +02:00
Ralf Jung
172c05cca2 only visit reachable blocks, do not use a visitor 2024-08-25 11:42:55 +02:00
bors
717aec0f8e Auto merge of #129521 - matthiaskrgr:rollup-uigv77m, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #128596 (stabilize const_fn_floating_point_arithmetic)
 - #129199 (make writes_through_immutable_pointer a hard error)
 - #129246 (Retroactively feature gate `ConstArgKind::Path`)
 - #129290 (Pin `cc` to 1.0.105)
 - #129323 (Implement `ptr::fn_addr_eq`)
 - #129500 (remove invalid `TyCompat` relation for effects)
 - #129501 (panicking: improve hint for Miri's RUST_BACKTRACE behavior)
 - #129505 (interpret: ImmTy: tighten sanity checks in offset logic)
 - #129510 (Fix `elided_named_lifetimes` in code)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-25 08:12:16 +00:00
mu001999
e7f11b6913 Removes dead code from the compiler 2024-08-25 13:41:39 +08:00
Trevor Gross
2269381e0a
Rollup merge of #129429 - cjgillot:named-variance, r=compiler-errors
Print the generic parameter along with the variance in dumps.

This allows to make sure we are testing what we think we are testing.

While the tests are correct, I discovered that opaque duplicated args are in the reverse declaration order.
2024-08-24 21:03:32 -05:00
Trevor Gross
198a68df1c
Rollup merge of #128735 - jieyouxu:pr-120176-revive, r=cjgillot
Add a special case for `CStr`/`CString` in the `improper_ctypes` lint

Revives #120176. Just needed to bless a test and fix an argument, but seemed reasonable to me otherwise.

Instead of saying to "consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct", we now tell users to "Use `*const ffi::c_char` instead, and pass the value from `CStr::as_ptr()`" when the type involved is a `CStr` or a `CString`.

The suggestion is not made for `&mut CString` or `*mut CString`.

r? ``````@cjgillot`````` (since you were the reviewer of the original PR #120176, but feel free to reroll)
2024-08-24 21:03:31 -05:00
Trevor Gross
dfe7d5c31e
Rollup merge of #128524 - chenyukang:yukang-fix-127930-invalid-outer-style-sugg, r=cjgillot
Don't suggest turning crate-level attributes into outer style

Fixes #127930
2024-08-24 21:03:31 -05:00
Trevor Gross
00308920ae
Rollup merge of #128467 - estebank:unsized-args, r=cjgillot
Detect `*` operator on `!Sized` expression

The suggestion is new:

```
error[E0277]: the size for values of type `str` cannot be known at compilation time
  --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:15:9
   |
LL |     let x = *"";
   |         ^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `str`
   = note: all local variables must have a statically known size
   = help: unsized locals are gated as an unstable feature
help: references to `!Sized` types like `&str` are `Sized`; consider not dereferencing the expression
   |
LL -     let x = *"";
LL +     let x = "";
   |
```

Fix #128199.
2024-08-24 21:03:30 -05:00
beetrees
abd44fc5f4
Add f16 and f128 inline ASM support for aarch64 2024-08-25 00:13:25 +01:00
Jubilee Young
af05882eb5 Deny wasm_c_abi lint to nudge the last 25%
This shouldn't affect projects indirectly depending on wasm-bindgen
because cargo passes `--cap-lints=allow` when building dependencies.
2024-08-24 15:35:28 -07:00
Michael Goulet
dbf06d2170 Get rid of predicates_defined_on 2024-08-24 18:25:41 -04:00
rongfu.leng
ec67cdf98a
Enable f16 in assembly on aarch64 platforms that support it
Signed-off-by: rongfu.leng <lenronfu@gmail.com>
2024-08-24 23:07:09 +01:00
Michael Goulet
42a901acd9 Don't use TyKind in lint 2024-08-24 17:16:39 -04:00
Michael Howell
6df0ccf49e rustdoc: clean up tuple <-> primitive conversion docs
This adds a minor missing feature to `fake_variadic`,
so that it can render `impl From<(T,)> for [T; 1]` correctly.
2024-08-24 14:06:57 -07:00
Rémy Rakic
902264b1a6 allow cfg(bootstrap) to avoid check-cfg warning on stable 2024-08-24 20:40:02 +00:00
Rémy Rakic
ad855fe6db this needs the type for some reason 2024-08-24 20:39:04 +00:00
Rémy Rakic
3e2763a215 add missing associated item 2024-08-24 20:38:11 +00:00
Rémy Rakic
300da9a910 only use rustc attr on nightly 2024-08-24 20:36:56 +00:00
Matthias Krüger
e664ff5d8c
Rollup merge of #129510 - GrigorenkoPV:fix-elided-named-lifetimes, r=cjgillot
Fix `elided_named_lifetimes` in code

https://github.com/rust-lang/rust/pull/129207#issuecomment-2308428671

r? cjgillot
2024-08-24 22:14:15 +02:00
Matthias Krüger
9e1f6281ab
Rollup merge of #129505 - RalfJung:imm-ty-offset, r=davidtwco
interpret: ImmTy: tighten sanity checks in offset logic

Also make some debug assertions into assertions. (Will need to be perf'd.)
2024-08-24 22:14:15 +02:00
Matthias Krüger
2a7f2da422
Rollup merge of #129290 - tgross35:pin-cc, r=Mark-Simulacrum
Pin `cc` to 1.0.105

`cc` 1.0.106 removes support for Visual Studio 12. Pin to 1.0.105 so we don't drop support yet.

Fixes: https://github.com/rust-lang/rust/pull/128722#issuecomment-2297605573
2024-08-24 22:14:13 +02:00
Matthias Krüger
c0bedb9e5e
Rollup merge of #129246 - BoxyUwU:feature_gate_const_arg_path, r=cjgillot
Retroactively feature gate `ConstArgKind::Path`

This puts the lowering introduced by #125915 under a feature gate until we fix the regressions introduced by it. Alternative to whole sale reverting the PR since it didn't seem like a very clean revert and I think this is generally a step in the right direction and don't want to get stuck landing and reverting the PR over and over :)

cc #129137 ``@camelid,`` tests taken from there. beta is branching soon so I think it makes sense to not try and rush that fix through since it wont have much time to bake and if it has issues we can't simply revert it on beta.

Fixes #128016
2024-08-24 22:14:12 +02:00
Matthias Krüger
05b8bcc662
Rollup merge of #129199 - RalfJung:writes_through_immutable_pointer, r=compiler-errors
make writes_through_immutable_pointer a hard error

This turns the lint added in https://github.com/rust-lang/rust/pull/118324 into a hard error. This has been reported in cargo's future-compat reports since Rust 1.76 (released in February). Given that const_mut_refs is still unstable, it should be impossible to even hit this error on stable: we did accidentally stabilize some functions that can cause this error, but that got reverted in https://github.com/rust-lang/rust/pull/117905. Still, let's do a crater run just to be sure.

Given that this should only affect unstable code, I don't think it needs an FCP, but let's Cc ``@rust-lang/lang`` anyway -- any objection to making this unambiguous UB into a hard error during const-eval? This can be viewed as part of https://github.com/rust-lang/rust/pull/129195 which is already nominated for discussion.
2024-08-24 22:14:12 +02:00
Matthias Krüger
0dfdea1c45
Rollup merge of #128596 - RalfJung:const_fn_floating_point_arithmetic, r=nnethercote
stabilize const_fn_floating_point_arithmetic

Part of https://github.com/rust-lang/rust/issues/128288
Fixes https://github.com/rust-lang/rust/issues/57241

The existing test `tests/ui/consts/const_let_eq_float.rs`  ([link](https://github.com/RalfJung/rust/blob/const_fn_floating_point_arithmetic/tests/ui/consts/const_let_eq_float.rs)) covers the basics, and also Miri has extensive tests covering the interpreter's float machinery. Also, that machinery can already be used on stable inside `const`/`static` initializers, just not inside `const fn`.

This was explicitly called out in https://github.com/rust-lang/rfcs/pull/3514 so in a sense t-lang just recently already FCP'd this, but let's hear from them whether they want another FCP for the stabilization here or whether that was covered by the FCP for the RFC.
Cc ``@rust-lang/lang``

### Open items

- [x] Update the Reference: https://github.com/rust-lang/reference/pull/1566
2024-08-24 22:14:11 +02:00
Pavel Grigorenko
06f2d73b2b repr_transparent_external_private_fields: treat rustc_pub_transparent types as local 2024-08-24 23:05:54 +03:00
Pavel Grigorenko
b9033bdd92 New #[rustc_pub_transparent] attribute 2024-08-24 23:05:37 +03:00
Michael Goulet
147bb17f51 Rework how we emit errors for unresolved object lifetimes 2024-08-24 14:55:31 -04:00
Camille GILLOT
bb17fda384 Do not call source_span when not tracking dependencies. 2024-08-24 16:40:40 +00:00
Pavel Grigorenko
53ce92770d Fix elided_named_lifetimes in code 2024-08-24 19:21:32 +03:00
Ralf Jung
5343550142 const checking: properly compute the set of transient locals 2024-08-24 17:14:31 +02:00
Ralf Jung
493cf6a7e9 interpret: ImmTy: tighten sanity checks in offset logic 2024-08-24 15:12:30 +02:00
Jubilee Young
9ccd7abefe library: Move unstable API of new_uninit to new features
- `new_zeroed` variants move to `new_zeroed_alloc`
- the `write` fn moves to `box_uninit_write`

The remainder will be stabilized in upcoming patches, as
it was decided to only stabilize `uninit*` and `assume_init`.
2024-08-23 20:52:02 -07:00
Nicole LeGare
1ed9ee7b03 Remove reserve-x18 from armv7-unknown-trusty 2024-08-23 16:26:20 -07:00
Nicole LeGare
681a866067 Add Trusty OS as tier 3 target 2024-08-23 16:09:56 -07:00
Camille GILLOT
5cef88c1f4 Print the generic parameter along with the variance in dumps. 2024-08-23 23:00:45 +00:00