mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 13:48:50 +00:00
Merge #1989
1989: Chalk update to simplified IR r=flodiebold a=kjeremy Co-authored-by: kjeremy <kjeremy@gmail.com>
This commit is contained in:
commit
0896ca04c4
2 changed files with 41 additions and 32 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -122,7 +122,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chalk-engine"
|
name = "chalk-engine"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
source = "git+https://github.com/rust-lang/chalk.git#df09cc603c0cff9ed95e5554055d483fdd756fbc"
|
source = "git+https://github.com/rust-lang/chalk.git#13303bb0067c6ed0572322080ae367ee38f9e7c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)",
|
"chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)",
|
||||||
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -132,7 +132,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chalk-ir"
|
name = "chalk-ir"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/rust-lang/chalk.git#df09cc603c0cff9ed95e5554055d483fdd756fbc"
|
source = "git+https://github.com/rust-lang/chalk.git#13303bb0067c6ed0572322080ae367ee38f9e7c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git)",
|
"chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git)",
|
||||||
"chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)",
|
"chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)",
|
||||||
|
@ -142,7 +142,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chalk-macros"
|
name = "chalk-macros"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
source = "git+https://github.com/rust-lang/chalk.git#df09cc603c0cff9ed95e5554055d483fdd756fbc"
|
source = "git+https://github.com/rust-lang/chalk.git#13303bb0067c6ed0572322080ae367ee38f9e7c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -150,7 +150,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chalk-rust-ir"
|
name = "chalk-rust-ir"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/rust-lang/chalk.git#df09cc603c0cff9ed95e5554055d483fdd756fbc"
|
source = "git+https://github.com/rust-lang/chalk.git#13303bb0067c6ed0572322080ae367ee38f9e7c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git)",
|
"chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git)",
|
||||||
"chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)",
|
"chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)",
|
||||||
|
@ -160,13 +160,12 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chalk-solve"
|
name = "chalk-solve"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/rust-lang/chalk.git#df09cc603c0cff9ed95e5554055d483fdd756fbc"
|
source = "git+https://github.com/rust-lang/chalk.git#13303bb0067c6ed0572322080ae367ee38f9e7c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git)",
|
"chalk-engine 0.9.0 (git+https://github.com/rust-lang/chalk.git)",
|
||||||
"chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)",
|
"chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)",
|
||||||
"chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)",
|
"chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)",
|
||||||
"chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)",
|
"chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)",
|
||||||
"derive-new 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"ena 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ena 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -491,15 +491,16 @@ pub(crate) fn trait_datum_query(
|
||||||
},
|
},
|
||||||
associated_ty_ids: Vec::new(),
|
associated_ty_ids: Vec::new(),
|
||||||
where_clauses: Vec::new(),
|
where_clauses: Vec::new(),
|
||||||
flags: chalk_rust_ir::TraitFlags {
|
|
||||||
non_enumerable: true,
|
|
||||||
auto: false,
|
|
||||||
marker: false,
|
|
||||||
upstream: true,
|
|
||||||
fundamental: false,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
return Arc::new(TraitDatum { binders: make_binders(trait_datum_bound, 1) });
|
|
||||||
|
let flags = chalk_rust_ir::TraitFlags {
|
||||||
|
auto: false,
|
||||||
|
marker: false,
|
||||||
|
upstream: true,
|
||||||
|
fundamental: false,
|
||||||
|
non_enumerable: true,
|
||||||
|
};
|
||||||
|
return Arc::new(TraitDatum { binders: make_binders(trait_datum_bound, 1), flags });
|
||||||
}
|
}
|
||||||
let trait_: Trait = from_chalk(db, trait_id);
|
let trait_: Trait = from_chalk(db, trait_id);
|
||||||
debug!("trait {:?} = {:?}", trait_id, trait_.name(db));
|
debug!("trait {:?} = {:?}", trait_id, trait_.name(db));
|
||||||
|
@ -525,8 +526,9 @@ pub(crate) fn trait_datum_query(
|
||||||
.map(|type_alias| type_alias.to_chalk(db))
|
.map(|type_alias| type_alias.to_chalk(db))
|
||||||
.collect();
|
.collect();
|
||||||
let trait_datum_bound =
|
let trait_datum_bound =
|
||||||
chalk_rust_ir::TraitDatumBound { trait_ref, where_clauses, flags, associated_ty_ids };
|
chalk_rust_ir::TraitDatumBound { trait_ref, where_clauses, associated_ty_ids };
|
||||||
let trait_datum = TraitDatum { binders: make_binders(trait_datum_bound, bound_vars.len()) };
|
let trait_datum =
|
||||||
|
TraitDatum { binders: make_binders(trait_datum_bound, bound_vars.len()), flags };
|
||||||
Arc::new(trait_datum)
|
Arc::new(trait_datum)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,18 +634,20 @@ fn impl_block_datum(
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let impl_datum_bound = chalk_rust_ir::ImplDatumBound {
|
let polarity = if negative {
|
||||||
trait_ref: if negative {
|
chalk_rust_ir::Polarity::Negative
|
||||||
chalk_rust_ir::PolarizedTraitRef::Negative(trait_ref)
|
} else {
|
||||||
} else {
|
chalk_rust_ir::Polarity::Positive
|
||||||
chalk_rust_ir::PolarizedTraitRef::Positive(trait_ref)
|
|
||||||
},
|
|
||||||
where_clauses,
|
|
||||||
associated_ty_values,
|
|
||||||
impl_type,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let impl_datum_bound =
|
||||||
|
chalk_rust_ir::ImplDatumBound { trait_ref, where_clauses, associated_ty_values };
|
||||||
debug!("impl_datum: {:?}", impl_datum_bound);
|
debug!("impl_datum: {:?}", impl_datum_bound);
|
||||||
let impl_datum = ImplDatum { binders: make_binders(impl_datum_bound, bound_vars.len()) };
|
let impl_datum = ImplDatum {
|
||||||
|
binders: make_binders(impl_datum_bound, bound_vars.len()),
|
||||||
|
impl_type,
|
||||||
|
polarity,
|
||||||
|
};
|
||||||
Arc::new(impl_datum)
|
Arc::new(impl_datum)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,12 +657,15 @@ fn invalid_impl_datum() -> Arc<ImplDatum> {
|
||||||
parameters: vec![chalk_ir::Ty::BoundVar(0).cast()],
|
parameters: vec![chalk_ir::Ty::BoundVar(0).cast()],
|
||||||
};
|
};
|
||||||
let impl_datum_bound = chalk_rust_ir::ImplDatumBound {
|
let impl_datum_bound = chalk_rust_ir::ImplDatumBound {
|
||||||
trait_ref: chalk_rust_ir::PolarizedTraitRef::Positive(trait_ref),
|
trait_ref,
|
||||||
where_clauses: Vec::new(),
|
where_clauses: Vec::new(),
|
||||||
associated_ty_values: Vec::new(),
|
associated_ty_values: Vec::new(),
|
||||||
impl_type: chalk_rust_ir::ImplType::External,
|
|
||||||
};
|
};
|
||||||
let impl_datum = ImplDatum { binders: make_binders(impl_datum_bound, 1) };
|
let impl_datum = ImplDatum {
|
||||||
|
binders: make_binders(impl_datum_bound, 1),
|
||||||
|
impl_type: chalk_rust_ir::ImplType::External,
|
||||||
|
polarity: chalk_rust_ir::Polarity::Positive,
|
||||||
|
};
|
||||||
Arc::new(impl_datum)
|
Arc::new(impl_datum)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,12 +720,15 @@ fn closure_fn_trait_impl_datum(
|
||||||
let impl_type = chalk_rust_ir::ImplType::External;
|
let impl_type = chalk_rust_ir::ImplType::External;
|
||||||
|
|
||||||
let impl_datum_bound = chalk_rust_ir::ImplDatumBound {
|
let impl_datum_bound = chalk_rust_ir::ImplDatumBound {
|
||||||
trait_ref: chalk_rust_ir::PolarizedTraitRef::Positive(trait_ref.to_chalk(db)),
|
trait_ref: trait_ref.to_chalk(db),
|
||||||
where_clauses: Vec::new(),
|
where_clauses: Vec::new(),
|
||||||
associated_ty_values: vec![output_ty_value],
|
associated_ty_values: vec![output_ty_value],
|
||||||
impl_type,
|
|
||||||
};
|
};
|
||||||
let impl_datum = ImplDatum { binders: make_binders(impl_datum_bound, num_args as usize + 1) };
|
let impl_datum = ImplDatum {
|
||||||
|
binders: make_binders(impl_datum_bound, num_args as usize + 1),
|
||||||
|
impl_type,
|
||||||
|
polarity: chalk_rust_ir::Polarity::Positive,
|
||||||
|
};
|
||||||
Some(Arc::new(impl_datum))
|
Some(Arc::new(impl_datum))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue