Skip to content

rustc_resolve: improve const generic errors#152913

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Unique-Usman:ua/constnottype
Mar 20, 2026
Merged

rustc_resolve: improve const generic errors#152913
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Unique-Usman:ua/constnottype

Conversation

@Unique-Usman
Copy link
Contributor

@Unique-Usman Unique-Usman commented Feb 20, 2026

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 20, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 20, 2026

r? @JonathanBrouwer

rustbot has assigned @JonathanBrouwer.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 68 candidates
  • Random selection from 14 candidates

@Unique-Usman
Copy link
Contributor Author

r? @estebank

@rustbot rustbot assigned estebank and unassigned JonathanBrouwer Feb 20, 2026
@Unique-Usman Unique-Usman marked this pull request as draft February 20, 2026 14:49
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 20, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 28, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

.struct_constructors
.insert(local_def_id, (ctor_res, ctor_vis.to_def_id(), ret_fields));
}
self.r.struct_generics.insert(local_def_id, generics.clone());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's see if we can struct_generics store references. That should keep mem usage to a minimum.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted.

Comment on lines +4472 to +4475
if let Some(const_err) = const_err {
err.cancel();
err = const_err;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently inactive, right? const_err isn't None anywhere right now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const_err is actually always None except in the case of where we add the error we just introduce see it here -> https://github.com/rust-lang/rust/pull/152913/changes#diff-2c81e6d8048a31a3ce43f30181aaa037e0ad0076e7aee67792ca993f28c75ac3R3440-R3441

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is to prevent the type error from showing up.

@Unique-Usman Unique-Usman requested a review from estebank March 6, 2026 17:35
@Unique-Usman Unique-Usman marked this pull request as ready for review March 6, 2026 17:35
@rustbot
Copy link
Collaborator

rustbot commented Mar 6, 2026

HIR ty lowering was modified

cc @fmease

@rust-log-analyzer

This comment has been minimized.

@Unique-Usman
Copy link
Contributor Author

@estebank

@rust-log-analyzer

This comment has been minimized.

@@ -4,18 +4,19 @@ error[E0575]: expected associated type, found associated constant `Trait::ASSOC`
LL | bar::<<T as Trait>::ASSOC>();
| ^^^^^^^^^^^^^^^^^^^ not a associated type

error[E0747]: unresolved item provided when a constant was expected
--> $DIR/assoc_const_as_type_argument.rs:8:11
error[E0284]: type annotations needed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is unfortunate that after silencing E0747 we end up with these inference errors instead...

I think we can split the work into two PRs: one silencing the unnecessary/redundant resolve error ("unresolved item when X was expected") and another for the appropriate const generic suggestions. That would make things easier to review and evolve on isolation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, thanks. we can resolve the E0747 error after getting this pr merged. I already update the patch to not silence the E0747 for now.

@estebank
Copy link
Contributor

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 16, 2026

📌 Commit 54aebeb has been approved by estebank

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 16, 2026
@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 16, 2026
rustc_resolve: improve const generic errors
@rust-log-analyzer

This comment has been minimized.

@rust-bors rust-bors bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 17, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 17, 2026

💔 Test for f80d097 failed: CI. Failed job:

Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
@rust-bors rust-bors bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 19, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 19, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@estebank
Copy link
Contributor

@bors r+

The error seems to be spurious/not related to this PR. It was rebased on top of a more recent main.

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 19, 2026

📌 Commit f60b649 has been approved by estebank

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 19, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 20, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 20, 2026

☀️ Test successful - CI
Approved by: estebank
Duration: 3h 8m 58s
Pushing 76be1cc to main...

@rust-bors rust-bors bot merged commit 76be1cc into rust-lang:main Mar 20, 2026
12 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 20, 2026
@github-actions
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing bcf3d36 (parent) -> 76be1cc (this PR)

Test differences

Show 3 test diffs

3 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 76be1cc4eef94daeab731ed9395a317b34d89d63 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-apple-various: 1h 20m -> 1h 46m (+33.0%)
  2. pr-check-1: 26m 6s -> 32m 29s (+24.5%)
  3. test-various: 1h 42m -> 2h 5m (+22.5%)
  4. dist-aarch64-msvc: 1h 33m -> 1h 53m (+22.0%)
  5. x86_64-gnu-llvm-22-2: 1h 23m -> 1h 39m (+18.9%)
  6. armhf-gnu: 1h 18m -> 1h 31m (+16.6%)
  7. aarch64-msvc-2: 1h 44m -> 2h (+15.3%)
  8. aarch64-apple: 2h 15m -> 2h 33m (+13.5%)
  9. x86_64-rust-for-linux: 45m 58s -> 51m 37s (+12.3%)
  10. x86_64-gnu-tools: 55m 12s -> 1h 1m (+12.0%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (76be1cc): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [0.1%, 0.1%] 1

Max RSS (memory usage)

Results (secondary -0.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.2% [1.2%, 1.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.8% [-1.8%, -1.8%] 1
All ❌✅ (primary) - - 0

Cycles

Results (secondary -2.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.7% [-3.0%, -2.4%] 2
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 483.892s -> 481.595s (-0.47%)
Artifact size: 394.73 MiB -> 396.86 MiB (0.54%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants