Commit Graph

252255 Commits

Author SHA1 Message Date
Josh Stone
a7201db04b
Merge cuviper in the mailmap 2024-04-12 14:55:36 -07:00
bors
22a2425c10 Auto merge of #121426 - madsmtm:remove-cc-syslibroot, r=pnkfelix
Remove redundant `-Wl,-syslibroot`

Since `-isysroot` is set, [Clang already passes this when invoking the linker](https://github.com/llvm/llvm-project/blob/llvmorg-17.0.6/clang/lib/Driver/ToolChains/Darwin.cpp#L439-L442).

See https://github.com/rust-lang/rust/pull/56833 for when the `-isysroot` was originally added, but didn't remove the unnecessary linker flag.

CC `@BlackHoleFox`
r? shepmaster
2024-04-12 18:16:47 +00:00
bors
322e92bdae Auto merge of #123856 - matthiaskrgr:rollup-4v8rkfj, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #123204 (rustdoc: point at span in `include_str!`-ed md file)
 - #123223 (Fix invalid silencing of parsing error)
 - #123249 (do not add prolog for variadic naked functions)
 - #123825 (Call the panic hook for non-unwind panics in proc-macros)
 - #123833 (Update stdarch submodule)
 - #123841 (Improve diagnostic by suggesting to remove visibility qualifier)
 - #123849 (Update E0384.md)
 - #123852 (fix typo in library/std/src/lib.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-12 16:14:41 +00:00
Matthias Krüger
4393eab9ea
Rollup merge of #123852 - kamaboko123:fix_typo_in_std_lib_rs, r=lqd
fix typo in library/std/src/lib.rs

I found typo in literal.
I got an error by this typo when build std.

```
salacia@Vega:~/fat12rs$ cargo build -Zbuild-std
   Compiling compiler_builtins v0.1.108
   Compiling core v0.0.0 (/home/salacia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling libc v0.2.153
   Compiling memchr v2.5.0
   Compiling std v0.0.0 (/home/salacia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std)
   Compiling rustc-std-workspace-core v1.99.0 (/home/salacia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/home/salacia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
   Compiling cfg-if v1.0.0
   Compiling unwind v0.0.0 (/home/salacia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/unwind)
   Compiling adler v1.0.2
   Compiling rustc-demangle v0.1.23
   Compiling rustc-std-workspace-alloc v1.99.0 (/home/salacia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-alloc)
   Compiling gimli v0.28.1
   Compiling object v0.32.2
   Compiling addr2line v0.21.0
   Compiling miniz_oxide v0.7.2
   Compiling std_detect v0.1.5 (/home/salacia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/stdarch/crates/std_detect)
   Compiling hashbrown v0.14.3
   Compiling panic_abort v0.0.0 (/home/salacia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_abort)
   Compiling panic_unwind v0.0.0 (/home/salacia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_unwind)
error: expected `,`, found `.`
   --> /home/salacia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/lib.rs:224:78
    |
224 |             `#![no_std]` or overriding this warning by enabling this feature".
    |                                                                              ^ expected `,`

error: could not compile `std` (lib) due to 1 previous error
:224:78
    |
224 |             `#![no_std]` or overriding this warning by enabling this feature".
    |                                                                              ^ expected `,`

error: could not compile `std` (lib) due to 1 previous error
```
2024-04-12 17:41:36 +02:00
Matthias Krüger
38283bc295
Rollup merge of #123849 - JimmyOhn:first_contribution, r=pnkfelix
Update E0384.md

Add an example for the shadowing usage.
2024-04-12 17:41:35 +02:00
Matthias Krüger
15a8b490ea
Rollup merge of #123841 - Kohei316:remove_qualifier_sugg, r=wesleywiser
Improve diagnostic by suggesting to remove visibility qualifier

Resolves #123529
This PR improve diagnostic by suggesting to remove visibility qualifier.
2024-04-12 17:41:35 +02:00
Matthias Krüger
be3ea1dfb0
Rollup merge of #123833 - dpaoliello:stdarch, r=Amanieu
Update stdarch submodule

`asm_experimental_arch` is required in `core` as we're now using unstable inline assembly when building Arm64EC.

Brings in the fix for <https://github.com/rust-lang/stdarch/issues/1555> (cc `@tslnc04).`

r? `@Amanieu`
2024-04-12 17:41:34 +02:00
Matthias Krüger
8c8692014b
Rollup merge of #123825 - saethlin:report-nounwind-panics, r=petrochenkov
Call the panic hook for non-unwind panics in proc-macros

As I suggested in https://github.com/rust-lang/rust/issues/123286#issuecomment-2030344815.

If a proc macro causes a non-unwinding panic, `proc_macro` isn't able to catch the unwind and report the panic as a compile error by passing control back to the compiler. Our only chance to produce any diagnostic is the panic hook, so we should call it.

This scenario has already existed, but has become a lot more interesting now that we're adding more UB-detecting panics to the standard library, and such panics do not unwind.
2024-04-12 17:41:34 +02:00
Matthias Krüger
4a0e9e0deb
Rollup merge of #123249 - goolmoos:naked_variadics, r=pnkfelix
do not add prolog for variadic naked functions

fixes #99858
2024-04-12 17:41:33 +02:00
Matthias Krüger
68359e2284
Rollup merge of #123223 - estebank:issue-123079, r=pnkfelix
Fix invalid silencing of parsing error

Given

```rust
macro_rules! a {
    ( ) => {
        impl<'b> c for d {
            e::<f'g>
        }
    };
}
```

ensure an error is emitted.

Fix #123079.
2024-04-12 17:41:33 +02:00
Matthias Krüger
ffea7e2a9b
Rollup merge of #123204 - notriddle:notriddle/include-str-span, r=pnkfelix
rustdoc: point at span in `include_str!`-ed md file

Fixes #118549
2024-04-12 17:41:32 +02:00
Jimmy Ohn
0b5653f098 Update compiler/rustc_error_codes/src/error_codes/E0384.md
Add an example for the shadowing usage.
2024-04-12 22:43:38 +09:00
bors
bd71213cf0 Auto merge of #123846 - matthiaskrgr:rollup-85y28av, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #123796 (Remove unused cargo-platform dependency from tidy)
 - #123830 (Remove `From` impls for unstable types that break inference)
 - #123842 (fix typo in pin.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-12 13:13:50 +00:00
kamaboko123
47c3ffa5d4 fix typo in library/std/src/lib.rs 2024-04-12 22:02:08 +09:00
Guy Shefy
9139d7252d do not add prolog for variadic naked functions
fixes #99858
2024-04-12 15:29:39 +03:00
Matthias Krüger
e256d5f2ee
Rollup merge of #123842 - ShockYoungCHN:master, r=scottmcm
fix typo in pin.rs

correct "implemts" to "implements".
2024-04-12 13:35:31 +02:00
Matthias Krüger
bcf24d6467
Rollup merge of #123830 - tgross35:f16-f128-from-inference-fix, r=Nilstrieb
Remove `From` impls for unstable types that break inference

Adding additional `From` implementations that fit `f32::from(<unaffixed float>)` broke inference. Remove these for now.

I added a test to make sure this doesn't quietly change in the future, even though the behavior is not technically guaranteed https://github.com/rust-lang/rust/issues/123824#issuecomment-2050628184

Fixes: <https://github.com/rust-lang/rust/issues/123824>
2024-04-12 13:35:30 +02:00
Matthias Krüger
b467eddf64
Rollup merge of #123796 - bjorn3:remove_cargo_platform, r=clubby789
Remove unused cargo-platform dependency from tidy

Noticed in https://github.com/rust-lang/rust/pull/123788#issuecomment-2049806519
2024-04-12 13:35:30 +02:00
bors
7bdae134cb Auto merge of #123783 - tgross35:f16-f128-debug-impl, r=Amanieu
Add a `Debug` impl and some basic functions to `f16` and `f128`

`compiler_builtins` uses some convenience functions like `is_nan` and `is_sign_positive`. Add these, as well as a temporary implementation for `Debug` that prints the bit representation.
2024-04-12 11:11:50 +00:00
bors
ab71ee7a92 Auto merge of #123736 - compiler-errors:multiply-on-rhs, r=estebank
Don't delay a bug if we suggest adding a semicolon to the RHS of an assign operator

It only makes sense to delay a bug based on the assumption that "[we] defer to the later error produced by `check_lhs_assignable`" *if* the expression we're erroring actually is an LHS; otherwise, we should still report the error since it's both useful and required.

Fixes #123722
2024-04-12 08:41:20 +00:00
bors
6bc9dcd7ec Auto merge of #123490 - niluxv:strict_prov_unwind_seh, r=Amanieu
Refactor `panic_unwind/seh.rs` pointer use

* `x86` now conforms to strict-provenance
* `x86_64` now uses the expose API (instead of `as` casts)
* changed `ptr_t` from a type alias to a `repr(transparent)` struct for some extra type-safety
* replaced the `ptr!` macro by methods on `ptr_t`, as there is now no reason (as far as I can see) anymore to use a macro

On `x86_64` pointers in SEH are represented by 32-bit offsets from `__ImageBase`, so we can't use a pointer type. It might be possible to leak the provenance into the FFI by using a `MaybeUninit<u32>` instead of a `u32`, but that is a bit more involved than using expose, and I'm not sure that would be worth it.
2024-04-12 06:38:26 +00:00
Yuanzhuo Yang
41ac5d93d6
fix pin.rs typo
correct "implemts" to "implements"
2024-04-12 01:28:58 -05:00
bors
6475796a81 Auto merge of #123838 - matthiaskrgr:rollup-zkgwyye, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #123599 (remove some things that do not need to be)
 - #123763 (Set the host library path in run-make v2)
 - #123775 (Make `PlaceRef` and `OperandValue::Ref` share a common `PlaceValue` type)
 - #123789 (move QueryKeyStringCache from rustc_middle to rustc_query_impl, where it actually used)
 - #123826 (Move rare overflow error to a cold function)
 - #123827 (linker: Avoid some allocations in search directory iteration)
 - #123829 (Fix revisions syntax in cfg(ub_checks) test)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-12 04:16:12 +00:00
morine0122
ac1bee6493 Improve diagnostic by suggesting to remove visibility qualifier 2024-04-12 12:59:40 +09:00
Matthias Krüger
2679ea09fe
Rollup merge of #123829 - saethlin:fix-revisions, r=jieyouxu
Fix revisions syntax in cfg(ub_checks) test

`//@ revisions YES NO` doesn't do anything without the `:`.  Thanks for pointing this out to me.

r? jieyouxu
2024-04-12 04:38:23 +02:00
Matthias Krüger
7f111834ad
Rollup merge of #123827 - petrochenkov:searchdirs, r=Nadrieril
linker: Avoid some allocations in search directory iteration

This is more a cleanup than actual optimization.
2024-04-12 04:38:23 +02:00
Matthias Krüger
3758e2ffa5
Rollup merge of #123826 - kornelski:one-in-a-quintillion, r=Amanieu
Move rare overflow error to a cold function

`scoped.spawn()` generates unnecessary inlined panic-formatting code for a branch that will never be taken.
2024-04-12 04:38:22 +02:00
Matthias Krüger
41a294dd2b
Rollup merge of #123789 - klensy:rq, r=cjgillot
move QueryKeyStringCache from rustc_middle to rustc_query_impl, where it actually used

Also allows to drop measureme dep on rustc_middle.
2024-04-12 04:38:22 +02:00
Matthias Krüger
f4f644182b
Rollup merge of #123775 - scottmcm:place-val, r=cjgillot
Make `PlaceRef` and `OperandValue::Ref` share a common `PlaceValue` type

Both `PlaceRef` and `OperandValue::Ref` need the triple of the backend pointer immediate, the optional backend metadata for DSTs, and the actual alignment of the place (since it can differ from the ABI alignment).

This PR introduces a new `PlaceValue` type for those three values, leaving [`PlaceRef`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/mir/place/struct.PlaceRef.html) with the `TyAndLayout` and a `PlaceValue`, just like how [`OperandRef`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/mir/operand/struct.OperandRef.html) is a `TyAndLayout` and an `OperandValue`.

This means that various places that use `Ref`s as places can just pass the `PlaceValue` along, like in the below excerpt from the diff:
```diff
        match operand.val {
-            OperandValue::Ref(ptr, meta, align) => {
-                debug_assert_eq!(meta, None);
+            OperandValue::Ref(source_place_val) => {
+                debug_assert_eq!(source_place_val.llextra, None);
                debug_assert!(matches!(operand_kind, OperandValueKind::Ref));
-                let fake_place = PlaceRef::new_sized_aligned(ptr, cast, align);
+                let fake_place = PlaceRef { val: source_place_val, layout: cast };
                Some(bx.load_operand(fake_place).val)
            }
```

There's more refactoring that I'd like to do after this, but I wanted to stop the PR here where it's hopefully easy (albeit probably not quick) to review since I tried to keep every change line-by-line clear.  (Most are just adding `.val` to get to a field.)

You can also go commit-at-a-time if you'd like.  Each passed tidy and the codegen tests on my machine (though I didn't run the cg_gcc ones).
2024-04-12 04:38:21 +02:00
Matthias Krüger
a510cbdead
Rollup merge of #123763 - cuviper:host-rpath-run-make-v2, r=jieyouxu
Set the host library path in run-make v2

When the build is configured with `[rust] rpath = false`, we need to set
`LD_LIBRARY_PATH` (or equivalent) to what would have been the `RPATH`,
so the compiler can find its own libraries. The old `tools.mk` code has
this environment prefixed in the `$(BARE_RUSTC)` variable, so we just
need to wire up something similar for run-make v2.

This is now set while building each `rmake.rs` itself, as well as in the
`rust-make-support` helpers for `rustc` and `rustdoc` commands. This is
also available in a `set_host_rpath` function for manual commands, like
in the `compiler-builtins` test.
2024-04-12 04:38:21 +02:00
Matthias Krüger
6f78bf2322
Rollup merge of #123599 - matthiaskrgr:rm, r=cjgillot
remove some things that do not need to be
2024-04-12 04:38:21 +02:00
bors
46961d2407 Auto merge of #120092 - zetanumbers:pin_in_static_allocator, r=Amanieu
Add `A: 'static` bound for `Arc/Rc::pin_in`

Analogous to https://github.com/rust-lang/rust/pull/79327
Needed to preserve pin's [drop guarantee](https://doc.rust-lang.org/std/pin/index.html#drop-guarantee)
2024-04-12 00:03:43 +00:00
Daniel Paoliello
8a6ec2eadd Update stdarch submodule 2024-04-11 16:26:02 -07:00
Josh Stone
7e171c72cb Use env::split_paths/join_paths in runtest 2024-04-11 15:33:44 -07:00
Trevor Gross
9bcc98818c Remove From impls for unstable types that break inference
Adding additional `From` implementations that fit `f32::from(<unaffixed
float>)` broke inference. Remove these for now.

Fixes: <https://github.com/rust-lang/rust/issues/123824>
2024-04-11 18:04:31 -04:00
bors
a07f3eb43a Auto merge of #123823 - matthiaskrgr:rollup-8zdtggx, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #122882 (Avoid a panic in `set_output_capture` in the default panic handler)
 - #123523 (Account for trait/impl difference when suggesting changing argument from ref to mut ref)
 - #123744 (Silence `unused_imports` for redundant imports)
 - #123784 (Replace `document.write` with `document.head.insertAdjacent`)
 - #123798 (Avoid invalid socket address in length calculation)
 - #123804 (Stop using `HirId` for fn-like parents since closures are not `OwnerNode`s)
 - #123806 (Panic on overflow in `BorrowedCursor::advance`)
 - #123820 (Add my former address to .mailmap)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-11 21:56:11 +00:00
Ben Kimock
5dcd242768 Fix revisions syntax 2024-04-11 17:53:27 -04:00
Ben Kimock
d8dc28b93e Call the panic hook for non-unwind panics in proc-macros 2024-04-11 17:46:12 -04:00
Vadim Petrochenkov
4ded0b82ca linker: Avoid some allocations in search directory iteration 2024-04-12 00:41:08 +03:00
Kornel
1170d73007 Move rare overflow error to a cold function 2024-04-11 22:23:49 +01:00
Matthias Krüger
d2e9ec789b
Rollup merge of #123820 - bash:mailmap, r=workingjubilee
Add my former address to .mailmap
2024-04-11 22:38:57 +02:00
Matthias Krüger
d8ae975c02
Rollup merge of #123806 - joboet:advanced_overflow, r=Amanieu
Panic on overflow in `BorrowedCursor::advance`

Passing `usize::MAX` to `advance` clearly isn't correct, but the current assertion fails to detect this when overflow checks are disabled. This isn't unsound, but should probably be fixed regardless.
2024-04-11 22:38:56 +02:00
Matthias Krüger
17a8ee636f
Rollup merge of #123804 - compiler-errors:podcrab-fix, r=jieyouxu
Stop using `HirId` for fn-like parents since closures are not `OwnerNode`s

This is a minimal fix for #123273.

I'm overall pretty disappointed w/ the state of this code; although it's "just diagnostics", it still should be maintainable and understandable and neither of those are true. I believe this code really needs some major overhauling before anything more should be added to it, because there are subtle invariants that are being exercised and subsequently broken all over the place, and I don't think we should just paper over them (e.g.) by delaying bugs or things like that. I wouldn't be surprised if fixing up this code would also yield better diagnostics.
2024-04-11 22:38:56 +02:00
Matthias Krüger
f361026ebd
Rollup merge of #123798 - tniessen:patch-1, r=workingjubilee
Avoid invalid socket address in length calculation

This has no effect on the lengths of these constants, but since the IP address portion of the socket addresses was intentionally chosen to be the largest valid value, it seems appropriate to also use the largest valid value for the other components (as opposed to invalid values exceeding the possible ranges).
2024-04-11 22:38:55 +02:00
Matthias Krüger
0ab8cc1931
Rollup merge of #123784 - GuillaumeGomez:replace-document-write, r=notriddle
Replace `document.write` with `document.head.insertAdjacent`

From [this comment](https://github.com/rust-lang/rust/pull/123706/files#r1559864981), using `document.write` is strongly discouraged (explained on [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/write)).

I think in this case it was mostly ok but better be on the safe side.

r? `@notriddle`
2024-04-11 22:38:55 +02:00
Matthias Krüger
da75aaf13d
Rollup merge of #123744 - compiler-errors:redundant-due-to-glob, r=petrochenkov
Silence `unused_imports` for redundant imports

Quick fix for https://github.com/rust-lang/rust/issues/121708#issuecomment-2048105393

r? `@petrochenkov` cc `@joshtriplett`

I think this is right, would like confirmation. I also think it's weird that we're using `=` to assign to `is_redundant` but using `per_ns` for the actual spans. Seems like this could be weirdly order dependent, but that's unrelated to this change.
2024-04-11 22:38:54 +02:00
Matthias Krüger
ec91d71a38
Rollup merge of #123523 - estebank:issue-123414, r=BoxyUwU
Account for trait/impl difference when suggesting changing argument from ref to mut ref

Do not ICE when encountering a lifetime error involving an argument with an immutable reference of a method that differs from the trait definition.

Fix #123414.
2024-04-11 22:38:54 +02:00
Matthias Krüger
1e99af514b
Rollup merge of #122882 - Zoxc:panic-output-panic, r=Amanieu
Avoid a panic in `set_output_capture` in the default panic handler

This avoid a panic in the default panic handler by not using `set_output_capture` as `OUTPUT_CAPTURE.with` may panic once `OUTPUT_CAPTURE` is dropped.

A new non-panicking `try_set_output_capture` variant of `set_output_capture` is added for use in the default panic handler.
2024-04-11 22:38:53 +02:00
bors
616a8f85f1 Auto merge of #123814 - matthiaskrgr:rollup-lxn0t4t, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #123459 (Correctly handle inlining of doc hidden foreign items)
 - #123740 (Reduce Size of `ModifierInfo`)
 - #123770 (Correct broken link in core::pin doc)
 - #123777 (Deduplicate some function implementations between the parser and AST/HIR)
 - #123808 (codegen tests: Tolerate `nuw` `nsw` on `trunc`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-11 19:52:22 +00:00
Trevor Gross
5159ecd922 Add a Debug impl and some basic functions to f16 and f128
`compiler_builtins` uses some convenience functions like `is_nan` and
`is_sign_positive`. Add these, as well as a temporary implementation for
`Debug` that prints the bit representation.
2024-04-11 15:31:10 -04:00