mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 07:04:22 +00:00
Chalk update to simplified IR
This commit is contained in:
parent
da190278e9
commit
4ba2c5b2de
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]]
|
||||
name = "chalk-engine"
|
||||
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 = [
|
||||
"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)",
|
||||
|
@ -132,7 +132,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "chalk-ir"
|
||||
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 = [
|
||||
"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)",
|
||||
|
@ -142,7 +142,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "chalk-macros"
|
||||
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 = [
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -150,7 +150,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "chalk-rust-ir"
|
||||
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 = [
|
||||
"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)",
|
||||
|
@ -160,13 +160,12 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "chalk-solve"
|
||||
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 = [
|
||||
"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-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)",
|
||||
"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)",
|
||||
"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)",
|
||||
|
|
|
@ -491,15 +491,16 @@ pub(crate) fn trait_datum_query(
|
|||
},
|
||||
associated_ty_ids: 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);
|
||||
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))
|
||||
.collect();
|
||||
let trait_datum_bound =
|
||||
chalk_rust_ir::TraitDatumBound { trait_ref, where_clauses, flags, associated_ty_ids };
|
||||
let trait_datum = TraitDatum { binders: make_binders(trait_datum_bound, bound_vars.len()) };
|
||||
chalk_rust_ir::TraitDatumBound { trait_ref, where_clauses, associated_ty_ids };
|
||||
let trait_datum =
|
||||
TraitDatum { binders: make_binders(trait_datum_bound, bound_vars.len()), flags };
|
||||
Arc::new(trait_datum)
|
||||
}
|
||||
|
||||
|
@ -632,18 +634,20 @@ fn impl_block_datum(
|
|||
})
|
||||
.collect();
|
||||
|
||||
let impl_datum_bound = chalk_rust_ir::ImplDatumBound {
|
||||
trait_ref: if negative {
|
||||
chalk_rust_ir::PolarizedTraitRef::Negative(trait_ref)
|
||||
} else {
|
||||
chalk_rust_ir::PolarizedTraitRef::Positive(trait_ref)
|
||||
},
|
||||
where_clauses,
|
||||
associated_ty_values,
|
||||
impl_type,
|
||||
let polarity = if negative {
|
||||
chalk_rust_ir::Polarity::Negative
|
||||
} else {
|
||||
chalk_rust_ir::Polarity::Positive
|
||||
};
|
||||
|
||||
let impl_datum_bound =
|
||||
chalk_rust_ir::ImplDatumBound { trait_ref, where_clauses, associated_ty_values };
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -653,12 +657,15 @@ fn invalid_impl_datum() -> Arc<ImplDatum> {
|
|||
parameters: vec![chalk_ir::Ty::BoundVar(0).cast()],
|
||||
};
|
||||
let impl_datum_bound = chalk_rust_ir::ImplDatumBound {
|
||||
trait_ref: chalk_rust_ir::PolarizedTraitRef::Positive(trait_ref),
|
||||
trait_ref,
|
||||
where_clauses: 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)
|
||||
}
|
||||
|
||||
|
@ -713,12 +720,15 @@ fn closure_fn_trait_impl_datum(
|
|||
let impl_type = chalk_rust_ir::ImplType::External;
|
||||
|
||||
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(),
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue