mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
⬆️ rust-analyzer
This commit is contained in:
parent
26a413e015
commit
8807fc4cc3
64 changed files with 2244 additions and 1607 deletions
|
@ -1111,24 +1111,6 @@ pub fn resolve_indexing_op(
|
|||
}
|
||||
None
|
||||
}
|
||||
/// Returns the receiver type for the try branch trait call.
|
||||
pub fn resolve_branch_op(
|
||||
db: &dyn HirDatabase,
|
||||
env: Arc<TraitEnvironment>,
|
||||
ty: Canonical<Ty>,
|
||||
try_trait: TraitId,
|
||||
) -> Option<ReceiverAdjustments> {
|
||||
let mut table = InferenceTable::new(db, env.clone());
|
||||
let ty = table.instantiate_canonical(ty);
|
||||
let (deref_chain, adj) = autoderef_method_receiver(&mut table, ty);
|
||||
for (ty, adj) in deref_chain.into_iter().zip(adj) {
|
||||
let goal = generic_implements_goal(db, env.clone(), try_trait, &ty);
|
||||
if db.trait_solve(env.krate, goal.cast(Interner)).is_some() {
|
||||
return Some(adj);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
macro_rules! check_that {
|
||||
($cond:expr) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue