Skip to content

Rollup of 7 pull requests #127065

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 36 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

onur-ozkan and others added 30 commits June 19, 2024 19:36
People are having trouble when they don't want to build `lld` for their custom
distribution tarballs even with `lld = false` in their config.toml. This is because
it is not controlled by `lld_enabled` flag. This change ensures that `llvm:Lld`
is controlled by lld configuration.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
Make sure lld is enabled for dist profile unless it is explicitly disabled.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
`-Z patchable-function-entry` works like `-fpatchable-function-entry`
on clang/gcc. The arguments are total nop count and function offset.

See MCP rust-lang/compiler-team#704
See [RFC](https://github.com/maurer/rust-rfcs/blob/patchable-function-entry/text/0000-patchable-function-entry.md) (yet to be numbered)

TODO before submission:
* Needs an RFC
* Improve error reporting for malformed attributes
Removes an `unsafe` in favor of just using `String` methods.
Co-authored-by: Ralf Jung <post@ralfj.de>
Currently bootstrap doesn't use any inner paths from rust-analyzer and
bootstrap with `ShouldRun::create_or_deps`.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
…garing, r=oli-obk

Implement new effects desugaring

cc `@rust-lang/project-const-traits.` Will write down notes once I have finished.

* [x] See if we want `T: Tr` to desugar into `T: Tr, T::Effects: Compat<true>`
* [x] Fix ICEs on `type Assoc: ~const Tr` and `type Assoc<T: ~const Tr>`
* [ ] add types and traits to minicore test
* [ ] update rustc-dev-guide

Fixes rust-lang#119717
Fixes rust-lang#123664
Fixes rust-lang#124857
Fixes rust-lang#126148
…s-pr, r=estebank,workingjubilee

patchable-function-entry: Add unstable compiler flag and attribute

Tracking issue: rust-lang#123115

Add the -Z patchable-function-entry compiler flag and the #[patchable_function_entry(prefix_nops = m, entry_nops = n)] attribute.
Rebased and adjusted the canditate implementation to match changes in the RFC.
…e, r=Kobzol

make cargo submodule optional

Right now, we fetch the cargo submodule no matter what, even if the command we are running doesn't need it (e.g., `x build compiler library`). This PR changes that to only fetch the cargo submodule when it's necessary.

For more context, see the zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/Why.20is.20cargo.20always.20checked.20out.3F
…=Kobzol

ignore `llvm::Lld` if lld is not enabled

People are having trouble ([ref. zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/MSVC.20Runtime.20mismatch.20when.20building.20LLD)) when they don't want to build `lld` for their custom distribution tarballs even with `lld = false` in their config.toml. This is because it is not controlled by `lld_enabled` flag. This change ensures that `llvm:Lld` is controlled by lld configuration.

Additionally, `lld = true` is set by default for dist profile, because we have been building it all along and this maintains that behavior.
core: avoid `extern type`s in formatting infrastructure

`@RalfJung` [said](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Use.20of.20.60extern.20type.60.20in.20formatting.20machinery/near/446552837):

>How attached are y'all to using `extern type` in the formatting machinery?
Seems like this was introduced a [long time ago](rust-lang@34ef8f5). However, it's also [not really compatible with Stacked Borrows](rust-lang/unsafe-code-guidelines#256), and only works currently because we effectively treat references-to-extern-type almost like raw pointers in Stacked Borrows -- which of course is unsound, it's not how LLVM works. I was planning to make Miri emit a warning when this happens to avoid cases like [this](rust-lang#126814 (comment)) where people use extern type specifically to silence Miri without realizing what happens. but with the formatting machinery using  extern type, this warning would just show up everywhere...
>
> The "proper" way to do this in Stacked Borrows is to use raw pointers (or `NonNull`).

This PR does just that.

r? `@RalfJung`
… r=cuviper

Simplify `str::clone_into`

Removes an `unsafe` in favor of just using `String` methods.
…s, r=oli-obk

Tighten `fn_decl_span` for async blocks

Tightens the span of `async {}` blocks in diagnostics, and subsequently async closures and async fns, by actually setting the `fn_decl_span` correctly. This is kinda a follow-up on rust-lang#125078, but it fixes the problem in a more general way.

I think the diagnostics are significantly improved, since we no longer have a bunch of overlapping spans. I'll point out one caveat where I think the diagnostic may get a bit more confusing, but where I don't think it matters.

r? ``@estebank`` or ``@oli-obk`` or someone else on wg-diag or compiler i dont really care lol
@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) rollup A PR which is a rollup labels Jun 28, 2024
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=7

@bors
Copy link
Collaborator

bors commented Jun 28, 2024

📌 Commit 7d05157 has been approved by matthiaskrgr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 28, 2024
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

     Running tests/compile-test.rs (obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/compile_test-e2f2ae96a28c6a7b)

FAILED TEST: tests/ui/missing_const_for_fn/could_be_const.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-17fa9f95c9b8f88f.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-5fa9affb7f4804a2.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-5726c12621123bb4.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-c05264ebc02d0b99.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-ae846d6788d6a9f1.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-e9aa61e1e4ee057e.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-8dba92144dd323d0.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libquote-0383f3501f3470c2.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libregex-caed1d72b1950c44.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-5c59675e11f6188b.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps/libserde_derive-2233436f0b800125.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-b8ecf01f7994beb1.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-d534f89567b59ccc.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/tests/ui/missing_const_for_fn" "tests/ui/missing_const_for_fn/could_be_const.rs" "--edition" "2021"
error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/missing_const_for_fn/could_be_const.stderr` to the actual output
--- tests/ui/missing_const_for_fn/could_be_const.stderr
+++ <stderr output>
+++ <stderr output>
 error: this could be a `const fn`
   --> tests/ui/missing_const_for_fn/could_be_const.rs:14:5
... 159 lines skipped ...
 LL | fn d(this: D) {}
+   |
+help: make the function `const`
+   |
+   |
+LL | const fn d(this: D) {}
+   | +++++
 error: this could be a `const fn`
... 82 lines skipped ...
 error: aborting due to 18 previous errors
 
---

error: this could be a `const fn`
##[error]  --> tests/ui/missing_const_for_fn/could_be_const.rs:20:5
   |
LL | /     fn const_generic_params<'a, T, const N: usize>(&self, b: &'a [T; N]) -> &'a [T; N] {
LL | |         b
LL | |     }
   | |_____^
   |
   |
help: make the function `const`
   |
LL |     const fn const_generic_params<'a, T, const N: usize>(&self, b: &'a [T; N]) -> &'a [T; N] {

error: this could be a `const fn`
##[error]  --> tests/ui/missing_const_for_fn/could_be_const.rs:27:1
   |
---

error: this could be a `const fn`
##[error]  --> tests/ui/missing_const_for_fn/could_be_const.rs:33:1
   |
LL | / fn two() -> i32 {
LL | |     let abc = 2;
LL | |     abc
LL | | }
   | |_^
   | |_^
   |
help: make the function `const`
   |
LL | const fn two() -> i32 {
   | +++++
error: this could be a `const fn`
##[error]  --> tests/ui/missing_const_for_fn/could_be_const.rs:40:1
   |
LL | / fn string() -> String {
---

error: this could be a `const fn`
##[error]  --> tests/ui/missing_const_for_fn/could_be_const.rs:46:1
   |
LL | / unsafe fn four() -> i32 {
LL | |     4
LL | | }
   | |_^
   |
---

error: this could be a `const fn`
##[error]  --> tests/ui/missing_const_for_fn/could_be_const.rs:61:1
   |
LL | / fn generic_arr<T: Copy>(t: [T; 1]) -> T {
LL | |     t[0]
LL | | }
   | |_^
   |
   |
help: make the function `const`
   |
LL | const fn generic_arr<T: Copy>(t: [T; 1]) -> T {
   | +++++
error: this could be a `const fn`
##[error]  --> tests/ui/missing_const_for_fn/could_be_const.rs:75:9
   |
   |
LL | /         pub fn b(self, a: &A) -> B {
LL | |             B
LL | |         }
   | |_________^
   |
   |
help: make the function `const`
   |
LL |         pub const fn b(self, a: &A) -> B {

error: this could be a `const fn`
##[error]  --> tests/ui/missing_const_for_fn/could_be_const.rs:85:5
   |
   |
LL | /     fn const_fn_stabilized_before_msrv(byte: u8) {
LL | |
LL | |         byte.is_ascii_digit();
   | |_____^
   |
help: make the function `const`
   |
   |
LL |     const fn const_fn_stabilized_before_msrv(byte: u8) {

error: this could be a `const fn`
##[error]  --> tests/ui/missing_const_for_fn/could_be_const.rs:97:1
   |
   |
LL | / fn msrv_1_46() -> i32 {
LL | |     46
LL | | }
   | |_^
   |
   |
help: make the function `const`
   |
LL | const fn msrv_1_46() -> i32 {
   | +++++
error: this could be a `const fn`
##[error]  --> tests/ui/missing_const_for_fn/could_be_const.rs:117:1
   |
   |
LL | fn d(this: D) {}
   |
help: make the function `const`
   |
   |
LL | const fn d(this: D) {}
   | +++++
error: this could be a `const fn`
##[error]  --> tests/ui/missing_const_for_fn/could_be_const.rs:125:9
   |
LL | /         fn deref_ptr_can_be_const(self) -> usize {
LL | /         fn deref_ptr_can_be_const(self) -> usize {
LL | |
LL | |             unsafe { *self.0 as usize }
   | |_________^
   |
help: make the function `const`
   |
---
##[error]  --> tests/ui/missing_const_for_fn/could_be_const.rs:141:5
   |
LL | /     fn union_access_can_be_const() {
LL | |
LL | |         let bar = Bar { val: 1 };
LL | |         let _ = unsafe { bar.val };
   | |_____^
   |
help: make the function `const`
   |
   |
LL |     const fn union_access_can_be_const() {
   |     +++++

error: this could be a `const fn`
##[error]  --> tests/ui/missing_const_for_fn/could_be_const.rs:155:9
   |
LL | /         pub fn new(strings: Vec<String>) -> Self {
LL | |             Self { strings }
   | |_________^
   |
help: make the function `const`
   |
   |
LL |         pub const fn new(strings: Vec<String>) -> Self {

error: this could be a `const fn`
##[error]  --> tests/ui/missing_const_for_fn/could_be_const.rs:160:9
   |
   |
LL | /         pub fn empty() -> Self {
LL | |             Self { strings: Vec::new() }
   | |_________^
   |
help: make the function `const`
   |

@matthiaskrgr matthiaskrgr deleted the rollup-8dwzhvj branch September 1, 2024 17:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend A-testsuite Area: The testsuite used to check the correctness of rustc rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.