1
Fork 0
Commit graph

278879 commits

Author SHA1 Message Date
Oli Scherer
a61cd86a4e Methods of const traits are const 2025-01-15 15:57:06 +00:00
Kevin Reid
aced46dcde Add the concrete syntax for precise capturing to 1.82 release notes.
This will make the note findable by searching for the “use” keyword,
and skimming. Many other language additions mention their syntax in
the release notes, but this one only used the name of the feature.
2025-01-15 07:44:42 -08:00
Guillaume Gomez
0128c910f4 Add GUI test for #135499 2025-01-15 16:31:20 +01:00
bors
27f336106d Auto merge of #133461 - ferrocene:add-copyright-files-to-dist, r=Kobzol
Add COPYRIGHT-*.html files to distribution and update `COPYRIGHT`

* Updates the `COPYRIGHT` file to describe how we actually do things now, and removes the licence text from it as they are stored elsewhere.
* dist tarballs get all of the files in `LICENSES/*`.
  * This folder is managed by `reuse` and each file exists because we refer to the licence somewhere in our tree. We should be supplying these licence texts to anyone who obtains a copy of the source code and now we do.
* The binary rust tarball gets `COPYRIGHT.html` and `COPYRIGHT-library.html`, which are auto-generated files that describe the licence information for both the in-tree source files used to build the Rust toolchain, and the out-of-tree dependencies we used to build the toolchain.
   * The other binary tarballs are unchanged, for now. In future you need to make a call whether to ship multiple version of COPYRIGHT.html, or whether to try and make, for example, a cargo-specific COPYRIGHT.html file.
* The `LICENSE-MIT` file now includes a blanket copyright statement, as the text indicates that it should and because users will expect to know who owns the copyright of the material they have been given (even if the answer is 'lots of people').

try-job: x86_64-fuchsia
2025-01-15 15:30:53 +00:00
Guillaume Gomez
01ae58bff1
Rollup merge of #135529 - onur-ozkan:outdated-fixme, r=jieyouxu
remove outdated FIXME

https://github.com/rust-lang/rust/pull/134967 already fixed this.
2025-01-15 16:30:21 +01:00
Guillaume Gomez
4de739be52
Rollup merge of #135507 - chriskrycho:trpl-edition-updates-stable, r=ehuss
TRPL: incorporate all backward-compatible Edition changes

This incorporates all the backwards-compatible changes for the 2024 Edition on stable. There will also be a follow-on PR to land revisions to the new chapter on async so it can be as ready as possible when officially released with 1.85 and the 2024 Edition.

Additionally, there are a few other, non-backward-compatible, changes (largely around `use<..>`) we can only land using the stable edition, which we may or may not be able to land in 1.85 by using the beta toolchain in the example code. Those may or may not be ported over, depending on how that does or does not play with the infrastructure.

There is also an accompanying PR, #135508, to land these changes on `beta` so they can go out with 1.85 and the Edition release.
2025-01-15 16:30:18 +01:00
Guillaume Gomez
b1035d7f49
Rollup merge of #135498 - compiler-errors:dyn-upcasting-completeness, r=lcnr
Prefer lower `TraitUpcasting` candidates in selection

Fixes #135463. The underlying cause is this ambiguity, but it's more clear (and manifests as a coercion error, rather than a MIR validation error) when it's written the way I did in the UI test.

Sorry this is cursed r? lcnr
2025-01-15 16:30:17 +01:00
Guillaume Gomez
b1d047b27c
Rollup merge of #135428 - camelid:attr-cleanup, r=GuillaumeGomez
rustdoc: Remove `AttributesExt` trait magic that added needless complexity

The new code is more explicit and avoids trait magic that added needless
complexity to this part of rustdoc.
2025-01-15 16:30:14 +01:00
Guillaume Gomez
369d135733
Rollup merge of #135003 - RalfJung:deprecate-allowed-through-unstable, r=davidtwco
deprecate `std::intrinsics::transmute` etc, use `std::mem::*` instead

The `rustc_allowed_through_unstable_modules` attribute lets users call `std::mem::transmute` as `std::intrinsics::transmute`. The former is a reexport of the latter, and for a long time we didn't properly check stability for reexports, so making this a hard error now would be a breaking change for little gain. But at the same time, `std::intrinsics::transmute` is not the intended path for this function, so I think it is a good idea to show a deprecation warning when that path is used. This PR implements that, for all the functions in `std::intrinsics` that carry the attribute.

I assume this will need ``@rust-lang/libs-api`` FCP.
2025-01-15 16:30:11 +01:00
Guillaume Gomez
4c26dc5d3d
Rollup merge of #132654 - joboet:lazy_main, r=ChrisDenton
std: lazily allocate the main thread handle

https://github.com/rust-lang/rust/pull/123550 eliminated the allocation of the main thread handle, but at the cost of greatly increased complexity. This PR proposes another approach: Instead of creating the main thread handle itself, the runtime simply remembers the thread ID of the main thread. The main thread handle is then only allocated when it is used, using the same lazy-initialization mechanism as for non-runtime use of `thread::current`, and the `name` method uses the thread ID to identify the main thread handle and return the correct name ("main") for it.

Thereby, we also allow accessing `thread::current` before main: as the runtime no longer tries to install its own handle, this will no longer trigger an abort. Rather, the name returned from `name` will only be "main" after the runtime initialization code has run, but I think that is acceptable.

This new approach also requires some changes to the signal handling code, as calling `thread::current` would now allocate when called on the main thread, which is not acceptable. I fixed this by adding a new function (`with_current_name`) that performs all the naming logic without allocation or without initializing the thread ID (which could allocate on some platforms).

Reverts #123550, CC ``@GnomedDev``
2025-01-15 16:30:08 +01:00
Lukas Wirth
805598dac3
Merge pull request #18922 from Veykril/push-tmtzukrsnott
fix: Don't return inlay hints outside requested range
2025-01-15 13:58:07 +00:00
Lukas Wirth
79f1471cd0 fix: Don't return inlay hints outside requested range 2025-01-15 14:42:53 +01:00
Lukas Wirth
6bf145932a
Merge pull request #18940 from Veykril/push-ulowqkpprslq
fix: Fix semantics not always correctly caching file roots
2025-01-15 12:54:58 +00:00
Lukas Wirth
38e696f6cf
Merge pull request #18929 from ChayimFriedman2/i-acknowledge-defeat
fix: Fix another bug when reaching macro expansion limit caused a stack overflow
2025-01-15 12:41:17 +00:00
Lukas Wirth
97522d1fe0
Merge pull request #18939 from Veykril/push-wztmylkyqttu
Flip on typing config to be opt-in, better defaults
2025-01-15 12:40:45 +00:00
Lukas Wirth
b56b4d60fe fix: Fix semantics not always correctly caching file roots 2025-01-15 13:40:25 +01:00
1hakusai1
f441bbfcf3 Fix wrong fixture 2025-01-15 21:28:37 +09:00
bors
341f60327f Auto merge of #134353 - oli-obk:safe-target-feature-unsafe-by-default, r=wesleywiser
Treat safe target_feature functions as unsafe by default [less invasive variant]

This unblocks
* #134090

As I stated in https://github.com/rust-lang/rust/pull/134090#issuecomment-2541332415 I think the previous impl was too easy to get wrong, as by default it treated safe target feature functions as safe and had to add additional checks for when they weren't. Now the logic is inverted. By default they are unsafe and you have to explicitly handle safe target feature functions.

This is the less (imo) invasive variant of #134317, as it doesn't require changing the Safety enum, so it only affects FnDefs and nothing else, as it should.
2025-01-15 12:06:56 +00:00
1hakusai1
f669b55b18 Use adjusted type 2025-01-15 21:04:19 +09:00
1hakusai1
7db40dd630 Add test cases 2025-01-15 20:43:28 +09:00
onur-ozkan
896953aee7 remove outdated FIXME
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-15 14:19:02 +03:00
Lukas Wirth
7be6698e75 Flip on typing config to be opt-in, better defaults 2025-01-15 10:25:37 +01:00
bors
2776bdfe42 Auto merge of #135525 - jhpratt:rollup-4gu2wpm, r=jhpratt
Rollup of 7 pull requests

Successful merges:

 - #132397 (Make missing_abi lint warn-by-default.)
 - #133807 (ci: Enable opt-dist for dist-aarch64-linux builds)
 - #134143 (Convert `struct FromBytesWithNulError` into enum)
 - #134338 (Use a C-safe return type for `__rust_[ui]128_*` overflowing intrinsics)
 - #134678 (Update `ReadDir::next` in `std::sys::pal::unix::fs` to use `&raw const (*p).field` instead of `p.byte_offset().cast()`)
 - #135424 (Detect unstable lint docs that dont enable their feature)
 - #135520 (Make sure we actually use the right trivial lifetime substs when eagerly monomorphizing drop for ADTs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-15 09:20:25 +00:00
Jacob Pratt
8e91327e71
Rollup merge of #135520 - compiler-errors:mono-impossible-drop-with-lifetimes, r=BoxyUwU
Make sure we actually use the right trivial lifetime substs when eagerly monomorphizing drop for ADTs

Absolutely clueless mistake of mine. Whoops.

When eagerly collecting mono items, when we encounter an ADT, we try to monomorphize its drop glue. In #135313, I made it so that this acts more like eagerly monomorphizing functions, where we allow (in this case) ADTs with lifetimes, since those can be erased by codegen.

However, I did not account for the call to `instantiate_and_check_impossible_predicates`, which was still passing an empty set of args. This means that if the ADT in question had any predicates, we'd get an index out of bounds panic.

This PR creates the correct set of args for the ADT.

Fixes #135515. I assume that this manifests in that issue because of `-Clink-dead-code` or something.
2025-01-15 04:08:14 -05:00
Jacob Pratt
f35ff74ac6
Rollup merge of #135424 - compiler-errors:unstable-lint, r=ehuss
Detect unstable lint docs that dont enable their feature

Makes sure that we detect cases where unstable lint's docs don't enable the corresponding feature.

r? ehuss
2025-01-15 04:08:13 -05:00
Jacob Pratt
56eb7bd9a9
Rollup merge of #134678 - zachs18:offset-ptr-update, r=tgross35
Update `ReadDir::next` in `std::sys::pal::unix::fs` to use `&raw const (*p).field` instead of `p.byte_offset().cast()`

Since https://github.com/rust-lang/reference/pull/1387 and https://github.com/rust-lang/rust/pull/117572, `&raw mut (*p).field`/`addr_of!((*p).field)` is defined to have the same inbounds preconditions as `ptr::offset`/`ptr::byte_offset`. I.e. `&raw const (*p).field` does not require that `p: *const T` point to a full `size_of::<T>()` bytes of memory, only that `p.byte_add(offset_of!(T, field))` is defined.

The old comment "[...] we don't even get to use `&raw const (*entry_ptr).d_name` because that operation requires the full extent of *entry_ptr to be in bounds of the same allocation, which is not necessarily the case here [...]" is now outdated, and the code can be simplified to use `&raw const (*entry_ptr).field`.

-------

There should be no behavior differences from this PR.

The `: *const dirent64` on line 716 and the `const _: usize = mem::offset_of!(dirent64, $field);` and comment on lines 749-751 are just sanity checks and should not affect semantics.

Since the `offset_ptr!` macro is only called three times, and all with the same local variable entry_ptr, I just used the local variable directly in the macro instead of taking it as an input, and renamed the macro to `entry_field_ptr!`.

The whole macro could also be removed and replaced with just using `&raw const (*entry_ptr).field`  in the three places, but the comments on the macro seemed worthwhile to keep.
2025-01-15 04:08:12 -05:00
Jacob Pratt
bf4aeeb45c
Rollup merge of #134338 - tgross35:overflowing-c-safe-ret, r=bjorn3,antoyo
Use a C-safe return type for `__rust_[ui]128_*` overflowing intrinsics

Combined with [1], this will change the overflowing multiplication operations to return an `extern "C"`-safe type.

Link: https://github.com/rust-lang/compiler-builtins/pull/735 [1]
2025-01-15 04:08:12 -05:00
Jacob Pratt
229c91bc31
Rollup merge of #134143 - nyurik:err-nul, r=dtolnay
Convert `struct FromBytesWithNulError` into enum

This PR renames the former `kind` enum from `FromBytesWithNulErrorKind` to `FromBytesWithNulError`, and removes the original struct.

See https://github.com/rust-lang/libs-team/issues/493

## Possible Changes - TBD
* [x] should the new `enum FromBytesWithNulError` derive `Copy`?
* [ ] should there be any new/changed attributes?
* [x] add some more tests

## Problem

One of `CStr` constructors, `CStr::from_bytes_with_nul(bytes: &[u8])` handles 3 cases:
1. `bytes` has one NULL as the last value - creates CStr
2. `bytes` has no NULL - error
3. `bytes` has a NULL in some other position - error

The 3rd case is error that may require lossy conversion, but the 2nd case can easily be handled by the user code. Unfortunately, this function returns an opaque `FromBytesWithNulError` error in both 2nd and 3rd case, so the user cannot detect just the 2nd case - having to re-implement the entire function and bring in the `memchr` dependency.

## Motivating examples or use cases

In [this code](f86d7a8768/varnish-sys/src/vcl/ws.rs (L158)), my FFI code needs to copy user's `&[u8]` into a C-allocated memory blob in a NUL-terminated `CStr` format.  My code must first validate if `&[u8]` has a trailing NUL (case 1), no NUL (adds one on the fly - case 2), or NUL in the middle (3rd case - error). I had to re-implement `from_bytes_with_nul` and add `memchr`dependency just to handle the 2nd case.

r? `@Amanieu`
2025-01-15 04:08:11 -05:00
Jacob Pratt
f9d8b6590d
Rollup merge of #133807 - mrkajetanp:ci-aarch64-opt-dist, r=Kobzol
ci: Enable opt-dist for dist-aarch64-linux builds

Move the CI dist-aarch64-linux job to an aarch64 runner and enable optimised dist builds with the opt-dist pipeline.

For the time being, disable bolt on aarch64 due to upstream bolt bugs.

r? `@Kobzol`
cc `@lqd`

try-job: dist-aarch64-linux
2025-01-15 04:08:11 -05:00
Jacob Pratt
285df03257
Rollup merge of #132397 - m-ou-se:warn-missing-abi, r=Nadrieril
Make missing_abi lint warn-by-default.

This makes the missing_abi lint warn-by-default, as suggested here: https://github.com/rust-lang/rfcs/pull/3722#issuecomment-2447719047

This needs a lang FCP.
2025-01-15 04:08:10 -05:00
Oli Scherer
767d4fe64e Avoid notes that only make sense for unsafe functions 2025-01-15 08:58:17 +00:00
Oli Scherer
1952b87780 Try to render shorthand differently 2025-01-15 08:58:17 +00:00
Oli Scherer
33651f49a0 Render fn defs with target_features attrs with the attribute [second site] 2025-01-15 08:58:17 +00:00
Oli Scherer
50654e5384 Render fn defs with target_features attrs with the attribute 2025-01-15 08:58:17 +00:00
Oli Scherer
e1a8b0da2d Hide the internal unsafety of safe target_feature fn items 2025-01-15 08:58:17 +00:00
Oli Scherer
56178ddc90 Treat safe target_feature functions as unsafe by default 2025-01-15 08:58:17 +00:00
lcnr
ebbcfd4e77 avoid running the overlap check twice 2025-01-15 09:58:04 +01:00
Lukas Wirth
1ceea5b275 Early exit in search properly 2025-01-15 09:47:45 +01:00
Ralf Jung
7ae494abd4 show deprecation message in rustdoc, too 2025-01-15 09:41:33 +01:00
Ralf Jung
f1c95c9000 intrinsics: deprecate calling them via the unstable std::intrinsics path 2025-01-15 09:41:33 +01:00
Ralf Jung
cf0ab86251 allowed_through_unstable_modules: support showing a deprecation message when the unstable module name is used 2025-01-15 09:41:33 +01:00
Ralf Jung
5460fbe610
Merge pull request #4139 from rust-lang/rustup-2025-01-15
Automatic Rustup
2025-01-15 08:39:35 +00:00
Ralf Jung
561a097b65 late_report_deprecation: move fast-path closer to the core logic 2025-01-15 09:36:17 +01:00
Ralf Jung
0922c191d5 fix known-bug link in normalize-tait-in-const 2025-01-15 09:32:30 +01:00
Rémy Rakic
67a07e01cf add test for issue 135514 2025-01-15 08:26:23 +00:00
Ralf Jung
620feadb38 remove some known-bug that do not seem to make sense 2025-01-15 09:21:51 +01:00
Lukas Wirth
0ed9d1c8e5
Merge pull request #18925 from Veykril/push-mtxxvpowwtrt
feat: Render type parameter projection target bounds in inlays
2025-01-15 08:08:15 +00:00
Lukas Wirth
eed2b5cf94 feat: Render type parameter projection target bounds in inlays 2025-01-15 08:54:38 +01:00
Lukas Wirth
a12c80ded2
Merge pull request #18917 from boattime/master
feat: Add dereferencing autocomplete
2025-01-15 07:46:18 +00:00
bors
00ded39014 Auto merge of #135519 - workingjubilee:rollup-xq9yryh, r=workingjubilee
Rollup of 11 pull requests

Successful merges:

 - #134913 (bootstrap: do not rely on LIBRARY_PATH env variable)
 - #134940 (Make sure to scrape region constraints from deeply normalizing type outlives assumptions in borrowck)
 - #135228 (Improve `DispatchFromDyn` and `CoerceUnsized` impl validation)
 - #135264 (Consider more erroneous layouts as `LayoutError::ReferencesError` to suppress spurious errors)
 - #135302 (for purely return-type based searches, deprioritize clone-like functions)
 - #135353 (re-add --disable-minification to rustdoc)
 - #135380 (Make sure we can produce `ConstArgHasWrongType` errors for valtree consts)
 - #135423 (Enforce syntactical stability of const traits in HIR)
 - #135425 (Do not consider traits that have unsatisfied const conditions to be conditionally const)
 - #135499 (fix underlining of hovered intra-doc links.)
 - #135505 (Fix clippy lints in rustdoc)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-15 06:37:22 +00:00