Commit Graph

264549 Commits

Author SHA1 Message Date
Michael Howell
a1746b4202 rustdoc: fix missing resource suffix on crates.js
Fixes a regression introduced in #128252.
2024-08-26 20:42:32 -07:00
Nicholas Nethercote
3aae994ca2 Add warn(unreachable_pub) to rustc_hir_pretty. 2024-08-27 13:25:40 +10:00
Nicholas Nethercote
5acf4e7b4b Add warn(unreachable_pub) to rustc_hir_analysis. 2024-08-27 13:14:50 +10:00
Nicholas Nethercote
bffa2244ed Add warn(unreachable_pub) to rustc_hir. 2024-08-27 12:59:20 +10:00
Nicholas Nethercote
fa18140994 Add warn(unreachable_pub) to rustc_graphviz. 2024-08-27 12:58:29 +10:00
Nicholas Nethercote
a510813e03 Add warn(unreachable_pub) to rustc_fluent_macro. 2024-08-27 12:56:54 +10:00
Nicholas Nethercote
0d8d05c07f Add warn(unreachable_pub) to rustc_feature. 2024-08-27 12:55:54 +10:00
Nicholas Nethercote
df5fbf05a1 Add warn(unreachable_pub) to rustc_expand.
Plus a tiny bit of reformatting.
2024-08-27 12:40:38 +10:00
Nicholas Nethercote
5fd503ab44 Add warn(unreachable_pub) to rustc_errors. 2024-08-27 12:03:37 +10:00
Nicholas Nethercote
2b5621280c Add warn(unreachable_pub) to rustc_error_messages. 2024-08-27 11:52:08 +10:00
Nicholas Nethercote
d607cfb336 Add warn(unreachable_pub) to rustc_error_codes. 2024-08-27 11:49:59 +10:00
Nicholas Nethercote
e81fad2b4d Add warn(unreachable_pub) to rustc_driver_impl. 2024-08-27 11:47:25 +10:00
Michael Goulet
38e62b9841 Use unsafe extern blocks throughout the compiler 2024-08-26 19:51:05 -04:00
Michael Goulet
56d861134d Fix tidy 2024-08-26 19:49:47 -04:00
bors
bf662eb808 Auto merge of #129632 - matthiaskrgr:rollup-8055gq6, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #126013 (Add `#[warn(unreachable_pub)]` to a bunch of compiler crates)
 - #128157 (deduplicate and clarify rules for converting pointers to references)
 - #129032 (Document & implement the transmutation modeled by `BikeshedIntrinsicFrom`)
 - #129250 (Do not ICE on non-ADT rcvr type when looking for crate version collision)
 - #129340 (Remove Duplicate E0381 Label)
 - #129560 ([rustdoc] Generate source link on impl associated types)
 - #129622 (Remove a couple of unused feature enables)
 - #129625 (Rename `ParenthesizedGenericArgs` to `GenericArgsMode`)
 - #129626 (Remove `ParamMode::ExplicitNamed`)

Failed merges:

 - #128166 (Improved `checked_isqrt` and `isqrt` methods)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-26 22:56:04 +00:00
Michael Goulet
93295ff6dc Remove some unnecessary TODOs 2024-08-26 18:44:20 -04:00
Michael Goulet
4609841c07 Stop using a special inner body for the coroutine by-move body for async closures 2024-08-26 18:44:19 -04:00
Matthias Krüger
b3b6baf833
Rollup merge of #129626 - compiler-errors:explicit-named, r=fmease
Remove `ParamMode::ExplicitNamed`

This was introduced as a hack to improve a diagnostics suggestion in #61679. It was subsequently broken, but also it was an incomplete hack that I don't believe we need to support, so let's just remove it.
2024-08-27 00:42:02 +02:00
Matthias Krüger
3d8d9da6a0
Rollup merge of #129625 - compiler-errors:generic-args-mode, r=fmease
Rename `ParenthesizedGenericArgs` to `GenericArgsMode`

A bit easier to digest name. Broken out of a PR implementing return type notation.
2024-08-27 00:42:02 +02:00
Matthias Krüger
90a1b6d158
Rollup merge of #129622 - bjorn3:less_unstable, r=lqd
Remove a couple of unused feature enables
2024-08-27 00:42:01 +02:00
Matthias Krüger
862b911551
Rollup merge of #129560 - GuillaumeGomez:impl-assoc-type-source-link, r=notriddle
[rustdoc] Generate source link on impl associated types

Currently, impl associated types are generated but don't get a source link. This PR fixes that.

Before:

![image](https://github.com/user-attachments/assets/3a22adb5-8b66-4124-9267-7c26eed1aa5e)

After:

![Screenshot from 2024-08-25 16-31-36](https://github.com/user-attachments/assets/6e9b35e7-4357-4ecf-8c49-1d8294051283)

r? `@notriddle`
2024-08-27 00:42:01 +02:00
Matthias Krüger
53f5294c0f
Rollup merge of #129340 - stephen-lazaro:u/slazaro/issue-129274, r=compiler-errors
Remove Duplicate E0381 Label

Aims to resolve https://github.com/rust-lang/rust/issues/129274, and adds a test for the case.

Essentially, we are duplicating this span for some reason. For now, I'm just using a set to collect the spans rather than the vec. I imagine there's probably no real reason to inspect duplicates in this area, but if I'm wrong I can adjust to collect "seen spans" in just the point where this label is applied.

I'm not sure why it's producing duplicate spans. Looks like this has been this way for a while? I think it gives the duplicate label on 1.75.0 for example.
2024-08-27 00:42:00 +02:00
Matthias Krüger
d4d4b6b4fa
Rollup merge of #129250 - estebank:issue-129205, r=compiler-errors
Do not ICE on non-ADT rcvr type when looking for crate version collision

When looking for multiple versions of the same crate, do not blindly construct the receiver type.

Follow up to #128786.
Fixes #129205
Fixes #129216
2024-08-27 00:42:00 +02:00
Matthias Krüger
29923b6801
Rollup merge of #129032 - jswrenn:transmute-method, r=compiler-errors
Document & implement the transmutation modeled by `BikeshedIntrinsicFrom`

Documents that `BikeshedIntrinsicFrom` models transmute-via-union, which is slightly more expressive than the transmute-via-cast implemented by `transmute_copy`. Additionally, we provide an implementation of transmute-via-union as a method on the `BikeshedIntrinsicFrom` trait with additional documentation on the boundary between trait invariants and caller obligations.

Whether or not transmute-via-union is the right kind of transmute to model remains up for discussion [1]. Regardless, it seems wise to document the present behavior.

[1] https://rust-lang.zulipchat.com/#narrow/stream/216762-project-safe-transmute/topic/What.20'kind'.20of.20transmute.20to.20model.3F/near/426331967

Tracking Issue: https://github.com/rust-lang/rust/issues/99571

r? `@compiler-errors`

cc `@scottmcm,` `@Lokathor`
2024-08-27 00:41:59 +02:00
Matthias Krüger
c6ceb5be24
Rollup merge of #128157 - lolbinarycat:unify-ptr-ref-docs, r=cuviper
deduplicate and clarify rules for converting pointers to references

part of #124669
2024-08-27 00:41:58 +02:00
Matthias Krüger
110c3df7fd
Rollup merge of #126013 - nnethercote:unreachable_pub, r=Urgau
Add `#[warn(unreachable_pub)]` to a bunch of compiler crates

By default `unreachable_pub` identifies things that need not be `pub` and tells you to make them `pub(crate)`. But sometimes those things don't need any kind of visibility. So they way I did these was to remove the visibility entirely for each thing the lint identifies, and then add `pub(crate)` back in everywhere the compiler said it was necessary. (Or occasionally `pub(super)` when context suggested that was appropriate.) Tedious, but results in more `pub` removal.

There are plenty more crates to do but this seems like enough for a first PR.

r? `@compiler-errors`
2024-08-27 00:41:57 +02:00
Michael Goulet
2db1d2e261 Rename ParenthesizedGenericArgs to GenericArgsMode 2024-08-26 16:48:13 -04:00
Michael Goulet
b4d3fa4829 Remove ParamMode::ExplicitNamed 2024-08-26 16:47:52 -04:00
bors
515395af0e Auto merge of #129615 - matthiaskrgr:rollup-lw733x7, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #129190 (Add f16 and f128 to tests/ui/consts/const-float-bits-conv.rs)
 - #129377 (Add implementations for `unbounded_shl`/`unbounded_shr`)
 - #129539 (link to Future::poll from the Poll docs)
 - #129588 (pal/hermit: correctly round up microseconds in `Thread::sleep`)
 - #129592 (Remove cfg(test) from library/core)
 - #129597 (mv `build_reduced_graph_for_external_crate_res` into Resolver)
 - #129600 (Tie `impl_trait_overcaptures` lint to Rust 2024)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-26 20:04:35 +00:00
bjorn3
4e1555462f Remove a couple of unused feature enables 2024-08-26 19:52:14 +00:00
Josh Stone
b11e0a883b
Apply suggestions from code review 2024-08-26 12:36:58 -07:00
Nicole LeGare
5d0ce4c391 Note that std support is WIP 2024-08-26 12:22:17 -07:00
Santiago Pastorino
ebf46f7607
Add unsafe to extern blocks in style guide 2024-08-26 14:55:56 -03:00
Eric Huss
a673e4fd4a Update src/tools/rustbook/Cargo.lock 2024-08-26 10:12:50 -07:00
Michael Goulet
4a088d9070 Remove crashes from type_of on resolution that doesn't have a type_of 2024-08-26 13:07:01 -04:00
Esteban Küber
00c435d9b3 Do not ICE on non-ADT rcvr type when looking for crate version collision
When looking for multiple versions of the same crate, do not blindly construct the receiver type.

Follow up to #128786. Fix #129205.
2024-08-26 13:02:21 -04:00
rustbot
834d615397 Update books 2024-08-26 13:00:51 -04:00
Matthias Krüger
114e60ff79
Rollup merge of #129600 - traviscross:TC/tie-impl_trait_overcaptures-to-rust-2024, r=compiler-errors
Tie `impl_trait_overcaptures` lint to Rust 2024

The `impl_trait_overcaptures` lint is part of the migration to Rust 2024 and the Lifetime Capture Rules 2024.  Now that we've stabilized precise capturing (RFC 3617), let's tie this lint to the `rust_2024_compatibility` lint group.

Tracking:

- https://github.com/rust-lang/rust/issues/117587

r? `@compiler-errors`
2024-08-26 17:25:34 +02:00
Matthias Krüger
1d58ac0ff7
Rollup merge of #129597 - bvanjoi:resolve, r=petrochenkov
mv `build_reduced_graph_for_external_crate_res` into Resolver

`build_reduced_graph_for_external_crate_res` is only related to `Resolver`, so move it there.

r? `@petrochenkov`
2024-08-26 17:25:34 +02:00
Matthias Krüger
b9dfb4d6f8
Rollup merge of #129592 - saethlin:core-cfg-test, r=tgross35
Remove cfg(test) from library/core

The diff here is very small with the ignore whitespace option.

`core` doesn't/can't have unit tests. All of its tests are just modules under `tests/`, so it has no use for `cfg(test)`, because the entire contents of `library/core/src` are only ever compiled with that cfg off, and the entire contents of `library/core/tests` are only ever compiled with that cfg on.

You can tell this is what's happening because we had `#[cfg(test)]` on a module declaration that has no source file.

I also deleted the extra `mod tests {` layer of nesting; there's no need to mention again in the module path that this is a module of tests. This exposes a name collision between the `u128` module of tests and `core::u128`. Fixed that by using `<u128>::MAX` like is done in the `check!` macro, which is what avoids this name ambiguity for the other types.
2024-08-26 17:25:33 +02:00
Matthias Krüger
d0b3c3a110
Rollup merge of #129588 - hermit-os:sleep-micros, r=workingjubilee
pal/hermit: correctly round up microseconds in `Thread::sleep`

This fixes the Hermit-related part of https://github.com/rust-lang/rust/issues/129212 and thus the whole issue, since ESP-IDF is already fixed, as far as I understand.

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

r? `@workingjubilee`

CC: `@stlankes`
2024-08-26 17:25:32 +02:00
Matthias Krüger
b1c9064071
Rollup merge of #129539 - oconnor663:poll_link, r=tgross35
link to Future::poll from the Poll docs

The most important thing about Poll is that Future::poll returns it, but previously the docs didn't emphasize this.
2024-08-26 17:25:32 +02:00
Matthias Krüger
68aff290fd
Rollup merge of #129377 - chorman0773:unbounded-shifts-impl, r=scottmcm
Add implementations for `unbounded_shl`/`unbounded_shr`

Tracking Issue: https://github.com/rust-lang/rust/issues/129375

This implements `unbounded_shl` and `unbounded_shr` under the feature gate `unbounded_shifts`
2024-08-26 17:25:31 +02:00
Matthias Krüger
dedfb35711
Rollup merge of #129190 - rezwanahmedsami:master, r=tgross35
Add f16 and f128 to tests/ui/consts/const-float-bits-conv.rs

Fixes #129163

try-job: x86_64-msvc
try-job: x86_64-mingw
try-job: i686-msvc
try-job: i686-mingw
2024-08-26 17:25:31 +02:00
Ralf Jung
0c7d6c45e6 also update copysign docs 2024-08-26 17:25:24 +02:00
Ralf Jung
53d4544628 move per-target NaN info into a table 2024-08-26 17:20:40 +02:00
Ralf Jung
fe2975076f float types: document NaN bit pattern guarantees 2024-08-26 17:20:40 +02:00
Ralf Jung
7a290fce90 interpret: do not make const-eval query result depend on tcx.sess 2024-08-26 17:08:52 +02:00
Ralf Jung
7ea2981605 const-eval: do not make UbChecks behavior depend on current crate's flags 2024-08-26 13:56:40 +02:00
bors
22572d0994 Auto merge of #129508 - RalfJung:transient-locals, r=cjgillot
const checking: properly compute the set of transient locals

For const-checking the MIR of a const/static initializer, we have to know the set of "transient" locals. The reason for this is that creating a mutable (or interior mutable) reference to a transient local is "safe" in the sense that this reference cannot possibly end up in the final value of the const -- even if it is turned into a raw pointer and stored in a union, we will see that pointer during interning and reliably reject it as dangling.

So far, we determined the set of transient locals as "locals that have a `StorageDead` somewhere". But that's not quite right -- if we had MIR like
```rust
StorageLive(_5);
StorageDead(_5);
StorageLive(_5);
// no further storage annotations for _5
```
Then we'd consider `_5` to be "transient", but it is not actually transient.

We do not currently generate such MIR, but I feel uneasy relying on subtle invariants like this. So this PR implements a proper analysis for computing the set of "transient" locals: a local is "transient" if it is guaranteed dead at all `Return` terminators.

Cc `@cjgillot`
2024-08-26 08:44:10 +00:00