Commit Graph

231726 Commits

Author SHA1 Message Date
Matthias Krüger
1ea9951b43
Rollup merge of #114550 - dtolnay:globalalloc, r=compiler-errors
Generate better function argument names in global_allocator expansion

Generated code for `#[global_allocator] static ALLOCATOR: Allocator = Allocator;`—

**Before:**

```rust
const _: () = {
    #[rustc_std_internal_symbol]
    unsafe fn __rust_alloc(arg0: usize, arg1: usize) -> *mut u8 {
        ::core::alloc::GlobalAlloc::alloc(
            &ALLOCATOR,
            ::core::alloc::Layout::from_size_align_unchecked(arg0, arg1),
        )
    }
    #[rustc_std_internal_symbol]
    unsafe fn __rust_dealloc(arg0: *mut u8, arg1: usize, arg2: usize) -> () {
        ::core::alloc::GlobalAlloc::dealloc(
            &ALLOCATOR,
            arg0,
            ::core::alloc::Layout::from_size_align_unchecked(arg1, arg2),
        )
    }
    #[rustc_std_internal_symbol]
    unsafe fn __rust_realloc(
        arg0: *mut u8,
        arg1: usize,
        arg2: usize,
        arg3: usize,
    ) -> *mut u8 {
        ::core::alloc::GlobalAlloc::realloc(
            &ALLOCATOR,
            arg0,
            ::core::alloc::Layout::from_size_align_unchecked(arg1, arg2),
            arg3,
        )
    }
    #[rustc_std_internal_symbol]
    unsafe fn __rust_alloc_zeroed(arg0: usize, arg1: usize) -> *mut u8 {
        ::core::alloc::GlobalAlloc::alloc_zeroed(
            &ALLOCATOR,
            ::core::alloc::Layout::from_size_align_unchecked(arg0, arg1),
        )
    }
};
```

**After:**

```rust
const _: () = {
    #[rustc_std_internal_symbol]
    unsafe fn __rust_alloc(size: usize, align: usize) -> *mut u8 {
        ::core::alloc::GlobalAlloc::alloc(
            &ALLOCATOR,
            ::core::alloc::Layout::from_size_align_unchecked(size, align),
        )
    }
    #[rustc_std_internal_symbol]
    unsafe fn __rust_dealloc(ptr: *mut u8, size: usize, align: usize) -> () {
        ::core::alloc::GlobalAlloc::dealloc(
            &ALLOCATOR,
            ptr,
            ::core::alloc::Layout::from_size_align_unchecked(size, align),
        )
    }
    #[rustc_std_internal_symbol]
    unsafe fn __rust_realloc(
        ptr: *mut u8,
        size: usize,
        align: usize,
        new_size: usize,
    ) -> *mut u8 {
        ::core::alloc::GlobalAlloc::realloc(
            &ALLOCATOR,
            ptr,
            ::core::alloc::Layout::from_size_align_unchecked(size, align),
            new_size,
        )
    }
    #[rustc_std_internal_symbol]
    unsafe fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8 {
        ::core::alloc::GlobalAlloc::alloc_zeroed(
            &ALLOCATOR,
            ::core::alloc::Layout::from_size_align_unchecked(size, align),
        )
    }
};
```
2023-08-07 00:06:07 +02:00
Matthias Krüger
d720f93a62
Rollup merge of #114543 - RalfJung:test-96944, r=compiler-errors
add tests for some fixed ConstProp ICEs

Fixes https://github.com/rust-lang/rust/issues/96944
Fixes https://github.com/rust-lang/rust/issues/111353
2023-08-07 00:06:06 +02:00
Matthias Krüger
74dce18639
Rollup merge of #114542 - RalfJung:const-prop-nonsense, r=compiler-errors
interpret: use ConstPropNonsense for more const-prop induced issues
2023-08-07 00:06:06 +02:00
Matthias Krüger
22d142aecc
Rollup merge of #114535 - klensy:windows-sys-0-42, r=compiler-errors
bump schannel, miow to drop windows-sys 0.42

Changes contains almost only of update to windows-sys 0.48
https://github.com/steffengy/schannel-rs/compare/v0.1.21...v0.1.22
https://github.com/yoshuawuyts/miow/compare/v0.5.0...v0.6.0
2023-08-07 00:06:05 +02:00
bors
f3623871cf Auto merge of #114502 - cjgillot:steal-ctfe, r=oli-obk
Steal MIR for CTFE when possible.

Some bodies, like constants, have CTFE MIR but no optimized MIR.
In that case, have `mir_for_ctfe` steal the MIR instead of cloning it.
2023-08-06 22:02:12 +00:00
bors
85fbb57149 Auto merge of #114553 - matthiaskrgr:rollup-5yddunv, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #114466 (Add Allocation to SMIR)
 - #114505 (Add documentation to has_deref)
 - #114519 (use offset_of! to calculate dirent64 field offsets)
 - #114537 (Migrate GUI colors test to original CSS color format)
 - #114539 (linkchecker: Remove unneeded FIXME about intra-doc links)

Failed merges:

 - #114485 (Add trait decls to SMIR)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-06 19:46:31 +00:00
Ralf Jung
997ec63fb1 simplify handling of valtrees for unsized types 2023-08-06 21:25:49 +02:00
Ralf Jung
b6e3bc23ef remove an unnecessary special case in valtree_into_mplace 2023-08-06 21:25:49 +02:00
Ralf Jung
b66b322a2a add testcase that hits valtree_into_mplace with a custom DST 2023-08-06 21:25:49 +02:00
Martin Nordholts
8a7520995c Remove FIXME about NLL diagnostic that is already improved
The FIXME was added in 46984 when the diagnostic message looked like
this:

    // FIXME(#46983): error message should be better
    &s.0 //~ ERROR free region `` does not outlive free region `'static`

The message was improved in 90667 and now looks like this:

    &s.0 //~ ERROR lifetime may not live long enough

but the FIXME was not removed. The issue 46983 about that diagnostics
should be improved has been closed. We can remove the FIXME now.
2023-08-06 21:20:15 +02:00
bors
baee6b338b Auto merge of #15406 - lowr:fix/panic-missing-impl-self-ty, r=lnicola
Don't provide `generate_default_from_new` when impl self ty is missing

Also don't provide the assist when the `Default` trait can't be found.

Part of #15398
2023-08-06 18:30:09 +00:00
Ryo Yoshida
582917453b
Don't provide generate_default_from_new when impl self ty is missing
Also don't provide the assist when the `Default` trait can't be found.
2023-08-07 03:23:41 +09:00
bors
5973bfbd38 Auto merge of #114516 - cjgillot:direct-module-parent, r=compiler-errors
parent_module_from_def_id does not need to be a query.

r? `@ghost`
2023-08-06 18:04:04 +00:00
Martin Nordholts
2b9876bd6d Issue numbers are enforced on active features; remove FIXME 2023-08-06 20:01:23 +02:00
Matthias Krüger
f542163351
Rollup merge of #114539 - Enselic:unneeded-fixme, r=ehuss
linkchecker: Remove unneeded FIXME about intra-doc links

It was added by https://github.com/rust-lang/rust/pull/77971 but the adder [proposed](https://github.com/rust-lang/rust/pull/77971#issuecomment-710026798) that the added code is a good fallback to have in case rustdoc gets buggy, and I agree. So remove the FIXME.

This PR is part of #44366 which is E-help-wanted.

r? `@jyn514` since you added the FIXME

`@rustbot` label T-dev-tools
2023-08-06 17:26:31 +02:00
Matthias Krüger
0c98f15a94
Rollup merge of #114537 - GuillaumeGomez:migrate-gui-test-color-29, r=notriddle
Migrate GUI colors test to original CSS color format

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

r? ``@notriddle``
2023-08-06 17:26:30 +02:00
Matthias Krüger
3d1c36e917
Rollup merge of #114519 - the8472:dirent-offset-of, r=dtolnay
use offset_of! to calculate dirent64 field offsets

r? `@dtolnay`
2023-08-06 17:26:30 +02:00
Matthias Krüger
13de583583
Rollup merge of #114505 - ouz-a:cleanup_mir, r=RalfJung
Add documentation to has_deref

Documentation of `has_deref` needed some polish to be more clear about where it should be used and what's it's purpose.

cc https://github.com/rust-lang/rust/issues/114401

r? `@RalfJung`
2023-08-06 17:26:29 +02:00
Matthias Krüger
92c04217ba
Rollup merge of #114466 - ouz-a:smir_allocation, r=oli-obk
Add Allocation to SMIR

As it's discussed [here ](https://rust-lang.zulipchat.com/#narrow/stream/320896-project-stable-mir/topic/Representing.20Constants.20in.20smir)this is an attempt to cover Constants for smir in a different way compared to https://github.com/rust-lang/rust/pull/114342

cc https://github.com/rust-lang/project-stable-mir/issues/15

r? ``@oli-obk``
2023-08-06 17:26:28 +02:00
bors
e59540968e Auto merge of #113648 - aliemjay:opaque-binder-ice, r=oli-obk
don't replace opaque types under binders with infer vars

Fixes an ICE in the ui test code.

Fixes #109636
Fixes #109281
Fixes #86800

r? `@oli-obk`
2023-08-06 15:26:03 +00:00
yukang
eb0fcc5ad1 refactor on span_look_ahead 2023-08-06 22:44:11 +08:00
David Tolnay
3f92261579 Generate better function argument names in global_allocator expansion 2023-08-06 07:36:05 -07:00
David Tolnay
704aa56ba0
Generate better function argument names in global_allocator expansion 2023-08-06 07:36:05 -07:00
ouz-a
6df546281b cleanup misinformation regarding has_deref 2023-08-06 17:29:09 +03:00
Deadbeef
6c1e3bb6e9 bless tests 2023-08-06 13:34:53 +00:00
Deadbeef
92f4c59e48 lower impl const to bind to host effect param 2023-08-06 13:34:53 +00:00
Ralf Jung
efd54ccf5a interpret: use ConstPropNonsense for more const-prop induced issues 2023-08-06 15:20:03 +02:00
Ralf Jung
0c595440e3 add test for issue #111353 2023-08-06 15:06:40 +02:00
Ralf Jung
09c71a5547 add test for issue #96944 2023-08-06 15:01:48 +02:00
Ali MJ Al-Nasrawy
2e83a72964 don't replace opaque types under binders with infer vars 2023-08-06 12:08:32 +00:00
ouz-a
b9a539e0a3 Add alocation to smir 2023-08-06 15:06:04 +03:00
Martin Nordholts
cf08888630 linkchecker: Remove unneeded FIXME about intra-doc links
It was added by 77971 but the adder proposed in that PR that the added
code is a good fallback to have in case rustdoc gets buggy, and I agree.
So remove the FIXME.
2023-08-06 13:28:43 +02:00
bors
bc720ad36b Auto merge of #114487 - compiler-errors:opaques-refactoring-idk, r=cjgillot
Consolidate opaque ty and async fn lowering code

The codepaths for lowering "regular" opaques and async fn were almost identical, modulo some bookkeeping that seemed pretty easy to consolidate.

r? `@cjgillot`
2023-08-06 11:16:31 +00:00
Guillaume Gomez
08ca8246f8 Migrate GUI colors test to original CSS color format 2023-08-06 12:46:35 +02:00
klensy
55935df22d bump schannel, miow to drop windows-sys 0.42 2023-08-06 13:24:59 +03:00
bors
a339ed184f Auto merge of #114528 - dtolnay:globalalloccast, r=cjgillot
Delete some useless casts from global_allocator expansion

These casts are from when #\[global_allocator\] needed to translate back and forth between `*mut u8` and `*mut Opaque`. This should have been cleaned up as part of f6ab74b8e7.

Difference to code generated by `#[global_allocator] static ALLOCATOR: Allocator = Allocator;`:

```diff
 const _: () = {
     #[rustc_std_internal_symbol]
     unsafe fn __rust_alloc(arg0: usize, arg1: usize) -> *mut u8 {
         ::core::alloc::GlobalAlloc::alloc(
             &ALLOCATOR,
             ::core::alloc::Layout::from_size_align_unchecked(arg0, arg1),
-        ) as *mut u8
+        )
     }
     #[rustc_std_internal_symbol]
     unsafe fn __rust_dealloc(arg0: *mut u8, arg1: usize, arg2: usize) -> () {
         ::core::alloc::GlobalAlloc::dealloc(
             &ALLOCATOR,
-            arg0 as *mut u8,
+            arg0,
             ::core::alloc::Layout::from_size_align_unchecked(arg1, arg2),
         )
     }
     #[rustc_std_internal_symbol]
     unsafe fn __rust_realloc(
         arg0: *mut u8,
         arg1: usize,
         arg2: usize,
         arg3: usize,
     ) -> *mut u8 {
         ::core::alloc::GlobalAlloc::realloc(
             &ALLOCATOR,
-            arg0 as *mut u8,
+            arg0,
             ::core::alloc::Layout::from_size_align_unchecked(arg1, arg2),
             arg3,
-        ) as *mut u8
+        )
     }
     #[rustc_std_internal_symbol]
     unsafe fn __rust_alloc_zeroed(arg0: usize, arg1: usize) -> *mut u8 {
         ::core::alloc::GlobalAlloc::alloc_zeroed(
             &ALLOCATOR,
             ::core::alloc::Layout::from_size_align_unchecked(arg0, arg1),
-        ) as *mut u8
+        )
     }
 };
```
2023-08-06 09:29:48 +00:00
Meysam Azad
0b16456efa
fix(bootstrap): rename exclude flag to skip 🐛 2023-08-06 14:29:36 +07:00
David Tolnay
e57a89174c
Delete some useless casts from global_allocator expansion 2023-08-05 23:10:38 -07:00
bors
11467b1c2a Auto merge of #114526 - matthiaskrgr:rollup-zz041wi, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #114486 (Avoid invalid NaN lint machine-applicable suggestion in const context)
 - #114503 (Remove invalid lint when there is a generic argument in prefix path)
 - #114509 (Migrate GUI colors test to original CSS color format)
 - #114524 (Also ICE when goals go from Ok to Err in new solver)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-06 03:39:37 +00:00
Matthias Krüger
bf4b1d7805
Rollup merge of #114524 - compiler-errors:more-ice-in-uncertainty, r=jackh726
Also ICE when goals go from Ok to Err in new solver

We were just using `?` here, silently downgrading the goal's response from (presumably) maybe to error -- that seems concerning, since this whole check is for detecting goal instability 😅

r? `@lcnr` or `@BoxyUwU`
2023-08-06 03:56:10 +02:00
Matthias Krüger
e0f04efccb
Rollup merge of #114509 - GuillaumeGomez:migrate-gui-test-color-28, r=notriddle
Migrate GUI colors test to original CSS color format

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

r? `@notriddle`
2023-08-06 03:56:10 +02:00
Matthias Krüger
83d84ffdd5
Rollup merge of #114503 - chenyukang:yukang-fix-114433-unused-qualifications, r=compiler-errors
Remove invalid lint when there is a generic argument in prefix path

Fixes #114433
2023-08-06 03:56:09 +02:00
Matthias Krüger
1305a43d0a
Rollup merge of #114486 - Urgau:const-context-nan-suggestion-114471, r=compiler-errors
Avoid invalid NaN lint machine-applicable suggestion in const context

This PR removes the machine-applicable suggestion in const context for the `invalid_nan_comparision` lint ~~and replace it with a simple help~~.

Fixes https://github.com/rust-lang/rust/issues/114471
2023-08-06 03:56:09 +02:00
bors
8236f63aba Auto merge of #114476 - Urgau:missing-dep-file-112898, r=oli-obk
Fix missing dependency file with `-Zunpretty`

This PR force the `output_filenames` to be run ~~in every early exits like~~ when using `-Zunpretty`, so to respect the `dep-info` flag.

Fixes https://github.com/rust-lang/rust/issues/112898
r? `@oli-obk`
2023-08-06 00:04:52 +00:00
Michael Goulet
3b3e466e36
Add FIXME as reminder to restore suggestion later 2023-08-05 17:04:30 -07:00
Urgau
b71f2becb2 Avoid invalid NaN lint machine-applicable suggestion in const context 2023-08-05 23:54:59 +02:00
Camille GILLOT
7a51b30ebd parent_module_from_def_id does not need to be a query. 2023-08-05 21:23:50 +00:00
Camille GILLOT
02e10a054e Steal MIR for CTFE when possible. 2023-08-05 21:16:55 +00:00
Michael Goulet
55bf810821 Also report when goals go from ok to error 2023-08-05 20:09:31 +00:00
bors
70fa270637 Auto merge of #15401 - Veykril:disabled-proc-macro, r=Veykril
internal: Turn unresolved proc macro expansions into missing expressions

Reduces the amount of type related errors one gets when proc macro expansion is disabled.
2023-08-05 18:01:46 +00:00