-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #114787 - compiler-errors:issue-114783, r=jackh726
Select obligations before processing wf obligation in `compare_method_predicate_entailment` We need to select obligations before processing the WF obligation for the `IMPLIED_BOUNDS_ENTAILMENT` lint, since it skips over type variables. Fixes #114783 r? `@jackh726`
- Loading branch information
Showing
3 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
tests/ui/implied-bounds/implied-bounds-entailment-wf-vars-issue-114783-1.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// check-pass | ||
|
||
pub trait Foo { | ||
type Error: Error; | ||
|
||
fn foo(&self, stream: &<Self::Error as Error>::Span); | ||
} | ||
|
||
pub struct Wrapper<Inner>(Inner); | ||
|
||
impl<E: Error, Inner> Foo for Wrapper<Inner> | ||
where | ||
Inner: Foo<Error = E>, | ||
{ | ||
type Error = E; | ||
|
||
fn foo(&self, stream: &<Self::Error as Error>::Span) { | ||
todo!() | ||
} | ||
} | ||
|
||
pub trait Error { | ||
type Span; | ||
} | ||
|
||
fn main() {} |
26 changes: 26 additions & 0 deletions
26
tests/ui/implied-bounds/implied-bounds-entailment-wf-vars-issue-114783-2.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// check-pass | ||
|
||
trait AsBufferView { | ||
type Device; | ||
} | ||
|
||
trait Error { | ||
type Span; | ||
} | ||
|
||
trait Foo { | ||
type Error: Error; | ||
fn foo(&self) -> &<Self::Error as Error>::Span; | ||
} | ||
|
||
impl<D: Error, VBuf0> Foo for VBuf0 | ||
where | ||
VBuf0: AsBufferView<Device = D>, | ||
{ | ||
type Error = D; | ||
fn foo(&self) -> &<Self::Error as Error>::Span { | ||
todo!() | ||
} | ||
} | ||
|
||
fn main() {} |