Commit Graph

254615 Commits

Author SHA1 Message Date
Jules Bertholet
9d92a7f355
Match ergonomics 2024: migration lint
Unfortunately, we can't always offer a machine-applicable suggestion when there are subpatterns from macro expansion.

Co-Authored-By: Guillaume Boisseau <Nadrieril@users.noreply.github.com>
2024-05-12 11:13:33 -04:00
bors
686bfc4c42 Auto merge of #125010 - matthiaskrgr:rollup-270pck3, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #124928 (Stabilize `byte_slice_trim_ascii` for `&[u8]`/`&str`)
 - #124954 (Document proper usage of `fmt::Error` and `fmt()`'s `Result`.)
 - #124969 (check if `x test tests` missing any test directory)
 - #124978 (Handle Deref expressions in invalid_reference_casting)
 - #125005 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-11 12:46:54 +00:00
Matthias Krüger
8f03405419
Rollup merge of #125005 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2024-05-11 13:16:42 +02:00
Matthias Krüger
8eac6d2333
Rollup merge of #124978 - saethlin:ref-casting_derefs, r=Urgau,Nilstrieb
Handle Deref expressions in invalid_reference_casting

Similar to https://github.com/rust-lang/rust/pull/124908

See https://github.com/rust-lang/rust/issues/124951 for context; this PR fixes the last of the known false postiive cases with this lint that we encounter in Crater.
2024-05-11 13:16:41 +02:00
Matthias Krüger
7d7a182c29
Rollup merge of #124969 - onur-ozkan:test-tests-remap, r=Mark-Simulacrum
check if `x test tests` missing any test directory

Add a unit test to ensure we don't skip any test directories for `x test tests` in the future.
2024-05-11 13:16:41 +02:00
Matthias Krüger
6c3fce90cc
Rollup merge of #124954 - kpreid:fmterr, r=Nilstrieb
Document proper usage of `fmt::Error` and `fmt()`'s `Result`.

I've seen several newcomers wonder why `fmt::Error` doesn't have any error detail information, or propose to return it in response to an error condition found inside a `impl fmt::Display for MyType`.

That is incorrect, per [a lone paragraph of the `fmt` module's documentation](https://doc.rust-lang.org/1.78.0/std/fmt/index.html#formatting-traits). However, users looking to implement a formatting trait won't necessarily look there. Therefore, let's add the critical information (that formatting per se is infallible) to all the involved items: every `fmt()` method, and `fmt::Error`.

This PR is not intended to make any novel claims about `fmt`; only to repeat an existing one in places where it will be more visible.
2024-05-11 13:16:40 +02:00
Matthias Krüger
03ff775966
Rollup merge of #124928 - okaneco:trim_ascii, r=workingjubilee
Stabilize `byte_slice_trim_ascii` for `&[u8]`/`&str`

Remove feature from documentation examples
Update intra-doc link for `u8::is_ascii_whitespace` on `&[u8]` functions

Closes #94035

FCP has successfully completed https://github.com/rust-lang/rust/issues/94035#issuecomment-2102690397
2024-05-11 13:16:40 +02:00
bors
35c5e67c69 Auto merge of #124567 - Jules-Bertholet:and-eats-andmut, r=Nadrieril
Match ergonomics 2024: let `&` patterns eat `&mut`

r? `@Nadrieril`

cc https://github.com/rust-lang/rust/issues/123076

`@rustbot` label A-edition-2024 A-patterns
2024-05-11 10:39:11 +00:00
bors
79a85d4e99 Auto merge of #3598 - RalfJung:heap, r=RalfJung
alloc: update comments around malloc() alignment

Also separate the C heap shims form the Windows heap shims; their guarantees aren't quite the same.
2024-05-11 08:53:42 +00:00
Ralf Jung
01b151ebd4 separate windows heap functions from C heap shims 2024-05-11 10:52:08 +02:00
Ralf Jung
7a0ee91ba5 alloc: update comments around malloc() alignment 2024-05-11 10:52:02 +02:00
bors
2259028a70 Auto merge of #124762 - madsmtm:refactor-apple-target-abi, r=lcnr,BlackHoleFox
Refactor Apple `target_abi`

This was bundled together with `Arch`, which complicated a few code paths and meant we had to do more string matching than necessary.

CC `@BlackHoleFox` as you've worked on the Apple target spec before

Related: Is there a reason why `Target`/`TargetOptions` use `StaticCow` for so many things, instead of an enum with defined values (and perhaps a catch-all case for custom target json files)? Tagging `@Nilstrieb,` as you might know?
2024-05-11 08:32:35 +00:00
bors
2427bf9113 Auto merge of #3597 - rust-lang:rustup-2024-05-11, r=RalfJung
Automatic Rustup
2024-05-11 07:00:13 +00:00
bors
be7549f82c Auto merge of #125000 - matthiaskrgr:rollup-cc9lc2y, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #124766 (std::rand: adding solaris/illumos for getrandom support.)
 - #124818 (Update ena to 0.14.3)
 - #124991 (Fix typo in ManuallyDrop's documentation)
 - #124994 (Add `@saethlin` to some triagebot groups)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-11 06:26:35 +00:00
Matthias Krüger
a4317c4eec
Rollup merge of #124994 - saethlin:saethlin-triagebot, r=scottmcm
Add @saethlin to some triagebot groups

I think this is a reasonable approximation of what I can review, and should encourage people to request me.

r? scottmcm
2024-05-11 08:00:16 +02:00
Matthias Krüger
0997891c54
Rollup merge of #124991 - Infinixius:patch-1, r=Nilstrieb
Fix typo in ManuallyDrop's documentation

```diff
- /// A wrapper to inhibit compiler from automatically calling `T`’s destructor.
+ /// A wrapper to inhibit the compiler from automatically calling `T`’s destructor.
```
2024-05-11 08:00:16 +02:00
Matthias Krüger
3c40e383df
Rollup merge of #124818 - compiler-errors:ena, r=Mark-Simulacrum
Update ena to 0.14.3

Includes https://github.com/rust-lang/ena/pull/53, which removes a trivial `Self: Sized` bound that prevents `ena` from building on the new solver.
2024-05-11 08:00:15 +02:00
Matthias Krüger
f73f266657
Rollup merge of #124766 - devnexen:getrandom_solarish, r=Mark-Simulacrum
std::rand: adding solaris/illumos for getrandom support.

To help solarish support for miri https://https://github.com/rust-lang/miri/issues/3567
2024-05-11 08:00:15 +02:00
The Miri Cronjob Bot
ce3daac283 Merge from rustc 2024-05-11 05:03:34 +00:00
The Miri Cronjob Bot
4d63d0af4d Preparing for merge from rustc 2024-05-11 04:56:14 +00:00
okaneco
9fb49faf40 Stabilize byte_slice_trim_ascii for &[u8]/&str
Remove feature from documentation examples
Add rustc_const_stable attribute to stabilized functions
Update intra-doc link for `u8::is_ascii_whitespace` on `&[u8]` functions
2024-05-10 23:42:40 -04:00
bors
ef15976387 Auto merge of #124996 - weihanglo:update-cargo, r=weihanglo
Update cargo

7 commits in 0ca60e940821c311c9b25a6423b59ccdbcea218f..4de0094ac78743d2c8ff682489e35c8a7cafe8e4
2024-05-08 01:54:25 +0000 to 2024-05-09 16:09:22 +0000
- Fix docs for unstable script feature (rust-lang/cargo#13893)
- Refactor cargo lint tests (rust-lang/cargo#13880)
- test(rustfix): run some tests only on nightly (rust-lang/cargo#13890)
- Old syntax suggestion (rust-lang/cargo#13874)
- docs: clarify dash replacement rule in target name (rust-lang/cargo#13887)
- Add local-only build scripts example in check-cfg docs (rust-lang/cargo#13884)
- docs(changelog): also mention `--message-format=json` (rust-lang/cargo#13882)

r? ghost
2024-05-11 02:39:56 +00:00
Weihang Lo
27197ef94f
Update cargo 2024-05-10 22:27:58 -04:00
bors
f9a3fd9661 Auto merge of #124993 - jieyouxu:rollup-u02aso7, r=jieyouxu
Rollup of 5 pull requests

Successful merges:

 - #124233 (Add `-lmingwex` second time in `mingw_libs`)
 - #124318 (ignore generics args in attribute paths)
 - #124899 (bootstrap: add comments for the automatic dry run)
 - #124904 (reachable computation: extend explanation of what this does, and why)
 - #124930 (Make sure we consume a generic arg when checking mistyped turbofish)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-11 00:31:30 +00:00
Ben Kimock
e6f961c762 Add @saethlin to some triagebot groups 2024-05-10 20:28:50 -04:00
许杰友 Jieyou Xu (Joe)
e7bb090d0a
Rollup merge of #124930 - compiler-errors:consume-arg, r=petrochenkov
Make sure we consume a generic arg when checking mistyped turbofish

When recovering un-turbofish-ed args in expr position (e.g. `let x = a<T, U>();` in `check_mistyped_turbofish_with_multiple_type_params`, we used `parse_seq_to_before_end` to parse the fake generic args; however, it used `parse_generic_arg` which *optionally* parses a generic arg. If it doesn't end up parsing an arg, it returns `Ok(None)` and consumes no tokens. If we don't find a delimiter after this (`,`), we try parsing *another* element. In this case, we just infinitely loop looking for a subsequent element.

We can fix this by making sure that we either parse a generic arg or error in `parse_seq_to_before_end`'s callback.

Fixes #124897
2024-05-11 01:15:10 +01:00
许杰友 Jieyou Xu (Joe)
d8bf3fd584
Rollup merge of #124904 - RalfJung:reachable, r=tmiasko
reachable computation: extend explanation of what this does, and why

Follow-up to https://github.com/rust-lang/rust/pull/122769. I had the time to think about this some more, in particular in the context of https://github.com/rust-lang/rust/issues/119214, so I felt it was worth extending these comments some more.

I also gave up on the context of "externally reachable" as it is not called that way anywhere else in the compiler.

Cc `@tmiasko` `@saethlin`
2024-05-11 01:15:10 +01:00
许杰友 Jieyou Xu (Joe)
881fa5b011
Rollup merge of #124899 - RalfJung:bootstrap-dry, r=onur-ozkan
bootstrap: add comments for the automatic dry run
2024-05-11 01:15:09 +01:00
许杰友 Jieyou Xu (Joe)
69122f1da4
Rollup merge of #124318 - bvanjoi:fix-123911, r=petrochenkov
ignore generics args in attribute paths

Fixes #97006
Fixes #123911
Fixes #123912

This patch ensures that we no longer have to handle invalid generic arguments in attribute paths.

r? `@petrochenkov`
2024-05-11 01:15:08 +01:00
许杰友 Jieyou Xu (Joe)
150633eea2
Rollup merge of #124233 - mati865:fix-support-for-upcoming-mingw-w64, r=petrochenkov
Add `-lmingwex` second time in `mingw_libs`

Upcoming mingw-w64 releases will contain small math functions refactor which moved implementation around. As a result functions like `lgamma`
now depend on libraries in this order:
`libmingwex.a` -> `libmsvcrt.a` -> `libmingwex.a`.

Fixes #124221
2024-05-11 01:15:08 +01:00
Infinixius
781d737478
Fix typo in ManuallyDrop's documentation 2024-05-10 23:13:32 +00:00
bors
19dacee0d8 Auto merge of #124982 - compiler-errors:uplift-trait-ref, r=lcnr
Uplift `TraitRef` into `rustc_type_ir`

Emotional rollercoaster

r? lcnr
2024-05-10 22:24:53 +00:00
bors
6e1d94708a Auto merge of #123886 - scottmcm:more-rvalue-operands, r=matthewjasper
Avoid `alloca`s in codegen for simple `mir::Aggregate` statements

The core idea here is to remove the abstraction penalty of simple newtypes in codegen.

Even something simple like constructing a
```rust
#[repr(transparent)] struct Foo(u32);
```
forces an `alloca` to be generated in nightly right now.

Certainly LLVM can optimize that away, but it would be nice if it didn't have to.

Quick example:
```rust
#[repr(transparent)]
pub struct Transparent32(u32);

#[no_mangle]
pub fn make_transparent(x: u32) -> Transparent32 {
    let a = Transparent32(x);
    a
}
```
on nightly we produce <https://rust.godbolt.org/z/zcvoM79ae>
```llvm
define noundef i32 `@make_transparent(i32` noundef %x) unnamed_addr #0 {
  %a = alloca i32, align 4
  store i32 %x, ptr %a, align 4
  %0 = load i32, ptr %a, align 4, !noundef !3
  ret i32 %0
}
```
but after this PR we produce
```llvm
define noundef i32 `@make_transparent(i32` noundef %x) unnamed_addr #0 {
start:
  ret i32 %x
}
```
(even before the optimizer runs).
2024-05-10 20:17:22 +00:00
Michael Goulet
b55d8a3b49 Apply nits, make some bounds into supertraits on inherent traits 2024-05-10 15:44:03 -04:00
Michael Goulet
f368527802 Also debug 2024-05-10 15:44:03 -04:00
Michael Goulet
1e5ec0a12c Lift TraitRef into rustc_type_ir 2024-05-10 15:44:03 -04:00
Michael Goulet
5e606c0bde Lift Lift 2024-05-10 15:44:03 -04:00
bors
2cce088584 Auto merge of #124952 - compiler-errors:no-error, r=lcnr
Rename some `FulfillmentErrorCode`/`ObligationCauseCode` variants to be less redundant

1. Rename some `FulfillmentErrorCode` variants.
2. Always use `ObligationCauseCode::` to prefix a code, rather than using a glob import and naming them through `traits::`.
3. Rename some `ObligationCauseCode` variants -- I wasn't particularly thorough with thinking of a new names for these, so could workshop them if necessary.
4. Misc stuff from renaming.

r? lcnr
2024-05-10 18:11:02 +00:00
Jules Bertholet
6d5c6f541f
Add comment on cap_to_weakly_not
Co-authored-by: Guillaume Boisseau <Nadrieril@users.noreply.github.com>
2024-05-10 13:53:48 -04:00
Jules Bertholet
7951311c1b
Move all ref pat logic into check_pat_ref 2024-05-10 13:50:19 -04:00
Jules Bertholet
bff287b4a5
Remove redundant comment 2024-05-10 13:47:39 -04:00
Jules Bertholet
d8a798b5e9
No more Option<Option<>> 2024-05-10 13:47:38 -04:00
Jules Bertholet
0f03c2be58
Rename explicit_ba 2024-05-10 13:47:38 -04:00
Jules Bertholet
f57b970de8
Comments and fixes 2024-05-10 13:47:37 -04:00
Jules Bertholet
91bbbaa0f7
Fix spans when macros are involved 2024-05-10 13:47:36 -04:00
Jules Bertholet
ed96c655c6
Various fixes:
- Only show error when move-check would not be triggered
- Add structured suggestion
2024-05-10 13:47:36 -04:00
Jules Bertholet
4f76f1069a
Match ergonomics 2024: let & patterns eat &mut 2024-05-10 13:47:34 -04:00
bors
6f4c7d997e Auto merge of #3593 - RalfJung:native-lib, r=RalfJung
rename 'extern-so' to 'native-lib'

Calling "extern" functions is not super clear IMO (extern to what), but saying that we are calling "native" functions from inside the interpreter makes it very clear I think.
2024-05-10 16:33:14 +00:00
Ben Kimock
2bb25d3f4a Handle Deref expressions in invalid_reference_casting 2024-05-10 12:33:07 -04:00
Ralf Jung
25a3b6687e rename 'extern-so' to 'native-lib' 2024-05-10 18:30:48 +02:00