Commit Graph

270314 Commits

Author SHA1 Message Date
Matthias Krüger
909574e411
Rollup merge of #132559 - bvanjoi:fix-132534, r=compiler-errors
find the generic container rather than simply looking up for the assoc with const arg

Fixes #132534

This issue is caused by mismatched generic parameters. Previously, it tried to find `T` in `trait X`, but after this change, it will find `T` in `fn a`.

r? `@compiler-errors`  as this assertion was introduced by you.
2024-11-04 18:12:47 +01:00
Matthias Krüger
b9db639ea5
Rollup merge of #132544 - dianne:unstable-library-feature-backticks, r=compiler-errors
Use backticks instead of single quotes for library feature names in diagnostics

This PR changes the text of library feature errors for using unstable or body-unstable items. Displaying library feature names in backticks is consistent with other diagnostics (e.g. those from `rustc_passes`) and with the `reason`s on unstable attributes in the library. Additionally, this simplifies diagnostics when supporting multiple unstable attributes on items (see #131824) since `DiagSymbolList` also displays symbols using backticks.
2024-11-04 18:12:46 +01:00
Matthias Krüger
c89a6cd0ad
Rollup merge of #132486 - compiler-errors:no-binder, r=lcnr
No need to instantiate binder in `confirm_async_closure_candidate`

Removes a FIXME that is redundant. No longer needed since #122267.
2024-11-04 18:12:45 +01:00
Matthias Krüger
31ad4e4a54
Rollup merge of #132355 - practicalrs:fix_117638, r=SparrowLii
Fix compiler panic with a large number of threads

Hi,

This PR is an attempt to fix the problem described here https://github.com/rust-lang/rust/issues/117638 using the solution suggested in this comment https://github.com/rust-lang/rust/issues/117638#issuecomment-1800925067

Best regards,
Michal
2024-11-04 18:12:45 +01:00
mejrs
c88ba28d9a document type_implements_trait 2024-11-04 18:08:30 +01:00
Guillaume Gomez
5dfbc0383d Rename DocContext::is_json into DocContext::is_json_output 2024-11-04 17:29:57 +01:00
Guillaume Gomez
0eff07ee4e Add UI regressions tests for rustdoc --show-coverage option 2024-11-04 14:46:04 +01:00
Guillaume Gomez
e9161db5b5 Fix invalid coverage computation when --output-format=json is enabled 2024-11-04 14:28:35 +01:00
bors
432972cae6 Auto merge of #132275 - compiler-errors:deref-effects, r=fee1-dead
Register `~const` preds for `Deref` adjustments in HIR typeck

This doesn't *do* anything yet, since `Deref` and `DerefMut` aren't constified, and we explicitly don't error on calling non-const trait methods in HIR yet -- presumably that will wait until std is re-constified. But I'm confident this logic is correct, and this (afaict?) is the only major hole left in enforcing `~const` in HIR typeck.

r? fee1-dead
2024-11-04 12:12:55 +00:00
Gabriel Bjørnager Jensen
7faa84e20e Stabilise 'const_char_encode_utf16'; 2024-11-04 13:09:44 +01:00
mejrs
5a48fe2c20 Suggest creating unary tuples 2024-11-04 12:06:19 +01:00
Zalathar
5bfa0b106e Simplify FFI calls for -Ztime-llvm-passes and -Zprint-codegen-stats 2024-11-04 20:31:16 +11:00
bors
ca87b535a0 Auto merge of #132250 - nnethercote:rustc_borrowck-cleanups, r=compiler-errors
`rustc_borrowck` cleanups

A bunch of cleanups I made while reading over this crate.

r? `@lqd`
2024-11-04 09:19:05 +00:00
Laurențiu Nicola
0cd3fb2da9
Merge pull request #18472 from lnicola/reinterpret-function-casing
minor: Fix feature name casing
2024-11-04 08:39:50 +00:00
Laurențiu Nicola
9f4e71940f Fix feature name casing 2024-11-04 10:27:32 +02:00
Ralf Jung
b2fe71a2fe miri: update ABI compat checks to accept Option-like types 2024-11-04 07:50:40 +01:00
bors
56c6a2f9b1 Auto merge of #132586 - workingjubilee:rollup-qrmn49a, r=workingjubilee
Rollup of 4 pull requests

Successful merges:

 - #131222 (Generate correct symbols.o for sparc-unknown-none-elf)
 - #132423 (remove const-support for align_offset and is_aligned)
 - #132565 (Reduce dependence on the target name)
 - #132576 (remove attribute ids from hir stats (they're simply not needed))

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-04 06:45:33 +00:00
Ralf Jung
b12745863e update rustc-std-workspace crates
- make rustc-std-workspace-core/alloc re-exports of their underlying crates, like std
= cleanup manifests
2024-11-04 07:45:15 +01:00
Nicholas Nethercote
e0e7a432db BorrowckDiags tweaks.
- Store a mut ref to a `BorrowckDiags` in `MirBorrowckCtxt` instead of
  owning it, to save having to pass ownership in and out of
  `promoted_mbcx`.
- Use `buffer_error` in a couple of suitable places.
2024-11-04 17:36:25 +11:00
Nicholas Nethercote
ce2f0b4ce9 Simplify LocalUseMapBuild.
It has four different `insert` methods, with some duplication. This
commit finds the commonality and removes them all.
2024-11-04 17:36:25 +11:00
Nicholas Nethercote
6ecf80e1ad Merge BorrowCheckContext into TypeChecker.
Because there is no real reason for it to be a separate struct.
- It has no methods.
- It's easy to confuse with the nearby `BorrowckInferContext` (which
  does have methods).
- The `mut` ref to it in `TypeChecker` makes it seem like any of the
  fields within might be mutable, but only two (`all_facts` and
  `constraints`) actually are.
- Two of the fields are `pub(crate)` but can be private.

This change makes a lot of code more concise and readable.
2024-11-04 17:36:25 +11:00
Nicholas Nethercote
f86c76a782 Remove unnecessary qualifiers. 2024-11-04 17:36:25 +11:00
Nicholas Nethercote
a07011bde2 Remove unnecessary continue. 2024-11-04 17:36:25 +11:00
Nicholas Nethercote
e23bdd68f9 Remove ToUniverseInfo impl for CanonicalQueryInput<CustomTypeOp>.
It's unused.
2024-11-04 17:36:25 +11:00
Nicholas Nethercote
7901c03d2d Merge UniverseInfo and UniverseInfoInner.
It's strange to have a struct that contains a single anonymous field
that is an enum. This commit merges them. This does require increasing
the visibility of `TypeOfInfo` to `pub(crate)`, but that seems
worthwhile.
2024-11-04 17:36:25 +11:00
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
883f8705d4 Remove BorrowKind glob, make names longer 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