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

regression: inference conflicts due to new From imps on Vec<T> #117054

Closed
Mark-Simulacrum opened this issue Oct 22, 2023 · 3 comments
Closed

regression: inference conflicts due to new From imps on Vec<T> #117054

Mark-Simulacrum opened this issue Oct 22, 2023 · 3 comments
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Milestone

Comments

@Mark-Simulacrum
Copy link
Member

This breaks many libraries that depend on the tui crate (see method: https://docs.rs/tui/latest/tui/layout/struct.Layout.html#method.constraints).

[INFO] [stdout] error[E0283]: type annotations needed
[INFO] [stdout]   --> src/app/app_parts.rs:18:14
[INFO] [stdout]    |
[INFO] [stdout] 18 |             .constraints(vec![Constraint::Percentage(15), Constraint::Percentage(85)].as_ref())
[INFO] [stdout]    |              ^^^^^^^^^^^                                                              ------ type must be known at this point
[INFO] [stdout]    |              |
[INFO] [stdout]    |              cannot infer type of the type parameter `C` declared on the method `constraints`
[INFO] [stdout]    |
[INFO] [stdout]    = note: multiple `impl`s satisfying `Vec<Constraint>: AsRef<_>` found in the `alloc` crate:
[INFO] [stdout]            - impl<T, A> AsRef<Vec<T, A>> for Vec<T, A>
[INFO] [stdout]              where A: Allocator;
[INFO] [stdout]            - impl<T, A> AsRef<[T]> for Vec<T, A>
[INFO] [stdout]              where A: Allocator;
[INFO] [stdout] help: consider specifying the generic argument
[INFO] [stdout]    |
[INFO] [stdout] 18 |             .constraints::<&T>(vec![Constraint::Percentage(15), Constraint::Percentage(85)].as_ref())
[INFO] [stdout]    |                         ++++++
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] error: aborting due to previous error

Added in #111278.

Around 69 errors likely attributable to this were detected in Crater:

Due to the tui method calls:

Other cases:

@Mark-Simulacrum Mark-Simulacrum added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Oct 22, 2023
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 22, 2023
@Mark-Simulacrum Mark-Simulacrum added this to the 1.74.0 milestone Oct 22, 2023
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 23, 2023
@apiraino
Copy link
Contributor

Added in #111278 cc @EFanZh

@Amanieu
Copy link
Member

Amanieu commented Oct 25, 2023

We discussed this in the t-libs meeting. We consider this to be acceptable inference breakage due to overly-generic code. We should however add a compatibility note in the release notes.

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 28, 2023
@Mark-Simulacrum
Copy link
Member Author

Closing - we have a pending comments on the relnotes PR.

@Mark-Simulacrum Mark-Simulacrum closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants