Commit Graph

264404 Commits

Author SHA1 Message Date
Matthias Krüger
2c4338802a
Rollup merge of #129323 - Urgau:ptr_fn_addr_eq, r=Mark-Simulacrum
Implement `ptr::fn_addr_eq`

This PR implements https://github.com/rust-lang/libs-team/issues/323: `ptr::fn_addr_eq`.

r? libs
2024-08-24 22:14:13 +02:00
Matthias Krüger
2a7f2da422
Rollup merge of #129290 - tgross35:pin-cc, r=Mark-Simulacrum
Pin `cc` to 1.0.105

`cc` 1.0.106 removes support for Visual Studio 12. Pin to 1.0.105 so we don't drop support yet.

Fixes: https://github.com/rust-lang/rust/pull/128722#issuecomment-2297605573
2024-08-24 22:14:13 +02:00
Matthias Krüger
c0bedb9e5e
Rollup merge of #129246 - BoxyUwU:feature_gate_const_arg_path, r=cjgillot
Retroactively feature gate `ConstArgKind::Path`

This puts the lowering introduced by #125915 under a feature gate until we fix the regressions introduced by it. Alternative to whole sale reverting the PR since it didn't seem like a very clean revert and I think this is generally a step in the right direction and don't want to get stuck landing and reverting the PR over and over :)

cc #129137 ``@camelid,`` tests taken from there. beta is branching soon so I think it makes sense to not try and rush that fix through since it wont have much time to bake and if it has issues we can't simply revert it on beta.

Fixes #128016
2024-08-24 22:14:12 +02:00
Matthias Krüger
05b8bcc662
Rollup merge of #129199 - RalfJung:writes_through_immutable_pointer, r=compiler-errors
make writes_through_immutable_pointer a hard error

This turns the lint added in https://github.com/rust-lang/rust/pull/118324 into a hard error. This has been reported in cargo's future-compat reports since Rust 1.76 (released in February). Given that const_mut_refs is still unstable, it should be impossible to even hit this error on stable: we did accidentally stabilize some functions that can cause this error, but that got reverted in https://github.com/rust-lang/rust/pull/117905. Still, let's do a crater run just to be sure.

Given that this should only affect unstable code, I don't think it needs an FCP, but let's Cc ``@rust-lang/lang`` anyway -- any objection to making this unambiguous UB into a hard error during const-eval? This can be viewed as part of https://github.com/rust-lang/rust/pull/129195 which is already nominated for discussion.
2024-08-24 22:14:12 +02:00
Matthias Krüger
0dfdea1c45
Rollup merge of #128596 - RalfJung:const_fn_floating_point_arithmetic, r=nnethercote
stabilize const_fn_floating_point_arithmetic

Part of https://github.com/rust-lang/rust/issues/128288
Fixes https://github.com/rust-lang/rust/issues/57241

The existing test `tests/ui/consts/const_let_eq_float.rs`  ([link](https://github.com/RalfJung/rust/blob/const_fn_floating_point_arithmetic/tests/ui/consts/const_let_eq_float.rs)) covers the basics, and also Miri has extensive tests covering the interpreter's float machinery. Also, that machinery can already be used on stable inside `const`/`static` initializers, just not inside `const fn`.

This was explicitly called out in https://github.com/rust-lang/rfcs/pull/3514 so in a sense t-lang just recently already FCP'd this, but let's hear from them whether they want another FCP for the stabilization here or whether that was covered by the FCP for the RFC.
Cc ``@rust-lang/lang``

### Open items

- [x] Update the Reference: https://github.com/rust-lang/reference/pull/1566
2024-08-24 22:14:11 +02:00
Pavel Grigorenko
06f2d73b2b repr_transparent_external_private_fields: treat rustc_pub_transparent types as local 2024-08-24 23:05:54 +03:00
Pavel Grigorenko
b9033bdd92 New #[rustc_pub_transparent] attribute 2024-08-24 23:05:37 +03:00
Michael Goulet
147bb17f51 Rework how we emit errors for unresolved object lifetimes 2024-08-24 14:55:31 -04:00
binarycat
027c47983e update the doc comment on lintchecker b/c it parses html now 2024-08-24 12:35:35 -04:00
Guillaume Gomez
c36b5634cf Update minifier to 0.3.1 2024-08-24 18:34:28 +02:00
Pavel Grigorenko
53ce92770d Fix elided_named_lifetimes in code 2024-08-24 19:21:32 +03:00
bors
30e0b69908 Auto merge of #12993 - GuillaumeGomez:too_long_first_doc_paragraph, r=Centri3
Add new `too_long_first_doc_paragraph` first paragraph lint

Fixes https://github.com/rust-lang/rust-clippy/issues/12989.

changelog: Add new `too_long_first_doc_paragraph` first paragraph lint
2024-08-24 15:23:34 +00:00
Ralf Jung
5343550142 const checking: properly compute the set of transient locals 2024-08-24 17:14:31 +02:00
Ralf Jung
493cf6a7e9 interpret: ImmTy: tighten sanity checks in offset logic 2024-08-24 15:12:30 +02:00
bors
f167efad2f Auto merge of #128349 - tgross35:x86-f16, r=Noratrieb
Enable `f16` tests on x86 and x86-64

Since the `compiler_builtins` update [1], ABI bugs on x86 should be resolved. Enable tests for f16 on these platforms now.

`f16` math functions (`reliable_f16_math`) are still excluded because there is an LLVM crash for powi [2].

[1]: https://github.com/rust-lang/rust/pull/125016
[2]: https://github.com/llvm/llvm-project/issues/105747

try-job: dist-i586-gnu-i586-i686-musl
try-job: x86_64-apple-1
2024-08-24 13:03:04 +00:00
bors
497177fa50 Auto merge of #13296 - Jarcho:get_src_display3, r=Alexendoo
Replace more uses of `snippet_opt`.

Almost all calls are removed after this.

changelog: none
2024-08-24 12:42:32 +00:00
Ralf Jung
ec0e16a665 panicking: improve hint for Miri's RUST_BACKTRACE behavior 2024-08-24 14:38:50 +02:00
bors
301f2c46cd Auto merge of #13299 - alex-semenyuk:unwrap_or_else_suggestion, r=Alexendoo
Fix suggestion unnecessary_lazy_eval

As mentioned at #13293 improve suggestion via span_suggestion_verbose

changelog: none
2024-08-24 12:29:08 +00:00
Zalathar
94aadf0f62 Build library/profiler_builtins from ci-llvm if appropriate 2024-08-24 21:21:34 +10:00
Alexey Semenyuk
f4fc3858bc Fix suggestion unwrap_or_else 2024-08-24 15:43:00 +05:00
Deadbeef
378902e325 remove invalid TyCompat relation for effects 2024-08-24 14:24:21 +08:00
bors
edbc000fa4 Auto merge of #129303 - nikic:llvm19rc3, r=cuviper
Update to LLVM 19 rc 3

I don't think that this fixes any specific issues we've encountered.
2024-08-24 03:53:43 +00:00
Miguel Ojeda
90b4e17a1f CI: rfl: move to temporary commit
Link: https://github.com/rust-lang/rust/pull/129416
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-08-23 20:52:07 -07:00
Jubilee Young
9ccd7abefe library: Move unstable API of new_uninit to new features
- `new_zeroed` variants move to `new_zeroed_alloc`
- the `write` fn moves to `box_uninit_write`

The remainder will be stabilized in upcoming patches, as
it was decided to only stabilize `uninit*` and `assume_init`.
2024-08-23 20:52:02 -07:00
Tshepang Mbambo
f734f3d8e7
remove extraneous text 2024-08-24 05:40:27 +02:00
Tshepang Mbambo
32e34eef57
make text more easy to read 2024-08-24 03:11:00 +02:00
Camille GILLOT
5cef88c1f4 Print the generic parameter along with the variance in dumps. 2024-08-23 23:00:45 +00:00
Ben Kimock
5d98d20529 Enable Alignment::new_unchecked precondition check 2024-08-23 18:26:45 -04:00
bors
4074d4902d Auto merge of #129278 - GuillaumeGomez:rm-duplicated-usage-of-unstable-options, r=Kobzol
Remove duplicated usage of `-Zunstable-options` in bootstrap

Surprisingly, sometimes it is in the same function.

r? `@Kobzol`
2024-08-23 21:18:13 +00:00
Trevor Gross
e76b7d029c Change f16 doctests in core to run on x86-64 linux
Since `f16` now works on x86 and x86-64, change doctests to use this
instead of aarch64. This is to make sure any changes get run in PR CI.
2024-08-23 14:21:57 -05:00
Thom Chiovoloni
5c6285c5f0 Add myself to the review rotation for libs 2024-08-23 19:16:01 +00:00
Scott McMurray
62f7d5305e Update compiler_builtins to 0.1.121 2024-08-23 12:02:26 -07:00
Trevor Gross
402ce53bfe Enable f16 tests on x86 and x86-64
Since the `compiler_builtins` update [1], ABI bugs on x86 should be
resolved. Enable tests for f16 on these platforms now.

`f16` math functions (`reliable_f16_math`) are still excluded because
there is an LLVM crash for powi [2].

[1]: https://github.com/rust-lang/rust/pull/125016
[2]: https://github.com/llvm/llvm-project/issues/105747
2024-08-23 13:54:50 -05:00
bors
eef00c8be8 Auto merge of #128507 - Oneirical:testart-from-scratch, r=jieyouxu
Migrate `libtest-thread-limit` `run-make` test to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Please try, but **only if normal CI is green**:

// try-job: armhf-gnu // <- failed on this
try-job: aarch64-gnu
2024-08-23 18:30:21 +00:00
Noa
c65ef3d37c
Move into_inner_unchecked back to the bottom of the impl block 2024-08-23 13:06:26 -05:00
Noa
b968b26c03
Put Pin::as_deref_mut in impl Pin<Ptr> 2024-08-23 12:45:05 -05:00
binarycat
4c5e888eb6 rustdoc: show exact case-sensitive matches first
fixes #119480
2024-08-23 13:05:24 -04:00
binarycat
69ca95bf7f use tuples for semver, not floats 2024-08-23 11:57:23 -04:00
Jack Wrenn
2540070fd4 document & impl 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
2024-08-23 14:37:36 +00:00
Oneirical
318dfb405f rewrite libtest-thread-limit to rmake 2024-08-23 10:29:27 -04:00
onur-ozkan
5f2cedc5dc handle stage0 cargo and rustc separately
This change allows setting either `build.cargo` or `build.rustc` without requiring
both to be set simultaneously, which was not possible previously.

To try it, set `build.rustc` without setting `build.cargo`, and try to bootstrap on clean build.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-23 15:39:45 +03:00
bors
a60a9e567a Auto merge of #129464 - GuillaumeGomez:rollup-ckfqd7h, r=GuillaumeGomez
Rollup of 9 pull requests

Successful merges:

 - #128511 (Document WebAssembly target feature expectations)
 - #129243 (do not build `cargo-miri` by default on stable channel)
 - #129263 (Add a missing compatibility note in the 1.80.0 release notes)
 - #129276 (Stabilize feature `char_indices_offset`)
 - #129350 (adapt integer comparison tests for LLVM 20 IR changes)
 - #129408 (Fix handling of macro arguments within the `dropping_copy_types` lint)
 - #129426 (rustdoc-search: use tighter json for names and parents)
 - #129437 (Fix typo in a help diagnostic)
 - #129457 (kobzol vacation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-23 10:56:34 +00:00
Guillaume Gomez
0369e854d3
Rollup merge of #129457 - Kobzol:kobzol-vacation, r=Kobzol
kobzol vacation

r? ``@ghost``
2024-08-23 12:32:18 +02:00
Guillaume Gomez
09b37855f6
Rollup merge of #129437 - gurry:fix-diagnostic-typo, r=jieyouxu
Fix typo in a help diagnostic

Replaced "**the your** dependency graph" with "**in the** dependency graph".
2024-08-23 12:32:17 +02:00
Guillaume Gomez
db65b6c544
Rollup merge of #129426 - notriddle:smaller-index-2024-08-22, r=GuillaumeGomez
rustdoc-search: use tighter json for names and parents

File size
---------

```console
$ du -hs doc.old/search-index1.82.0.js doc/search-index1.82.0.js
3.2M    doc.old/search-index1.82.0.js
2.8M    doc/search-index1.82.0.js
$ gzip doc/search-index1.82.0.js
$ gzip doc.old/search-index1.82.0.js
$ du -hs doc.old/search-index1.82.0.js.gz doc/search-index1.82.0.js.gz
464K    doc.old/search-index1.82.0.js.gz
456K    doc/search-index1.82.0.js.gz
$ du -hs compiler-doc.old/search-index.js compiler-doc/search-index.js
8.5M    compiler-doc.old/search-index.js
6.5M    compiler-doc/search-index.js
$ gzip compiler-doc/search-index1.82.0.js
$ gzip compiler-doc.old/search-index1.82.0.js
$ du -hs compiler-doc.old/search-index.js.gz compiler-doc/search-index.js.gz
1.4M    compiler-doc.old/search-index.js.gz
1.4M    compiler-doc/search-index.js.gz
```

Performance
-----------

Firefox profile: [before](https://profiler.firefox.com/public/jf1741wycma0n38asdf7kdtw8egs0pqakbr03jg/calltree/?globalTrackOrder=0w3&implementation=js&thread=3&v=10), [after](https://profiler.firefox.com/public/p4fptad7vncsfgrgk9a18yx7m6w8kdpgfy15f8r/calltree/?globalTrackOrder=0w3&implementation=js&thread=3&v=10)

CLI profiler scripts comparison: https://notriddle.com/rustdoc-html-demo-9/smaller-index-2024-08-22/index.html

| Benchmark | Before     | After      | % Diff
| --------- | ----------:| ----------:| ------:
| arti      | 225692 KiB | 218744 KiB | 3%
| cortex-m  | 58276 KiB  | 57852 KiB  | 0%
| sqlx      | 123132 KiB | 125448 KiB | -2%
| stm32f4   | 556828 KiB | 548996 KiB | 1%
| ripgrep   | 86964 KiB  | 86180 KiB  | 1%
2024-08-23 12:32:17 +02:00
Guillaume Gomez
81aca633bb
Rollup merge of #129408 - Urgau:macro-arg-drop_copy, r=compiler-errors
Fix handling of macro arguments within the `dropping_copy_types` lint

This PR fixes the handling of spans with different context (aka macro arguments) than the primary expression within the different `{drop,forget}ing_copy_types` and `{drop,forget}ing_references` lints.

<details>
<summary>Before</summary>

```
warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
 --> drop_writeln.rs:5:5
  |
5 |     drop(writeln!(&mut msg, "test"));
  |     ^^^^^--------------------------^
  |          |
  |          argument has type `Result<(), std::fmt::Error>`
  |
  = note: `#[warn(dropping_copy_types)]` on by default
help: use `let _ = ...` to ignore the expression or result
 --> /home/[..]/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/macros/mod.rs:688:9
  |
68|         let _ =
  |         ~~~~~~~
```

</details>

<details>
<summary>With this PR</summary>

```
warning: calls to `std::mem::drop` with a value that implements `Copy` does nothing
 --> drop_writeln.rs:5:5
  |
5 |     drop(writeln!(&mut msg, "test"));
  |     ^^^^^--------------------------^
  |          |
  |          argument has type `Result<(), std::fmt::Error>`
  |
  = note: `#[warn(dropping_copy_types)]` on by default
help: use `let _ = ...` to ignore the expression or result
  |
5 -     drop(writeln!(&mut msg, "test"));
5 +     let _ = writeln!(&mut msg, "test");
  |
```

</details>

``````@rustbot`````` label +L-dropping_copy_types
2024-08-23 12:32:16 +02:00
Guillaume Gomez
1bbb8d5183
Rollup merge of #129350 - krasimirgg:llvm20, r=nikic
adapt integer comparison tests for LLVM 20 IR changes

The LLVM commit abf69a167b changed the IR in a few comparison tests:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/30500#01917017-26fe-4a4d-956b-725a2903e5a8

Adapted accordingly.

````@rustbot```` label: +llvm-main
r? ````@nikic````
2024-08-23 12:32:16 +02:00
Guillaume Gomez
26672c93d5
Rollup merge of #129276 - eduardosm:stabilize-char_indices_offset, r=Amanieu
Stabilize feature `char_indices_offset`

Stabilized API:

```rust
impl CharIndices<'_> {
    pub fn offset(&self) -> usize;
}
```

Tracking issue: https://github.com/rust-lang/rust/issues/83871

Closes https://github.com/rust-lang/rust/issues/83871

I also attempted to improved the documentation to make it more clear that it returns the offset of the character that will be returned by the next call to `next()`.
2024-08-23 12:32:15 +02:00
Guillaume Gomez
724f612be8
Rollup merge of #129263 - apiraino:add-missing-compat-note, r=cuviper
Add a missing compatibility note in the 1.80.0 release notes

#99969 missed being included in the release notes. As discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/.2399969.20missed.20the.20release.20notes/near/463002451).

(the discussion about the _a posteriori_ breakage the ecosystem is experiencing is another topic)

Thanks

r? ``````@rust-lang/release``````
2024-08-23 12:32:15 +02:00
Guillaume Gomez
e5cd26a22e
Rollup merge of #129243 - onur-ozkan:stuff, r=Kobzol
do not build `cargo-miri` by default on stable channel

Skips `cargo-miri` build on `stable` channel just like `miri`.

Closes #129171

cc ``@RalfJung``
2024-08-23 12:32:14 +02:00