Merge pull request #18987 from ChayimFriedman2/drop-glue

feat: Calculate drop glue and show it on hover
This commit is contained in:
Lukas Wirth 2025-02-24 13:52:17 +00:00 committed by GitHub
commit 93bd36dfb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 1002 additions and 6 deletions

View file

@ -11,6 +11,7 @@ use hir_def::{
};
use hir_expand::name::Name;
use intern::{sym, Symbol};
use stdx::never;
use crate::{
error_lifetime,
@ -20,6 +21,7 @@ use crate::{
LangItem, Layout, Locals, Lookup, MirEvalError, MirSpan, Mutability, Result, Substitution,
Ty, TyBuilder, TyExt,
},
DropGlue,
};
mod simd;
@ -853,7 +855,14 @@ impl Evaluator<'_> {
"size_of generic arg is not provided".into(),
));
};
let result = !ty.clone().is_copy(self.db, locals.body.owner);
let result = match self.db.has_drop_glue(ty.clone(), self.trait_env.clone()) {
DropGlue::HasDropGlue => true,
DropGlue::None => false,
DropGlue::DependOnParams => {
never!("should be fully monomorphized now");
true
}
};
destination.write_from_bytes(self, &[u8::from(result)])
}
"ptr_guaranteed_cmp" => {