Commit Graph

12316 Commits

Author SHA1 Message Date
Michael Goulet
a57b8b91db Bless test fallout 2024-08-03 07:57:31 -04:00
Michael Goulet
ac56007ea7 Revert "Rollup merge of #125572 - mu001999-contrib:dead/enhance, r=pnkfelix"
This reverts commit 13314df21b, reversing
changes made to 6e534c73c3.
2024-08-03 07:57:31 -04:00
Michael Goulet
d29818c9f5 Revert "Rollup merge of #126315 - mu001999-contrib:fix/126289, r=petrochenkov"
This reverts commit 977c5fd419, reversing
changes made to 24c94f0e4f.
2024-08-03 07:57:31 -04:00
Michael Goulet
22da616245 Revert "Rollup merge of #126618 - mu001999-contrib:dead/enhance, r=pnkfelix"
This reverts commit 2724aeaaeb, reversing
changes made to d929a42a66.
2024-08-03 07:57:31 -04:00
Michael Goulet
5f5b4ee128 Revert "Rollup merge of #127107 - mu001999-contrib:dead/enhance-2, r=pnkfelix"
This reverts commit 31fe9628cf, reversing
changes made to f20307851e.
2024-08-03 07:57:31 -04:00
Michael Goulet
c6b6c1270a Revert "Rollup merge of #127017 - mu001999-contrib:dead/enhance, r=pnkfelix"
This reverts commit a70dc297a8, reversing
changes made to ceae37188b.
2024-08-03 07:57:31 -04:00
Michael Goulet
361ab1af0c Revert "Rollup merge of #128104 - mu001999-contrib:fix/128053, r=petrochenkov"
This reverts commit 91b18a058c, reversing
changes made to 9aedec9313.
2024-08-03 07:57:30 -04:00
bors
ad0a2b7180 Auto merge of #128595 - matthiaskrgr:rollup-7a4qa8b, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #126704 (Added SHA512, SM3, SM4 target-features and `sha512_sm_x86` feature gate)
 - #127586 (Add `#[must_use]` to some `into_raw*` functions.)
 - #128161 (nested aux-build in tests/rustdoc/ tests)
 - #128303 (Enable `std::io::copy` specialisation for `std::pipe::{PipeReader, PipeWriter}`)
 - #128368 (Formatting tweaks)
 - #128483 (Still more `cfg` cleanups)
 - #128557 (chore: use shorthand initializer)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-03 10:40:36 +00:00
Matthias Krüger
47a795bbd3
Rollup merge of #128161 - EtomicBomb:just-compiletest, r=notriddle
nested aux-build in tests/rustdoc/ tests

* Fixes bug that prevented using nested aux-build in `tests/rustdoc/` tests. Before, `fn document` and the auxiliary builder disagreed about where to find the nested aux-build source file (`auxiliary/auxiliary/aux.rs` vs `auxiliary/aux.rs`), preventing them from building. Picked the latter in line with other builders in compiletest.
* Adds `//@ doc-flags` header, which forwards flags to rustdoc and not rustc.
* Adds `//@ unique-doc-out-dir` header, which sets the --out-dir for the rustdoc invocation to a unique directory: `<root out dir>/docs/<test name>/doc`
* Changes working directory of the rustdoc invocation to the root out directory (common among all aux-builds). Prior art: exec_compiled_test in runtest.rs
* Adds tests that use nested aux builds and new headers

These changes provide useful capabilities for writing rustdoc tests on their own. They are also needed to test the implementation for the [mergable-rustdoc-cross-crate-info](https://github.com/rust-lang/rfcs/pull/3662) RFC.

try-job: x86_64-msvc
2024-08-03 11:17:42 +02:00
Matthias Krüger
8aa18290a4
Rollup merge of #126704 - sayantn:sha, r=Amanieu
Added SHA512, SM3, SM4 target-features and `sha512_sm_x86` feature gate

This is an effort towards #126624. This adds support for these 3 target-features and introduces the feature flag `sha512_sm_x86`, which would gate these target-features and the yet-to-be-implemented detection and intrinsics in stdarch.
2024-08-03 11:17:41 +02:00
bors
a6043039ad Auto merge of #128356 - Oneirical:real-estate-reaLTOr, r=jieyouxu
Migrate `cross-lang-lto-clang` and `cross-lang-lto-pgo-smoketest` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

This has the same problem outlined by #126180, where the tests do not actually run as no test-running CI enviroment has `RUSTBUILD_FORCE_CLANG_BASED_TESTS` set.

However, I still find it interesting to turn the Makefiles into the rmake format until the Clang issue is fixed.

This should technically be tested on MSVC... if MSVC actually ran Clang tests.

try-job: x86_64-gnu-debug
2024-08-03 08:07:00 +00:00
Michael Goulet
b0beb64830 Use ParamEnv::reveal_all in CFI 2024-08-02 23:24:50 -04:00
DianQK
1f9d9603c0
Re-enable SimplifyToExp in match_branches. 2024-08-03 10:55:46 +08:00
DianQK
8b9d7b1489
Simplify match based on the cast result of IntToInt. 2024-08-03 10:55:43 +08:00
Oli Scherer
33cb33441d Add test for coroutine attribute 2024-08-03 02:28:59 +00:00
bors
fd8d6fbe50 Auto merge of #128361 - Oneirical:testle-deforestation, r=jieyouxu
Migrate `link-cfg` and `rustdoc-default-output` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

try-job: aarch64-apple
try-job: x86_64-msvc
try-job: x86_64-mingw
try-job: x86_64-gnu-llvm-18
try-job: i686-msvc
2024-08-02 18:24:21 +00:00
Oneirical
290a260721 run cross-lang-lto-pgo-smoketest in CI by renaming it 2024-08-02 11:54:20 -04:00
Oneirical
560e86d753 rewrite cross-lang-lto-pgo-smoketest to rmake 2024-08-02 11:53:32 -04:00
Oneirical
c0d9357a4c rewrite cross-lang-lto-clang to rmake 2024-08-02 11:53:32 -04:00
Oneirical
c27fa5c332 rewrite rustdoc-default-output to rmake 2024-08-02 11:50:19 -04:00
Oneirical
46b4083e6f rewrite foreign-exceptions to rmake 2024-08-02 10:06:20 -04:00
Oneirical
5b44f800f3 rewrite and rename issue-36710 to rmake 2024-08-02 10:06:07 -04:00
Oneirical
8f641b1b95 rewrite foreign-double-unwind to rmake 2024-08-02 10:05:55 -04:00
bjorn3
feeeb5c48e Bless tests 2024-08-02 11:34:54 +00:00
bors
5367673014 Auto merge of #128352 - Oneirical:daLTOnist-vision, r=jieyouxu
Migrate `cross-lang-lto` `run-make` test to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Please try:

try-job: x86_64-msvc
try-job: i686-mingw
try-job: x86_64-mingw
try-job: armhf-gnu
try-job: test-various
try-job: aarch64-apple
try-job: x86_64-gnu-llvm-18
2024-08-02 10:59:19 +00:00
Scott McMurray
77ca30f195 Implement UncheckedIterator directly for RepeatN 2024-08-01 21:58:34 -07:00
bors
2cec7a85ed Auto merge of #128529 - matthiaskrgr:rollup-gzq2slo, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #126818 (Better handle suggestions for the already present code and fix some suggestions)
 - #128436 (Update sysinfo version to 0.31.2)
 - #128453 (raw_eq: using it on bytes with provenance is not UB (outside const-eval))
 - #128491 ([`macro_metavar_expr_concat`] Dogfooding)
 - #128494 (MIR required_consts, mentioned_items: ensure we do not forget to fill these lists)
 - #128521 (rustdoc: Remove dead opaque_tys rendering logic)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-02 04:53:45 +00:00
Matthias Krüger
67fcb58347
Rollup merge of #128453 - RalfJung:raw_eq, r=saethlin
raw_eq: using it on bytes with provenance is not UB (outside const-eval)

The current behavior of raw_eq violates provenance monotonicity. See https://github.com/rust-lang/rust/pull/124921 for an explanation of provenance monotonicity. It is violated in raw_eq because comparing bytes without provenance is well-defined, but adding provenance makes the operation UB.

So remove the no-provenance requirement from raw_eq. However, the requirement stays in-place for compile-time invocations of raw_eq, that indeed cannot deal with provenance.

Cc `@rust-lang/opsem`
2024-08-02 06:43:43 +02:00
Matthias Krüger
d1d57bd104
Rollup merge of #126818 - estebank:suggestions-fix, r=wesleywiser
Better handle suggestions for the already present code and fix some suggestions

When a suggestion part is for code that is already present, skip it. If all the suggestion parts for a suggestion are for code that is already there, do not emit the suggestion.

Fix two suggestions that treat `span_suggestion` as if it were `span_help`.
2024-08-02 06:43:41 +02:00
bors
05e692ae02 Auto merge of #128147 - lolbinarycat:fmt-write-bloat-rmake, r=jieyouxu
migrate fmt-write-bloat to rmake

try-job: aarch64-apple
try-job: x86_64-gnu-llvm-18
try-job: dist-x86_64-linux
2024-08-02 02:28:59 +00:00
bors
425ae69588 Auto merge of #127624 - Oneirical:a-test-of-lime, r=jieyouxu
Migrate and rename `issue-47551`, `issue-35164` and `issue-69368` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

try-job: dist-x86_64-msvc
2024-08-02 00:03:42 +00:00
sayantn
41b017ec99 Add the sha512, sm3 and sm4 target features
Add the feature in `core/lib.rs`
2024-08-02 02:29:15 +05:30
bors
8e86c95671 Auto merge of #127276 - aDotInTheVoid:no-opaque, r=camelid
rustdoc: Remove OpaqueTy

r? `@ghost`

Apparently this works lol?!?

try-job: aarch64-apple
2024-08-01 19:45:25 +00:00
Esteban Küber
8ce8c42e0b Do not underline suggestions for code that is already there
When a suggestion part is for already present code, do not highlight it. If after that there are no highlights left, do not show the suggestion at all.

Fix clippy lint suggestion incorrectly treated as `span_help`.
2024-08-01 18:53:42 +00:00
Matthias Krüger
29cd3103a1
Rollup merge of #128496 - clubby789:box-syntax-multipart, r=compiler-errors
Fix removed `box_syntax` diagnostic if source isn't available

Fix #128442
2024-08-01 18:43:41 +02:00
Matthias Krüger
8671b0bfbd
Rollup merge of #128482 - RalfJung:ptr-signed-offset, r=oli-obk
interpret: on a signed deref check, mention the right pointer in the error

When a negative offset (like `ptr.offset(-10)`) goes out-of-bounds, we currently show an error saying that we expect the *resulting* pointer to be inbounds for 10 bytes. That's confusing, so this PR makes it so that instead we say that we expect the *original* pointer `ptr` to have 10 bytes *to the left*.

I also realized I can simplify the pointer arithmetic logic and handling of "staying inbounds of a target `usize`" quite a bit; the second commit does that.
2024-08-01 18:43:40 +02:00
Alona Enraght-Moony
52a49d94c7 rustdoc: Add test for impl_trait_in_accos_type 2024-08-01 15:48:22 +00:00
Oneirical
94da7b157a rewrite stable-symbol-names to rmake 2024-08-01 11:07:04 -04:00
Oneirical
b485dd1495 rewrite reproducible-build-2 to rmake 2024-08-01 10:56:48 -04:00
clubby789
e157954cce Fix removed box_syntax diagnostic if source isn't available 2024-08-01 13:11:24 +00:00
Ralf Jung
db1652e07b fix the way we detect overflow for inbounds arithmetic (and tweak the error message) 2024-08-01 14:38:58 +02:00
Ralf Jung
5d5c97aad7 interpret: simplify pointer arithmetic logic 2024-08-01 14:25:19 +02:00
Ralf Jung
de78cb56b2 on a signed deref check, mention the right pointer in the error 2024-08-01 14:25:19 +02:00
bors
c0e32983f5 Auto merge of #127543 - carbotaniuman:more_unsafe_attr_verification, r=estebank,traviscross
More unsafe attr verification

This code denies unsafe on attributes such as `#[test]` and `#[ignore]`, while also changing the `MetaItem` parsing so `unsafe` in args like `#[allow(unsafe(dead_code))]` is not accidentally allowed.

Tracking:

- https://github.com/rust-lang/rust/issues/123757
2024-08-01 10:40:45 +00:00
bors
97ac52f579 Auto merge of #128481 - matthiaskrgr:rollup-efa706r, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #128416 (android: Remove libstd hacks for unsupported Android APIs)
 - #128437 (improve bootstrap to allow selecting llvm tools individually)
 - #128450 (Create COFF archives for non-LLVM backends)
 - #128458 (Emit an error if `#[optimize]` is applied to an incompatible item)
 - #128477 (Finish blessing `coverage/mcdc` tests after LLVM 19 upgrade)
 - #128478 (Ignore `use` declaration reformatting in `.git-blame-ignore-revs`.)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-01 08:09:31 +00:00
Matthias Krüger
5dc8d49ba5
Rollup merge of #128477 - Zalathar:bless-mcdc-19, r=cuviper
Finish blessing `coverage/mcdc` tests after LLVM 19 upgrade

Context: https://github.com/rust-lang/rust/pull/127513#issuecomment-2260887708

These changes aren't needed for Rust CI, because after the LLVM 19 upgrade we have no jobs that run these tests in `coverage-run` mode against LLVM 18. But they might help external builds.

The longer-term plan is to completely drop (unstable) MC/DC support on LLVM 18, as part of getting it working on LLVM 19 in #126733.

cc `@cuviper`
2024-08-01 08:33:30 +02:00
Matthias Krüger
7c60525877
Rollup merge of #128458 - clubby789:optimize-unused-attr, r=compiler-errors
Emit an error if `#[optimize]` is applied to an incompatible item

#54882

The RFC specifies that this should emit a lint. I used the same allow logic as the `coverage` attribute (also allowing modules and impl blocks) - this should possibly be changed depending on if it's decided to allow 'propogation' of the attribute.
2024-08-01 08:33:29 +02:00
bors
70591dc15d Auto merge of #127060 - Oneirical:testificate, r=jieyouxu
Migrate `symbol-visibility` `run-make` test to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Pretty scary!

- The expected number of symbols on each check has been changed slightly to reflect the differences between `llvm_readobj` and `nm`, as I think the former will print hidden symbols once and visible symbols twice, while the latter will only print visible symbols.
- The original test ran the same exact checks on `cdylib` twice, for seemingly no reason. I have removed it.
- This may be possible to optimize some more? `llvm_readobj` could get called only once for each library type, and the regex could avoid being created repeatedly. I am not sure if these kinds of considerations are important for a `run-make` test.

Demands a Windows try-job.

try-job: x86_64-mingw
2024-08-01 05:42:09 +00:00
Zalathar
68df46c4c2 Finish blessing coverage/mcdc tests after LLVM 19 upgrade 2024-08-01 13:36:50 +10:00
bors
e485266c67 Auto merge of #128461 - matthiaskrgr:rollup-3dpp11g, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #123813 (Add `REDUNDANT_IMPORTS` lint for new redundant import detection)
 - #126697 ([RFC] mbe: consider the `_` in 2024 an expression)
 - #127159 (match lowering: Hide `Candidate` from outside the lowering algorithm)
 - #128244 (Peel off explicit (or implicit) deref before suggesting clone on move error in borrowck, remove some hacks)
 - #128431 (Add myself as VxWorks target maintainer for reference)
 - #128438 (Add special-case for [T, 0] in dropck_outlives)
 - #128457 (Fix docs for OnceLock::get_mut_or_init)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-01 02:26:32 +00:00
Matthias Krüger
cf900ab62d
Rollup merge of #128452 - dingxiangfei2009:smart-ptr-require-maybe-sized, r=compiler-errors
derive(SmartPointer): require pointee to be maybe sized

cc ``@Darksonn``

So `#[pointee]` has to be `?Sized` in order for deriving `SmartPointer` to be meaningful.

cc ``@compiler-errors`` for suggestions in #127681
2024-08-01 00:50:13 +02:00
Matthias Krüger
046664bdea
Rollup merge of #128449 - Urgau:tmp-allow-negative-lit-lint, r=compiler-errors
Temporarily switch `ambiguous_negative_literals` lint to allow

This PR temporarily switch the `ambiguous_negative_literals` lint to `allow-by-default`, as asked by T-lang in https://github.com/rust-lang/rust/issues/128287#issuecomment-2260902036.
2024-08-01 00:50:12 +02:00
Matthias Krüger
ac67d10050
Rollup merge of #128443 - compiler-errors:async-unreachable, r=fmease
Properly mark loop as diverging if it has no breaks

Due to specifics about the desugaring of the `.await` operator, HIR typeck doesn't recognize that `.await`ing an `impl Future<Output = !>` will diverge in the same way as calling a `fn() -> !`.

This is because the await operator desugars to approximately:

```rust
loop {
    match future.poll(...) {
        Poll::Ready(x) => break x,
        Poll::Pending => {}
    }
}
```

We know that the value of `x` is `!`, however since `break` is a coercion site, we coerce `!` to some `?0` (the type of the loop expression). Then since the type of the `loop {...}` expression is `?0`, we will not detect the loop as diverging like we do with other expressions that evaluate to `!`:

0b5eb7ba7b/compiler/rustc_hir_typeck/src/expr.rs (L240-L243)

We can technically fix this in two ways:
1. Make coercion of loop exprs more eagerly result in a type of `!` when the only break expressions have type `!`.
2. Make loops understand that all of that if they have only diverging break values, then the loop diverges as well.

(1.) likely has negative effects on inference, and seems like a weird special case to drill into coercion. However, it turns out that (2.) is very easy to implement, we already record whether a loop has any break expressions, and when we do so, we actually skip over any break expressions with diverging values!:

0b5eb7ba7b/compiler/rustc_hir_typeck/src/expr.rs (L713-L716)

Thus, we can consider the loop as diverging if we see that it has no breaks, which is the change implemented in this PR.

This is not usually a problem in regular code for two reasons:
1. In regular code, we already mark `break diverging()` as unreachable if `diverging()` is unreachable. We don't do this for `.await`, since we suppress unreachable errors within `.await` (#64930). Un-suppressing this code will result in spurious unreachable expression errors pointing to internal await machinery.
3. In loops that truly have no breaks (e.g. `loop {}`), we already evaluate the type of the loop to `!`, so this special case is kinda moot. This only affects loops that have `break`s with values of type `!`.

Thus, this seems like a change that may affect more code than just `.await`, but it likely does not in meaningful ways; if it does, it's certainly correct to apply.

Fixes #128434
2024-08-01 00:50:12 +02:00
Matthias Krüger
b22c48ed6e
Rollup merge of #128438 - Bryanskiy:empty-array-dropck, r=lcnr
Add special-case for [T, 0] in dropck_outlives

implements/fixes #110288.

r? `@lcnr`
2024-07-31 23:20:12 +02:00
Matthias Krüger
52f7d33109
Rollup merge of #128244 - compiler-errors:move-clone-sugg, r=estebank
Peel off explicit (or implicit) deref before suggesting clone on move error in borrowck, remove some hacks

Also remove a heck of a lot of weird hacks in `suggest_cloning` that I don't think we should have around.

I know this regresses tests, but I don't believe most of these suggestions were accurate, b/c:
1. They either produced type errors (e.g. turning `&x` into `x.clone()`)
2. They don't fix the issue
3. They fix the issue ostensibly, but introduce logic errors (e.g. cloning a `&mut Option<T>` to then `Option::take` out...)

Most of the suggestions are still wrong, but they're not particularly *less* wrong IMO.

Stacked on top of #128241, which is an "obviously worth landing" subset of this PR.

r? estebank
2024-07-31 23:20:11 +02:00
Matthias Krüger
19f6ff0655
Rollup merge of #127159 - Nadrieril:hide-candidate, r=matthewjasper
match lowering: Hide `Candidate` from outside the lowering algorithm

The internals of `Candidate` are tricky and a source of confusion. This PR makes it so we don't expose `Candidate`s outside the lowering algorithm. Now:
- false edges are handled in `lower_match_tree`;
- `lower_match_tree` takes a list of patterns as input;
- `lower_match_tree` returns a flat datastructure that contains only the necessary information.

r? ```@matthewjasper```
2024-07-31 23:20:10 +02:00
Matthias Krüger
3acd910036
Rollup merge of #126697 - vincenzopalazzo:macros/find_the_expression_tok, r=eholk,compiler-errors
[RFC] mbe: consider the `_` in 2024 an expression

This commit is adding the possibility to parse the `_` as an expression inside the esition 2024.

Link: https://rust-lang.zulipchat.com/#narrow/stream/404510-wg-macros/topic/supporting.20.60_.60.20expressions

Issue https://github.com/rust-lang/rust/issues/123742

r? `@eholk`
2024-07-31 23:20:09 +02:00
Matthias Krüger
20379e4d4e
Rollup merge of #123813 - compiler-errors:redundant-lint, r=petrochenkov
Add `REDUNDANT_IMPORTS` lint for new redundant import detection

Defaults to Allow for now. Stacked on #123744 to avoid merge conflict, but much easier to review all as one.

r? petrochenkov
2024-07-31 23:20:09 +02:00
clubby789
6d7bb127e6 Emit an error if #[optimize] is applied to an incompatible item 2024-07-31 20:28:00 +00:00
bors
28a58f2fa7 Auto merge of #126991 - cjgillot:gvn-prof, r=oli-obk
Accelerate GVN a little

This PR addresses a few inefficiencies I've seen in callgrind profiles.

Commits are independent.

Only the first commit introduces a change in behaviour: we stop substituting some constant pointers. But we keep propagating their contents that have no provenance, so we don't lose much.

r? `@saethlin`
2024-07-31 18:37:20 +00:00
Vincenzo Palazzo
6b731c2e7d tests: add the _ as expr test for cargo fix
Co-authored-by: Eric Holk <eric@theincredibleholk.org>
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2024-07-31 18:34:33 +00:00
Vincenzo Palazzo
276fa19c0a rustc_parser: consider the in 2024 an expression
This commit is adding the possibility to parse the `_` as
an expression inside the esition 2024.

Link: https://rust-lang.zulipchat.com/#narrow/stream/404510-wg-macros/topic/supporting.20.60_.60.20expressions
Co-authored-by: Eric Holk <eric@theincredibleholk.org>
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2024-07-31 18:34:22 +00:00
Ralf Jung
f97aba2271 raw_eq: using it on bytes with provenance is not UB (outside const-eval) 2024-07-31 20:26:20 +02:00
Ding Xiang Fei
14a0963f96
reject pointee without ?Sized 2024-08-01 02:00:05 +08:00
Urgau
840ca3cbef Temporarily switch ambiguous_negative_literals lint to allow 2024-07-31 19:36:47 +02:00
Michael Goulet
74754b8786 Properly mark loop as diverging if it has no breaks 2024-07-31 12:24:26 -04:00
Oneirical
152db2760c rewrite cross-lang-lto to rmake 2024-07-31 11:33:08 -04:00
bors
99322d84c4 Auto merge of #128435 - matthiaskrgr:rollup-l76vu3i, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #126454 (bump-stage0: use IndexMap for determinism)
 - #127681 (derive(SmartPointer): rewrite bounds in where and generic bounds)
 - #127830 (When an archive fails to build, print the path)
 - #128151 (Structured suggestion for `extern crate foo` when `foo` isn't resolved in import)
 - #128387 (More detailed note to deprecate ONCE_INIT)
 - #128388 (Match LLVM ABI in `extern "C"` functions for `f128` on Windows)
 - #128402 (Attribute checking simplifications)
 - #128412 (Remove `crate_level_only` from `ELIDED_LIFETIMES_IN_PATHS`)
 - #128430 (Use a separate pattern type for `rustc_pattern_analysis` diagnostics )

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-31 15:24:45 +00:00
Oneirical
ea04b0afbf use llvm-nm in symbol-visibility rmake test 2024-07-31 10:39:16 -04:00
Matthias Krüger
06b837231a
Rollup merge of #128412 - compiler-errors:crate-level-only, r=cjgillot
Remove `crate_level_only` from `ELIDED_LIFETIMES_IN_PATHS`

As far as I can tell, we provide the right node id to the `ELIDED_LIFETIMES_IN_PATHS` lint:

f8060d282d/compiler/rustc_resolve/src/late.rs (L2015-L2027)

So I've gone ahead and removed the restriction from this lint.
2024-07-31 15:36:33 +02:00
Matthias Krüger
5c63363284
Rollup merge of #128388 - beetrees:f16-f128-slightly-improve-windows-abi, r=tgross35
Match LLVM ABI in `extern "C"` functions for `f128` on Windows

As MSVC doesn't support `_Float128`, x86-64 Windows doesn't have a defined ABI for `f128`. Currently, Rust will pass and return `f128` indirectly for `extern "C"` functions. This is inconsistent with LLVM, which passes and returns `f128` in XMM registers, meaning that e.g. the ABI of `extern "C"` compiler builtins won't match. This PR fixes this discrepancy by making the x86-64 Windows `extern "C"` ABI pass `f128` directly through to LLVM, so that Rust will follow whatever LLVM does. This still leaves the difference between LLVM and GCC (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054) but this PR is still an improvement as at least Rust is now consistent with it's primary codegen backend and compiler builtins from `compiler-builtins` will now work.

I've also fixed the x86-64 Windows `has_reliable_f16` match arm in `std` `build.rs` to refer to the correct target, and added an equivalent match arm to `has_reliable_f128` as the LLVM-GCC ABI difference affects both `f16` and `f128`.

Tracking issue: #116909

try-job: x86_64-msvc
try-job: x86_64-mingw
2024-07-31 15:36:31 +02:00
Matthias Krüger
336a378fcd
Rollup merge of #128151 - estebank:missing-extern-crate, r=petrochenkov
Structured suggestion for `extern crate foo` when `foo` isn't resolved in import

When encountering a name in an import that could have come from a crate that wasn't imported, use a structured suggestion to suggest `extern crate foo;` pointing at the right place in the crate.

When encountering `_` in an import, do not suggest `extern crate _;`.

```
error[E0432]: unresolved import `spam`
  --> $DIR/import-from-missing-star-3.rs:2:9
   |
LL |     use spam::*;
   |         ^^^^ maybe a missing crate `spam`?
   |
help: consider importing the `spam` crate
   |
LL + extern crate spam;
   |
```
2024-07-31 15:36:30 +02:00
Matthias Krüger
563f938ab3
Rollup merge of #127681 - dingxiangfei2009:smart-ptr-bounds, r=compiler-errors
derive(SmartPointer): rewrite bounds in where and generic bounds

Fix #127647

Due to the `Unsize` bounds, we need to commute the bounds on the pointee type to the new self type.

cc ```@Darksonn```
2024-07-31 15:36:29 +02:00
Bryanskiy
34fcf92ea0 Add special-case for [T, 0] in dropck 2024-07-31 16:15:05 +03:00
bors
0b5eb7ba7b Auto merge of #127513 - nikic:llvm-19, r=cuviper
Update to LLVM 19

The LLVM 19.1.0 final release is planned for Sep 3rd. The rustc 1.82 stable release will be on Oct 17th.

The unstable MC/DC coverage support is temporarily broken by this update. It will be restored by https://github.com/rust-lang/rust/pull/126733. The implementation changed substantially in LLVM 19, and there are no plans to support both the LLVM 18 and LLVM 19 implementation at the same time.

Compatibility note for wasm:

> WebAssembly target support for the `multivalue` target feature has changed when upgrading to LLVM 19. Support for generating functions with multiple returns no longer works and `-Ctarget-feature=+multivalue` has a different meaning than it did in LLVM 18 and prior. The WebAssembly target features `multivalue` and `reference-types` are now both enabled by default, but generated code is not affected by default. These features being enabled are encoded in the `target_features` custom section and may affect downstream tooling such as `wasm-opt` consuming the module, but the actual generated WebAssembly will continue to not use either `multivalue` or `reference-types` by default. There is no longer any supported means to generate a module that has a function with multiple returns.

Related changes:
 * https://github.com/rust-lang/rust/pull/127605
 * https://github.com/rust-lang/rust/pull/127613
 * https://github.com/rust-lang/rust/pull/127654
 * https://github.com/rust-lang/rust/pull/128141
 * https://github.com/llvm/llvm-project/pull/98933

Fixes https://github.com/rust-lang/rust/issues/121444.
Fixes https://github.com/rust-lang/rust/issues/128212.
2024-07-31 12:56:46 +00:00
Michael Goulet
f6f587e7ea Introduce REDUNDANT_IMPORTS lint 2024-07-31 00:07:42 -04:00
Josh Stone
33a36ea438 Bless coverage/mcdc for line number changes 2024-07-30 18:25:05 -07:00
Camille GILLOT
a0b4d6dfb8 Do not normalize constants eagerly. 2024-07-31 00:59:12 +00:00
bors
83dcdb3a5d Auto merge of #128075 - Oneirical:try-your-damnetest, r=jieyouxu
Migrate `rlib-format-packed-bundled-libs-2`, `native-link-modifier-whole-archive` and `no-builtins-attribute` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Please try:

try-job: x86_64-msvc
try-job: test-various
try-job: armhf-gnu
try-job: aarch64-apple
try-job: x86_64-gnu-llvm-18
2024-07-31 00:36:46 +00:00
carbotaniuman
49db8a5a99 Add toggle for parse_meta_item unsafe parsing
This makes it possible for the `unsafe(...)` syntax to only be
valid at the top level, and the `NestedMetaItem`s will automatically
reject `unsafe(...)`.
2024-07-30 18:28:43 -05:00
Matthias Krüger
e6a82d2878
Rollup merge of #128380 - folkertdev:naked-compatible-doc-comment, r=bjorn3
make `///` doc comments compatible with naked functions

tracking issue: https://github.com/rust-lang/rust/issues/90957

reported in https://github.com/rust-lang/rust/pull/127853#issuecomment-2257323333

it turns out `/// doc comment` and `#[doc = "doc comment"]` are represented differently, at least at the point where we perform the check for what should be allowed. The `///` style doc comment is now also allowed.

r? ``@bjorn3``

cc ``@hsanzg``
2024-07-30 22:51:39 +02:00
Matthias Krüger
7ea1f7265f
Rollup merge of #128379 - Dajamante:aïssata_needs_unwind, r=pietroalbini
the output in stderr expects panic-unwind

r​? ``@pietroalbini``
2024-07-30 22:51:39 +02:00
Matthias Krüger
6f0b237c72
Rollup merge of #128376 - compiler-errors:finish-ur-vegetables, r=jieyouxu
Mark `Parser::eat`/`check` methods as `#[must_use]`

These methods return a `bool`, but we probably should either use these values or explicitly throw them away (e.g. when we just want to unconditionally eat a token if it exists).

I changed a few places from `eat` to `expect`, but otherwise I tried to leave a comment explaining why the `eat` was okay.

This also adds a test for the `pattern_type!` macro, which used to silently accept a missing `is` token.
2024-07-30 22:51:38 +02:00
Matthias Krüger
40edd4f1c6
Rollup merge of #128357 - compiler-errors:shadowed-non-lifetime-binder, r=petrochenkov
Detect non-lifetime binder params shadowing item params

We should check that `for<T>` shadows `T` from an item in the same way that `for<'a>` shadows `'a` from an item.

r? ``@petrochenkov`` since you're familiar w the nuances of rib kinds
2024-07-30 22:51:37 +02:00
Michael Goulet
e65777301b Remove crate_level_only from ELIDED_LIFETIMES_IN_PATHS 2024-07-30 16:42:53 -04:00
beetrees
fe6478cc53
Match LLVM ABI in extern "C" functions for f128 on Windows 2024-07-30 20:23:33 +01:00
Ding Xiang Fei
e7f89a7eea
derive(SmartPointer): rewrite bounds in where and generic bounds 2024-07-30 21:14:10 +02:00
Oneirical
01a266206b rewrite and rename issue-69368 to rmake 2024-07-30 14:44:14 -04:00
bors
f8060d282d Auto merge of #128083 - Mark-Simulacrum:bump-bootstrap, r=albertlarsan68
Bump bootstrap compiler to new beta

https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2024-07-30 17:49:08 +00:00
binarycat
ebd6718218 tidy
this commit cannot easily be squashed, since there is already a
PR based on the previous commit.
2024-07-30 13:33:36 -04:00
Oneirical
dcaa17a661 invalid stdout_utf8 handling in run_make_support 2024-07-30 13:07:54 -04:00
Oneirical
689bb118ce rewrite symbol-visibility to rmake 2024-07-30 13:07:54 -04:00
binarycat
4feb949617 migrate fmt-write-bloat to rmake 2024-07-30 12:19:57 -04:00
bors
006c8df322 Auto merge of #124339 - oli-obk:supports_feature, r=wesleywiser
allow overwriting the output of `rustc --version`

Our wonderful bisection folk [have to work around](https://github.com/rust-lang/rust/issues/123276#issuecomment-2075001510) crates that do incomplete nightly/feature detection, as otherwise the bisection just points to where the feature detection breaks, and not to the actual breakage they are looking for.

This is also annoying behaviour to nightly users who did not opt-in to those nightly features. Most nightly users want to be in control of the nightly breakage they get, by

* choosing when to update rustc
* choosing when to update dependencies
* choosing which nightly features they are willing to take the breakage for

The reason this breakage occurs is that the build script of some crates run `rustc --version`, and if the version looks like nightly or dev, it will enable nightly features. These nightly features may break in random ways whenever we change something in nightly, so every release of such a crate will only work with a small range of nightly releases. This causes bisection to fail whenever it tries an unsupported nightly, even though that crate is not related to the bisection at all, but is just an unrelated dependency.

This PR (and the policy I want to establish with this FCP) is only for situations like the `version_check`'s `supports_feature` function. It is explicitly not for `autocfg` or similar feature-detection-by-building-rust-code, irrespective of my opinions on it and the similarity of nightly breakage that can occur with such schemes. These cause much less breakage, but should the breakage become an issue, they should get covered by this policy, too.

This PR allows changing the version and release strings reported by `rustc --version` via the `RUSTC_OVERRIDE_VERSION_STRING` env var. The bisection issue is then fixed by https://github.com/rust-lang/cargo-bisect-rustc/pull/335.

I mainly want to establish a compiler team policy:

> We do not consider feature detection on nightly (on stable via compiler version numbering is fine) a valid use case that we need to support, and if it causes problems, we are at liberty to do what we deem best - either actively working to prevent it or to actively ignore it. We may try to work with responsive and cooperative authors, but are not obligated to.

Should they subvert the workarounds that nightly users or cargo-bisect-rustc can use, we should be able to land rustc PRs that target the specific crates that cause issues for us and outright replace their build script's logic to disable nightly detection.

I am not including links to crates, PRs or issues here, as I don't actually care about the specific use cases and don't want to make it trivial to go there and leave comments. This discussion is going to be interesting enough on its own, without branching out.
2024-07-30 15:25:31 +00:00
Oli Scherer
92f263b792 Make RUSTC_OVERRIDE_VERSION_STRING overwrite the rendered version output, too 2024-07-30 14:08:02 +00:00
Oli Scherer
cbab16feaf Test RUSTC_OVERRIDE_VERSION_STRING 2024-07-30 14:08:02 +00:00
bors
595316b400 Auto merge of #127955 - chenyukang:yukang-fix-mismatched-delimiter-issue-12786, r=nnethercote
Add limit for unclosed delimiters in lexer diagnostic

Fixes #127868

The first commit shows the original diagnostic, and the second commit shows the changes.
2024-07-30 13:02:16 +00:00
bors
1ddedbaa59 Auto merge of #125929 - Bryanskiy:delegation-generics-3, r=petrochenkov
Delegation: support generics for delegation from free functions

(The PR was split from https://github.com/rust-lang/rust/pull/123958, explainer - https://github.com/Bryanskiy/posts/blob/master/delegation%20in%20generic%20contexts.md)

This PR implements generics inheritance from free functions to free functions and trait methods.

#### free functions to free functions:

```rust
fn to_reuse<T: Clone>(_: T) {}

reuse to_reuse as bar;
// desugaring:
fn bar<T: Clone>(x: T) {
  to_reuse(x)
}
```

Generics, predicates and signature are simply copied. Generic arguments in paths are ignored during generics inheritance:

```rust
fn to_reuse<T: Clone>(_: T) {}

reuse to_reuse::<u8> as bar;
// desugaring:
fn bar<T: Clone>(x: T) {
  to_reuse::<u8>(x) // ERROR: mismatched types
}
```

Due to implementation limitations callee path is lowered without modifications. Therefore, it is a compilation error at the moment.

#### free functions to trait methods:

```rust
trait Trait<'a, A> {
    fn foo<'b, B>(&self, x: A, y: B) {...}
}

reuse Trait::foo;
// desugaring:
fn foo<'a, 'b, This: Trait<'a, A>, A, B>(this: &This, x: A, y: B) {
  Trait::foo(this, x, y)
}
```

The inheritance is similar to the previous case but with some corrections:

- `Self` parameter converted into `T: Trait`
- generic parameters need to be reordered so that lifetimes go first

Arguments are similarly ignored.

---

In the future, we plan to  support generic inheritance for delegating from all contexts to all contexts (from free/trait/impl to free/trait /impl). These cases were considered first as the simplest from the implementation perspective.
2024-07-30 10:39:33 +00:00
Folkert
58bfd98baf
make /// doc comments compatible with naked functions 2024-07-30 12:20:18 +02:00
Nikita Popov
b960390548 Crash test for issue 121444 has been fixed 2024-07-30 10:22:48 +02:00