Skip to content

Solver prefers param-env bound over object bound #98

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

Closed
compiler-errors opened this issue Mar 11, 2024 · 2 comments
Closed

Solver prefers param-env bound over object bound #98

compiler-errors opened this issue Mar 11, 2024 · 2 comments

Comments

@compiler-errors
Copy link
Member

Causes tests/ui/trivial-bounds/trivial-bounds-object.rs to fail.

//@ run-pass
// Check that the object bound dyn A + 'a: A is preferred over the
// where clause bound dyn A + 'static: A.

#![allow(unused)]

trait A {
    fn test(&self);
}

fn foo(x: &dyn A)
where
    dyn A + 'static: A, // Using this bound would lead to a lifetime error.
{
    x.test();
}

fn main () {}
@compiler-errors
Copy link
Member Author

Maybe we should prefer object bounds over WC bounds?

@lcnr
Copy link
Contributor

lcnr commented Jan 29, 2025

Fixed by preferring impl candidates over global where-bounds, matching the old solver

@lcnr lcnr closed this as completed Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants