variables.
use super::{InferCtxt, FixupError, FixupResult, Span};
use super::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
use crate::mir::interpret::ConstValue;
-use crate::ty::{self, Ty, Const, TyCtxt, TypeFoldable, InferConst, TypeFlags};
+use crate::ty::{self, Ty, Const, TyCtxt, TypeFoldable, InferConst};
use crate::ty::fold::{TypeFolder, TypeVisitor};
///////////////////////////////////////////////////////////////////////////
}
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
- if !t.has_infer_types() {
+ if !t.has_infer_types() && !t.has_infer_consts() {
t // micro-optimize -- if there is nothing in this type that this fold affects...
} else {
let t = self.infcx.shallow_resolve(t);
}
fn fold_const(&mut self, ct: &'tcx Const<'tcx>) -> &'tcx Const<'tcx> {
- if !ct.has_type_flags(TypeFlags::HAS_CT_INFER) {
+ if !ct.has_infer_consts() {
ct // micro-optimize -- if there is nothing in this const that this fold affects...
} else {
let ct = self.infcx.shallow_resolve(ct);
fn has_infer_types(&self) -> bool {
self.has_type_flags(TypeFlags::HAS_TY_INFER)
}
+ fn has_infer_consts(&self) -> bool {
+ self.has_type_flags(TypeFlags::HAS_CT_INFER)
+ }
fn has_local_value(&self) -> bool {
self.has_type_flags(TypeFlags::KEEP_IN_LOCAL_TCX)
}
debug!("resolve_type_vars_with_obligations(ty={:?})", ty);
// No Infer()? Nothing needs doing.
- if !ty.has_infer_types() {
+ if !ty.has_infer_types() && !ty.has_infer_consts() {
debug!("resolve_type_vars_with_obligations: ty={:?}", ty);
return ty;
}
// If `ty` is a type variable, see whether we already know what it is.
ty = self.resolve_vars_if_possible(&ty);
- if !ty.has_infer_types() {
+ if !ty.has_infer_types() && !ty.has_infer_consts() {
debug!("resolve_type_vars_with_obligations: ty={:?}", ty);
return ty;
}
error[E0308]: mismatched types
- --> $DIR/const-argument-cross-crate-mismatch.rs:6:41
+ --> $DIR/const-argument-cross-crate-mismatch.rs:6:67
|
LL | let _ = const_generic_lib::function(const_generic_lib::Struct([0u8, 1u8]));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `3usize`, found `2usize`
+ | ^^^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements
|
- = note: expected type `const_generic_lib::Struct<3usize>`
- found type `const_generic_lib::Struct<_: usize>`
+ = note: expected type `[u8; 3]`
+ found type `[u8; 2]`
error[E0308]: mismatched types
- --> $DIR/const-argument-cross-crate-mismatch.rs:8:39
+ --> $DIR/const-argument-cross-crate-mismatch.rs:8:65
|
LL | let _: const_generic_lib::Alias = const_generic_lib::Struct([0u8, 1u8, 2u8]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2usize`, found `3usize`
+ | ^^^^^^^^^^^^^^^ expected an array with a fixed size of 2 elements, found one with 3 elements
|
- = note: expected type `const_generic_lib::Struct<2usize>`
- found type `const_generic_lib::Struct<_: usize>`
+ = note: expected type `[u8; 2]`
+ found type `[u8; 3]`
error: aborting due to 2 previous errors