Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mark ty::Const::Error when meet unsupport ty for const generic params #117176

Merged
merged 1 commit into from
Dec 24, 2023

Conversation

bvanjoi
Copy link
Contributor

@bvanjoi bvanjoi commented Oct 25, 2023

Close #116796

@rustbot
Copy link
Collaborator

rustbot commented Oct 25, 2023

r? @wesleywiser

(rustbot has picked a reviewer for you, use r? to override)

@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 Oct 25, 2023
@compiler-errors
Copy link
Member

Why can't we just delay a bug? Or is there a way we could do the ConstParamTy trait check earlier?

@bvanjoi
Copy link
Contributor Author

bvanjoi commented Oct 26, 2023

Or is there a way we could do the ConstParamTy trait check earlier?

The function type_allowed_to_implement_const_param_ty is executed within check_param_wf which follows check_item , wherein the internals of check_item trigger a panic.

Can we reorder it and halt the process as follows? I'm concerned that it may not be feasible because it could lead to unsoundness

let mut res = None;
if let Some(generics) = node.generics() {
    for param in generics.params {
        res = res.and(check_param_wf(tcx, param));
    }
}
if res.is_error() {
    return res
}
return res.and(check_item(xxxx));

Why can't we just delay a bug?

How might we postpone this? The exact value is retrieved using the c.expect, but there doesn't appear to be an error fallback for ValTree.

@bors
Copy link
Contributor

bors commented Nov 8, 2023

☔ The latest upstream changes (presumably #116930) made this pull request unmergeable. Please resolve the merge conflicts.

@wesleywiser
Copy link
Member

r? @jackh726

@rustbot rustbot assigned jackh726 and unassigned wesleywiser Dec 21, 2023
@jackh726
Copy link
Member

I'll take this review, but it'll be this weekend

r? @jackh726

@jackh726
Copy link
Member

Okay, this errors cleanly since beta 1.76. So, I'll mark the issue as needs-test. @bvanjoi sorry for the review delay here - would you like to just update the PR to add the test as a regression test?

@jackh726 jackh726 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 Dec 23, 2023
@bvanjoi
Copy link
Contributor Author

bvanjoi commented Dec 23, 2023

Pleased to see the issue being jointly addressed. And I will add a test case.

@jackh726
Copy link
Member

Can you put the test under const-generics? And rename to something descriptive, referencing the issue in a comment?

@jackh726
Copy link
Member

Thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 24, 2023

📌 Commit 0f814e3 has been approved by jackh726

It is now in the queue for this repository.

@bors bors 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 Dec 24, 2023
@bors
Copy link
Contributor

bors commented Dec 24, 2023

⌛ Testing commit 0f814e3 with merge 08cc634...

@bors
Copy link
Contributor

bors commented Dec 24, 2023

☀️ Test successful - checks-actions
Approved by: jackh726
Pushing 08cc634 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 24, 2023
@bors bors merged commit 08cc634 into rust-lang:master Dec 24, 2023
12 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Dec 24, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (08cc634): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.7% [0.6%, 0.7%] 4
Regressions ❌
(secondary)
0.4% [0.2%, 0.6%] 19
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [0.6%, 0.7%] 4

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.6% [-5.0%, -2.1%] 2
All ❌✅ (primary) - - 0

Cycles

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

Binary size

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

Bootstrap: 670.535s -> 669.722s (-0.12%)
Artifact size: 312.63 MiB -> 312.65 MiB (0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Dec 24, 2023
@jackh726
Copy link
Member

This is only a test, so must be noise.

@jackh726 jackh726 added the perf-regression-triaged The performance regression has been triaged. label Dec 24, 2023
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. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

ice: 'ty::Const::eval' called on a non-valtree-compatible type
7 participants