-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Change a commit_if_ok call to probe #105292
Conversation
This comment has been minimized.
This comment has been minimized.
e91e731
to
9cc1988
Compare
Some changes occurred in const_evaluatable.rs cc @lcnr |
9cc1988
to
1058dcd
Compare
☔ The latest upstream changes (presumably #105365) made this pull request unmergeable. Please resolve the merge conflicts. |
replacing this with a What's needed is to have the visitor visit all the consts regardless of it succeeds in unifying with something, and if it succeed in unifying with something (in the probe) track that in |
aaf7eb5
to
0bec1bb
Compare
I updated to check for only a single match and commit the change if there is a single one, but somehow this results in an error for the original test case. Is this an issue with the way I implemented it? |
This comment has been minimized.
This comment has been minimized.
the current code only works for a single |
0bec1bb
to
878d3ea
Compare
This comment has been minimized.
This comment has been minimized.
I think all the CI failures are caused by cases where we have duplicate candidates, i.e. two |
Can you add the following as tests: #![feature(generic_const_exprs)]
#![allow(incomplete_features)]
fn foo<const N: usize>()
where
[(); N + 1]:,
[(); N + 1]:,
{
bar::<N>();
}
fn bar<const N: usize>()
where
[(); N + 1]:,
{
}
fn main() {} #![feature(generic_const_exprs)]
#![allow(incomplete_features)]
const fn both(_: usize, b: usize) -> usize {
b
}
fn foo<const N: usize>()
where
[(); both(N + 1, N + 1)]:,
{
bar::<N>();
}
fn bar<const N: usize>()
where
[(); N + 1]:,
{
}
fn main() {} #![feature(generic_const_exprs)]
#![allow(incomplete_features)]
const fn both(_: usize, b: usize) -> usize {
b
}
fn foo<const N: usize, const M: usize>() -> [(); N + 2]
where
[(); both(N + 1, M + 1)]:,
{
bar()
}
fn bar<const N: usize>() -> [(); N]
where
[(); N + 1]:,
{
[(); N]
}
fn main() {} |
51d614e
to
f1e1e81
Compare
f1e1e81
to
31d5feb
Compare
will r+ this once its rebased |
Instead of just switching to a probe, check for different matches, and see how many there are. If one, unify it, otherwise return true and let it be unified later.
This prevents an ICE due to a value not actually being evaluatable later.
31d5feb
to
21c5ffe
Compare
@bors r+ rollup |
…yUwU Change a commit_if_ok call to probe Removes an over-eager `commit_if_ok` which makes inference worse. I'm not entirely sure whether it's ok to remove the check that types are the same, because casting seems to cause equality checks with incorrect types? Fixes rust-lang#105037 r? `@BoxyUwU`
…yUwU Change a commit_if_ok call to probe Removes an over-eager `commit_if_ok` which makes inference worse. I'm not entirely sure whether it's ok to remove the check that types are the same, because casting seems to cause equality checks with incorrect types? Fixes rust-lang#105037 r? ``@BoxyUwU``
…fee1-dead Rollup of 10 pull requests Successful merges: - rust-lang#105292 (Change a commit_if_ok call to probe) - rust-lang#105655 (Remove invalid case for mutable borrow suggestion) - rust-lang#106047 (Fix ui constant tests for big-endian platforms) - rust-lang#106061 (Enable Shadow Call Stack for Fuchsia on AArch64) - rust-lang#106164 (Move `check_region_obligations_and_report_errors` to `TypeErrCtxt`) - rust-lang#106291 (Fix incorrect suggestion for extra `&` in pattern) - rust-lang#106389 (Simplify some canonical type alias names) - rust-lang#106468 (Use FxIndexSet when updating obligation causes in `adjust_fulfillment_errors_for_expr_obligation`) - rust-lang#106549 (Use fmt named parameters in rustc_borrowck) - rust-lang#106614 (error-code docs improvements (No. 2)) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…compiler-errors Added const-generic ui test case for issue rust-lang#106419 This PR adds a test case for rust-lang#106419 which has been fixed in master by rust-lang#105292 I also ran the test on f769d34 (the commit before rust-lang#105292 was merged) and it did fail there with the following output. ``` --- stderr ------------------------------- error[E0308]: mismatched types --> /home/patrikk/src/rust/src/test/ui/const-generics/issue-106419-struct-with-multiple-const-params.rs:5:10 | LL | #[derive(Clone)] | ^^^^^ | | | expected `A`, found `B` | expected `Bar<A, B>` because of return type | = note: expected struct `Bar<A, _>` found struct `Bar<B, _>` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. ------------------------------------------ ```
Removes an over-eager
commit_if_ok
which makes inference worse.I'm not entirely sure whether it's ok to remove the check that types are the same, because casting seems to cause equality checks with incorrect types?
Fixes #105037
r? @BoxyUwU