intellij-rust / intellij-rust

Rust plugin for the IntelliJ Platform
https://intellij-rust.github.io
MIT License
4.53k stars 380 forks source link

Incorrect trait bound is not satisfied error #7095

Open PizzaCrust opened 3 years ago

PizzaCrust commented 3 years ago

Environment

Problem description

The IDE incorrectly says that B is not implemented for E<[T]>, however the example compiles. image

Steps to reproduce

trait A {}

trait B {}

trait C: B {}

struct E<T: A + ?Sized>(T);

impl<T> B for E<[T]> where [T]: A {}

impl<T> C for E<[T]> where [T]: A {}
PizzaCrust commented 3 years ago

Another case:

trait A {}

trait B {}

trait C: B {}

struct E<'a, T>(&'a T);

impl<'a, T> B for E<'a, T> where &'a T: A {}

impl<'a, T> C for E<'a, T> where &'a T: A {}

So I guess the problem lies within array/reference bounds