Commit Graph

256007 Commits

Author SHA1 Message Date
Urgau
ab23fd8dea non_local_defs: improve main without a trait note 2024-05-27 23:59:18 +02:00
Urgau
d3dfe14b53 non_local_defs: be more precise about what needs to be moved 2024-05-27 23:59:18 +02:00
Urgau
402580bcd5 non_local_defs: improve exception note for impl and macro_rules!
- Remove wrong exception text for non-local macro_rules!
 - Simplify anonymous const exception note
2024-05-27 23:59:18 +02:00
Urgau
22095fbd8d non_local_defs: use labels to indicate what may need to be moved 2024-05-27 23:58:55 +02:00
Urgau
26b873d030 non_local_defs: use span of the impl def and not the impl block 2024-05-27 23:58:55 +02:00
Urgau
de1c122950 non_local_defs: improve some notes around trait, bounds, consts
- Restrict const-anon exception diag to relevant places
 - Invoke bounds (and type-inference) in non_local_defs
 - Specialize diagnostic for impl without Trait
2024-05-27 23:58:55 +02:00
Urgau
06c6a2d9d6 non_local_defs: switch to more friendly primary message 2024-05-27 23:58:55 +02:00
Urgau
5ad4ad7aee non_local_defs: move out from #[derive(LintDiagnostic)] to manual impl 2024-05-27 23:58:55 +02:00
bors
f00b02e6bb Auto merge of #125599 - camelid:clarify-stability, r=notriddle,GuillaumeGomez
rustdoc: Clarify const-stability with regard to normal stability

Fixes #125511.

- Elide const-unstable if also unstable overall
- Show "const" for const-unstable if also overall unstable
2024-05-27 18:42:42 +00:00
bors
b0f8618938 Auto merge of #125413 - lcnr:ambig-drop-region-constraints, r=compiler-errors
drop region constraints for ambiguous goals

See the comment in `compute_external_query_constraints`. While the underlying issue is preexisting, this fixes a bug introduced by #125343.

It slightly weakens the leak chec, even if we didn't have any test which was affected. I want to write such a test before merging this PR.

r? `@compiler-errors`
2024-05-27 15:28:51 +00:00
bors
f6e4703e91 Auto merge of #125611 - GuillaumeGomez:rollup-dfavpgg, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #124870 (Update Result docs to the new guarantees)
 - #125148 (codegen: tweak/extend shift comments)
 - #125522 (Add "better" edition handling on lint-docs tool)
 - #125530 (cleanup dependence of `ExtCtxt` in transcribe when macro expansion)
 - #125535 (clean-up: remove deprecated field `dist.missing-tools`)
 - #125597 (Uplift `EarlyBinder` into `rustc_type_ir`)
 - #125607 (Migrate `run-make/compile-stdin` to `rmake.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-27 13:22:55 +00:00
Guillaume Gomez
7083131c92
Rollup merge of #125607 - GuillaumeGomez:migrate-compile-stdin, r=jieyouxu
Migrate `run-make/compile-stdin` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? `@jieyouxu`
2024-05-27 13:10:37 +02:00
Guillaume Gomez
a9c125f864
Rollup merge of #125597 - compiler-errors:early-binder, r=jackh726
Uplift `EarlyBinder` into `rustc_type_ir`

We also need to give `EarlyBinder` a `'tcx` param, so that we can carry the `Interner` in the `EarlyBinder` too. This is necessary because otherwise we have an unconstrained `I: Interner` parameter in many of the `EarlyBinder`'s inherent impls.

I also generally think that this is desirable to have, in case we later want to track some state in the `EarlyBinder`.

r? lcnr
2024-05-27 13:10:36 +02:00
Guillaume Gomez
cfa7ab474f
Rollup merge of #125535 - onur-ozkan:remove-deprecated-field, r=clubby789
clean-up: remove deprecated field `dist.missing-tools`

It's been 5 months since this field was deprecated.
2024-05-27 13:10:36 +02:00
Guillaume Gomez
f50b4f5034
Rollup merge of #125530 - SparrowLii:expand2, r=petrochenkov
cleanup dependence of `ExtCtxt` in transcribe when macro expansion

part of #125356
We can remove `transcribe`’s dependence on `ExtCtxt` to facilitate subsequent work (such as moving macro expansion into the incremental compilation system)

r? ```@petrochenkov```
Thanks for the reviewing!
2024-05-27 13:10:35 +02:00
Guillaume Gomez
ad37f40355
Rollup merge of #125522 - spastorino:fix-lint-docs-edition-handling, r=Urgau,michaelwoerister
Add "better" edition handling on lint-docs tool

r? `@Urgau`
2024-05-27 13:10:34 +02:00
Guillaume Gomez
86f2fa35a2
Rollup merge of #125148 - RalfJung:codegen-sh, r=scottmcm
codegen: tweak/extend shift comments

r? `@scottmcm`
2024-05-27 13:10:34 +02:00
Guillaume Gomez
6dddc888fc
Rollup merge of #124870 - Lokathor:update-result-docs, r=dtolnay
Update Result docs to the new guarantees

The `Option` docs already explain the guarantees given in [RFC 3391](https://github.com/rust-lang/rfcs/blob/master/text/3391-result_ffi_guarantees.md), so all that we need is a paragraph saying that some `Result` type combinations will also qualify.

Part of https://github.com/rust-lang/rust/issues/110503
2024-05-27 13:10:33 +02:00
bors
a59072ec4f Auto merge of #125602 - RalfJung:interpret-mir-lifetime, r=oli-obk
interpret: get rid of 'mir lifetime

I realized our MIR bodies are actually at lifetime `'tcx`, so we don't need to carry around this other lifetime everywhere.

r? `@oli-obk`
2024-05-27 11:01:15 +00:00
Guillaume Gomez
e4abfaeb62 Migrate run-make/compile-stdin to rmake.rs 2024-05-27 11:37:27 +02:00
bors
b582f807fa Auto merge of #125410 - fmease:adj-lint-diag-api, r=nnethercote
[perf] Delay the construction of early lint diag structs

Attacks some of the perf regressions from https://github.com/rust-lang/rust/pull/124417#issuecomment-2123700666.

See individual commits for details. The first three commits are not strictly necessary.
However, the 2nd one (06bc4fc671, *Remove `LintDiagnostic::msg`*) makes the main change way nicer to implement.
It's also pretty sweet on its own if I may say so myself.
2024-05-27 08:44:12 +00:00
bors
fec98b3bbc Auto merge of #125468 - BoxyUwU:remove_defid_from_regionparam, r=compiler-errors
Remove `DefId` from `EarlyParamRegion`

Currently we represent usages of `Region` parameters via the `ReEarlyParam` or `ReLateParam` variants. The `ReEarlyParam` is effectively equivalent to `TyKind::Param` and `ConstKind::Param` (i.e. it stores a `Symbol` and a `u32` index) however it also stores a `DefId` for the definition of the lifetime parameter.

This was used in roughly two places:
- Borrowck diagnostics instead of threading the appropriate `body_id` down to relevant locations. Interestingly there were already some places that had to pass down a `DefId` manually.
- Some opaque type checking logic was using the `DefId` field to track captured lifetimes

I've split this PR up into a commit for generate rote changes to diagnostics code to pass around a `DefId` manually everywhere, and another commit for the opaque type related changes which likely require more careful review as they might change the semantics of lints/errors.

Instead of manually passing the `DefId` around everywhere I previously tried to bundle it in with `TypeErrCtxt` but ran into issues with some call sites of `infcx.err_ctxt` being unable to provide a `DefId`, particularly places involved with trait solving and normalization. It might be worth investigating adding some new wrapper type to pass this around everywhere but I think this might be acceptable for now.

This pr also has the effect of reducing the size of `EarlyParamRegion` from 16 bytes -> 8 bytes. I wouldn't expect this to have any direct performance improvement however, other variants of `RegionKind` over `8` bytes are all because they contain a `BoundRegionKind` which is, as far as I know, mostly there for diagnostics. If we're ever able to remove this it would shrink the `RegionKind` type from `24` bytes to `12` (and with clever bit packing we might be able to get it to `8` bytes). I am curious what the performance impact would be of removing interning of `Region`'s if we ever manage to shrink `RegionKind` that much.

Sidenote: by removing the `DefId` the `Debug` output for `Region` has gotten significantly nicer. As an example see this opaque type debug print before vs after this PR:
`Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), [DefId(0:9 ~ impl_trait_captures[aeb9]::foo::'a)_'a/#0, T, DefId(0:9 ~ impl_trait_captures[aeb9]::foo::'a)_'a/#0])`
`Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), ['a/#0, T, 'a/#0])`

r? `@compiler-errors` (I would like someone who understands the opaque type setup to atleast review the type system commit, but the rest is likely reviewable by anyone)
2024-05-27 06:36:57 +00:00
Ralf Jung
e8379c9598 interpret: get rid of 'mir lifetime everywhere 2024-05-27 08:25:57 +02:00
Ralf Jung
36d36a3e1f interpret: the MIR is actually at lifetime 'tcx 2024-05-27 07:45:41 +02:00
Noah Lev
699d28f968 rustdoc: Show "const" for const-unstable if also overall unstable
If a const function is unstable overall (and thus, in all circumstances
I know of, also const-unstable), we should show the option to use it as
const. You need to enable a feature to use the function at all anyway.

If the function is stabilized without also being const-stabilized, then
we do not show the const keyword and instead show "const: unstable" in
the version info.
2024-05-26 21:06:02 -07:00
bors
cdc509f7c0 Auto merge of #125580 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2024-05-27 02:23:10 +00:00
Michael Goulet
f92292978f Use EarlyBinder in rustc_type_ir, simplify imports 2024-05-26 20:53:00 -04:00
Michael Goulet
993553ceb8 Uplift EarlyBinder 2024-05-26 20:45:37 -04:00
bors
529bb2573a Auto merge of #125593 - workingjubilee:rollup-67qk7di, r=workingjubilee
Rollup of 8 pull requests

Successful merges:

 - #124048 (Support C23's Variadics Without a Named Parameter)
 - #125046 (Only allow immutable statics with #[linkage])
 - #125466 (Don't continue probing for method if in suggestion and autoderef hits ambiguity)
 - #125469 (Don't skip out of inner const when looking for body for suggestion)
 - #125544 (Also mention my-self for other check-cfg docs changes)
 - #125559 (Simplify the `unchecked_sh[lr]` ub-checks a bit)
 - #125566 (Notify T-rustdoc for beta-accepted and stable-accepted too)
 - #125582 (Avoid a `FieldIdx::from_usize` in InstSimplify)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-27 00:17:11 +00:00
Michael Goulet
bbcdb4fd3e Give EarlyBinder a tcx parameter
We are gonna need it to uplift EarlyBinder
2024-05-26 20:04:05 -04:00
Jubilee
4ff78692db
Rollup merge of #125582 - scottmcm:less-from-usize, r=jieyouxu
Avoid a `FieldIdx::from_usize` in InstSimplify

Just a tiny cleanup I noticed in passing while looking at something unrelated.
2024-05-26 15:28:29 -07:00
Jubilee
45507e4304
Rollup merge of #125566 - camelid:notify-accepted, r=GuillaumeGomez
Notify T-rustdoc for beta-accepted and stable-accepted too

Otherwise, it's unclear when the nomination label is removed whether the backport was accepted, thus nomination removed, or if the backport was rejected, thus nomination removed.

r? ````@GuillaumeGomez````
2024-05-26 15:28:29 -07:00
Jubilee
25b079a1cf
Rollup merge of #125559 - scottmcm:simplify-shift-ubcheck, r=workingjubilee
Simplify the `unchecked_sh[lr]` ub-checks a bit

It can use the constant in the check, rather than passing it as a parameter.
2024-05-26 15:28:28 -07:00
Jubilee
c51fc1d02b
Rollup merge of #125544 - Urgau:check-cfg-mention-cargo-specific, r=jieyouxu
Also mention my-self for other check-cfg docs changes

This PR adds a mention for my-self for the recently added `src/doc/rustc/src/check-cfg` directory.

*I had to add a second mention just for the directory since [`Path::starts_with`](https://doc.rust-lang.org/std/path/struct.Path.html#method.starts_with) as used by [triagebot](48f29f351c/src/handlers/mentions.rs (L69)), matches on path components and so can never return true for a file and directory at the same time.*
2024-05-26 15:28:28 -07:00
Jubilee
b65b2b6ced
Rollup merge of #125469 - compiler-errors:dont-skip-inner-const-body, r=cjgillot
Don't skip out of inner const when looking for body for suggestion

Self-explanatory title, I'll point out the important logic in an inline comment.

Fixes #125370
2024-05-26 15:28:27 -07:00
Jubilee
09e75921f3
Rollup merge of #125466 - compiler-errors:dont-probe-for-ambig-in-sugg, r=jieyouxu
Don't continue probing for method if in suggestion and autoderef hits ambiguity

The title is somewhat self-explanatory. When we hit ambiguity in method autoderef steps, we previously would continue to probe for methods if we were giving a suggestion. This seems useless, and causes an ICE when we are not able to unify the receiver later on in confirmation.

Fixes #125432
2024-05-26 15:28:27 -07:00
Jubilee
5860d43af3
Rollup merge of #125046 - bjorn3:no_mutable_static_linkage, r=cjgillot
Only allow immutable statics with #[linkage]
2024-05-26 15:28:26 -07:00
Jubilee
866630d004
Rollup merge of #124048 - veera-sivarajan:bugfix-123773-c23-variadics, r=compiler-errors
Support C23's Variadics Without a Named Parameter

Fixes #123773

This PR removes the static check that disallowed extern functions
with ellipsis (varargs) as the only parameter since this is now
valid in C23.

This will not break any existing code as mentioned in the proposal
document: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2975.pdf.

Also, adds a doc comment for `check_decl_cvariadic_pos()` and
fixes the name of the function (`varadic` -> `variadic`).
2024-05-26 15:28:26 -07:00
bors
0aad3f64e2 Auto merge of #125576 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-05-26 22:08:06 +00:00
Scott McMurray
d37f456b2a Avoid a FieldIdx::from_usize in InstSimplify 2024-05-26 13:31:28 -07:00
bors
bdbbb6c6a7 Auto merge of #125546 - ChrisDenton:mingw-ci, r=Mark-Simulacrum
Try to not reinstall tools in mingw CI

Reinstalling the tools seems prone to failure (e.g. [latest](https://github.com/rust-lang/rust/pull/125529#issuecomment-2130919307)) and is more work. It also seems unnecessary as CI actually uses a vendored tarball for builds.

cc `@mati865`
2024-05-26 18:50:48 +00:00
bors
0963353634 Auto merge of #3631 - RalfJung:blocking-refactor, r=RalfJung
completely refactor how we manage blocking and unblocking threads

This hides a lot of invariants from the implementation of the synchronization primitives, and makes sure we never have to release or acquire a vector clock on another thread but the active one.
2024-05-26 18:36:10 +00:00
Ralf Jung
2e89443b93 add a macro to declare thread unblock callbacks 2024-05-26 19:15:05 +02:00
bors
b0925697fd Auto merge of #122079 - tbu-:pr_copy_file_range_probe, r=the8472
Less syscalls for the `copy_file_range` probe

If it's obvious from the actual syscall results themselves that the syscall is supported or unsupported, don't do an extra syscall with an invalid file descriptor.

CC #122052
2024-05-26 15:48:29 +00:00
bors
8e861c6c4c Auto merge of #3632 - RalfJung:readdir, r=RalfJung
unix/fs: a bit of cleanup in macos_fbsd_readdir_r
2024-05-26 15:22:18 +00:00
Ralf Jung
350f5c88db unix/fs: a bit of cleanup in macos_fbsd_readdir_r 2024-05-26 17:20:28 +02:00
bors
e09bf5694b Auto merge of #3633 - RalfJung:target, r=RalfJung
fix './miri run --dep --target _'
2024-05-26 14:39:28 +00:00
Ralf Jung
cbec1288a2 fix './miri run --dep --target _' 2024-05-26 16:37:50 +02:00
Ralf Jung
e6bb468b53 data_race: vector indices can be reused immediately when the thread is gone 2024-05-26 16:11:04 +02:00
Ralf Jung
a131243557 completely refactor how we manage blocking and unblocking threads 2024-05-26 16:11:04 +02:00