mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Ensure at least one trait bound in TyKind::DynTy
This commit is contained in:
parent
4d989b5465
commit
9845e37f58
3 changed files with 27 additions and 5 deletions
|
@ -166,6 +166,8 @@ impl TyExt for Ty {
|
|||
let trait_ref = match self.kind(Interner) {
|
||||
// The principal trait bound should be the first element of the bounds. This is an
|
||||
// invariant ensured by `TyLoweringContext::lower_dyn_trait()`.
|
||||
// FIXME: dyn types may not have principal trait and we don't want to return auto trait
|
||||
// here.
|
||||
TyKind::Dyn(dyn_ty) => dyn_ty.bounds.skip_binders().interned().get(0).and_then(|b| {
|
||||
match b.skip_binders() {
|
||||
WhereClause::Implemented(trait_ref) => Some(trait_ref),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue