Commit Graph

270416 Commits

Author SHA1 Message Date
Nicholas Nethercote
bf1a5c2b7f Tidy up comments and some formatting.
Mostly by wrapping overly long comment lines, plus a few other things.
2024-11-04 17:36:25 +11:00
Nicholas Nethercote
ad875529bf Move some use declarations.
So they're all in the one place. Also prepend with `crate::`, à la the
`unqualified_local_imports` lint.
2024-11-04 17:36:23 +11:00
Nicholas Nethercote
981dc02eaf Revert "Avoid nested replacement ranges" from #129346.
It caused a test regression in the `cfg_eval.rs` crate. (The bugfix
in #129346 was in a different commit; this commit was just a code
simplification.)
2024-11-04 15:57:35 +11:00
Michael Goulet
e3bd6b27f3 Fix minicore, add tests based off of it 2024-11-04 04:51:32 +00:00
Michael Goulet
7bd595d216 Make sure to enforce ~const DerefMut on mutability fixup 2024-11-04 04:51:32 +00:00
Michael Goulet
e03e9abe3c Register const preds for Deref adjustments in HIR typeck 2024-11-04 04:51:31 +00:00
Michael Goulet
d458f850aa ty::BrK -> ty::BoundRegionKind::K 2024-11-04 04:45:52 +00:00
Michael Goulet
efeed550c4 Remove BorrowKind glob, make names longer 2024-11-04 04:45:52 +00:00
Michael Goulet
883f8705d4 Remove BorrowKind glob, make names longer 2024-11-04 04:45:52 +00:00
Michael Goulet
b14362f665 ty::KContainer -> ty::AssocItemContainer::K 2024-11-04 04:45:52 +00:00
Michael Goulet
be4b0261c2 ty::KContainer -> ty::AssocItemContainer::K 2024-11-04 04:45:52 +00:00
Michael Goulet
8e6af16192 Remove the trivial constkind imports 2024-11-04 04:45:51 +00:00
Nicholas Nethercote
6676cec925 Reduce visibilities. 2024-11-04 15:43:45 +11:00
bohan
6026a0f6c9 find the generic container rather than simply looking up for the assoc with const arg 2024-11-04 12:17:44 +08:00
Jubilee
759e80d019
Rollup merge of #132576 - jdonszelmann:no-attrid-in-stats, r=nnethercote
remove attribute ids from hir stats (they're simply not needed)

Turns out these are simply not needed. Yay!

r? `@nnethercote`
2024-11-03 20:08:15 -08:00
Jubilee
7155c65d68
Rollup merge of #132565 - bjorn3:less_target_name_dependence, r=workingjubilee
Reduce dependence on the target name

The target name can be anything with custom target specs. Matching on fields inside the target spec is much more robust than matching on the target name.

Also remove the unused is_builtin target spec field.
2024-11-03 20:08:14 -08:00
Jubilee
3313e760d0
Rollup merge of #132423 - RalfJung:const-eval-align-offset, r=dtolnay
remove const-support for align_offset and is_aligned

As part of the recent discussion to stabilize `ptr.is_null()` in const context, the general vibe was that it's okay for a const function to panic when the same operation would work at runtime (that's just a case of "dynamically detecting that something is not supported as a const operation"), but it is *not* okay for a const function to just return a different result.

Following that, `is_aligned` and `is_aligned_to` have their const status revoked in this PR, since they do return actively wrong results at const time. In the future we can consider having a new intrinsic or so that can check whether a pointer is "guaranteed to be aligned", but the current implementation based on `align_offset` does not have the behavior we want.

In fact `align_offset` itself behaves quite strangely in const, and that support needs a bunch of special hacks. That doesn't seem worth it. Instead, the users that can fall back to a different implementation should just use const_eval_select directly, and everything else should not be made const-callable. So this PR does exactly that, and entirely removes const support for align_offset.

Closes some tracking issues by removing the associated features:
Closes https://github.com/rust-lang/rust/issues/90962
Closes https://github.com/rust-lang/rust/issues/104203

Cc `@rust-lang/wg-const-eval` `@rust-lang/libs-api`
2024-11-03 20:08:13 -08:00
Jubilee
f35433e250
Rollup merge of #131222 - thejpster:fix-sparc-v7-symbol-o, r=workingjubilee
Generate correct symbols.o for sparc-unknown-none-elf

This fixes #130172 by selecting the correct ELF Machine type for sparc-unknown-none-elf (which has a baseline of SPARC V7).
2024-11-03 20:08:13 -08:00
bors
706eec8ce1 Auto merge of #132434 - tgross35:f128-tests, r=workingjubilee
Update `compiler-builtins` and enable f128 tests on all non-buggy platforms

Update compiler_builtins to 0.1.138 and pin it. This updates to a new version of builtins that includes [1], which was
the last blocker to us enabling `f128` tests on all platforms.

With that, we now provide symbols necessary to work with `f128` everywhere. This means that we are no longer restricted to systems that provide `f128` symbols themselves, and can enable tests by default.

There are still a handful of platforms that need to remain disabled because of bugs and some that had to get updated.

Math support is still off by default since those symbols are not yet available.

[1]: https://github.com/rust-lang/compiler-builtins/pull/624

try-job: test-various
try-job: i686-gnu-nopt
2024-11-04 04:03:29 +00:00
Trevor Gross
c0fc25cc20 Enable f128 tests on all non-buggy platforms 🎉
With the `compiler-builtins` update to 0.1.137 [1], we now provide
symbols necessary to work with `f128` everywhere. This means that we are
no longer restricted to 64-bit linux, and can enable tests by default.

There are still a handful of platforms that need to remain disabled
because of bugs. This patch additionally disables the following:

1. MIPS [2]
2. 32-bit x86 [3]

Math support is still off by default since those symbols are not yet
available.

[1]: https://github.com/rust-lang/rust/pull/132433
[2]: https://github.com/llvm/llvm-project/issues/96432
[3]: https://github.com/llvm/llvm-project/issues/77401
2024-11-03 19:33:04 -06:00
bors
43c78051ea Auto merge of #132581 - workingjubilee:rollup-4wj318p, r=workingjubilee
Rollup of 6 pull requests

Successful merges:

 - #126136 (Call the target libdir target libdir)
 - #132516 (Add bad-reg inline assembly ui test for RISC-V and s390x)
 - #132521 (replace manual time convertions with std ones, comptime time format parsing)
 - #132560 (Remove outdated tidy license fixmes)
 - #132563 (Modify `NonZero` documentation to reference the underlying integer type)
 - #132574 (compiler: Directly use rustc_abi almost everywhere)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-04 00:54:17 +00:00
Trevor Gross
95ecf0c262 Update compiler_builtins to 0.1.138 and pin it
This updates to a new version of builtins that includes [1], which was
the last blocker to us enabling `f128` tests on all platforms 🎉.

With this update, also change to pinning the version with `=` rather
than using the default carat versioning. This is meant to ensure that
`compiler-builtins` does not get updated as part of the weekly
`Cargo.lock` update, since updates to this crate need to be intentional:
changes to rust-lang/rust and rust-lang/compiler-builtins sometimes need
to be kept in lockstep, unlike most dependencies, and sometimes these
updates can be problematic.

[1]: https://github.com/rust-lang/compiler-builtins/pull/624
2024-11-03 17:43:16 -06:00
Jubilee
72df7780dd
Rollup merge of #132574 - workingjubilee:abi-in-compiler, r=compiler-errors
compiler: Directly use rustc_abi almost everywhere

Use rustc_abi instead of rustc_target where applicable. This is mostly described by the following substitutions:
```rust
match path_substring {
    rustc_target::spec::abi::Abi => rustc_abi::ExternAbi,
    rustc_target::abi::call => rustc_target::callconv,
    rustc_target::abi => rustc_abi,
}
```

A number of spot-fixes make that not quite the whole story.

The main exception is in 33edc68 where I get a lot more persnickety about how things are imported, especially in `rustc_middle::ty::layout`, not just from where. This includes putting an end to a reexport of `rustc_middle::ty::ReprOptions`, for the same reason that the rest of this change is happening: reexports mostly confound things.

This notably omits rustc_passes and the ast crates, as I'm still examining a question I have about how they do stability checking of `extern "Abi"` strings and if I can simplify their logic. The rustc_abi and rustc_target crates also go untouched because they will be entangled in that cleanup.

r? compiler-errors
2024-11-03 15:25:00 -08:00
Jubilee
1505997c64
Rollup merge of #132563 - frectonz:master, r=Amanieu
Modify `NonZero` documentation to reference the underlying integer type

This change updates the documentation for `NonZero` integer types to explicitly reference the underlying integer type each `NonZero` variant wraps, instead of  using a general "integer" term.

**Before**
![image](https://github.com/user-attachments/assets/b13bda82-007b-459c-8b22-e27d79005271)

**After**
![image](https://github.com/user-attachments/assets/1d7fadc7-dce3-4b84-9b8f-d2bb81c05eb7)
2024-11-03 15:24:59 -08:00
Jubilee
cf712a2485
Rollup merge of #132560 - Urgau:tidy-license-deps, r=onur-ozkan
Remove outdated tidy license fixmes

~~This PR re-enables license dependency checking for:~~
 - ~~the `backtrace` submodule~~
 - ~~and the `portable-simd` subtree~~

~~The `stdarch` submodule doesn't have a `Cargo.lock` yet so we can't re-enable it.~~

This PR removes outdated tidy license fixmes, https://github.com/rust-lang/rust/pull/132560#issuecomment-2453525276.

r? bootstrap
2024-11-03 15:24:59 -08:00
Jubilee
3285d12baf
Rollup merge of #132521 - klensy:times, r=compiler-errors
replace manual time convertions with std ones, comptime time format parsing

First commit replaces few manual time conversions with std ones, second makes parsing of time format at compiletime.
2024-11-03 15:24:58 -08:00
Jubilee
6bc7be5efa
Rollup merge of #132516 - taiki-e:asm-ui, r=workingjubilee
Add bad-reg inline assembly ui test for RISC-V and s390x

https://github.com/rust-lang/rust/pull/131341#discussion_r1826555431

> Btw, such unsupported registers are present in most architectures, but only aarch64/arm64ec, x86_64, and not yet merged [sparc/sparc64](https://github.com/rust-lang/rust/pull/132472/files#diff-02aebda3376c2b020265137f9ce2c387669ca5cfecd7d60494275c2387db5114) (and powerpc/powerpc64 by this PR) currently have ui tests for them.  I plan to add tests for other arches later.

Starting with RISC-V and s390x, which I'm familiar with and relatively easy to check for correctness.

(Relevant rustc code are supported_types/def_regs/overlapping_regs in [compiler/rustc_target/src/asm/riscv.rs](588a420350/compiler/rustc_target/src/asm/riscv.rs) and [compiler/rustc_target/src/asm/s390x.rs](588a420350/compiler/rustc_target/src/asm/s390x.rs).)

r? workingjubilee

`@rustbot` label +A-inline-assembly
2024-11-03 15:24:57 -08:00
Jubilee
deb4ceb263
Rollup merge of #126136 - Noratrieb:bootstrap-naming, r=onur-ozkan
Call the target libdir target libdir

Because it's the target libdir.

`--print` uses the same terminology, and it's a simple way to make it obviously different from `$sysroot/lib`.
2024-11-03 15:24:57 -08:00
bors
ccf7c88386 Auto merge of #13648 - samueltardieu:push-rpxvoukpolvm, r=Centri3
needless_continue: check labels consistency before warning

changelog: [`needless_continue`]: check labels before warning about `continue` as the last statement in a loop body

Fix #13641
2024-11-03 23:17:36 +00:00
dianne
ae428141f7 Don't test new error messages with the stage 0 compiler
This commit can be reverted once the error message changes are in the stage 0 compiler.
2024-11-03 14:32:25 -08:00
bors
42188c3ca8 Auto merge of #123723 - madsmtm:apple-std-os, r=dtolnay
Make `std::os::darwin` public

I'm not sure of the reasoning behind them not being public before, but I think they should be, just like `std::os::ios` and `std::os::macos` are public.

Additionally, I've merged their source code, as it was otherwise just a bunch of unnecessary duplication.

Ultimately, I've done this PR to fix `./x build library --target=aarch64-apple-tvos,aarch64-apple-watchos,aarch64-apple-visionos`, as that currently fails because of dead code warnings.

Since you reviewed https://github.com/rust-lang/rust/pull/121419
r? davidtwco

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

`@rustbot` label O-tvos O-watchos O-visionos
2024-11-03 22:25:11 +00:00
dianne
d7d6238b23 use backticks instead of single quotes when reporting "use of unstable library feature"
This is consistent with all other diagnostics I could find containing
features and enables the use of `DiagSymbolList` for generalizing
diagnostics for unstable library features to multiple features.
2024-11-03 13:55:52 -08:00
Jubilee Young
fa2047370b compiler: Remove unused rustc_target from Cargo.tomls 2024-11-03 13:38:47 -08:00
Jubilee Young
5c953ee910 compiler: Replace rustc_target with abi in symbol_mangling 2024-11-03 13:38:47 -08:00
Jubilee Young
7639773e70 compiler: Directly use rustc_abi in session 2024-11-03 13:38:47 -08:00
Jubilee Young
586e141be7 compiler: Directly use rustc_abi in lints 2024-11-03 13:38:47 -08:00
Jubilee Young
092135b7b4 compiler: Directly use rustc_abi in ty_utils 2024-11-03 13:38:47 -08:00
Jubilee Young
6c16a3123b compiler: Directly use rustc_abi in smir again 2024-11-03 13:38:47 -08:00
Jubilee Young
843b6e0859 compiler: Directly use rustc_abi in mir_transform 2024-11-03 13:38:47 -08:00
Jubilee Young
236fe33345 compiler: Directly use rustc_abi in metadata and middle
Stop reexporting ReprOptions from middle::ty
2024-11-03 13:38:47 -08:00
Jubilee Young
89ec8c2cfe compiler: Directly use rustc_abi in hir_{analysis,typeck} 2024-11-03 13:38:47 -08:00
Jubilee Young
bbd18e29da compiler: Directly use rustc_abi in const_eval 2024-11-03 13:38:47 -08:00
Ralf Jung
5c6f27b1e0 extract rustc-std-workspace crate sources from crates.io and place them here 2024-11-03 22:30:02 +01:00
Jonathan Dönszelmann
efaf9ab430
remove attribute ids from hir stats (they're simply not needed) 2024-11-03 22:14:54 +01:00
bjorn3
775aad80fc Remove is_builtin target spec field
It is unused.
2024-11-03 21:06:49 +00:00
Jubilee Young
b895bf4fdc compiler: Directly use rustc_abi in codegen 2024-11-03 12:30:32 -08:00
bors
a1a9aaef87 Auto merge of #13631 - samueltardieu:push-uoowutzkvsrk, r=Centri3
no_mangle attribute requires unsafe in Rust 2024

Tests without unsafe must not run in edition 2024. Also, error messages have been modified to include the full attribute, so that a use of `#[unsafe(no_mangle)]` does not produce an error message containing `#[no_mangle]`.

changelog: [`no_mangle_attribute`]: handle `#[unsafe(no_mangle)]` as well
2024-11-03 19:43:19 +00:00
bors
b8c8287a22 Auto merge of #132479 - compiler-errors:fx-feat-yeet, r=fee1-dead
Yeet the `effects` feature, move it onto `const_trait_impl`

This PR merges the `effects` feature into the `const_trait_impl` feature. There's really no need to have two feature gates for one feature.

After this PR, if `const_trait_impl` **is** enabled:
* Users can use and define const traits
* `HostEffect` const conditions will be enforced on the HIR
* We re-check the predicates in MIR just to make sure that we don't "leak" anything during MIR lowering

And if `const_trait_impl` **is not** enabled:
* Users cannot use nor define const traits
* `HostEffect` const conditions are not enforced on the HIR
* We will raise a const validation error if we call a function that has any const conditions (i.e. const traits and functions with any `~const` in their where clasues)

This should be the last step for us to be able to enable const traits in the standard library. We still need to re-constify `Drop` and `Destruct` and stuff for const traits to be particularly *useful* for some cases, but this is a good step :D

r? fee1-dead
cc `@rust-lang/project-const-traits`
2024-11-03 19:41:46 +00:00
Urgau
b3fc11bd64 Remove outdated tidy license fixmes 2024-11-03 20:41:06 +01:00
Michael Goulet
f0cf9969cb Rename the FIXMEs, remove a few that dont matter anymore 2024-11-03 18:59:41 +00:00