35069 Commits

Author SHA1 Message Date
Laurențiu Nicola
10ebd0e3c9 Try to downgrade object 2025-06-17 19:00:01 +03:00
Laurențiu Nicola
5d93e31067
Merge pull request #20025 from SoxPopuli/hide_private_imports_without_pe
Hide imported privates if private editable is disabled
2025-06-17 15:27:27 +00:00
bors
50a90e2920 Auto merge of #137944 - davidtwco:sized-hierarchy, r=oli-obk
Sized Hierarchy: Part I

This patch implements the non-const parts of rust-lang/rfcs#3729. It introduces two new traits to the standard library, `MetaSized` and `PointeeSized`. See the RFC for the rationale behind these traits and to discuss whether this change makes sense in the abstract.

These traits are unstable (as is their constness), so users cannot refer to them without opting-in to `feature(sized_hierarchy)`. These traits are not behind `cfg`s as this would make implementation unfeasible, there would simply be too many `cfg`s required to add the necessary bounds everywhere. So, like `Sized`, these traits are automatically implemented by the compiler.

RFC 3729 describes changes which are necessary to preserve backwards compatibility given the introduction of these traits, which are implemented and as follows:

- `?Sized` is rewritten as `MetaSized`
- `MetaSized` is added as a default supertrait for all traits w/out an explicit sizedness supertrait already.

There are no edition migrations implemented in this,  as these are primarily required for the constness parts of the RFC and prior to stabilisation of this (and so will come in follow-up PRs alongside the const parts). All diagnostic output should remain the same (showing `?Sized` even if the compiler sees `MetaSized`) unless the `sized_hierarchy` feature is enabled.

Due to the use of unstable extern types in the standard library and rustc, some bounds in both projects have had to be relaxed already - this is unfortunate but unavoidable so that these extern types can continue to be used where they were before. Performing these relaxations in the standard library and rustc are desirable longer-term anyway, but some bounds are not as relaxed as they ideally would be due to the inability to relax `Deref::Target` (this will be investigated separately).

It is hoped that this is implemented such that it could be merged and these traits could exist "under the hood" without that being observable to the user (other than in any performance impact this has on the compiler, etc). Some details might leak through due to the standard library relaxations, but this has not been observed in test output.

**Notes:**

- Any commits starting with "upstream:" can be ignored, as these correspond to other upstream PRs that this is based on which have yet to be merged.
- This best reviewed commit-by-commit. I've attempted to make the implementation easy to follow and keep similar changes and test output updates together.
  - Each commit has a short description describing its purpose.
  - This patch is large but it's primarily in the test suite.
- I've worked on the performance of this patch and a few optimisations are implemented so that the performance impact is neutral-to-minor.
- `PointeeSized` is a different name from the RFC just to make it more obvious that it is different from `std::ptr::Pointee` but all the names are yet to be bikeshed anyway.
- `@nikomatsakis` has confirmed [that this can proceed as an experiment from the t-lang side](https://rust-lang.zulipchat.com/#narrow/channel/435869-project-goals/topic/SVE.20and.20SME.20on.20AArch64.20.28goals.23270.29/near/506196491)
- FCP in https://github.com/rust-lang/rust/pull/137944#issuecomment-2912207485

Fixes rust-lang/rust#79409.

r? `@ghost` (I'll discuss this with relevant teams to find a reviewer)
2025-06-17 15:08:50 +00:00
Charlotte Smith
e6a4602209 Hide imported privates if private editable is disabled 2025-06-17 15:38:15 +01:00
Lukas Wirth
3bf8a77d13
Merge pull request #20023 from Veykril/push-vkqlnyttnqzl
Improve completions in if / while expression conditions
2025-06-17 12:01:43 +00:00
Lukas Wirth
7447db83ed Better completion test sorting 2025-06-17 13:50:58 +02:00
Lukas Wirth
4331688e3d Improve completions in if / while expression conditions 2025-06-17 13:50:58 +02:00
Lukas Wirth
630628f3c8
Merge pull request #20022 from ChayimFriedman2/type-mismatch-exp
fix: Never make type mismatch diagnostic stable, even when there is a fix
2025-06-17 09:59:50 +00:00
Chayim Refael Friedman
b46593ece2 Never make type mismatch diagnostic stable, even when there is a fix
We show fixes now even for experimental diagnostics anyway, and it has false positives.
2025-06-17 12:48:19 +03:00
Lukas Wirth
2b0c726e1b
Merge pull request #20020 from Veykril/push-yuqmorzsqumw
fix: Reload workspaces when cargo configs change
2025-06-17 09:24:13 +00:00
Lukas Wirth
24b0666d93 fix: Reload workspaces when cargo configs change 2025-06-17 11:13:56 +02:00
Lukas Wirth
c6b74f7e6f
Merge pull request #19495 from Veykril/push-woywmrxrtqqy
chore: Start infesting ide crates with 'db lifetime
2025-06-17 08:53:11 +00:00
Lukas Wirth
03f1003637 chore: Start infesting ide crates with 'db lifetime 2025-06-17 10:42:38 +02:00
Lukas Wirth
a31e10a2fd
Merge pull request #20018 from Veykril/push-pkowrtoturkr
fix: Copy lockfiles into target directory before invoking `cargo metadata`
2025-06-17 08:20:20 +00:00
Lukas Wirth
8661c59a7f
Merge pull request #19939 from ChayimFriedman2/fill-arms-self
feat: In "Fill match arms", allow users to prefer `Self` to the enum name when possible
2025-06-17 08:20:02 +00:00
Lukas Wirth
eb25f5e85b
Merge pull request #19945 from ChayimFriedman2/private-field-quickfix
feat: Add the quickfix for increasing visibility of a private field to the private-field diagnostic (previously it was only on no-such-field)
2025-06-17 08:19:09 +00:00
Lukas Wirth
c0f428d55b fix: Copy lockfiles into target directory before invoking cargo metadata 2025-06-17 10:09:04 +02:00
bors
dae444f3ce Auto merge of #142447 - dianqk:llvm-20.1.7, r=nikic
Update to LLVM 20.1.7

Closes rust-lang/rust#141306, closes rust-lang/rust#140686, closes rust-lang/rust#141737, closes rust-lang/rust#140933.
2025-06-16 22:33:38 +00:00
Lukas Wirth
2c25e436c7
Merge pull request #20015 from Veykril/push-wsxzsuurqwwr
feat: Insert required parentheses when typing `+` in dyn trait type
2025-06-16 17:13:16 +00:00
Lukas Wirth
b1824c3962 feat: Insert required parentheses when typing + in trait type 2025-06-16 19:02:18 +02:00
Lukas Wirth
a67e2ba115
Merge pull request #20014 from Veykril/push-lsqvxunvnrqw
feat: Show what cargo metadata is doing in status
2025-06-16 16:17:48 +00:00
Lukas Wirth
9dfbd56bb8 feat: Show what cargo metadata is doing in status 2025-06-16 18:05:44 +02:00
bors
bacb2554d8 Auto merge of #142574 - Kobzol:rollup-ldj386u, r=Kobzol
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#141639 (Expose discriminant values in stable_mir)
 - rust-lang/rust#142082 (Refactor `rustc_attr_data_structures` documentation)
 - rust-lang/rust#142125 (Stabilize "file_lock" feature)
 - rust-lang/rust#142236 (Add documentation for `PathBuf`'s `FromIterator` and `Extend` impls)
 - rust-lang/rust#142373 (Fix Debug for Location)
 - rust-lang/rust#142416 (Assorted bootstrap cleanups (step 2))
 - rust-lang/rust#142431 (Add initial version of snapshot tests to bootstrap)
 - rust-lang/rust#142450 (Add documentation on top of `rustc_middle/src/query/mod.rs`)
 - rust-lang/rust#142528 (clarify `rustc_do_not_const_check` comment)
 - rust-lang/rust#142530 (use `if let` guards where possible)
 - rust-lang/rust#142561 (Remove an `njn:` comment accidentaly left behind.)
 - rust-lang/rust#142566 (Fix `-nopt` CI jobs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-16 14:25:08 +00:00
Jakub Beránek
975e1172f3
Rollup merge of #142566 - Kobzol:ci-nopt-fix, r=jieyouxu
Fix `-nopt` CI jobs

They were using `--config` instead of `--set`, which overrides too much stuff after recent changes to config merging.

Should hopefully unblock https://github.com/rust-lang/rust/pull/142447.

r? `@jieyouxu`
2025-06-16 14:31:15 +02:00
Jakub Beránek
8991dc44f9
Rollup merge of #142561 - nnethercote:fix-njn-comment, r=chenyukang
Remove an `njn:` comment accidentaly left behind.

r? `@chenyukang`
2025-06-16 14:31:14 +02:00
Jakub Beránek
f4f130937e
Rollup merge of #142530 - fee1-dead-contrib:push-klusvwusyqvq, r=compiler-errors
use `if let` guards where possible

these crates already enable the feature
2025-06-16 14:31:14 +02:00
Jakub Beránek
cc6711b9f1
Rollup merge of #142528 - fee1-dead-contrib:push-rlxklunqkwmv, r=RalfJung
clarify `rustc_do_not_const_check` comment

~~Given that we have used this attribute for other reasons before it seems appropriate to make this a "usually".~~

Add function name as a pointer

cc ```@rust-lang/wg-const-eval```
2025-06-16 14:31:13 +02:00
Laurențiu Nicola
e2c3647c6a
Merge pull request #19994 from sourcefrog/book-links
Fix some links in the book
2025-06-16 07:02:59 +00:00
Chayim Refael Friedman
a207299344
Merge pull request #20000 from tadeokondrak/lifetime-repeat-macro
Allow lifetime repeats in macros: $($x)'a*
2025-06-16
2025-06-15 16:34:42 +00:00
Tadeo Kondrak
2070e9a8f3 Use is_any_identifier in pretty_print_macro_expansion 2025-06-15 18:23:18 +02:00
Tadeo Kondrak
12226b704a Fix spacing for LIFETIME_IDENT near keywords and literals in test output 2025-06-15 17:43:45 +02:00
Deadbeef
4ca88ff6a9 clarify rustc_do_not_const_check comment 2025-06-15 20:40:08 +08:00
Lukas Wirth
3d9daeec36
Merge pull request #20009 from Veykril/push-rvnnorzvpnqv
Optimize `pub(crate)` and `pub(self)` visibility resolution
2025-06-15 08:36:27 +00:00
Lukas Wirth
b3768cdc0e Optimize private visibility resolution 2025-06-15 10:25:45 +02:00
Lukas Wirth
e129cdc202 Optimize pub(crate) visibility resolution 2025-06-15 10:25:45 +02:00
Lukas Wirth
d822f6a0ed
Merge pull request #20008 from Veykril/push-rsnkrwyplmwr
More idiomatic salsa use
2025-06-15 08:12:11 +00:00
Lukas Wirth
4b38ea5abd Unify assoc item visibility queries 2025-06-15 10:01:34 +02:00
Lukas Wirth
bceeb6a3c7 Idiomatic salsa use for extern block abi query 2025-06-15 10:01:04 +02:00
Lukas Wirth
4e392f82cb Idiomatic salsa use for impl items query 2025-06-15 09:40:02 +02:00
Lukas Wirth
155ef3de60 Replace unnecessary use of MacroDefId with MacroId 2025-06-15 09:16:45 +02:00
Lukas Wirth
08f795335b
Merge pull request #20007 from Veykril/push-opqzsnwzwyvn
Idiomatic salsa use for enum variants query
2025-06-15 07:15:22 +00:00
Lukas Wirth
aa2d234426 Idiomatic salsa use for enum variants query 2025-06-15 09:03:44 +02:00
Lukas Wirth
188b0667ce
Merge pull request #20006 from Veykril/push-uvmuznvlwsxx
Cleanup incremental tests and verify query executions
2025-06-15 06:25:54 +00:00
Lukas Wirth
f68512af65 Cleanup incremental tests 2025-06-15 08:07:49 +02:00
bors
6da11e1510 Auto merge of #142388 - cjgillot:span-hash, r=davidtwco
Do not clone Arc when hashing span.

Tiny improvement I was when trying to profile span hashing.
2025-06-15 05:27:08 +00:00
Chayim Refael Friedman
4d30c53ceb
Merge pull request #19996 from LHolten/exclude-imports
Add support for excluding imports from symbol search
2025-06-15 00:52:44 +00:00
Lucas Holten
dc85e3ee35 Add config option to exclude imports from symbol search 2025-06-15 02:41:35 +02:00
bors
4854294847 Auto merge of #142335 - nnethercote:rustdoc-json-allocations, r=aDotInTheVoid
rustdoc_json: reduce allocations

These commits reduce the number of allocations done for rustdoc_json, mostly by avoiding unnecessary clones.

Best reviewed one commit at a time.

r? `@aDotInTheVoid`
2025-06-14 23:21:16 +00:00
bors
20dce9d9b8 Auto merge of #142259 - sayantn:simplify-intrinsics, r=workingjubilee
Simplify implementation of Rust intrinsics by using type parameters in the cache

The current implementation of intrinsics have a lot of duplication to handle different overloads of overloaded LLVM intrinsic. This PR uses the **base name and the type parameters** in the cache instead of the full, overloaded name. This has the benefit that `call_intrinsic` doesn't need to provide the full name, rather the type parameters (which is most of the time more available). This uses `LLVMIntrinsicCopyOverloadedName2` to get the overloaded name from the base name and the type parameters, and only uses it to declare the function.

(originally was part of rust-lang/rust#140763, split off later)

`@rustbot` label A-codegen A-LLVM
r? codegen
2025-06-14 16:43:34 +00:00
bors
bc762e2666 Auto merge of #142129 - shepmaster:mismatched-syntaxes-in-function-like-places, r=jieyouxu
Apply `mismatched-lifetime-syntaxes` to trait and extern functions

r? `@jieyouxu`
2025-06-14 12:37:35 +00:00