mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Generalize reborrow hints as adjustment hints
This commit is contained in:
parent
cd2603299c
commit
c98fc537e6
9 changed files with 182 additions and 78 deletions
|
@ -117,7 +117,7 @@ pub use {
|
|||
name::{known, Name},
|
||||
ExpandResult, HirFileId, InFile, MacroFile, Origin,
|
||||
},
|
||||
hir_ty::display::HirDisplay,
|
||||
hir_ty::{display::HirDisplay, PointerCast, Safety},
|
||||
};
|
||||
|
||||
// These are negative re-exports: pub using these names is forbidden, they
|
||||
|
@ -3651,6 +3651,28 @@ impl From<ItemInNs> for ScopeDef {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum Adjust {
|
||||
/// Go from ! to any type.
|
||||
NeverToAny,
|
||||
/// Dereference once, producing a place.
|
||||
Deref(Option<OverloadedDeref>),
|
||||
/// Take the address and produce either a `&` or `*` pointer.
|
||||
Borrow(AutoBorrow),
|
||||
Pointer(PointerCast),
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum AutoBorrow {
|
||||
/// Converts from T to &T.
|
||||
Ref(Mutability),
|
||||
/// Converts from T to *T.
|
||||
RawPtr(Mutability),
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct OverloadedDeref(pub Mutability);
|
||||
|
||||
pub trait HasVisibility {
|
||||
fn visibility(&self, db: &dyn HirDatabase) -> Visibility;
|
||||
fn is_visible_from(&self, db: &dyn HirDatabase, module: Module) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue