Combine projection and opaque into alias
This commit is contained in:
parent
c13bd83528
commit
61adaf8187
104 changed files with 387 additions and 381 deletions
|
@ -373,7 +373,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
// the case of `!`, no return value is required, as the block will never return.
|
||||
// Opaque types of empty bodies also need this unit assignment, in order to infer that their
|
||||
// type is actually unit. Otherwise there will be no defining use found in the MIR.
|
||||
if destination_ty.is_unit() || matches!(destination_ty.kind(), ty::Opaque(..)) {
|
||||
if destination_ty.is_unit()
|
||||
|| matches!(destination_ty.kind(), ty::Alias(ty::Opaque, ..))
|
||||
{
|
||||
// We only want to assign an implicit `()` as the return value of the block if the
|
||||
// block does not diverge. (Otherwise, we may try to assign a unit to a `!`-type.)
|
||||
this.cfg.push_assign_unit(block, source_info, destination, this.tcx);
|
||||
|
|
|
@ -121,7 +121,7 @@ impl<'tcx> ConstToPat<'tcx> {
|
|||
ty::Dynamic(..) => {
|
||||
"trait objects cannot be used in patterns".to_string()
|
||||
}
|
||||
ty::Opaque(..) => {
|
||||
ty::Alias(ty::Opaque, ..) => {
|
||||
"opaque types cannot be used in patterns".to_string()
|
||||
}
|
||||
ty::Closure(..) => {
|
||||
|
|
|
@ -845,7 +845,7 @@ fn is_useful<'p, 'tcx>(
|
|||
|
||||
// Opaque types can't get destructured/split, but the patterns can
|
||||
// actually hint at hidden types, so we use the patterns' types instead.
|
||||
if let ty::Opaque(..) = ty.kind() {
|
||||
if let ty::Alias(ty::Opaque, ..) = ty.kind() {
|
||||
if let Some(row) = rows.first() {
|
||||
ty = row.head().ty();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue