Commit Graph

253945 Commits

Author SHA1 Message Date
David Koloski
982a58e900 Fix Fuchsia build broken by #124210
Fuchsia doesn't support dirfd although we have a symbol stubbed for it.
2024-04-29 17:00:03 +00:00
Jonathan Pallant
8cea4f3e1e
arm target docs: small wording fixes 2024-04-29 17:31:49 +01:00
bors
e27af2917b Auto merge of #124332 - Kobzol:toolstate-auto-build, r=pietroalbini
CI: remove `master` job

It only had one job (pun intended), to publish the toolstate. We could probably do that at the end of `auto` builds instead, which is what is done in this PR.

r? `@pietroalbini`
2024-04-29 16:23:44 +00:00
Santiago Pastorino
9276ce1cf3 Add StaticForeignItem and use it on ForeignItemKind 2024-04-29 13:15:51 -03:00
Santiago Pastorino
f06e0f7837
Add StaticForeignItem and use it on ForeignItemKind 2024-04-29 13:15:51 -03:00
y21
f0beaedf83 suppress readonly_write_lock for underscore-prefixed bindings 2024-04-29 17:30:01 +02:00
Michael Goulet
2eb7c8196b Only register candidate if it is associated w a shallow certainty 2024-04-29 10:25:51 -04:00
Michael Goulet
7cf1c547c2 Actually use probes when needed and stop relying on existing outer probes 2024-04-29 10:25:51 -04:00
Michael Goulet
5776aec662 Make names more accurate 2024-04-29 10:25:05 -04:00
bors
0fc9a65b8f Auto merge of #12694 - J-ZhengLi:issue11783, r=dswij
check if closure as method arg has read access in [`collection_is_never_read`]

fixes: #11783

---

changelog: fix [`collection_is_never_read`] misfires when use `retain` for iteration
2024-04-29 14:09:05 +00:00
blyxyas
d31b7db8e4 [Refactor] Rename Lint and LintGroup\'s is_loaded to is_externally_loaded 2024-04-29 15:57:09 +02:00
Krasimir Georgiev
52ea73a540 adapt a codegen test for llvm 19
No functional changes intended.

Found by our experimental rust + LLVM @ HEAD bot:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/27747#018f2570-018c-4b12-9c5a-38cf81453683/957-965
2024-04-29 13:03:45 +00:00
est31
c6e946d0f0 Change wording 2024-04-29 14:53:38 +02:00
bors
7a58674259 Auto merge of #124255 - RenjiSann:renji/mcdc-nested-expressions, r=Zalathar
MCDC coverage: support nested decision coverage

#123409 provided the initial MCDC coverage implementation.

As referenced in #124144, it does not currently support "nested" decisions, like the following example :

```rust
fn nested_if_in_condition(a: bool, b: bool, c: bool) {
    if a && if b || c { true } else { false } {
        say("yes");
    } else {
        say("no");
    }
}
```

Note that there is an if-expression (`if b || c ...`) embedded inside a boolean expression in the decision of an outer if-expression.

This PR proposes a workaround for this cases, by introducing a Decision context stack, and by handing several `temporary condition bitmaps` instead of just one.
When instrumenting boolean expressions, if the current node is a leaf condition (i.e. not a `||`/`&&` logical operator nor a `!` not operator), we insert a new decision context, such that if there are more boolean expressions inside the condition, they are handled as separate expressions.

On the codegen LLVM side, we allocate as many `temp_cond_bitmap`s as necessary to handle the maximum encountered decision depth.
2024-04-29 11:54:49 +00:00
Zalathar
f9263374fb coverage: Replace boolean options with a CoverageLevel enum 2024-04-29 20:04:22 +10:00
Sasha Pourcelot
c8ff8a4dc7 Pretty-print parenthesis around binary in postfix match
Signed-off-by: Sasha Pourcelot <sasha.pourcelot@protonmail.com>
2024-04-29 11:34:22 +02:00
Jonathan Pallant
fa6b90cb8a
arm target docs: collapsed eabi and eabihf into one 2024-04-29 10:32:04 +01:00
bors
90846015cc Auto merge of #124505 - Enselic:aux-bin-fix, r=jieyouxu
aux-bin: Avoid old .so files from old tests; clean auxiliary dir root

