Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d5ffd36
Change HashSet element type to `DefId`
sinkuu Oct 16, 2019
ac2f906
Make use of the return value of `HashSet::insert`
sinkuu Oct 16, 2019
c4deea2
Avoid unnecessary arena allocations in `expand_pattern()`.
nnethercote Oct 16, 2019
f721547
ci: move install-awscli.sh into scripts/
pietroalbini Oct 4, 2019
e9974f9
ci: extract dumping the environment into a script
pietroalbini Oct 4, 2019
6b89d59
ci: extract installing sccache into a script
pietroalbini Oct 4, 2019
aa76006
ci: extract installing clang into a script
pietroalbini Oct 4, 2019
7c23f58
ci: extract switching xcode into a script
pietroalbini Oct 7, 2019
6cfe5d9
ci: extract parts of windows-build-deps into scripts
pietroalbini Oct 7, 2019
1ac2ad3
ci: extract disabling git crlf handling into a script
pietroalbini Oct 7, 2019
f828a41
ci: extract installing msys2 into a script
pietroalbini Oct 7, 2019
a5ea6ce
ci: extract installing mingw into a script
pietroalbini Oct 8, 2019
69a946a
ci: extract installing ninja into a script
pietroalbini Oct 8, 2019
d778f95
ci: extract enabling ipv6 on docker into a script
pietroalbini Oct 8, 2019
09bf3cf
ci: extract checking out submodules into a script
pietroalbini Oct 8, 2019
646da3a
ci: extract verifying line endings into a script
pietroalbini Oct 8, 2019
c139db7
ci: use shared.sh in scripts/install-awscli.sh
pietroalbini Oct 8, 2019
9458c9b
ci: cleanup platform detection
pietroalbini Oct 8, 2019
11173f8
ci: fix tidy
pietroalbini Oct 8, 2019
11c59e3
ci: reuse the mirrors base url from shared.sh in scripts
pietroalbini Oct 9, 2019
6351efb
ci: fix innosetup installation
pietroalbini Oct 15, 2019
375e34d
ci: fix wrong path being set in install-msys2.sh
pietroalbini Oct 18, 2019
2e36c84
Remove unreachable unit tuple compare binop codegen
TheOregonTrail Sep 9, 2019
925e304
Fix resolve_type_vars_with_obligations not resolving const inference
skinnyBat Oct 18, 2019
9cefcd3
Rename resolve_type_vars_with_obligations to
skinnyBat Oct 18, 2019
379733e
typo fix
Oct 20, 2019
05937fc
Rollup merge of #65202 - pietroalbini:scriptify-ci-config, r=alexcric…
JohnTitor Oct 20, 2019
ea12ddc
Rollup merge of #65460 - sinkuu:contains_insert, r=varkor
JohnTitor Oct 20, 2019
6d6ead4
Rollup merge of #65463 - nnethercote:rm-arena-allocation-from-expand_…
JohnTitor Oct 20, 2019
df117c2
Rollup merge of #65579 - skinny121:resolve_const_vars, r=varkor
JohnTitor Oct 20, 2019
6e875a9
Rollup merge of #65605 - bjorn3:fix_63906, r=eddyb
JohnTitor Oct 20, 2019
faf69f6
Rollup merge of #65626 - guanqun:patch-1, r=varkor
JohnTitor Oct 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix resolve_type_vars_with_obligations not resolving const inference
variables.
  • Loading branch information
skinnyBat committed Oct 19, 2019
commit 925e3042f659c4a79bb742503cdbbd4ee4a731a2
6 changes: 3 additions & 3 deletions src/librustc/infer/resolve.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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};

///////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -29,7 +29,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticVarResolver<'a, 'tcx> {
}

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);
Expand All @@ -38,7 +38,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticVarResolver<'a, 'tcx> {
}

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);
Expand Down
3 changes: 3 additions & 0 deletions src/librustc/ty/fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
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)
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2448,14 +2448,14 @@ impl<'a, 'tcx> FnCtxt<'a, '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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
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

Expand Down