Commit Graph

269692 Commits

Author SHA1 Message Date
Michael Howell
9900ea48b5 Adjust ranking so that duplicates count against rank 2024-10-31 13:12:14 -07:00
Michael Howell
12dc24f460 rustdoc-search: simplify rules for generics and type params
This commit is a response to feedback on the displayed type
signatures results, by making generics act stricter.

Generics are tightened by making order significant. This means
`Vec<Allocator>` now matches only with a true vector of allocators,
instead of matching the second type param. It also makes unboxing
within generics stricter, so `Result<A, B>` only matches if `B`
is in the error type and `A` is in the success type. The top level
of the function search is unaffected.

Find the discussion on:

* <https://rust-lang.zulipchat.com/#narrow/stream/393423-t-rustdoc.2Fmeetings/topic/meeting.202024-07-08/near/449965149>
* <https://github.com/rust-lang/rust/pull/124544#issuecomment-2204272265>
* <https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/deciding.20on.20semantics.20of.20generics.20in.20rustdoc.20search/near/476841363>
2024-10-30 12:27:48 -07:00
Michael Howell
20a4b4fea1 rustdoc-search: show types signatures in results 2024-10-30 10:35:39 -07:00
Michael Howell
5973005d93 rustdoc-search: use correct type annotations 2024-10-30 10:35:38 -07:00
Michael Howell
5c7e7dfe10 rustdoc-search: pass original names through AST 2024-10-30 10:35:38 -07:00
Michael Howell
2cc1c0c39a rustdoc-search: simplify the checkTypes fast path
This reduces code size while still matching the common case
for plain, concrete types.
2024-10-30 10:35:38 -07:00
Michael Howell
488d5b0d8e rustdoc-search: add type param names to index 2024-10-30 10:35:38 -07:00
bors
298c7462c3 Auto merge of #130860 - tmandry:fix-directives, r=jieyouxu
Fix directives for lint-non-snake-case-crate

This test fails on targets without unwinding or with `--target-rustcflags=-Cpanic=abort` because the proc macro was compiled as the target, not the host. Some targets were explicitly disabled to pass CI, but these directives are more general.

* `needs-dynamic-linking` is self explanatory
* `force-host` for proc macros
* `no-prefer-dynamic` is apparently also used for proc macros

Note that `needs-unwind` can also be useful for situations other than proc macros where unwinding is necessary.

r? `@jieyouxu`

try-job: test-various
2024-10-30 10:28:56 +00:00
bors
8b9f0f9c1c Auto merge of #132349 - matthiaskrgr:rollup-9g6s4p2, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #129394 (Don't lint `irrefutable_let_patterns` on leading patterns if `else if` let-chains)
 - #131856 (TypingMode: merge intercrate, reveal, and defining_opaque_types)
 - #132322 (powerpc64-ibm-aix: update maintainters)
 - #132327 (Point to Fuchsia team in platform support docs)
 - #132332 (Use `token_descr` more in error messages)
 - #132338 (Remove `Engine`)
 - #132340 (cg_llvm: Consistently use safe wrapper function `set_section`)
 - #132342 (cg_llvm: Clean up FFI calls for operand bundles)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-30 07:49:46 +00:00
Matthias Krüger
879c4d5ccc
Rollup merge of #132342 - Zalathar:operand-bundle, r=workingjubilee
cg_llvm: Clean up FFI calls for operand bundles

All of these FFI functions have equivalents in the stable LLVM-C API, though `LLVMBuildCallBr` requires a temporary polyfill on LLVM 18.

This PR also creates a clear split between `OperandBundleOwned` and `OperandBundle`, and updates the internals of the owner to be a little less terrifying.
2024-10-30 06:40:38 +01:00
Matthias Krüger
cf2cc010a3
Rollup merge of #132340 - Zalathar:set-section, r=compiler-errors
cg_llvm: Consistently use safe wrapper function `set_section`

Follow-up to #131962 and https://github.com/rust-lang/rust/pull/132260#discussion_r1821626260.

To avoid too much scope creep, I've deliberately kept the changes to `LLVMRustGetSliceFromObjectDataByName` as minimal as possible.
2024-10-30 06:40:37 +01:00
Matthias Krüger
2055237e8f
Rollup merge of #132338 - nnethercote:rm-Engine, r=nnethercote
Remove `Engine`

It's just unnecessary plumbing. Removing it results in less code, and simpler code.

r? ``@cjgillot``
2024-10-30 06:40:37 +01:00
Matthias Krüger
2480e3bbc5
Rollup merge of #132332 - nnethercote:use-token_descr-more, r=estebank
Use `token_descr` more in error messages

This is the first two commits from #124141, put into their own PR to get things rolling. Commit messages have the details.

r? ``@estebank``
cc ``@petrochenkov``
2024-10-30 06:40:36 +01:00
Matthias Krüger
af33bc3ec0
Rollup merge of #132327 - djkoloski:redirect_fuchsia_maintainers, r=compiler-errors
Point to Fuchsia team in platform support docs

This consolidates our docs into a single source of truth for the current Fuchsia maintainers.

r? ```@tmandry```
2024-10-30 06:40:36 +01:00
Matthias Krüger
864837b084
Rollup merge of #132322 - daltenty:daltenty/update-aix-maintainters, r=workingjubilee
powerpc64-ibm-aix: update maintainters

Chaofan (`@ecnelises)` and Kai (`@bzEq)` will be passing over maintainership for the target over to David Tenty (`@daltenty)` and Chris Cambly (`@gilamn5tr)`
2024-10-30 06:40:35 +01:00
Matthias Krüger
305508f969
Rollup merge of #131856 - lcnr:typing-mode, r=compiler-errors
TypingMode: merge intercrate, reveal, and defining_opaque_types

This adds `TypingMode` and uses it in most places. We do not yet remove `Reveal` from `param_env`s. This and other future work as tracked in #132279 and via `FIXME`s.

Fetching the `TypingMode` of the `InferCtxt` asserts that the `TypingMode` agrees with `ParamEnv::reveal` to make sure we don't introduce any subtle bugs here. This will be unnecessary once `ParamEnv::reveal` no longer exists.

As the `TypingMode` is now a part of the query input, I've merged the coherence and non-coherence caches for the new solver. I've also enabled the local `infcx` cache during coherence by clearing the cache when forking it with a different `TypingMode`.

#### `TypingMode::from_param_env`

I am using this even in cases where I know that the `param_env` will always be `Reveal::UserFacing`. This is to make it easier to correctly refactor this code in the future, any time we use `Reveal::UserFacing` in a body while not defining its opaque types is incorrect and should use a `TypingMode` which only reveals opaques defined by that body instead, cc #124598

r? ``@compiler-errors``
2024-10-30 06:40:34 +01:00
Matthias Krüger
87d348b333
Rollup merge of #129394 - Jarcho:irrefutable_let_patterns, r=Nadrieril
Don't lint `irrefutable_let_patterns` on leading patterns if `else if` let-chains

fixes #128661

Is there any preference where the test goes? There looks to be several places it could fit.
2024-10-30 06:40:34 +01:00
Zalathar
c3071590ab Clean up FFI calls for operand bundles 2024-10-30 13:26:24 +11:00
bors
16422dbd89 Auto merge of #132238 - Urgau:midpoint-i64-hackers-impl, r=joboet
Use Hacker's Delight impl in `i64::midpoint` instead of wide `i128` impl

This PR switches `i64::midpoint` and (`isize::midpoint` where `isize == i64`) to using our Hacker's Delight impl instead of wide `i128` implementation.

As LLVM seems to be outperformed by the complexity of signed 128-bits number compared to our Hacker's Delight implementation.[^1]

It doesn't seems like it's an improvement for the other sizes[^2], so we let them with the wide implementation.

[^1]: https://rust.godbolt.org/z/ravE75EYj
[^2]: https://rust.godbolt.org/z/fzr171zKh

r? libs
2024-10-30 02:26:18 +00:00
Zalathar
65ff2a6ad7 Consistently use safe wrapper function set_section 2024-10-30 11:38:20 +11:00
Tyler Mandry
d942113fdb Fix directives for lint-non-snake-case-crate
This test fails on targets without unwinding because the proc macro was
compiled as the target, not the host. Some targets were explicitly
disabled to pass CI, but these directives are more general.

Fixes Fuchsia tests.
2024-10-29 16:40:06 -07:00
Nicholas Nethercote
d78e7bbeff Remove Engine.
It's no longer needed. `Engine::iterate_to_fixpoint` can be inlined into
`Analysis::iterate_to_fixpoint` and removed. The commit also renames
`engine.rs` as `results.rs`.
2024-10-30 09:42:01 +11:00
Nicholas Nethercote
e54c177118 Remove Analysis::into_engine.
This is a standard pattern:
```
MyAnalysis.into_engine(tcx, body).iterate_to_fixpoint()
```
`into_engine` and `iterate_to_fixpoint` are always called in pairs, but
sometimes with a builder-style `pass_name` call between them. But a
builder-style interface is overkill here. This has been bugging me a for
a while.

This commit:
- Merges `Engine::new` and `Engine::iterate_to_fixpoint`. This removes
  the need for `Engine` to have fields, leaving it as a trivial type
  that the next commit will remove.
- Renames `Analysis::into_engine` as `Analysis::iterate_to_fixpoint`,
  gives it an extra argument for the optional pass name, and makes it
  call `Engine::iterate_to_fixpoint` instead of `Engine::new`.

This turns the pattern from above into this:
```
MyAnalysis.iterate_to_fixpoint(tcx, body, None)
```
which is shorter at every call site, and there's less plumbing required
to support it.
2024-10-30 09:41:46 +11:00
bors
1e4f10ba64 Auto merge of #132326 - matthiaskrgr:rollup-ngyw18g, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #131984 (Stabilize if_let_rescope)
 - #132151 (Ensure that resume arg outlives region bound for coroutines)
 - #132157 (Remove detail from label/note that is already available in other note)
 - #132274 (Cleanup op lookup in HIR typeck)
 - #132319 (cg_llvm: Clean up FFI calls for setting module flags)
 - #132321 (xous: sync: remove `rustc_const_stable` attribute on Condvar and Mutex new())

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-29 19:25:03 +00:00
Jason Newcomb
4a2e08af22 Don't lint irrefutable_let_patterns on leading patterns if else if let-chains. 2024-10-29 14:43:50 -04:00
David Koloski
0783af89cd Point to Fuchsia team in platform support docs 2024-10-29 18:29:39 +00:00
Matthias Krüger
07afe8d12f
Rollup merge of #132321 - betrusted-io:xous/fix-rustc_const_stable-attribute, r=joboet
xous: sync: remove `rustc_const_stable` attribute on Condvar and Mutex new()

These functions had `#[rustc_const_stable(feature = "const_locks", since = "1.63.0")]` on them because they were originally taken from `no_threads`. with d066dfd these no longer compile. Since other platforms do not have this attribute, remove it. This fixes the build for Xous.
2024-10-29 18:39:00 +01:00
Matthias Krüger
2707cd670c
Rollup merge of #132319 - Zalathar:add-module-flag, r=jieyouxu
cg_llvm: Clean up FFI calls for setting module flags

This is a combination of several inter-related changes to how module flags are set:

- Remove some unnecessary code for setting an `"LTOPostLink"` flag, which has been obsolete since LLVM 17.
- Define our own enum instead of relying on enum values defined by LLVM's unstable C++ API.
- Use safe wrapper functions to set module flags, instead of direct `unsafe` calls.
- Consistently pass pointer/length strings instead of C strings.
- Remove or shrink some `unsafe` blocks.
2024-10-29 18:38:59 +01:00
Matthias Krüger
1e3c0da9a0
Rollup merge of #132274 - compiler-errors:cleanup-op-lookup, r=nnethercote
Cleanup op lookup in HIR typeck

Minor cleanup for some redundant methods involved with looking up the `Operator::operator` methods for operators.
2024-10-29 18:38:59 +01:00
Matthias Krüger
f9fdd63cf4
Rollup merge of #132157 - estebank:long-types-3, r=jieyouxu
Remove detail from label/note that is already available in other note

Remove the "which is required by `{root_obligation}`" post-script in
"the trait `X` is not implemented for `Y`" explanation in E0277. This
information is already conveyed in the notes explaining requirements,
making it redundant while making the text (particularly in labels)
harder to read.

```
error[E0277]: the trait bound `NotCopy: Copy` is not satisfied
  --> $DIR/wf-static-type.rs:10:13
   |
LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
   |             ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`
   |
   = note: required for `Option<NotCopy>` to implement `Copy`
note: required by a bound in `IsCopy`
  --> $DIR/wf-static-type.rs:7:17
   |
LL | struct IsCopy<T:Copy> { t: T }
   |                 ^^^^ required by this bound in `IsCopy`
```
vs the prior

```
error[E0277]: the trait bound `NotCopy: Copy` is not satisfied
  --> $DIR/wf-static-type.rs:10:13
   |
LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
   |             ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy`
   |
   = note: required for `Option<NotCopy>` to implement `Copy`
note: required by a bound in `IsCopy`
  --> $DIR/wf-static-type.rs:7:17
   |
LL | struct IsCopy<T:Copy> { t: T }
   |                 ^^^^ required by this bound in `IsCopy`
```

*Ignore first three commits from https://github.com/rust-lang/rust/pull/132086.*
2024-10-29 18:38:58 +01:00
Matthias Krüger
5dc36391fe
Rollup merge of #132151 - compiler-errors:coroutine-resume-outlives, r=spastorino
Ensure that resume arg outlives region bound for coroutines

When proving that `{Coroutine}: 'region`, we must also prove that the coroutine's resume ty outlives that region as well. See the inline comment.

Fixes #132104
2024-10-29 18:38:57 +01:00
Matthias Krüger
5d6c49938e
Rollup merge of #131984 - dingxiangfei2009:stabilize-if-let-rescope, r=traviscross,lcnr
Stabilize if_let_rescope

Close #131154
Tracked by #124085
2024-10-29 18:38:57 +01:00
Esteban Küber
5b54286640 Remove detail from label/note that is already available in other note
Remove the "which is required by `{root_obligation}`" post-script in
"the trait `X` is not implemented for `Y`" explanation in E0277. This
information is already conveyed in the notes explaining requirements,
making it redundant while making the text (particularly in labels)
harder to read.

```
error[E0277]: the trait bound `NotCopy: Copy` is not satisfied
  --> $DIR/wf-static-type.rs:10:13
   |
LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
   |             ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`
   |
   = note: required for `Option<NotCopy>` to implement `Copy`
note: required by a bound in `IsCopy`
  --> $DIR/wf-static-type.rs:7:17
   |
LL | struct IsCopy<T:Copy> { t: T }
   |                 ^^^^ required by this bound in `IsCopy`
```
vs the prior

```
error[E0277]: the trait bound `NotCopy: Copy` is not satisfied
  --> $DIR/wf-static-type.rs:10:13
   |
LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
   |             ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy`
   |
   = note: required for `Option<NotCopy>` to implement `Copy`
note: required by a bound in `IsCopy`
  --> $DIR/wf-static-type.rs:7:17
   |
LL | struct IsCopy<T:Copy> { t: T }
   |                 ^^^^ required by this bound in `IsCopy`
```
2024-10-29 16:26:57 +00:00
bors
e473783d90 Auto merge of #132231 - lukas-code:rc-plug-leaks, r=tgross35
Rc/Arc: don't leak the allocation if drop panics

Currently, when the last `Rc<T>` or `Arc<T>` is dropped and the destructor of `T` panics, the allocation will be leaked. This leak is unnecessary since the data cannot be (safely) accessed again and `Box` already deallocates in this case, so let's do the same for `Rc` and `Arc`, too.
2024-10-29 16:26:00 +00:00
lcnr
524a22e790 rebase 2024-10-29 17:07:32 +01:00
lcnr
4f3a73a42c update tools 2024-10-29 17:01:24 +01:00
lcnr
ce22ccb552 remove outdated debug_assertion 2024-10-29 17:01:24 +01:00
lcnr
f51ec110a7 TypingMode 🤔 2024-10-29 17:01:24 +01:00
Sean Cross
59944c9c9f xous: sync: remove rustc_const_stable attribute
These functions had `#[rustc_const_stable(feature = "const_locks", since
= "1.63.0")]` on them because they were originally taken from
`no_threads`. with d066dfd these no longer compile. Since other
platforms do not have this attribute, remove it. This fixes the build
for Xous.

Signed-off-by: Sean Cross <sean@xobs.io>
2024-10-29 22:43:46 +08:00
David Tenty
826e0ca885
powerpc64-ibm-aix: update maintainters
Chaofan and Kai will be passing over maintainership for the target over to David Tenty and Chris Cambly.
2024-10-29 10:00:40 -04:00
bors
2dece5bb62 Auto merge of #132317 - workingjubilee:rollup-x21ncea, r=workingjubilee
Rollup of 12 pull requests

Successful merges:

 - #131375 (compiler: apply clippy::clone_on_ref_ptr for CI)
 - #131520 (Mark `str::is_char_boundary` and `str::split_at*` unstably `const`.)
 - #132119 (Hack out effects support for old solver)
 - #132194 (Collect item bounds for RPITITs from trait where clauses just like associated types)
 - #132216 (correct LLVMRustCreateThinLTOData arg types)
 - #132233 (Split `boxed.rs` into a few modules)
 - #132266 (riscv-soft-abi-with-float-features.rs: adapt for LLVM 20)
 - #132270 (clarified doc for `std::fs::OpenOptions.truncate()`)
 - #132284 (Remove my ping for rustdoc/clean/types.rs)
 - #132293 (Remove myself from mentions inside `tests/ui/check-cfg` directory)
 - #132312 (Delete `tests/crashes/23707.rs` because it's flaky)
 - #132313 (compiletest: Rename `command-list.rs` to `directive-list.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-29 12:29:43 +00:00
Zalathar
8d2ed4f0f3 Clean up FFI calls for setting module flags
- Don't rely on enum values defined by LLVM's C++ API
- Use safe wrapper functions instead of direct `unsafe` calls
- Consistently pass pointer/length strings instead of C strings
2024-10-29 21:40:34 +11:00
Zalathar
ba81dbf3c6 Don't set unnecessary module flag "LTOPostLink"
This module flag was an internal detail of LLVM's optimization passes, and all
code involving it was removed in LLVM 17.

<200cc952a2>
2024-10-29 21:17:13 +11:00
Jubilee
6c5641c16b
Rollup merge of #132313 - Zalathar:directive-list, r=jieyouxu
compiletest: Rename `command-list.rs` to `directive-list.rs`

Because I forget the name of this file literally every single time I need to find and edit it.

r? jieyouxu
2024-10-29 03:11:45 -07:00
Jubilee
096363626a
Rollup merge of #132312 - jieyouxu:delete-crashes-23707, r=matthiaskrgr
Delete `tests/crashes/23707.rs` because it's flaky

It's conditioned on `only-x86_64` because it doesn't reliably fail on other platforms, it's optimization dependent and failed to ICE post-PGO in
<https://github.com/rust-lang/rust/pull/132300#issuecomment-2443279042>. Remove this test for now without prejudice against relanding the test in a more reliable form.

I removed the `S-bug-has-test` label from #23707.

r? compiler
2024-10-29 03:11:45 -07:00
Jubilee
9d58475760
Rollup merge of #132293 - Urgau:tests-check-cfg-out-triagebot, r=lqd
Remove myself from mentions inside `tests/ui/check-cfg` directory

This PR removes myself from mentions inside `tests/ui/check-cfg` directory.

I'm not sure this particular mention has ever been useful to me, and lately it's been too annoying for me to ignore it.

So remove my-self from it.
2024-10-29 03:11:44 -07:00
Jubilee
3eb7dddfed
Rollup merge of #132284 - camelid:rm-ping, r=workingjubilee
Remove my ping for rustdoc/clean/types.rs

It was useful at one time, but now it just causes notification noise.
2024-10-29 03:11:44 -07:00
Jubilee
29a7ca993d
Rollup merge of #132270 - yakiimoninja:fs-truncate-docs, r=Noratrieb
clarified doc for `std::fs::OpenOptions.truncate()`

Clarified what method does when `std::fs::OpenOptions.truncate()` parameter is set to `true`.
2024-10-29 03:11:43 -07:00
Jubilee
423d4f0c2f
Rollup merge of #132266 - krasimirgg:llvm-20-testfix, r=hanna-kruppe,beetrees,workingjubilee
riscv-soft-abi-with-float-features.rs: adapt for LLVM 20

Adapts a test for LLVM 20. No functional changes intended.
2024-10-29 03:11:43 -07:00
Jubilee
5ee13ae513
Rollup merge of #132233 - WaffleLapkin:box-module-split, r=workingjubilee
Split `boxed.rs` into a few modules

I wanted to add an impl for `Box<_>`, but was quickly discouraged by the 3K file. This splits off a couple bits, making it at least a bit more manageable.

r? ````@workingjubilee```` (I think you are not bothered by refactorings like this?)
2024-10-29 03:11:42 -07:00