Commit Graph

262439 Commits

Author SHA1 Message Date
Michael Goulet
79ef91e879
tweak comment on NonterminalKind::Expr
Co-authored-by: Eric Holk <eric@theincredibleholk.org>
2024-07-31 15:37:55 -04:00
Juniper Tyree
83fb140ec1
Fix docs for OnceLock::get_mut_or_init 2024-07-31 22:00:38 +03: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
bors
e12408bf11 Auto merge of #17755 - ShoyuVanilla:issue-17738, r=davidbarsky
fix: Apply `IndexMut` obligations for non-assigning mutable index usages

Fixes #17738

Currently, we are pushing `IndexMut` obligations only for assign usages;
f982f3fa2c/crates/hir-ty/src/infer/expr.rs (L809-L817)
2024-07-31 18:06:53 +00:00
Ding Xiang Fei
14a0963f96
reject pointee without ?Sized 2024-08-01 02:00:05 +08:00
Shoyu Vanilla
086065e56b Prevent redundant obigation push for assignee exprs 2024-08-01 02:51:33 +09:00
Daniel Paoliello
03357f12f8 Create COFF archives for non-LLVM backends 2024-07-31 10:40:36 -07:00
Urgau
840ca3cbef Temporarily switch ambiguous_negative_literals lint to allow 2024-07-31 19:36:47 +02:00
Shoyu Vanilla
8b14b743f9 fix: Apply IndexMut obligations for non-assigning mutable index usages, too 2024-08-01 02:20:52 +09:00
Michael Goulet
74754b8786 Properly mark loop as diverging if it has no breaks 2024-07-31 12:24:26 -04:00
joboet
1d49aad844
std: fix busy-waiting in Once::wait_force, add more tests 2024-07-31 17:44:10 +02:00
joboet
cf11f499b3
std: implement the once_wait feature 2024-07-31 17:42:20 +02: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
onur-ozkan
f6c4110b9d improve bootstrap to allow selecting llvm tools individually
Everything works as before, + now bootstrap allows for individually selecting LLVM
tools (e.g., `x dist opt llvm-dis`) to include in the dist artifact.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-31 17:45:17 +03:00
Oneirical
ea04b0afbf use llvm-nm in symbol-visibility rmake test 2024-07-31 10:39:16 -04:00
bors
bba84aa836 Auto merge of #17750 - davidbarsky:david/remove-abspath-requirement-in-linked-projects, r=Veykril
fix: remove AbsPath requirement from linkedProjects

Should (fingers crossed!) fix https://github.com/rust-lang/rust-analyzer/issues/17664. I opened the `rustc` workspace with the [suggested configuration](e552c168c7/src/etc/rust_analyzer_settings.json) and I was able to successfully open some rustc crates (`rustc_incremental`) and have IDE functionality.

`@Veykril:` can you try these changes and let me know if it fixed rustc?
2024-07-31 14:31:16 +00:00
David Barsky
e8a90513de fix: remove AbsPath requirement from linkedProjects 2024-07-31 10:07:48 -04:00
B I Mohammed Abbas
62d4998753 Add VxWorks platfrom support documents 2024-07-31 19:28:18 +05:30
Chris Denton
e84a7d91b7
Remove unneeded pub(crate) 2024-07-31 13:45:14 +00:00
Matthias Krüger
031093f24b
Rollup merge of #128430 - Zalathar:print-pat, r=Nadrieril
Use a separate pattern type for `rustc_pattern_analysis` diagnostics

The pattern-analysis code needs to print patterns, as part of its user-visible diagnostics. But it never actually tries to print "real" patterns! Instead, it only ever prints synthetic patterns that it has reconstructed from its own internal represenations.

We can therefore simultaneously remove two obstacles to changing `thir::Pat`, by having the pattern-analysis code use its own dedicated type for building printable patterns, and then making `thir::Pat` not printable at all.

r? `@Nadrieril`
2024-07-31 15:36:33 +02: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
e2d8f1ac21
Rollup merge of #128402 - oli-obk:checked_attrs, r=compiler-errors
Attribute checking simplifications

remove an unused boolean and then merge two big matches into one

I was reviewing some attributes and realized we don't really check this list against the list of builtin attributes, so we "may" totally be missing some attributes that we should be checking (like the `coroutine` attribute, which you can just apply to random stuff)

```rust
#![feature(coroutines)]
#[coroutine]
struct Foo;
```

just compiles for example. Unless we check that the fallthrough match arm is never reached for builtin attributes, we're just going to keep forgetting to add them here, too. I can do that without the changes in this PR, but it seemed like a nice cleanup
2024-07-31 15:36:32 +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
22dbf88744
Rollup merge of #128387 - liigo:patch-14, r=tgross35
More detailed note to deprecate ONCE_INIT
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
75dfe1e63d
Rollup merge of #127830 - tgross35:archive-failure-message, r=BoxyUwU
When an archive fails to build, print the path

Currently the output on failure is as follows:

       Compiling block-buffer v0.10.4
       Compiling crypto-common v0.1.6
       Compiling digest v0.10.7
       Compiling sha2 v0.10.8
       Compiling xz2 v0.1.7
    error: failed to build archive: No such file or directory

    error: could not compile `bootstrap` (lib) due to 1 previous error

Change this to print which file is being constructed, to give some hint about what is going on.

    error: failed to build archive at `path/to/output`: No such file or directory
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
Matthias Krüger
579eb684b9
Rollup merge of #126454 - cuviper:deterministic-bump, r=Kobzol
bump-stage0: use IndexMap for determinism

When it used `HashMap`, `bump-stage0` would change `src/stage0` every
time it ran, whereas `IndexMap` will keep insertion order -- matching
the manifest file.

I included an actual bump here mainly to reset the order, but that did
update to a new rustfmt nightly too.
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
Martin Kröning
127b469b7e
refactor(pal/hermit): use default impl of GlobalAlloc::alloc_zeroed
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2024-07-31 13:31:41 +02:00
Martin Kröning
76b4a86b57
refactor(pal/hermit): return ! to satisfy rust-analyzer
This silences this rust-analyzer-specific error: `expected !, found ()`

Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2024-07-31 13:31:41 +02:00
bors
e552c168c7 Auto merge of #128420 - weihanglo:update-cargo, r=weihanglo
Update cargo

5 commits in b5d44db1daf0469b227a6211b987162a39a54730..257b72b8adfb1f2aa9916cefca67285c21666276
2024-07-26 21:27:12 +0000 to 2024-07-30 15:08:27 +0000
- chore: Update toml (rust-lang/cargo#14324)
- dont call wrap in a no-op source_id::with* (rust-lang/cargo#14318)
- Partial revert of 3085b548ecbd7d29d40c6180609ea3c224bad857 (rust-lang/cargo#14319)
- chore(deps): update msrv (rust-lang/cargo#14303)
- Fix warnings building tests on Windows (rust-lang/cargo#14315)

r? ghost
2024-07-31 10:14:22 +00:00
bors
9fb03f0f21 Auto merge of #17747 - ShoyuVanilla:issue-17734, r=Veykril
fix: Errors on method call inferences with elided lifetimes

Fixes #17734

Currently, we are matching non-lifetime(type or const) generic arg to liftime argument position while building substs for method calling when there are elided lifetimes.
This mismatch just make a subst for error lifetime and while this alone is not much a trouble, it also makes the mismatched type or const generic arg cannot be used in its proper place and this makes type inference failure
2024-07-31 07:09:57 +00:00
Zalathar
dd5a8d7714 Use a separate pattern type for rustc_pattern_analysis diagnostics
The pattern-analysis code needs to print patterns, as part of its user-visible
diagnostics. But it never actually tries to print "real" patterns! Instead, it
only ever prints synthetic patterns that it has reconstructed from its own
internal represenations.

We can therefore simultaneously remove two obstacles to changing `thir::Pat`,
by having the pattern-analysis code use its own dedicated type for building
printable patterns, and then making `thir::Pat` not printable at all.
2024-07-31 16:03:27 +10:00
Zalathar
a9ea85e044 Revert "Make thir::Pat not implement fmt::Display directly"
This reverts commit ae0ec731a8.

The original change in #128304 was intended to be a step towards being able to
print `thir::Pat` even after switching to `PatId`.

But because the only patterns that need to be printed are the synthetic ones
created by pattern analysis (for diagnostic purposes only), it makes more sense
to completely separate the printable patterns from the real THIR patterns.
2024-07-31 16:00:52 +10:00
Zalathar
a2b3256374 Print thir::PatRange, not its surrounding thir::Pat
This further reduces the amount of code that relies on `thir::Pat` being
printable.
2024-07-31 16:00:52 +10:00
Michael Goulet
f6f587e7ea Introduce REDUNDANT_IMPORTS lint 2024-07-31 00:07:42 -04:00
Shoyu Vanilla
1b058b796d
Add a test case 2024-07-31 10:47:13 +09:00
Weihang Lo
d629d5f7b8
Update cargo 2024-07-30 21:26:49 -04:00
Josh Stone
33a36ea438 Bless coverage/mcdc for line number changes 2024-07-30 18:25:05 -07:00
Matthew Maurer
7d7ad7b874 android: Remove libstd hacks for unsupported Android APIs
Our minimum supported API version is 21, remove hacks to support older
Android APIs.
2024-07-31 01:03:36 +00:00
Camille GILLOT
4067795d8c Do not intern if we have provenance. 2024-07-31 00:59:13 +00:00
Camille GILLOT
98c1ea8e82 Simplify constant creation. 2024-07-31 00:59:13 +00:00
Camille GILLOT
61ef0441b8 Encode constant determinism in disambiguator. 2024-07-31 00:59:12 +00:00
Camille GILLOT
9d23c86176 Reduce allocations in GVN. 2024-07-31 00:59:12 +00:00
Camille GILLOT
70ee6e4b23 Amortize growing rev_locals. 2024-07-31 00:59:12 +00:00
Camille GILLOT
95986dd279 Indirect places can only appear as first projection in runtime MIR. 2024-07-31 00:59:12 +00:00