Skip to content

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

Closed as not planned
@Mark-Simulacrum

Description

@Mark-Simulacrum

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions