Commit graph

2727 commits

Author SHA1 Message Date
bors
f6a07efc81 Auto merge of #151224 - matthiaskrgr:rollup-SLK4owB, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#151196 (Ship LLVM (`rust-dev`) in fast try builds again)
 - rust-lang/rust#151198 (Add an additional help note to the ambiguity lint error)
 - rust-lang/rust#151215 (Add missing closing brackets to THIR output.)
 - rust-lang/rust#151218 (compiletest: Add `AuxCrate` struct with docs.)

r? @ghost
2026-01-16 20:33:57 +00:00
Matthias Krüger
64f318e6f2
Rollup merge of #151198 - ambiguity_fix_help, r=petrochenkov
Add an additional help note to the ambiguity lint error

This PR adds an additional help note to the ambiguity lint error output to ask users updating their dependencies. This hopefully helps with cases like rust-lang/rust#149845 where newer crate versions are fixed.

r? @petrochenkov
2026-01-16 21:04:32 +01:00
bors
503745e917 Auto merge of #151210 - matthiaskrgr:rollup-JwDAUuv, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#145354 (Cache derive proc macro expansion with incremental query)
 - rust-lang/rust#151123 (Support primitives in type info reflection)
 - rust-lang/rust#151178 (simplify words initialization using Rc::new_zeroed)
 - rust-lang/rust#151187 (Use `default_field_values` more in `Resolver`)
 - rust-lang/rust#151197 (remove lcnr from compiler review rotation)
 - rust-lang/rust#151203 (Revert `QueryStackFrame` split)

r? @ghost
2026-01-16 16:44:08 +00:00
bors
b08c11df4b Auto merge of #151162 - GuillaumeGomez:cleanup-attr-parsing, r=JonathanBrouwer
Clean up `rustc_attr_parsing`

Follow-up of rust-lang/rust#150934.

It removes the `Option<>` wrapping for `SharedContext::target` field and completely removed the `target_id` field. Considering this type contains a closure and never updates its `target_id` field, there is no need to keep it around, it can be used directly in the lint emitter.

r? @JonathanBrouwer
2026-01-16 13:03:57 +00:00
Matthias Krüger
771fa1c0f1
Rollup merge of #151187 - const-resolver, r=petrochenkov
Use `default_field_values` more in `Resolver`

Extend more ways of building `FxHashSet`, `FxHashMap`, `UnordSet`, `UnordMap` and `DisambiguatorState` in `const` contexts to allow for more fields in `Resolver` to have a default value. `FxIndexSet`/`FxIndexMap` are still outstanding and not const-buildable.

r? @petrochenkov
2026-01-16 13:57:47 +01:00
Georg Semmler
d028956f11
Add an additional help note to the ambiguity lint error
This PR adds an additional help note to the ambiguity lint error output
to ask users updating their dependencies. This hopefully helps with
cases like https://github.com/rust-lang/rust/issues/149845 where newer crate versions are fixed.
2026-01-16 13:39:01 +01:00
Esteban Küber
2b139b786e prelude is already defaulted 2026-01-16 02:38:18 +00:00
Esteban Küber
664e19bc3a Make DisambiguatorState const-buildable 2026-01-16 02:38:18 +00:00
Esteban Küber
dd4d60f701 Provide default field in Resolver for NodeMap fields 2026-01-16 02:38:18 +00:00
Esteban Küber
2766ccfd4e Make UnordSet and UnordMap const Default and use it in Resolver 2026-01-16 02:38:18 +00:00
Esteban Küber
bfd1a9a86f Use default_field_values more in Resolver
Provide `const` functions to get around lack of `const Default` for `FxHash*` types.

Use default field values in `Resolver` more.
2026-01-16 02:38:17 +00:00
bors
b5c2a0fc0a Auto merge of #150982 - petrochenkov:modsplitfast2, r=JonathanBrouwer
resolve: In `visit_scopes` do not extract ctxt out of span unless necessary

This recovers the second half of perf regressions from https://github.com/rust-lang/rust/pull/149681 (the first part was recovered in https://github.com/rust-lang/rust/pull/150741).
2026-01-15 16:16:17 +00:00
Guillaume Gomez
820579243f Remove rustc_attr_parsing::SharedContext::target_id field 2026-01-15 15:39:00 +01:00
Vadim Petrochenkov
83c5f2c194 resolve: Relax one more assert in glob overwriting and add a test
Also avoid losing some glob ambiguities when re-fetching globs
2026-01-14 19:58:40 +03:00
Vadim Petrochenkov
81ef42d5b7 resolve: Consistently use old decls before new decls in interfaces
The opposite ordering was a consistent source of confusion during debuggingю
`report_conflict` actually used an incorrect order due to similar confusion.
2026-01-14 19:58:33 +03:00
Vadim Petrochenkov
8b52c73b3e resolve: Relax some asserts in glob overwriting and add tests 2026-01-14 19:57:21 +03:00
Vadim Petrochenkov
0361bd004a resolve: In visit_scopes do not extract ctxt out of span unless necessary 2026-01-14 19:26:07 +03:00
Jonathan Brouwer
18c62b5d44
Rollup merge of #151077 - issue-84327, r=fmease
Recognize potential `impl<const N: usize>` to `impl<N>` mistake

When encountering code like `impl<N> Bar<N> for [u8; N]`, suggest `impl<const N: Type> Bar<N> for [u8; N]` as a possibility.

```
error[E0423]: expected value, found type parameter `T`
  --> $DIR/issue-69654.rs:5:25
   |
LL | impl<T> Bar<T> for [u8; T] {}
   |      -                  ^ not a value
   |      |
   |      found this type parameter
   |
help: you might have meant to write a const parameter here
   |
LL | impl<const T: Type> Bar<T> for [u8; T] {}
   |      +++++  ++++++
```

Addresses "case 3" from rust-lang/rust#84327.
2026-01-14 11:05:41 +01:00
Esteban Küber
15d8e9ea66 Recognize potential impl<const N: usize> to impl<N> mistake
When encountering code like `impl<N> Bar<N> for [u8; N]`, suggest `impl<const N: Type> Bar<N> for [u8; N]` as a possibility.

```
error[E0423]: expected value, found type parameter `T`
  --> $DIR/issue-69654.rs:5:25
   |
LL | impl<T> Bar<T> for [u8; T] {}
   |      -                  ^ not a value
   |      |
   |      found this type parameter
   |
help: you might have meant to write a const parameter here
   |
LL | impl<const T: /* Type */> Bar<T> for [u8; T] {}
   |      +++++  ++++++++++++
```
2026-01-13 23:47:35 +00:00
Vadim Petrochenkov
c4820e6cb4 resolve: Refactor away the side table decl_parent_modules
Instead keep parent modules in `DeclData` itself
2026-01-13 20:59:26 +03:00
Lukas Bergdoll
506762f3ff Explicitly export core and std macros
Currently all core and std macros are automatically added to the prelude
via #[macro_use]. However a situation arose where we want to add a new macro
`assert_matches` but don't want to pull it into the standard prelude for
compatibility reasons. By explicitly exporting the macros found in the core and
std crates we get to decide on a per macro basis and can later add them via
the rust_20xx preludes.
2026-01-13 08:47:48 +01:00
bors
aefa10405d Auto merge of #151003 - matthiaskrgr:rollup-wvnF9sN, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#150861 (Folding/`ReErased` cleanups)
 - rust-lang/rust#150869 (Emit error instead of delayed bug when meeting mismatch type for const tuple)
 - rust-lang/rust#150920 (Use a hook to decouple `rustc_mir_transform` from `rustc_mir_build`)
 - rust-lang/rust#150941 (rustc_parse_format: improve diagnostics for unsupported python numeric grouping)
 - rust-lang/rust#150972 (Rename EII attributes slightly (being consistent in naming things foreign items, not extern items))
 - rust-lang/rust#150980 (Use updated indexes to build reverse map for delegation generics)
 - rust-lang/rust#150986 (std: Fix size returned by UEFI tcp4 read operations)
 - rust-lang/rust#150996 (Remove `S-waiting-on-bors` after a PR is merged)

r? @ghost
2026-01-12 16:43:20 +00:00
bors
137716908d Auto merge of #150786 - reddevilmidzy:mgca-array, r=BoxyUwU
mGCA: Support array expression as direct const arguments

tracking issue: rust-lang/rust#132980
resolve: rust-lang/rust#150612

Support array expression as direct const arguments (e. g. [1, 2, N]) in min_generic_const_args.

todo:
* [x] Rebase another mGCA PR
* [x] Add more test case
* [x] Modify clippy code
2026-01-12 13:26:21 +00:00
Jana Dönszelmann
322bbdfaaf
rename eii-extern-target 2026-01-12 08:07:23 +01:00
rust-bors[bot]
b68e16cfc0
Auto merge of #150741 - petrochenkov:modsplitfast, r=nnethercote
resolve: Use `Macros20NormalizedIdent` in more interfaces

It allows to avoid expensive double normalization in some cases.
This is an attempt to fix the perf regressions from https://github.com/rust-lang/rust/pull/149681.
2026-01-11 19:23:22 +00:00
rust-bors[bot]
1b9ae9eddc
Auto merge of #150502 - petrochenkov:overglob, r=yaahc
resolve: Factor out and document the glob binding overwriting logic

Also, avoid creating fresh name declarations and overwriting declarations in modules to update some fields in `DeclData`, when possible.
Instead, change the fields directly in `DeclData` using cells.

Unblocks https://github.com/rust-lang/rust/pull/149195.
2026-01-10 05:03:09 +00:00
reddevilmidzy
fc06a57a78 Introduce hir::ConstArgKind::Array 2026-01-10 12:41:50 +09:00
Jana Dönszelmann
5ddda0c37b
fix up diagnostics referring to the right items 2026-01-09 09:29:02 +01:00
Jana Dönszelmann
e3cff18370
dont resolve defaults anymore, store foreign item defid instead of macro 2026-01-09 09:29:02 +01:00
Folkert de Vries
3be74a7441
render intra-doc links in the #[deprectated] note 2026-01-08 11:35:33 +01:00
Vadim Petrochenkov
a251ae2615 resolve: Update NameBindingData::ambiguity in place
instead of creating fresh bindings, except in one case.
2026-01-08 10:51:11 +03:00
Vadim Petrochenkov
c2379717a2 resolve: Tweak overwriting with ambiguous globs
Do not overwrite unless necessary, and combine both globs instead of losing the first one.
2026-01-08 10:42:53 +03:00
Vadim Petrochenkov
227e7bd48b resolve: Update NameBindingData::vis in place
instead of overwriting bindings in modules.
2026-01-08 10:40:42 +03:00
Vadim Petrochenkov
32cf3a96d7 resolve: Update NameBindingData::warn_ambiguity in place
instead of creating fresh bindings.
2026-01-08 10:34:43 +03:00
Vadim Petrochenkov
e454835eef resolve: Factor out and document the glob binding overwriting logic 2026-01-08 10:26:57 +03:00
Vadim Petrochenkov
99a7d285d4 resolve: Avoid most allocations in resolve_ident_in_scope_set
Also evaluate one cheap and often-false condition first
2026-01-07 17:24:39 +03:00
Vadim Petrochenkov
888e28b41b resolve: Pass a normalized ident to resolve_ident_in_scope
In practice it was already normalized because `visit_scopes` normalized it
2026-01-07 17:06:18 +03:00
Vadim Petrochenkov
12007736ac resolve: Use Macros20NormalizedIdent in more interfaces
It allows to avoid expensive double normalization in some cases
2026-01-07 17:04:33 +03:00
Vadim Petrochenkov
87195e7a2a resolve: Do not query edition too eagerly in visit_scopes 2026-01-07 16:53:47 +03:00
mu001999
af76a2456d MGCA: Support tuple expressions as direct const arguments 2026-01-07 08:44:23 +08:00
Vadim Petrochenkov
db26d01211 resolve: DeclKind::Import::binding -> DeclKind::Import::source_decl 2026-01-06 18:21:37 +03:00
Vadim Petrochenkov
a0ea3b0635 Update more function names and fields from bindings to declarations 2026-01-06 18:21:37 +03:00
Vadim Petrochenkov
a67e289b4d Update some function names and fields from bindings to declarations 2026-01-06 18:21:37 +03:00
Vadim Petrochenkov
844e085de6 resolve: MacroRulesScope::Binding -> MacroRulesScope::Def
`MacroRulesBinding` -> `MacroRulesDef`
2026-01-06 18:21:37 +03:00
Vadim Petrochenkov
7a34af2f67 resolve: Rename LexicalScopeBinding::(Item,Res) to LateDecl::(Decl,RibDef) 2026-01-06 18:21:37 +03:00
Vadim Petrochenkov
460f22c388 resolve: Rename NameBinding(Data,Kind) to Decl(Data,Kind)
Also, rename `DeclKind::Res` to `DeclKind::Def`.
2026-01-06 18:21:37 +03:00
bors
6885bdf1af Auto merge of #150603 - Kivooeo:tuple-struct, r=BoxyUwU
MGCA: Support for tuple constructors

r? BoxyUwU

part of https://github.com/rust-lang/rust/issues/132980

fixes rust-lang/rust#136379
fixes rust-lang/rust#138132

i tried to keep implementation very minimal and it's very similar to how structs was implemented with small adjustments

this does not make const constructor like None works, just something like Some(n)

todo:
* ~~tests~~
* write a better description (not sure if needed)
* add more comments and FIXMEs from structs code
2026-01-05 01:45:18 +00:00
Matthias Krüger
df246c107a
Rollup merge of #149681 - petrochenkov:openapi1, r=davidtwco
resolve: Split `Scope::Module` into two scopes for non-glob and glob bindings

This is a re-implementation of https://github.com/rust-lang/rust/pull/144131 with all the issues mentioned there fixed.

As it turned out, the non-trivial part of the split was already done in https://github.com/rust-lang/rust/pull/149454/commits/c91b6ca58d4d870d3099db1defbd8c1f26a7d851, so the remaining part implemented in this PR is *mostly* mechanical.

After addressing the issue of already found bindings being lost due to indeterminacies in outer scopes (7e890bfa87) and adding one missing `Stage::Late` in `Finalize` the scope splitting refactoring just worked.
(One more ICE was revealed by the refactoring, but not caused by it, fixed up in the last commit.)

This is a part of implementation for the [Open API](https://rust-lang.github.io/rust-project-goals/2025h1/open-namespaces.html) proposal.
2026-01-04 21:14:04 +01:00
Kivooeo
05afcb6d26 init impl 2026-01-04 15:12:39 +00:00
Stuart Cook
05dce482d3
Rollup merge of #150650 - enthropy7:main, r=BoxyUwU
Forbid generic parameters in types of #[type_const] items

fixes rust-lang/rust#150614

we enforce the same restriction on `#[type_const]` const items that already exists for const generic parameters - when `generic_const_parameter_types` feature gate is not enabled, the type of a `#[type_const]` item cannot reference generic parameters.  implementation follows the same pattern used for const generic parameters. we check if the item has the `#[type_const]` attribute and if the feature gate is disabled, then we apply `RibKind::ConstParamTy` restrictions when visiting the type, which prevents the use of generic parameters.

check is added in three places:
- Free const items (`ItemKind::Const`)
- Trait associated consts (`AssocItemKind::Const` in traits)
- Impl associated consts (`AssocItemKind::Const` in impls)

added tests for new feature, hope i get this task right :>

r? `@BoxyUwU`
2026-01-04 21:37:04 +11:00