Commit Graph

265007 Commits

Author SHA1 Message Date
lcnr 6188aae369 do not attempt to prove unknowable goals 2024-09-03 08:35:23 +02:00
bors 6199b69c53 Auto merge of #129777 - nnethercote:unreachable_pub-4, r=Urgau
Add `unreachable_pub`, round 4

A follow-up to #129732.

r? `@Urgau`
2024-09-03 01:27:20 +00:00
bors 2251572086 Auto merge of #129915 - matthiaskrgr:rollup-56h2xp2, r=matthiaskrgr
Rollup of 12 pull requests

Successful merges:

 - #129748 (Box validity: update for new zero-sized rules)
 - #129829 (Make decoding non-optional `LazyArray` panic if not set)
 - #129856 (compiler_fence documentation: emphasize synchronization, not reordering)
 - #129868 (Remove kobzol vacation status)
 - #129875 (chore: Fix typos in 'compiler' (batch 1))
 - #129877 (chore: Fix typos in 'compiler' (batch 2))
 - #129878 (chore: Fix typos in 'compiler' (batch 3))
 - #129890 (Remove stray word in a comment)
 - #129892 (Clarify language around ptrs in slice::raw)
 - #129905 (mailmap: add new email for davidtwco)
 - #129906 (mailmapper?)
 - #129907 (Fix compile error in solid's remove_dir_all)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-02 22:54:39 +00:00
Nicholas Nethercote 88b6a78d0b Add `warn(unreachable_pub)` to `rustc_const_eval`. 2024-09-03 08:50:33 +10:00
Nicholas Nethercote d7caea129d Add `warn(unreachable_pub)` to `rustc_ty_utils`. 2024-09-03 08:50:33 +10:00
Nicholas Nethercote 3e09c450b4 Add `warn(unreachable_pub)` to `rustc_type_ir`. 2024-09-03 08:50:31 +10:00
Nicholas Nethercote e4b1e28033 Add `warn(unreachable_pub)` to `rustc_transmute`. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote 2e358e633d Add `warn(unreachable_pub)` to `rustc_trait_selection`. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote c4f6f52139 Add `warn(unreachable_pub)` to `rustc_traits`. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote 0fb3a509cf Add `warn(unreachable_pub)` to `rustc_target`. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote 89deb3c742 Add `warn(unreachable_pub)` to `rustc_symbol_mangling`. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote b0f22ff98f Add `warn(unreachable_pub)` to `rustc_span`. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote b457ab3186 Add `warn(unreachable_pub)` to `rustc_smir`. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote 19ff6e6e63 Add `warn(unreachable_pub)` to `rustc_session`. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote 21a37da268 Add `warn(unreachable_pub)` to `rustc_serialize`. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote 19843bba64 Add `warn(unreachable_pub)` to `rustc_sanitizers`. 2024-09-03 08:49:54 +10:00
Matthias Krüger d6298d3736
Rollup merge of #129907 - saethlin:solid-io-error, r=WaffleLapkin
Fix compile error in solid's remove_dir_all

Before this PR, `x check library/std --target=aarch64-kmc-solid_asp3` will fail with:
```
error[E0382]: use of partially moved value: `result`
   --> std/src/sys/pal/solid/fs.rs:544:20
    |
541 |         if let Err(err) = result
    |                    --- value partially moved here
...
544 |             return result;
    |                    ^^^^^^ value used here after partial move
    |
    = note: partial move occurs because value has type `io::error::Error`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
    |
541 |         if let Err(ref err) = result
    |                    +++

```

cc `@kawadakk` I think this will clear up https://solid-rs.github.io/toolstate/ :)
2024-09-02 22:35:23 +02:00
Matthias Krüger b1b8e3ef0d
Rollup merge of #129906 - BoxyUwU:boxy_mailmap, r=lqd
mailmapper?

I think I have done this right? lol
2024-09-02 22:35:23 +02:00
Matthias Krüger f065302f09
Rollup merge of #129905 - davidtwco:update-davidtwco-mailmap, r=lqd
mailmap: add new email for davidtwco
2024-09-02 22:35:23 +02:00
Matthias Krüger 9dad90a22a
Rollup merge of #129892 - oskgo:clarify-slice-from-raw, r=RalfJung
Clarify language around ptrs in slice::raw

More specifically we explicitly mention that the pointer should be non-null as a top level requirement. Nullptrs are always valid for zero sized operations, so just validity (and alignment) does not guarantee non-nullness as implied in the existing docs.

We also explicitly call out ZSTs as an additional example where perhaps unintuitively alignment and non-nullness still have to hold.

Finally we change `data` in the range functions to `start`, which seems like a typo to me.

Touches docs for #89792

r? RalfJung
2024-09-02 22:35:22 +02:00
Matthias Krüger 3ddf061926
Rollup merge of #129890 - alex:patch-1, r=workingjubilee
Remove stray word in a comment
2024-09-02 22:35:22 +02:00
Matthias Krüger 929b308579
Rollup merge of #129878 - Sajjon:sajjon_fix_typos_batch_3, r=jieyouxu
chore: Fix typos in 'compiler' (batch 3)

Batch 3/3: Fixes typos in `compiler`

(See [issue](https://github.com/rust-lang/rust/issues/129874) tracking all PRs with typos fixes)
2024-09-02 22:35:21 +02:00
Matthias Krüger 1d9eb9df7f
Rollup merge of #129877 - Sajjon:sajjon_fix_typos_batch_2, r=fee1-dead
chore: Fix typos in 'compiler' (batch 2)

Batch 2/3: Fixes typos in `compiler`

(See [issue](https://github.com/rust-lang/rust/issues/129874) tracking all PRs with typos fixes)
2024-09-02 22:35:21 +02:00
Matthias Krüger cfb12716e9
Rollup merge of #129875 - Sajjon:sajjon_fix_typos_batch_1, r=compiler-errors,jieyouxu
chore: Fix typos in 'compiler' (batch 1)

Batch 1/3: Fixes typos in `compiler`

(See [issue](https://github.com/rust-lang/rust/issues/129874) tracking all PRs with typos fixes)
2024-09-02 22:35:20 +02:00
Matthias Krüger 912931d64a
Rollup merge of #129868 - Kobzol:kobzol-vacation-remove, r=lqd
Remove kobzol vacation status

Conflicts with https://github.com/rust-lang/rust/pull/129843, so should be merged after it.
2024-09-02 22:35:20 +02:00
Matthias Krüger f0072bf274
Rollup merge of #129856 - RalfJung:compiler_fence, r=thomcc
compiler_fence documentation: emphasize synchronization, not reordering

Our `fence` docs have at some point been update to explain that they are about synchronization, not about "preventing reordering". This updates the `compiler_fence` docs n the same vein, mostly by referring to the `fence` docs.

The old docs make it sound like I can put a compiler_fence in the middle of a bunch of non-atomic operations and that would achieve any kind of guarantee. It does not, atomic operations are still required to do synchronization.

I also slightly tweaked the `fence` docs, to put the synchronization first and the "prevent reordering" second.

Cc `@rust-lang/opsem` `@chorman0773` `@m-ou-se`

Fixes https://github.com/rust-lang/rust/issues/129189
Fixes https://github.com/rust-lang/rust/issues/54962
2024-09-02 22:35:19 +02:00
Matthias Krüger c6410f5066
Rollup merge of #129829 - compiler-errors:decode-non-optional, r=lcnr
Make decoding non-optional `LazyArray` panic if not set

Tables may be [defined](9649706ead/compiler/rustc_metadata/src/rmeta/mod.rs (L377)) as `optional:` or `defaulted:`. If optional, if we try to read a value from a key that was never encoded, we should panic. This has high value in ensuring correctness over a defaulted table, so the tradeoff is worth considering, since it signals the compiler has a buggy encode impl, rather than just defaulting to a value.

HOWEVER, `optional:` arrays were side-stepping this. So this PR fixes that, and makes `optional:` tables of `LazyArray` act like `LazyValue`, and panic if it's not assigned a value during encoding.

During this PR, I found that `deduced_param_attrs` has buggy (?? i think??) implementation where it will refuse to encode cross-crate `deduced_param_attrs` unless we're codegening, we're optimizing the library, and incremental is disabled. This seems incredibly wrong, but I don't want to fix it in this PR.
9649706ead/compiler/rustc_metadata/src/rmeta/encoder.rs (L1733-L1747)
2024-09-02 22:35:19 +02:00
Matthias Krüger 003ddec7a6
Rollup merge of #129748 - RalfJung:box-validity, r=workingjubilee
Box validity: update for new zero-sized rules

Fixes https://github.com/rust-lang/unsafe-code-guidelines/issues/529

Cc `@joshlf` `@rust-lang/opsem`
2024-09-02 22:35:18 +02:00
Ben Kimock 8be9fed672 Fix compile error in solid's remove_dir_all 2024-09-02 14:58:00 -04:00
Jakub Beránek fa77b9d21c
Remove kobzol vacation status 2024-09-02 20:06:37 +02:00
Boxy 5d47b4d198 mailmapper? 2024-09-02 18:15:26 +01:00
David Wood 7ac5fdaf99
mailmap: add new email for davidtwco
Signed-off-by: David Wood <david@davidtw.co>
2024-09-02 18:12:20 +01:00
bors bd53aa3bf7 Auto merge of #129317 - compiler-errors:expectation-subtyping, r=lcnr
Use equality when relating formal and expected type in arg checking

#129059 uncovered an interesting issue in argument checking. When we check arguments, we create three sets of types:
* Formals
* Expected
* Actuals

The **actuals** are the types of the argument expressions themselves. The **formals** are the types from the signature that we're checking. The **expected** types are the formal types, but passed through `expected_inputs_for_expected_outputs`:

a971212545/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs (L691-L725)

This method attempts to constrain the formal inputs by relating the [expectation](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_typeck/expectation/enum.Expectation.html) of the call expression and the formal output.

When we check an argument, we get the expression's actual type, and then we first attempt to coerce it to the expected type:

a971212545/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs (L280-L293)

Then we subtype the expected type and the formal type:

a971212545/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs (L299-L305)

However, since we are now recording the right coercion target (since #129059), we now end up recording the expected type to the typeck results, rather than the actual.

Since that expected type was [fudged](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxt.html#method.fudge_inference_if_ok), it has fresh variables. And since the expected type is only subtyped against the formal type, if that expected type has a bivariant parameter, it will likely remain unconstrained since `Covariant * Bivariant = Bivariant` according to [xform](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.Variance.html#method.xform). This leads to an unconstrained type variable in writeback.

AFAICT, there's no reason for us to be using subtyping here, though. The expected output is already related to the expectation by subtyping:

a971212545/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs (L713)

So the formals don't need "another" indirection of subtyping in the argument checking... So I've changed it to use equality here. We could alternatively fix this by requiring WF for all the expected types to constrain their bivariant parameters, but this seems a bit overkill.

Fixes #129286
2024-09-02 16:08:50 +00:00
oskgo 7494224e74 clarify language around non-null ptrs in slice::raw 2024-09-02 15:49:18 +02:00
Alex Gaynor 06e3552ad0
Remove stray word in a comment 2024-09-02 09:44:03 -04:00
bors a4601859ae Auto merge of #129873 - matthiaskrgr:rollup-bv849ud, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #127474 (doc: Make block of inline Deref methods foldable)
 - #129678 (Deny imports of `rustc_type_ir::inherent` outside of type ir + new trait solver)
 - #129738 (`rustc_mir_transform` cleanups)
 - #129793 (add extra linebreaks so rustdoc can identify the first sentence)
 - #129804 (Fixed some typos in the standard library documentation/comments)
 - #129837 (Actually parse stdout json, instead of using hacky contains logic.)
 - #129842 (Fix LLVM ABI NAME for riscv64imac-unknown-nuttx-elf)
 - #129843 (Mark myself as on vacation for triagebot)
 - #129858 (Replace walk with visit so we dont skip outermost expr kind in def collector)

Failed merges:

 - #129777 (Add `unreachable_pub`, round 4)
 - #129868 (Remove kobzol vacation status)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-02 13:41:42 +00:00
Alexander Cyon 00de006f22
chore: Fix typos in 'compiler' (batch 2) 2024-09-02 07:50:22 +02:00
Alexander Cyon ac69544a17
chore: Fix typos in 'compiler' (batch 1) 2024-09-02 07:42:38 +02:00
Alexander Cyon 5780c1ca5e
chore: Fix typos in 'compiler' (batch 3) 2024-09-02 07:33:41 +02:00
bors 9b82580c73 Auto merge of #129798 - weihanglo:update-cargo, r=weihanglo
Update cargo

9 commits in 8f40fc59fb0c8df91c97405785197f3c630304ea..c1fa840a85eca53818895901a53fae34247448b2
2024-08-21 22:37:06 +0000 to 2024-08-29 21:03:53 +0000
- fix(resolve): With `latest` message, differentiate actionable updates (rust-lang/cargo#14461)
- fix(pkgid): Allow open namespaces in PackageIdSpec's (rust-lang/cargo#14467)
- feat(resolve): Report incompatible-with-rustc when MSRV-resolver is disabled (rust-lang/cargo#14459)
- fix(resolve): Report incompatible packages with precise Rust version (rust-lang/cargo#14457)
- fix(resolve): Dont show locking workspace members (rust-lang/cargo#14445)
- Log details of failure if no errors were seen (rust-lang/cargo#14453)
- More helpful missing feature error message (rust-lang/cargo#14436)
- feat: Add matches_prerelease semantic (rust-lang/cargo#14305)
- refactor(update): Prepare for smarter update messages (rust-lang/cargo#14440)

r? ghost
2024-09-02 05:13:21 +00:00
Matthias Krüger 38b6a66def
Rollup merge of #129858 - compiler-errors:async-def, r=cjgillot
Replace walk with visit so we dont skip outermost expr kind in def collector

This affects async closures with macros as their body expr. Fixes #129855.

r? ``@cjgillot`` or anyone else
2024-09-02 04:19:31 +02:00
Matthias Krüger 3ea3397943
Rollup merge of #129843 - tgross35:triagebot-vacation, r=tgross35
Mark myself as on vacation for triagebot

I'll be on vacation for a couple weeks coming up pretty soon.

r? ``@ghost``
2024-09-02 04:19:31 +02:00
Matthias Krüger efad457ad5
Rollup merge of #129842 - no1wudi:master, r=saethlin
Fix LLVM ABI NAME for riscv64imac-unknown-nuttx-elf

This patch fix https://github.com/rust-lang/rust/issues/129825

For the riscv64imac target, the LLVM ABI NAME should be "lp64", which is the default ABI if not specified for the riscv64imac target.
2024-09-02 04:19:30 +02:00
Matthias Krüger 5c3370d684
Rollup merge of #129837 - aDotInTheVoid:test-better-json, r=jieyouxu
Actually parse stdout json, instead of using hacky contains logic.

Fixes up the test added in #128963, to actually parse the stdout to JSON, instead of just checking that it contains `{"`.

CC ``@GuillaumeGomez``

r? ``@jieyouxu``
2024-09-02 04:19:30 +02:00
Matthias Krüger 820540aaa0
Rollup merge of #129804 - ranger-ross:fixed-documentation-typos, r=Noratrieb
Fixed some typos in the standard library documentation/comments

I spent some time to fix a few typos in `library/std` and `library/core`
2024-09-02 04:19:29 +02:00
Matthias Krüger 8c2898989f
Rollup merge of #129793 - lolbinarycat:doc-missing-newlines, r=workingjubilee
add extra linebreaks so rustdoc can identify the first sentence

there should probably be a lint against this in rustdoc, it causes too many lines to be shown in the short documentation overviews

expecially noticable for the slice primative type: https://doc.rust-lang.org/std/index.html
2024-09-02 04:19:29 +02:00
Matthias Krüger dce26656ea
Rollup merge of #129738 - nnethercote:rustc_mir_transform-cleanups, r=cjgillot
`rustc_mir_transform` cleanups

A bunch of small improvements I made while looking closely at this code.

r? `@saethlin`
2024-09-02 04:19:28 +02:00
Matthias Krüger e0039171ff
Rollup merge of #129678 - compiler-errors:type-ir-inherent, r=fmease
Deny imports of `rustc_type_ir::inherent` outside of type ir + new trait solver

We shouldn't encourage using `rustc_type_ir::inherent` outside of the new solver[^1], though this can happen by accident due to rust-analyzer, for example. See https://github.com/rust-lang/rust/pull/127537#discussion_r1733813842 for an example in practice.

r? fmease

[^1]: Unless we go the fully radical approach of always using these inherent methods everywhere in favor of inherent methods, which would be a major overhaul of the compiler, IMO. I don't really want to consider that possibility right now, tho.
2024-09-02 04:19:28 +02:00
Matthias Krüger c90991db17
Rollup merge of #127474 - tesuji:foldable-inline-derefs, r=t-rustdoc
doc: Make block of inline Deref methods foldable

After:
![image](https://github.com/rust-lang/rust/assets/15225902/3e8ab320-dbf7-436f-9be0-d0ef82664663)
Before:
![image](https://github.com/rust-lang/rust/assets/15225902/f6f7635d-d4c3-437e-a2d9-147726287b05)

Fix  #127470.

Current status:
- [x] Bug when hovering over title "Methods from ...": The anchor sign $ overlaps with `[-]`: https://github.com/rust-lang/rust/pull/127474#issuecomment-2222930038
    => Fixed by https://github.com/rust-lang/rust/pull/127474#issuecomment-2228886292
2024-09-02 04:19:27 +02:00
bors e71f952912 Auto merge of #129063 - the8472:cold-opt-size, r=Amanieu
Apply size optimizations to panic machinery and some cold functions

* std dependencies gimli and addr2line are now built with opt-level=s
* various panic-related methods and `#[cold]` methods are now marked `#[optimize(size)]`

Panics should be cold enough that it doesn't make sense to optimize them for speed. The only tradeoff here is if someone does a lot of backtrace captures (without panics) and printing then the opt-level change might impact their perf.

Seems to be the first use of the optimize attribute. Tracking issue #54882
2024-09-02 00:58:50 +00:00