Commit graph

253680 commits

Author SHA1 Message Date
bors 5b1d58c9e2 Auto merge of #124502 - NCGThompson:statically-known-docs, r=jhpratt
Update `is_val_statically_known` Docs

* Add `Type Requirements` section, listing the allowed inputs, as requested by #121115
* Add `Pointers` subsection, explaining is_val_statically_known handles pointers.
* Add `Stability concerns` section, referring to other documentation relating to consistency in `const` functions.

Fixes #121115

Sorry this took so long.
2024-04-29 03:00:12 +00:00
Nicholas Thompson 5969ad4cae Update is_val_statically_known docs
* Add `Type Requirements` section, listing the allowed inputs, as requested by #121115
* Add `Pointers` subsection, explaining is_val_statically_known handles pointers.
* Add `Stability concerns` section, referring to other documentation relating to consistency in `const` functions.
2024-04-28 21:00:53 -04:00
bors 5fe8b697e7 Auto merge of #124498 - tgross35:stabilize-non_null_convenience, r=jhpratt
Stabilize `non_null_convenience`

Fully stabilize the following API, including const where applicable:

```rust
impl <T> NonNull<T> {
    pub const unsafe fn offset(self, count: isize) -> Self;
    pub const unsafe fn add(self, count: usize) -> Self;
    pub const unsafe fn sub(self, count: usize) -> Self;
    pub const unsafe fn offset_from(self, origin: NonNull<T>) -> isize;
    pub const unsafe fn read(self) -> T;
    pub unsafe fn read_volatile(self) -> T;
    pub const unsafe fn read_unaligned(self) -> T;
    pub unsafe fn write_volatile(self, val: T);
    pub unsafe fn replace(self, src: T) -> T;
}

impl<T: ?Sized> NonNull<T> {
    pub const unsafe fn byte_offset(self, count: isize) -> Self;
    pub const unsafe fn byte_add(self, count: usize) -> Self;
    pub const unsafe fn byte_sub(self, count: usize) -> Self;
    pub const unsafe fn byte_offset_from<U: ?Sized>(self, origin: NonNull<U>) -> isize;
    pub unsafe fn drop_in_place(self);
}
```

Stabilize the following without const:

```rust
impl <T> NonNull<T> {
    // const under `const_intrinsic_copy`
    pub const unsafe fn copy_to(self, dest: NonNull<T>, count: usize);
    pub const unsafe fn copy_to_nonoverlapping(self, dest: NonNull<T>, count: usize);
    pub const unsafe fn copy_from(self, src: NonNull<T>, count: usize);
    pub const unsafe fn copy_from_nonoverlapping(self, src: NonNull<T>, count: usize);

    // const under `const_ptr_write`
    pub const unsafe fn write(self, val: T);
    pub const unsafe fn write_bytes(self, val: u8, count: usize);
    pub const unsafe fn write_unaligned(self, val: T);

    // const under `const_swap`
    pub const unsafe fn swap(self, with: NonNull<T>);

    // const under `const_align_offset`
    pub const fn align_offset(self, align: usize) -> usize;

    // const under `const_pointer_is_aligned`
    pub const fn is_aligned(self) -> bool;
}
```

Left the following unstable:

```rust
impl <T> NonNull<T> {
    // moved gate to `ptr_sub_ptr`
    pub const unsafe fn sub_ptr(self, subtracted: NonNull<T>) -> usize;
}

impl <T: ?Sized> NonNull<T> {
    // moved gate to `pointer_is_aligned_to`
    pub const fn is_aligned_to(self, align: usize) -> bool;
}
```

Fixes: https://github.com/rust-lang/rust/issues/117691
2024-04-29 00:05:30 +00:00
bors 1fffb2a355 Auto merge of #124431 - chenyukang:yukang-fix-rustdoc-124363, r=Nadrieril
Fix the assertion crash from rustdoc document indent widths

Fixes #124363
2024-04-28 21:20:07 +00:00
Trevor Gross e0f8202ed5 Stabilize non_null_convenience
Fully stabilize the following API, including const where applicable:

    impl <T> NonNull<T> {
        pub const unsafe fn offset(self, count: isize) -> Self;
        pub const unsafe fn add(self, count: usize) -> Self;
        pub const unsafe fn sub(self, count: usize) -> Self;
        pub const unsafe fn offset_from(self, origin: NonNull<T>) -> isize;
        pub const unsafe fn read(self) -> T;
        pub unsafe fn read_volatile(self) -> T;
        pub const unsafe fn read_unaligned(self) -> T;
        pub unsafe fn write_volatile(self, val: T);
        pub unsafe fn replace(self, src: T) -> T;
    }

    impl<T: ?Sized> NonNull<T> {
        pub const unsafe fn byte_offset(self, count: isize) -> Self;
        pub const unsafe fn byte_add(self, count: usize) -> Self;
        pub const unsafe fn byte_sub(self, count: usize) -> Self;
        pub const unsafe fn byte_offset_from<U: ?Sized>(self, origin: NonNull<U>) -> isize;
        pub unsafe fn drop_in_place(self);
    }

Stabilize the following without const:

    impl <T> NonNull<T> {
        // const under `const_intrinsic_copy`
        pub const unsafe fn copy_to(self, dest: NonNull<T>, count: usize);
        pub const unsafe fn copy_to_nonoverlapping(self, dest: NonNull<T>, count: usize);
        pub const unsafe fn copy_from(self, src: NonNull<T>, count: usize);
        pub const unsafe fn copy_from_nonoverlapping(self, src: NonNull<T>, count: usize);

        // const under `const_ptr_write`
        pub const unsafe fn write(self, val: T);
        pub const unsafe fn write_bytes(self, val: u8, count: usize);
        pub const unsafe fn write_unaligned(self, val: T);

        // const under `const_swap`
        pub const unsafe fn swap(self, with: NonNull<T>);

        // const under `const_align_offset`
        pub const fn align_offset(self, align: usize) -> usize;

        // const under `const_pointer_is_aligned`
        pub const fn is_aligned(self) -> bool;
    }

Left the following unstable:

    impl <T> NonNull<T> {
        // moved gate to `ptr_sub_ptr`
        pub const unsafe fn sub_ptr(self, subtracted: NonNull<T>) -> usize;
    }

    impl <T: ?Sized> NonNull<T> {
        // moved gate to `pointer_is_aligned_to`
        pub const fn is_aligned_to(self, align: usize) -> bool;
    }

Fixes: https://github.com/rust-lang/rust/issues/117691
2024-04-28 16:19:53 -05:00
bors 10505a1cc9 Auto merge of #124489 - matthiaskrgr:rollup-7pa86bf, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - #123734 (Inline more svg images into CSS)
 - #124473 (Port `print-cfg` run-make test to Rust-based rmake.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-28 19:16:32 +00:00
Matthias Krüger 6edb721a9d
Rollup merge of #124473 - Urgau:port-print-cfg, r=jieyouxu
Port `print-cfg` run-make test to Rust-based rmake.rs

This PR port the `print-cfg` run-make test to Rust-based rmake.rs tests.

The actual test is now split in two:
 - the first part for the `--print=cfg` part
 - and the second part for the `=PATH` part of `--print`

Part of #121876.

r? `@jieyouxu`
2024-04-28 21:02:59 +02:00
Matthias Krüger 1b567de50a
Rollup merge of #123734 - GuillaumeGomez:inline-svg-into-css, r=notriddle
Inline more svg images into CSS

Follow-up of https://github.com/rust-lang/rust/pull/123706.

r? `@notriddle`
2024-04-28 21:02:58 +02:00
Guillaume Gomez 5a3509c2f4 Add some missing comments to describe what the inlined SVG is 2024-04-28 17:23:12 +02:00
Guillaume Gomez f780913c72 Inline wheel.svg into CSS 2024-04-28 17:23:12 +02:00
Guillaume Gomez f5b3b400f7 Inline clipboard.svg into CSS 2024-04-28 17:23:11 +02:00
Urgau 006c94cfa1 Use named struct arguments instead of comment named args 2024-04-28 17:17:22 +02:00
Urgau 607497d57c Port print-cfg run-make to Rust-based rmake.rs 2024-04-28 17:17:22 +02:00
bors ce609db948 Auto merge of #124467 - matthiaskrgr:rollup-1aq98fu, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - #124444 (Record certainty of `evaluate_added_goals_and_make_canonical_response` call in candidate)
 - #124463 (Rename `inhibit_union_abi_opt()` to `inhibits_union_abi_opt()`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-28 13:05:18 +00:00
Matthias Krüger 7ab3997970
Rollup merge of #124463 - gurry:rename-func, r=TaKO8Ki
Rename `inhibit_union_abi_opt()` to `inhibits_union_abi_opt()`

`inihibit` seems to suggest that this function will inhibit optimizations whereas `inhibits` correctly indicates that it will merely _check_ that. With `inhibits` if conditions read more naturally e.g.:

```rust
if repr.inhibits_union_abi_opt() {
}
```
2024-04-28 13:34:42 +02:00
Matthias Krüger a7771385e5
Rollup merge of #124444 - compiler-errors:eval, r=lcnr
Record certainty of `evaluate_added_goals_and_make_canonical_response` call in candidate

Naming subject to bikeshedding, but I will need this when moving `select` to a proof tree visitor.

r? lcnr
2024-04-28 13:34:41 +02:00
bors ba00750418 Auto merge of #124435 - matthiaskrgr:tests, r=jieyouxu
add more tests

r? `@jieyouxu`
2024-04-28 10:55:16 +00:00
Matthias Krüger a15996c9f1 try to fix tests on windows where the "file not found" error is different from linux 2024-04-28 11:07:00 +02:00
bors 91d5e4af86 Auto merge of #124261 - onur-ozkan:drop-llvm-if-available, r=Mark-Simulacrum
drop deprecated value `if-available` for `download-ci-llvm` option

It's been 5 months since we deprecated this. It should be fine to drop its support now.
2024-04-28 08:52:27 +00:00
Matthias Krüger f536a06a5a add test for ice expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr
Fixes https://github.com/rust-lang/rust/issues/113776
2024-04-28 10:23:11 +02:00
Matthias Krüger 27338f2fe0 add test for ice future has no bound vars.
Fixes https://github.com/rust-lang/rust/issues/112347
2024-04-28 10:23:11 +02:00
Matthias Krüger bb4769532b add test for const generic ty's with lifetimes cause opaque types to ICE
Fixes https://github.com/rust-lang/rust/issues/111911
2024-04-28 10:23:11 +02:00
Matthias Krüger f483971b87 add test for ICE failed to resolve instance for <[f32; 2] as CrossProduct
Fixes https://github.com/rust-lang/rust/issues/111667
2024-04-28 10:23:10 +02:00
Matthias Krüger 012f9e26ac add test for Inconsistent rustc_transmute::is_transmutable(...) result, got Yes
Fixes https://github.com/rust-lang/rust/issues/110969
2024-04-28 10:23:10 +02:00
Matthias Krüger c32e2fe179 add test for https://github.com/rust-lang/rust/issues/109812 2024-04-28 10:23:10 +02:00
Matthias Krüger c968b8b777 add test for ICE: tcx.resolutions(()) is not supported for local crate -Zunpretty=mir on invalid module path with staged_ap
Fixes https://github.com/rust-lang/rust/issues/108697
2024-04-28 10:23:10 +02:00
Gurinder Singh 4aafec1bc1 Rename inihibit_union_abi_opt() to inihibits_union_abi_opt()
The present tense makes it read more naturally at use site i.e.
"this repr _inhibits_ optimizations"
2024-04-28 13:09:36 +05:30
bors cb49406457 Auto merge of #124210 - the8472:consign-ebadf-to-the-fire, r=Mark-Simulacrum
Abort a process when FD ownership is violated

When an owned FD has already been closed before it's dropped that means something else touched an FD in ways it is not allowed to. At that point things can already be arbitrarily bad, e.g. clobbered mmaps. Recovery is not possible.
All we can do is hasten the fire.

Unlike the previous attempt in #124130 this shouldn't suffer from the possibility that FUSE filesystems can return arbitrary errors.
2024-04-28 06:20:28 +00:00
bors 6c90ac8d8f Auto merge of #123546 - Rajveer100:branch-for-issue-122128, r=onur-ozkan
Bootstrap: Check validity of `--target` and `--host` triples before starting a build

Resolves #122128

As described in the issue, validating the `target` and `host` triples would save a lot of time before actually starting a build. This would also check for custom targets by looking for a valid JSON spec if the specified target does not exist in the [supported](42825768b1/compiler/rustc_target/src/spec/mod.rs (L1401-L1689)) list of targets.
2024-04-28 04:16:05 +00:00
yukang 6faedd381b Fix the assertion crash from rustdoc document indent widths 2024-04-28 11:17:09 +08:00
bors 2207179a59 Auto merge of #124454 - Mark-Simulacrum:bump-version, r=Mark-Simulacrum
Bump version to 1.80

https://forge.rust-lang.org/release/process.html#bump-the-stable-version-number-t-6-days-friday-the-week-before

r? `@Mark-Simulacrum`
2024-04-28 02:12:04 +00:00
bors 0986358d2c Auto merge of #124456 - matthiaskrgr:rollup-8bm3m6v, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #123248 (1.78 release notes)
 - #123942 (`x vendor`)
 - #124165 (add test for incremental ICE: slice-pattern-const.rs #83085)
 - #124242 (bootstrap: Describe build_steps modules)
 - #124406 (Remove unused `[patch]` for clippy_lints)
 - #124429 (bootstrap: Document `struct Builder` and its fields)
 - #124447 (Unconditionally call `really_init` on GNU/Linux)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-28 00:05:11 +00:00
The 8472 1ba00d9cb2 put FD validity behind late debug_asserts checking
uses the same machinery as assert_unsafe_precondition
2024-04-28 01:44:25 +02:00
Matthias Krüger be8976022e
Rollup merge of #124447 - workingjubilee:set-argv-twice-on-gnu, r=ChrisDenton
Unconditionally call `really_init` on GNU/Linux

This makes miri not diverge in behavior, it fixes running Rust linux-gnu binaries on musl with gcompat, it fixes dlopen edge-cases that cranelift somehow hits, etc.

Fixes #124126

thou hast gazed into this abyss with me:
r? ``@ChrisDenton``
2024-04-28 01:25:02 +02:00
Matthias Krüger 088753cb9a
Rollup merge of #124429 - Enselic:document-builder, r=Mark-Simulacrum
bootstrap: Document `struct Builder` and its fields

I'm exploring the code of bootstrap and had a bit of a hard time understanding exactly what `Builder` is for at first. I decided to help document it and its field to help future explorers.
2024-04-28 01:25:01 +02:00
Matthias Krüger 62a88c375c
Rollup merge of #124406 - Alexendoo:cargo-patch-clippy, r=Mark-Simulacrum
Remove unused `[patch]` for clippy_lints

Looks like it was once used by RLS
2024-04-28 01:25:01 +02:00
Matthias Krüger f17ce8bf7a
Rollup merge of #124242 - workingjubilee:describe-bootstrap-files-better, r=Mark-Simulacrum
bootstrap: Describe build_steps modules

One of my preferred ways to understand source code is to start with its API. This implies the code is documented reasonably accurately, even if it is a private API. The description of one of these modules had not been updated since 2015 and so was both terse and confusing, so I rewrote it. Then I noticed many others went unremarked, so I offered some remarks.
2024-04-28 01:25:00 +02:00
Matthias Krüger 289bf549ad
Rollup merge of #124165 - matthiaskrgr:slice-pattern-const-ice-incr, r=Mark-Simulacrum
add test for incremental ICE: slice-pattern-const.rs #83085

Fixes #83085
2024-04-28 01:25:00 +02:00
Matthias Krüger 8ef4a8df4b
Rollup merge of #123942 - onur-ozkan:x-vendor, r=Mark-Simulacrum
`x vendor`

This PR implements `x vendor` on bootstrap; enabling dependency vendoring without the need for developers to have `cargo` installed on their system (previously, we suggested running `cargo vendor ...` but now we can accomplish the same task with `x vendor`).

In addition, fixes #112391 problem.
2024-04-28 01:24:59 +02:00
Matthias Krüger 856dfdca8e
Rollup merge of #123248 - Mark-Simulacrum:relnotes, r=Mark-Simulacrum
1.78 release notes

cc `@rust-lang/release`

r? `@cuviper`
2024-04-28 01:24:59 +02:00
Mark Rousskov a7696ed4ab Bump version to 1.80 2024-04-27 19:03:50 -04:00
Mark Rousskov 7a69a4a5cf 1.78 release notes 2024-04-27 19:00:19 -04:00
Michael Goulet 17728a9bb2 Record certainty of evaluate_added_goals_and_make_canonical_response call in candidate 2024-04-27 17:46:29 -04:00
bors aed2187d53 Auto merge of #124448 - matthiaskrgr:rollup-iloy9vz, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #124370 (Fix substitution parts having a shifted underline in some cases)
 - #124394 (Fix ICE on invalid const param types)
 - #124425 (Do not ICE on invalid consts when walking mono-reachable blocks)
 - #124434 (Remove lazycell and once_cell from compiletest dependencies)
 - #124437 (doc: Make the `mod.rs` in the comment point to the correct location)
 - #124443 (Elaborate in comment about `statx` probe)
 - #124445 (bootstrap: Change `global(true)` to `global = true` for flags for consistency)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-27 20:49:06 +00:00
Matthias Krüger 6f8811d113
Rollup merge of #124445 - Enselic:global-true, r=onur-ozkan
bootstrap: Change `global(true)` to `global = true` for flags for consistency

All other arg properties use the `prop = value` style, which makes it slightly annoying to use the `prop(value)` only style for `global`. Change to `prop = value` also for `global` for consistency.
2024-04-27 20:46:10 +02:00
Matthias Krüger 45019310b8
Rollup merge of #124443 - tbu-:pr_statx_enosys_comment, r=workingjubilee
Elaborate in comment about `statx` probe

As requested by `@workingjubilee` in https://github.com/rust-lang/rust/pull/123928#discussion_r1564916743.
2024-04-27 20:46:09 +02:00
Matthias Krüger 9c634f95bf
Rollup merge of #124437 - linyihai:doc-link-typeck, r=compiler-errors
doc: Make the `mod.rs` in the comment point to the correct location

The origin `mod.rs` had moved to `rustc_hir_analysis::check`, but the annotation doesn't point to it.

See [the origin PR](https://github.com/rust-lang/rust/pull/61857/files#diff-b65997b61ccd8d8e08238c925d631207671aca506e93ce7c5cfa0bec134c0a8e).
2024-04-27 20:46:09 +02:00
Matthias Krüger 8f962a6256
Rollup merge of #124434 - GKFX:remove-lazy-dependencies, r=jieyouxu
Remove lazycell and once_cell from compiletest dependencies

Use the standard library `OnceLock` instead of third-party equivalents. A macro is used for the regexes to make their initialization less unwieldy.
2024-04-27 20:46:09 +02:00
Matthias Krüger 0430e743e4
Rollup merge of #124425 - saethlin:ceci-nest-pas-une-ice, r=compiler-errors
Do not ICE on invalid consts when walking mono-reachable blocks

The `bug!` here was written under the logic of "this condition is impossible, right?" except that of course, if the compiler is given code that results in an compile error, then the situation is possible.

So now we just direct errors into the already-existing path for when we can't do a mono-time optimization.
2024-04-27 20:46:08 +02:00
Matthias Krüger aeb4c0413c
Rollup merge of #124394 - gurry:123863-ice-unexpected-region, r=lcnr
Fix ICE on invalid const param types

Fixes ICE #123863 which occurs because the const param has a type which is not a `bool`, `char` or an integral type.

The ICEing code path begins here in `typeck_with_fallback`: cb3752d20e/compiler/rustc_hir_typeck/src/lib.rs (L167)

The `fallback` invokes the `type_of` query and that eventually ends up calling `ct_infer` from the lowering code over here:
cb3752d20e/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs (L561) and `ct_infer` ICEs at this location: cb3752d20e/compiler/rustc_hir_analysis/src/collect.rs (L392)

To fix the ICE it I'm triggering a `span_delayed_bug` before we hit `ct_infer` if the type of the const param is not one of the supported types

### Edit
On `@lcnr's` suggestion I've changed the approach to not let `ReStatic` region hit the `bug!` in `ct_infer` instead of triggering a `span_delayed_bug`.
2024-04-27 20:46:08 +02:00