-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Rust can't infer appropriate generics for function when it should #89242
Copy link
Copy link
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Milestone
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I was working on some generic code when I hit this bug, so I made this MRE:
(playground link: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=ce2ea68678f61b329a6cec59310c1aea)
I'd expect both calls to
takes_trait_bto succeed, but the second call doesn't as rust seemingly tries to uphold the where clause for any possibleTThis has been observed on
rustc 1.57.0-nightly (aa8f2d432 2021-09-18)Adding two extra where clauses makes both calls compile on stable, but this example still fails on nightly: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=aaa115e139635787f9b033a1418c7f06
Seems like a regression.