check if ProjectionTy or ProjectionConst
fmt
This commit is contained in:
parent
78865ca937
commit
c8ce14018f
3 changed files with 21 additions and 0 deletions
|
|
@ -1607,6 +1607,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
};
|
||||
|
||||
if let Some(lhs) = lhs.to_alias_term()
|
||||
&& let ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst = lhs.kind(self.tcx)
|
||||
&& let Some((better_type_err, expected_term)) =
|
||||
derive_better_type_error(lhs, rhs)
|
||||
{
|
||||
|
|
@ -1615,6 +1616,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
better_type_err,
|
||||
)
|
||||
} else if let Some(rhs) = rhs.to_alias_term()
|
||||
&& let ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst = rhs.kind(self.tcx)
|
||||
&& let Some((better_type_err, expected_term)) =
|
||||
derive_better_type_error(rhs, lhs)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
//@ compile-flags: -Znext-solver=globally
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
type Foo = Vec<impl Send>;
|
||||
|
||||
#[define_opaque(Foo)]
|
||||
fn make_foo() -> Foo {}
|
||||
//~^ ERROR type mismatch resolving
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
error[E0271]: type mismatch resolving `Foo == ()`
|
||||
--> $DIR/opaque-alias-relate-issue-151331.rs:7:18
|
||||
|
|
||||
LL | fn make_foo() -> Foo {}
|
||||
| ^^^ types differ
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0271`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue