Commit graph

253213 commits

Author SHA1 Message Date
Michael Woerister c373ec07c4 Improve ICE message for forbidden dep-graph reads. 2024-04-22 12:11:07 +02:00
bors 32885838c0 Auto merge of #124112 - beetrees:incremental-os-str, r=Nadrieril
Fix ICE when there is a non-Unicode entry in the incremental crate directory

Fix the ICE that occurs when there is a non-Unicode entry in the incremental crate directory by replacing uses of `to_string_lossy` + `assert_no_characters_lost` with `to_str`. The added test would cause the compiler to ICE before this PR.
2024-04-22 04:00:58 +00:00
bors eb70af2e03 Auto merge of #124244 - saethlin:stdarch, r=workingjubilee
Update stdarch submodule

Most importantly, this pulls in https://github.com/rust-lang/stdarch/pull/1567 which is part of https://github.com/rust-lang/rust/pull/124050
2024-04-22 01:56:40 +00:00
Ben Kimock 9989d009c4 Update stdarch submodule 2024-04-21 21:35:17 -04:00
bors fb898629a2 Auto merge of #124241 - matthiaskrgr:rollup-xhu90xr, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #123840 (Add an intrinsic for `ptr::from_raw_parts(_mut)`)
 - #124224 (cleanup: unnecessary clone during lower generics args)
 - #124229 (Add gnullvm targets to manifest)
 - #124231 (remove from reviewers)
 - #124235 (Move some tests)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-21 21:08:03 +00:00
Matthias Krüger 3315bf961d
Rollup merge of #124235 - c410-f3r:tests98765, r=jieyouxu
Move some tests

r? `@petrochenkov`
2024-04-21 21:56:34 +02:00
Matthias Krüger f277f3d653
Rollup merge of #124231 - BoxyUwU:dereview, r=Mark-Simulacrum
remove from reviewers

not gonna be around for a few weeks
2024-04-21 21:56:33 +02:00
Matthias Krüger e96ed6d35d
Rollup merge of #124229 - mati865:add-gnullvm-targets-to-manifest, r=Mark-Simulacrum
Add gnullvm targets to manifest

Fixes an oversight from https://github.com/rust-lang/rust/pull/121712
2024-04-21 21:56:33 +02:00
Matthias Krüger cd92422180
Rollup merge of #124224 - bvanjoi:cleanup, r=fmease
cleanup: unnecessary clone during lower generics args
2024-04-21 21:56:32 +02:00
Matthias Krüger 67872e740e
Rollup merge of #123840 - scottmcm:aggregate-kind-rawptr, r=cjgillot
Add an intrinsic for `ptr::from_raw_parts(_mut)`

Fixes #123174
cc `@CAD97` `@saethlin`
r? `@cjgillot`

As suggested in https://github.com/rust-lang/rust/pull/123190#issuecomment-2028717967, this adds a new `AggregateKind::RawPtr` for creating a pointer from its data pointer and its metadata.

That means that `slice::from_raw_parts` and friends no longer need to hard-code pointer layout into `libcore`, and because it no longer does union hacks the MIR is shorter and more amenable to optimizations.
2024-04-21 21:56:32 +02:00
bors 1b3fba066c Auto merge of #124203 - lukas-code:delete-deleting-caches, r=compiler-errors
fix normalizing in different `ParamEnv`s with the same `InferCtxt`

This PR changes the key of the projection cache from just `AliasTy` to `(AliasTy, ParamEnv)` to allow normalizing in different `ParamEnv`s without resetting caches. Previously, normalizing the same alias in different param envs would always reuse the cached result from the first normalization, which is incorrect if the projection clauses in the param env have changed.

Fixing this bug allows us to get rid of `InferCtxt::clear_caches`, which was only used by the `AutoTraitFinder`, because it requires normalizing in different param envs.

r? `@fmease`
2024-04-21 19:05:08 +00:00
Caio 3aaa3941fd Move some tests 2024-04-21 15:43:43 -03:00
Scott McMurray 5e785b1420 Update tests after 123949 2024-04-21 11:24:54 -07:00
Scott McMurray 1398fe7a5e Address more PR feedback 2024-04-21 11:08:38 -07:00
Scott McMurray bb8d6f790b Address PR feedback 2024-04-21 11:08:37 -07:00
Scott McMurray 5e1d16ca55 Also handle AggregateKind::RawPtr in cg_cranelift 2024-04-21 11:08:37 -07:00
Scott McMurray 9520cebfc5 InstSimplify from_raw_parts(p, ())p as _ 2024-04-21 11:08:37 -07:00
Scott McMurray de64ff76f8 Use it in the library, and InstSimplify it away in the easy places 2024-04-21 11:08:37 -07:00
Scott McMurray 4f4442655e Add an intrinsic that lowers to AggregateKind::RawPtr 2024-04-21 11:08:37 -07:00
Scott McMurray e6b2b764ec Add AggregateKind::RawPtr and enough support to compile 2024-04-21 11:08:37 -07:00
Scott McMurray 70df9d9a13 Add a mir-opt test for byte_add on pointers 2024-04-21 11:08:36 -07:00
Scott McMurray b76faff1b2 Add a MIR pre-codegen test for Vec::deref 2024-04-21 11:08:36 -07:00
Scott McMurray 5800dc1faa New slice indexing pre-codegen MIR test 2024-04-21 11:08:36 -07:00
Boxy e1d12ffb6c removal 2024-04-21 18:41:32 +01:00
bors f22a0c2d9f Auto merge of #123594 - Urgau:fix-non_local_def-lint-overflow, r=lcnr
Fix trait solver overflow with `non_local_definitions` lint

This PR fixes the trait solver overflow with the `non_local_definitions` lint reported in https://github.com/rust-lang/rust/issues/123573 using the suggestion from `@lcnr:` https://github.com/rust-lang/rust/issues/123573#issuecomment-2041348320 to use the next trait solver.

~~I have not (yet) tried to create a minimized repro~~ ``@compiler-errors`` did the minimization (thanks you) but I have manually tested on the `starlark-rust` project that it fixes the issue.

Fixes #123573
r? `@lcnr`
2024-04-21 17:02:03 +00:00
Lukas Markeffsky 5a2b335e49 also remap RPITITs nested in other types back to their opaques 2024-04-21 18:04:50 +02:00
Mateusz Mikuła 6ae761cd40 Add gnullvm targets to manifest 2024-04-21 17:41:42 +02:00
bors aa31bad26b Auto merge of #124222 - GuillaumeGomez:rollup-ws1zju7, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #124069 (enable clippy for bootstrap on CI PRs (in `mingw-check` image))
 - #124089 (Fix watchOS and visionOS for pread64 and pwrite64 calls)
 - #124184 (Suggest using `unsigned_abs` in `abs` documentation)
 - #124198 (Flip spans for precise capturing syntax not capturing a ty/const param, and for implicit captures of lifetime params)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-21 13:05:45 +00:00
bohan 2d5a226f8f cleanup: unnecessary clone during lower generics args 2024-04-21 20:40:44 +08:00
Guillaume Gomez 43d5e00bac
Rollup merge of #124198 - compiler-errors:improve-ty-ct-param-span, r=Nadrieril
Flip spans for precise capturing syntax not capturing a ty/const param, and for implicit captures of lifetime params

Make the primary span point to the opaque, rather than the param which might be very far away (e.g. in an impl header hundreds of lines above).
2024-04-21 13:30:26 +02:00
Guillaume Gomez 24b8c54f6d
Rollup merge of #124184 - gurry:124152-suggest-unsigned-abs-in-abs-doc, r=jhpratt
Suggest using `unsigned_abs` in `abs` documentation

Fixes #124152
2024-04-21 13:30:26 +02:00
Guillaume Gomez 9efd1477ac
Rollup merge of #124089 - simlay:fix-preadv64-and-pwritev64-link-for-watchos-and-visionos, r=workingjubilee
Fix watchOS and visionOS for pread64 and pwrite64 calls

In #122880, links to `preadv64` and `pwritev64` were added for `watchOS` however the underlying [`weak!` macro did not include `target_os = "watchos"`](c45dee5efd/library/std/src/sys/pal/unix/weak.rs (L30-L74)).

This resulted in an `xcodebuild` error when targeting `watchOS`:
```
Undefined symbols for architecture arm64:
  "_preadv64", referenced from:
      __rust_extern_with_linkage_preadv64 in libliveview_native_core.a[274](std-324fdd8d31e8eaa2.std.e18cf7e8d0336778-cgu.08.rcgu.o)
  "_pwritev64", referenced from:
      __rust_extern_with_linkage_pwritev64 in libliveview_native_core.a[274](std-324fdd8d31e8eaa2.std.e18cf7e8d0336778-cgu.08.rcgu.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

So I added them. I also went ahead and added the same for visionOS because it's bound to create the same issue.
2024-04-21 13:30:25 +02:00
Guillaume Gomez f122a5129c
Rollup merge of #124069 - onur-ozkan:run-clippy-on-bootstrap, r=albertlarsan68
enable clippy for bootstrap on CI PRs (in `mingw-check` image)

Let's keep the bootstrap codebase cleaner.
2024-04-21 13:30:24 +02:00
bors fecb7b4309 Auto merge of #124193 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2024-04-21 11:01:46 +00:00
Ralf Jung ae37b6ec58 the mir-validation ICE test behaves strangely on Windows hosts
let's just disable it there, this code is not platform-dependent anyway
2024-04-21 12:36:16 +02:00
beetrees 71f751d139
Fix ICE when there is a non-Unicode entry in the incremental crate directory 2024-04-21 11:24:55 +01:00
bors b9be3c47e5 Auto merge of #117457 - daxpedda:wasm-nontrapping-fptoint, r=wesleywiser
Stabilize Wasm target features that are in phase 4 and 5

This stabilizes the Wasm target features that are known to be working and in [phase 4 and 5](04fa8c810e).

Feature stabilized:
- [Non-trapping float-to-int conversions](https://github.com/WebAssembly/nontrapping-float-to-int-conversions)
- [Import/Export of Mutable Globals](https://github.com/WebAssembly/mutable-global)
- [Sign-extension operators](https://github.com/WebAssembly/sign-extension-ops)
- [Bulk memory operations](https://github.com/WebAssembly/bulk-memory-operations)
- [Extended Constant Expressions](https://github.com/WebAssembly/extended-const)

Features not stabilized:
- [Multi-value](https://github.com/WebAssembly/multi-value): requires rebuilding `std` #73755.
- [Reference Types](https://github.com/WebAssembly/reference-types): no point stabilizing without #103516.
- [Threads](https://github.com/webassembly/threads): requires rebuilding `std` #77839.
- [Relaxed SIMD](https://github.com/WebAssembly/relaxed-simd): separate PR #117468.
- [Multi Memory](https://github.com/WebAssembly/multi-memory): not implemented.

See https://github.com/rust-lang/rust/pull/117457#issuecomment-1787648070 for more context.

Documentation: https://github.com/rust-lang/reference/pull/1420
Tracking issue: https://github.com/rust-lang/rust/issues/44839
2024-04-21 06:32:10 +00:00
Sebastian Imlay fa53b9f39c Fix watchOS and visionOS for pread64 and pwrite64 calls
* Refactor apple OSs  to use pwritev and preadv rather pwritev64 and preadv64
* Updated the comments for preadv and pwritev
2024-04-21 00:36:07 -04:00
bors 13eb8c736c Auto merge of #123930 - Mark-Simulacrum:vec-length-invariant, r=jhpratt
Tell LLVM Vec::len is invariant across growth

This allows LLVM to avoid re-loading it from memory.
2024-04-21 03:08:50 +00:00
Mark Rousskov f1ae5314be Avoid reloading Vec::len across grow_one in push
This saves an extra load from memory.
2024-04-20 21:07:00 -04:00
bors 426a698606 Auto merge of #123981 - Kobzol:update-nodejs, r=Mark-Simulacrum
CI: add script for installing NodeJS and update it to v20

I centralized the installation on a single place to make it simple to update the NodeJS version across the board.

Fixes: https://github.com/rust-lang/rust/issues/123965

r? `@Mark-Simulacrum`
2024-04-21 01:06:10 +00:00
bors 453ceafce3 Auto merge of #124208 - jieyouxu:rollup-gbgpu4u, r=jieyouxu
Rollup of 10 pull requests

Successful merges:

 - #123379 (Print note with closure signature on type mismatch)
 - #123967 (static_mut_refs: use raw pointers to remove the remaining FIXME)
 - #123976 (Use fake libc in core test)
 - #123986 (lint-docs: Add redirects for renamed lints.)
 - #124053 (coverage: Branch coverage tests for lazy boolean operators)
 - #124071 (Add llvm-bitcode-linker to build manifest)
 - #124103 (Improve std::fs::Metadata Debug representation)
 - #124132 (llvm RustWrapper: explain OpBundlesIndirect argument type)
 - #124191 (Give a name to each distinct manipulation of pretty-printer FixupContext)
 - #124196 (mir-opt tests: rename unit-test -> test-mir-pass)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-20 22:35:56 +00:00
许杰友 Jieyou Xu (Joe) c72cfdd46f
Rollup merge of #124196 - RalfJung:mir-opt-tests, r=Mark-Simulacrum
mir-opt tests: rename unit-test -> test-mir-pass

"unit-test" is extremely non-descriptive, no idea how one is supposed to read that and know that this specifies the MIR pass being tested.
2024-04-20 21:45:38 +01:00
许杰友 Jieyou Xu (Joe) b3f9117a2d
Rollup merge of #124191 - dtolnay:fixup, r=compiler-errors
Give a name to each distinct manipulation of pretty-printer FixupContext

There are only 7 distinct ways that the AST pretty-printer interacts with FixupContext: 3 constructors (including Default), 2 transformations, and 2 queries.

This PR turns these into associated functions which can be documented with examples.

This PR unblocks https://github.com/rust-lang/rust/pull/119427#discussion_r1439481201. In order to improve the pretty-printer's behavior regarding parenthesization of braced macro calls in match arms, which have different grammar than macro calls in statements, FixupContext needs to be extended with 2 new fields. In the previous approach, that would be onerous. In the new approach, all it entails is 1 new constructor (`FixupContext::new_match_arm()`).
2024-04-20 21:45:38 +01:00
许杰友 Jieyou Xu (Joe) 726361caf4
Rollup merge of #124132 - RalfJung:OpBundlesIndirect, r=Mark-Simulacrum
llvm RustWrapper: explain OpBundlesIndirect argument type

Follow-up to https://github.com/rust-lang/rust/pull/123941

r? ``@Mark-Simulacrum``
2024-04-20 21:45:37 +01:00
许杰友 Jieyou Xu (Joe) 418a07861a
Rollup merge of #124103 - dtolnay:metadatadebug, r=Mark-Simulacrum
Improve std::fs::Metadata Debug representation

- Remove duplication of `mode` between `file_type` and `permissions`, which both involve operating on the same mode_t integer
- Add `is_symlink`
- Add `len` in bytes
- Remove Ok wrapping around `modified`, `accessed`, `created`, which eliminates 6 useless lines

<table>
<tr><th>Before</th><th>After</th></tr>
<tr><td>

```console
Metadata {
    file_type: FileType(
        FileType {
            mode: 0o100600 (-rw-------),
        },
    ),
    is_dir: false,
    is_file: true,
    permissions: Permissions(
        FilePermissions {
            mode: 0o100600 (-rw-------),
        },
    ),
    modified: Ok(
        SystemTime {
            tv_sec: 1713402981,
            tv_nsec: 682983531,
        },
    ),
    accessed: Ok(
        SystemTime {
            tv_sec: 1713402983,
            tv_nsec: 206999623,
        },
    ),
    created: Ok(
        SystemTime {
            tv_sec: 1713402981,
            tv_nsec: 682983531,
        },
    ),
    ..
}
```
</td><td>

```console
Metadata {
    file_type: FileType {
        is_file: true,
        is_dir: false,
        is_symlink: false,
        ..
    },
    permissions: Permissions(
        FilePermissions {
            mode: 0o100600 (-rw-------),
        },
    ),
    len: 2096,
    modified: SystemTime {
        tv_sec: 1713402981,
        tv_nsec: 682983531,
    },
    accessed: SystemTime {
        tv_sec: 1713402983,
        tv_nsec: 206999623,
    },
    created: SystemTime {
        tv_sec: 1713402981,
        tv_nsec: 682983531,
    },
    ..
}

```
</td></tr></table>

Generated by:

```rust
fn main() {
    println!("{:#?}", std::fs::metadata("Cargo.toml").unwrap());
}
```
2024-04-20 21:45:37 +01:00
许杰友 Jieyou Xu (Joe) 29ee276368
Rollup merge of #124071 - kjetilkjeka:llvm_bitcode_linker_build_manifest, r=Mark-Simulacrum
Add llvm-bitcode-linker to build manifest

When creating #123423 I didn't realize I also had to add the new component to the build-manifest. This PR finishes the work of adding it, by also adding it to the build manifest.

r? ``@Mark-Simulacrum``
2024-04-20 21:45:36 +01:00
许杰友 Jieyou Xu (Joe) f13cd0c8d0
Rollup merge of #124053 - Zalathar:lazy-boolean, r=Mark-Simulacrum
coverage: Branch coverage tests for lazy boolean operators

The current branch coverage implementation already supports the `&&` and `||` operators (even outside of an `if` condition), as a natural consequence of how they are desugared/lowered, but we didn't have any specific tests for them. This PR adds some appropriate tests.

I've also moved the existing branch coverage tests into a `coverage/branch` subdirectory, so that they don't become unwieldy as I add more branch coverage tests.

``@rustbot`` label +A-code-coverage
2024-04-20 21:45:36 +01:00
许杰友 Jieyou Xu (Joe) 871c3e3075
Rollup merge of #123986 - ehuss:lint-renamed, r=Mark-Simulacrum
lint-docs: Add redirects for renamed lints.

This updates the lint docs to include a redirect for renamed lints to the new name. This helps ensure that links to the old name will still be valid.

Note that this currently uses a hard-coded list. As mentioned in the comment, a future enhancement may gather this information in a better way.

Unblocks #123680
2024-04-20 21:45:35 +01:00
许杰友 Jieyou Xu (Joe) a73aabfa92
Rollup merge of #123976 - ChrisDenton:no-libc-in-std-doc-tests, r=Mark-Simulacrum
Use fake libc in core test

The war on libc continues.

Some platforms may not need to link to the libc crate (and it's possible some may not even have a libc), therefore we shouldn't require it for tests. This creates dummy `malloc` and `free` implementations for use in the pointer docs, but, keeps the public documentation looking the same as before.
2024-04-20 21:45:35 +01:00