Also fix the typo pointed out [here](https://github.com/rust-lang/rust/pull/123316/files#r1577081531).

Closes #124465
2024-04-29 09:14:09 +00:00
Jonathan Pallant
a9022d4680
Arm target doc wording tweaks based on review comments. 2024-04-29 10:13:42 +01:00
Dorian Péron
eb422d5c7e tests(mcdc-coverage): Add tests for nested decision structures in mcdc_nested_if.rs 2024-04-29 09:13:41 +00:00
Dorian Péron
60ca9b6e29 mcdc-coverage: Get decision_depth from THIR lowering
Use decision context stack to handle nested decisions:
- Introduce MCDCDecisionCtx
- Use a stack of MCDCDecisionCtx to handle nested decisions
2024-04-29 09:13:40 +00:00
Dorian Péron
ae8c023983 mcdc-coverage: Add decision_depth field in structs
Add decision_depth field to TVBitmapUpdate/CondBitmapUpdate statements
Add decision_depth field to BcbMappingKinds MCDCBranch and MCDCDecision
Add decision_depth field to MCDCBranchSpan and MCDCDecisionSpan
2024-04-29 09:13:40 +00:00
Nicholas Nethercote
52e9a23bdc Remove extern crate smallvec from a couple of crates. 2024-04-29 18:47:54 +10:00
Nicholas Nethercote
1ab34f063b Remove extern crate bitflags from a couple of crates. 2024-04-29 18:47:54 +10:00
Nicholas Nethercote
7418aa1a07 Remove extern crate rustc_data_structures from numerous crates. 2024-04-29 18:45:14 +10:00
Jonathan Pallant
e6f0e03e5f
Adding new arm target docs to SUMMARY.md 2024-04-29 09:42:50 +01:00
Dorian Péron
3c2f48ede9 mcdc-coverage: Add possibility for codegen llvm to handle several condition bitmaps 2024-04-29 08:41:15 +00:00
bors
c65b2dc935 Auto merge of #124506 - ivmarkov:master, r=jhpratt
Fix ESP IDF build broken by #124210

Subject says it all I hope.

Fix is trivial, thanks to the contributors of #124210 really considering these Tier 3 targets in their change-set (even if ESP IDF was accidentally omitted).
2024-04-29 07:10:01 +00:00
Petr Sumbera
feeb1842cb Normalize bootstrap_out path, r=clubby789 2024-04-29 09:01:58 +02:00
Zalathar
a25a11ad73 coverage: Avoid hard-coded values when visiting logical ops
Instead of separately hard-coding the operation being visited, we can get it
from the match arm pattern by using an as-pattern.
2024-04-29 16:41:10 +10:00
ivmarkov
fa6db4c428 Fix ESP IDF build broken by #124210 2024-04-29 06:17:02 +00:00
Nicholas Nethercote
f3e05d1609 Remove extern crate rustc_data_structures from rustc_query_system. 2024-04-29 15:40:29 +10:00
J-ZhengLi
cbdc36aa09 skip warning when generic evolved;
suggest explicit type when its inferred in closure
2024-04-29 13:38:45 +08:00
Nicholas Nethercote
99e036bd21 Remove extern crate rustc_middle from numerous crates. 2024-04-29 14:50:45 +10:00
Martin Nordholts
de3eff79a6 aux-bin: Avoid old .so files from old tests; clean auxiliary dir root 2024-04-29 06:50:38 +02:00
Martin Nordholts
448d527fd8 Typo fix: exec:ing -> exec'ing 2024-04-29 06:49:39 +02:00
Nicholas Nethercote
e6b3e20243 Remove extern crate rustc_session from rustc_lint. 2024-04-29 13:57:41 +10:00
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
Gurinder Singh
254a9fbe86 Prohibit const prop of unions in KnownPanicsLint
as they have a potential to ICE during layout calculation
2024-04-29 08:16:26 +05:30
Nicholas Nethercote
6ce258f657 Remove extern crate rustc_macros from rustc_middle. 2024-04-29 11:19:16 +10: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
Nicholas Nethercote
4814fd0a4b Remove extern crate rustc_macros from numerous crates. 2024-04-29 10:21:54 +10: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
George Bateman
8aa3c59752
Move rustfmt changes out
Now in https://github.com/rust-lang/rustfmt/pull/6154
2024-04-28 21:38:55 +01:00
Mads Marquart
f9f3573b62 Fix posix_spawn not being used on iOS and visionOS
`man posix_spawn` documents it to be able to return `ENOENT`, and there
should be nothing preventing this. Tested in the iOS simulator and on
Mac Catalyst.
2024-04-28 22:34:51 +02:00
bors
e68fcb0973 Auto merge of #12725 - llogiq:allow-useless-test-vecs, r=blyxyas
configurably allow `useless_vec` in tests

This adds a `àllow-useless-vec-in-test` configuration which, when set to `true` will allow the `useless_vec` lint in `#[test]` functions and code within `#[cfg(test)]`. It also moves a `is_in_test` helper to `clippy_utils`.

---

changelog: configurably allow [`useless_vec`] in test code
2024-04-28 20:10:33 +00:00
George Bateman
2348eb271c
Update mir-opt tests, add proper regression test 2024-04-28 21:10:09 +01:00
Andre Bogus
87efce4fa2 configurably allow useless_vec in tests
This adds a `àllow-useless-vec-in-test` configuration which, when set
to `true` will allow the `useless_vec` lint in `#[test]` functions and
code within `#[cfg(test)]`. It also moves a `is_in_test` helper to
`clippy_utils`.
2024-04-28 22:07:56 +02:00