rust-lang / trait-system-refactor-initiative

The Rustc Trait System Refactor Initiative
21 stars 0 forks source link

Solver prefers param-env bound over object bound #98

Open compiler-errors opened 6 months ago

compiler-errors commented 6 months ago

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 commented 6 months ago

Maybe we should prefer object bounds over WC bounds?