Commit graph

257510 commits

Author SHA1 Message Date
bors f9515fdd5a Auto merge of #126473 - matthiaskrgr:rollup-8w2xm09, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #123769 (Improve escaping of byte, byte str, and c str proc-macro literals)
 - #126054 (`E0229`: Suggest Moving Type Constraints to Type Parameter Declaration)
 - #126135 (add HermitOS support for vectored read/write operations)
 - #126266 (Unify guarantees about the default allocator)
 - #126285 (`UniqueRc`: support allocators and `T: ?Sized`.)
 - #126399 (extend the check for LLVM build)
 - #126426 (const validation: fix ICE on dangling ZST reference)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-14 11:29:58 +00:00
Matthias Krüger aebd794d15
Rollup merge of #126426 - RalfJung:dangling-zst-ice, r=oli-obk
const validation: fix ICE on dangling ZST reference

Fixes https://github.com/rust-lang/rust/issues/126393
I'm not super happy with this fix but I can't think of a better one.

r? `@oli-obk`
2024-06-14 12:23:38 +02:00
Matthias Krüger b7dcdf684c
Rollup merge of #126399 - onur-ozkan:126156, r=albertlarsan68
extend the check for LLVM build

We don't build LLVM when using the precompiled version from the CI builder.

Closes #126156
2024-06-14 12:23:38 +02:00
Matthias Krüger b55cabe636
Rollup merge of #126285 - kpreid:unique-rc, r=dtolnay
`UniqueRc`: support allocators and `T: ?Sized`.

Added the following (all unstable):

* Defaulted type pararameter `A: Allocator`.
* `UniqueRc::new_in()`.
* `T:  ?Sized` where possible.
* `impl CoerceUnsized for UniqueRc`.

These changes are motivated by supporting the implementation of unsized `Rc::make_mut()` (PR #116113), but are also intended to be obvious generalizations of `UniqueRc` to support the things `Rc` does.

r? ``````@the8472``````
2024-06-14 12:23:37 +02:00
Matthias Krüger e923048768
Rollup merge of #126266 - tbu-:pr_doc_alloc_default_system, r=jhpratt
Unify guarantees about the default allocator

`std::alloc` said that the default allocator is unspecified for all crrate types except `cdylib` and `staticlib`. Adjust `std::alloc::System` documentation to say the same.

Fixes #125870.
2024-06-14 12:23:37 +02:00
Matthias Krüger 6396d4c846
Rollup merge of #126135 - hermit-os:fuse, r=jhpratt
add HermitOS support for vectored read/write operations

In general, the I/O interface of hermit-abi is revised and now a more POSIX-like interface. Consequently, platform abstraction layer for HermitOS has slightly adjusted and some inaccuracies remove.

Hermit is a tier 3 platform and this PR changes only files, wich are related to the tier 3 platform.
2024-06-14 12:23:36 +02:00
Matthias Krüger bfe032334f
Rollup merge of #126054 - veera-sivarajan:bugfix-113073-bound-on-generics-2, r=fee1-dead
`E0229`: Suggest Moving Type Constraints to Type Parameter Declaration

Fixes #113073

This PR suggests  `impl<T: Bound> Trait<T> for Foo` when finding `impl Trait<T: Bound> for Foo`. Tangentially, it also improves a handful of other error messages.

It accomplishes this in two steps:
1. Check if constrained arguments and parameter names appear in the same order and delay emitting "incorrect number of generic arguments" error because it can be confusing for the programmer to see `0 generic arguments provided` when there are `n` constrained generic arguments.

2. Inside `E0229`, suggest declaring the type parameter right after the `impl` keyword by finding the relevant impl block's span for type parameter declaration. This also handles lifetime declarations correctly.

Also, the multi part suggestion doesn't use the fluent error mechanism because translating all the errors to fluent style feels outside the scope of this PR. I will handle it in a separate PR if this gets approved.
2024-06-14 12:23:36 +02:00
Matthias Krüger 20ca54b6a6
Rollup merge of #123769 - dtolnay:literal, r=fee1-dead
Improve escaping of byte, byte str, and c str proc-macro literals

This PR changes the behavior of `proc_macro::Literal::byte_character` (https://github.com/rust-lang/rust/issues/115268), `byte_string`, and `c_string` (https://github.com/rust-lang/rust/issues/119750) to improve their choice of escape sequences. 3 categories of changes are made:

1. Never use `\x00`. Always prefer `\0`, which is supported in all the same places.

2. Never escape `\'` inside double quotes and `\"` inside single quotes.

3. Never use `\x` for valid UTF-8 in literals that permit `\u`.

The second commit adds tests covering these cases, asserting the **old** behavior.

The third commit implements the behavior change and simultaneously updates the tests to assert the **new** behavior.
2024-06-14 12:23:35 +02:00
bors 63491e1012 Auto merge of #126463 - matthiaskrgr:rollup-lnkfibf, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #124884 (place explicit lifetime bound after generic param)
 - #126343 (Remove some msys2 utils)
 - #126351 (std::unix::fs::link using direct linkat call for Solaris.)
 - #126368 (Remove some unnecessary crate dependencies.)
 - #126386 (Migrate `run-make/allow-non-lint-warnings-cmdline` to `rmake.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-14 09:19:38 +00:00
bors d2ad293851 Auto merge of #126462 - matthiaskrgr:rollup-g0t1am4, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #123962 (change method resolution to constrain hidden types instead of rejecting method candidates)
 - #126244 (Update fuchsia commit, and SDK to 21.20240610.2.1)
 - #126270 (Migrate run make const fn mir)
 - #126320 (Avoid ICES after reporting errors on erroneous patterns)
 - #126449 (Fill out missing Windows support information)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-14 07:08:40 +00:00
Matthias Krüger edd4c97b81
Rollup merge of #126386 - GuillaumeGomez:migrate-run-make-allow-non-lint-warnings-cmdline, r=jieyouxu
Migrate `run-make/allow-non-lint-warnings-cmdline` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? ```@jieyouxu```
2024-06-14 08:35:50 +02:00
Matthias Krüger 9f2fc640f3
Rollup merge of #126368 - nnethercote:rm-more-unused-crate-deps, r=jackh726
Remove some unnecessary crate dependencies.

A follow-up to #126063.

r? ``@jackh726``
2024-06-14 08:35:50 +02:00
Matthias Krüger e1e72aa486
Rollup merge of #126351 - devnexen:to_sol11_upd, r=ChrisDenton
std::unix::fs::link using direct linkat call for Solaris.

Since we support solaris 11 as minimum, we can get rid of the runtime overhead.

try-job: dist-various-2
2024-06-14 08:35:49 +02:00
Matthias Krüger f8eae4da3f
Rollup merge of #126343 - ChrisDenton:remove-utils, r=Kobzol
Remove some msys2 utils

`dos2unix` should no longer be necessary. I suspect `diffutils` might not be needed either as (I think) only `diff` is used and that seems to be shipped with git bash at least.

try-job: x86_64-msvc
try-job: x86_64-msvc-ext
try-job: dist-x86_64-msvc
2024-06-14 08:35:49 +02:00
Matthias Krüger 7f52e7d9c4
Rollup merge of #126449 - ChrisDenton:windows-std-support, r=workingjubilee
Fill out missing Windows support information

All the Windows targets (including tier 3) currently have some level of std support.
2024-06-14 08:35:48 +02:00
Matthias Krüger 74e82328ce
Rollup merge of #124884 - bvanjoi:fix-124785, r=estebank
place explicit lifetime bound after generic param

Fixes #124785

An easy fix.
2024-06-14 08:35:48 +02:00
Matthias Krüger 2b3fb62b93
Rollup merge of #126320 - oli-obk:pat_ice, r=lcnr
Avoid ICES after reporting errors on erroneous patterns

fixes #109812
fixes #125914
fixes #124004
2024-06-14 08:35:48 +02:00
Matthias Krüger 254f10a59c
Rollup merge of #126270 - GuillaumeGomez:migrate-run-make-const_fn_mir, r=jieyouxu
Migrate run make const fn mir

Part of https://github.com/rust-lang/rust/issues/121876.

r? ```@jieyouxu```
2024-06-14 08:35:47 +02:00
Matthias Krüger e37fb612ef
Rollup merge of #126244 - erickt:bump, r=Kobzol
Update fuchsia commit, and SDK to 21.20240610.2.1

This includes a fix to the race when publishing multiple packages at the same time.

try-job: x86_64-gnu-integration
2024-06-14 08:35:47 +02:00
Matthias Krüger 0468462538
Rollup merge of #123962 - oli-obk:define_opaque_types5, r=lcnr
change method resolution to constrain hidden types instead of rejecting method candidates

Some of these are in probes and may affect inference. This is therefore a breaking change.

This allows new code to compile on stable:

```rust
trait Trait {}

impl Trait for u32 {}

struct Bar<T>(T);

impl Bar<u32> {
    fn foo(self) {}
}

fn foo(x: bool) -> Bar<impl Sized> {
    if x {
        let x = foo(false);
        x.foo();
        //^ this used to not find the `foo` method, because while we did equate `x`'s type with possible candidates, we didn't allow opaque type inference while doing so
    }
    todo!()
}
```

r? ```````@compiler-errors```````

fixes  #121404

cc https://github.com/rust-lang/rust/issues/116652
2024-06-14 08:35:46 +02:00
Ralf Jung a6907100de const validation: fix ICE on dangling ZST reference 2024-06-14 07:52:51 +02:00
bors bfa098eae0 Auto merge of #126439 - matthiaskrgr:rollup-856xt18, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #123726 (Clarify `Command::new` behavior for programs with arguments)
 - #126088 ([1/2] clean-up / general improvements)
 - #126238 (Fix Miri sysroot for `x run`)
 - #126315 (Add pub struct with allow(dead_code) into worklist)
 - #126360 (Uplift `structural_traits.rs` into the new trait solver)
 - #126371 (Tweak output of import suggestions)
 - #126388 (const-eval: make lint scope computation consistent)
 - #126390 (Fix wording in {checked_}next_power_of_two)
 - #126392 (Small style improvement in `gvn.rs`)
 - #126402 (Fix wrong `assert_unsafe_precondition` message for `core::ptr::copy`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-14 02:44:01 +00:00
bors 0ef0dd2451 Auto merge of #126445 - GuillaumeGomez:rm-help-page, r=lqd
Remove failing GUI test to stop blocking CI until it is fixed

Until https://github.com/rust-lang/rust/pull/126436 is solved, let's unblock rust CI.

r? `@lqd`
2024-06-14 00:29:33 +00:00
Chris Denton efbfcdd220
Fill out missing Windows support information 2024-06-14 00:18:21 +00:00
Guillaume Gomez 9e466d3361 Remove failing GUI test to stop blocking CI until it is fixed 2024-06-14 00:49:05 +02:00
Matthias Krüger 3494ea1818
Rollup merge of #126402 - firefighterduck:fix-unsafe-precon-copy, r=Nilstrieb
Fix wrong `assert_unsafe_precondition` message for `core::ptr::copy`

A small fix in the `assert_unsafe_precondition` message for `core::ptr::copy` as described by https://github.com/rust-lang/rust/issues/126400 .

fixes #126400
2024-06-13 22:55:49 +02:00
Matthias Krüger 424fe2c878
Rollup merge of #126392 - WaffleLapkin:gvn-style-ish-changes, r=scottmcm
Small style improvement in `gvn.rs`

Allowed by https://github.com/rust-lang/rust/pull/110451#discussion_r1169298319. :P

r? ``@scottmcm``
2024-06-13 22:55:48 +02:00
Matthias Krüger 5de59519fb
Rollup merge of #126390 - Kriskras99:master, r=Nilstrieb
Fix wording in {checked_}next_power_of_two

Small documentation update
2024-06-13 22:55:48 +02:00
Matthias Krüger 141d458076
Rollup merge of #126388 - RalfJung:const-eval-lint-scope, r=oli-obk
const-eval: make lint scope computation consistent

The first commit is some renaming for consistency, but otherwise unrelated. It just didn't feel worth a separate PR, but I can split this up if you prefer.

r? ``@oli-obk``
2024-06-13 22:55:47 +02:00
Matthias Krüger 422da40294
Rollup merge of #126371 - estebank:suggest-core, r=fmease
Tweak output of import suggestions

When both `std::` and `core::` items are available, only suggest the `std::` ones. We ensure that in `no_std` crates we suggest `core::` items.

Ensure that the list of items suggested to be imported are always in the order of local crate items, `std`/`core` items and finally foreign crate items.

Tweak wording of import suggestion: if there are multiple items but they are all of the same kind, we use the kind name and not the generic "items".

Fix #83564.
2024-06-13 22:55:46 +02:00
Matthias Krüger 4dd8813afd
Rollup merge of #126360 - compiler-errors:uplift-structural-traits, r=lcnr
Uplift `structural_traits.rs` into the new trait solver

Self-explanatory. I will leave some comments inline regarding design decisions.
2024-06-13 22:55:46 +02:00
Matthias Krüger 977c5fd419
Rollup merge of #126315 - mu001999-contrib:fix/126289, r=petrochenkov
Add pub struct with allow(dead_code) into worklist

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->

Fixes #126289
2024-06-13 22:55:45 +02:00
Matthias Krüger 24c94f0e4f
Rollup merge of #126238 - Nilstrieb:run,miri,run, r=RalfJung
Fix Miri sysroot for `x run`

Miri no longer (after https://github.com/rust-lang/miri/pull/3411) respects `MIRI_SYSROOT` and wants to be treated like a REAL rustc, with `--sysroot`. \*pats Miri\* sure Miri, just for you :3.

fixes #126233

r? RalfJung (or whoever else feels like it)
2024-06-13 22:55:45 +02:00
Matthias Krüger c22ee450c5
Rollup merge of #126088 - onur-ozkan:brooming, r=albertlarsan68
[1/2] clean-up / general improvements

This PR applies various clippy suggestions on the tools. I have only applied the ones that make sense and left out trivial changes (e.g., suggestions like 'remove &' are ignored to keep the original commit history for the lines).

I am planning to do the same for the library and compiler, but those will add too many changes to this PR, so I will handle them in a separate PR later.
2024-06-13 22:55:44 +02:00
Matthias Krüger a685cdc34f
Rollup merge of #123726 - jieyouxu:command-new-docs, r=Nilstrieb
Clarify `Command::new` behavior for programs with arguments

I mistakenly passed program path along arguments as the same string into `Command::new` a couple of times now. It might be useful to explicitly highlight that `Command::new` intends to accept path to a program, not path to a program plus arguments. Also nudge the user to use `Command::arg` or `Command::args` if they wish to pass arguments.
2024-06-13 22:55:44 +02:00
Esteban Küber 5de8e6edfc Tweak output of import suggestions
When both `std::` and `core::` items are available, only suggest the
`std::` ones. We ensure that in `no_std` crates we suggest `core::`
items.

Ensure that the list of items suggested to be imported are always in the
order of local crate items, `std`/`core` items and finally foreign crate
items.

Tweak wording of import suggestion: if there are multiple items but they
are all of the same kind, we use the kind name and not the generic "items".

Fix #83564.
2024-06-13 20:22:21 +00:00
Erick Tryzelaar 14014abf06 Update fuchsia commit, and SDK to 21.20240610.2.1
This includes a fix to the race when publishing multiple packages at the
same time.
2024-06-13 18:56:05 +00:00
Ralf Jung 54e24c1573 const-eval: make lint scope computation consistent 2024-06-13 20:31:00 +02:00
Ralf Jung b316033dd8 rename CompileTimeInterpreter -> CompileTimeMachine, CompileTimeEvalContext -> CompileTimeInterpCx
to match the terms used in the shared interpreter infrastructure
2024-06-13 20:30:11 +02:00
Nilstrieb a1667a98e8 Fix Miri sysroot for x run
Miri no longer respects `MIRI_SYSROOT` and wants to be treated like a
REAL rustc, with `--sysroot`. *pats Miri* sure Miri, just for you :3.
2024-06-13 20:10:23 +02:00
David Tolnay 7ddc89e893
Remove superfluous escaping from byte, byte str, and c str literals 2024-06-13 09:49:15 -07:00
David Tolnay 2cc0284905
Add more Literal::to_string tests 2024-06-13 09:39:29 -07:00
David Tolnay 57106e4a46
Rename proc_macro::Literal tests from parse.rs to literal.rs
This module contains tests not just of parse (FromStr) but also
to_string (Display) for literals.
2024-06-13 09:39:27 -07:00
bors f1586001ac Auto merge of #126398 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`

Updates `Cargo.lock` with Clippy version bump.
2024-06-13 16:17:56 +00:00
onur-ozkan c8d2b9397a fix bootstrap CI failure
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-13 18:43:46 +03:00
onur-ozkan d12f1a7338 tidy: apply considerable clippy suggestions
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-13 18:43:38 +03:00
onur-ozkan a31b1b2eeb opt-dist: apply considerable clippy suggestions
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-13 18:41:49 +03:00
onur-ozkan 80d96dffae lint-docs: apply considerable clippy suggestions
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-13 18:41:47 +03:00
onur-ozkan 5aa3fbce61 remote-test-client: apply considerable clippy suggestions
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-13 18:41:45 +03:00
onur-ozkan c755df2d35 remote-test-server: apply considerable clippy suggestions
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-13 18:41:43 +03:00