mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-04 10:50:15 +00:00
Add AsMut Borrow BorrowMut to minicore and famous_defs
This commit is contained in:
parent
7c3de9df36
commit
cb000ad313
2 changed files with 34 additions and 0 deletions
|
@ -106,6 +106,18 @@ impl FamousDefs<'_, '_> {
|
|||
self.find_trait("core:convert:AsRef")
|
||||
}
|
||||
|
||||
pub fn core_convert_AsMut(&self) -> Option<Trait> {
|
||||
self.find_trait("core:convert:AsMut")
|
||||
}
|
||||
|
||||
pub fn core_borrow_Borrow(&self) -> Option<Trait> {
|
||||
self.find_trait("core:borrow:Borrow")
|
||||
}
|
||||
|
||||
pub fn core_borrow_BorrowMut(&self) -> Option<Trait> {
|
||||
self.find_trait("core:borrow:BorrowMut")
|
||||
}
|
||||
|
||||
pub fn core_ops_ControlFlow(&self) -> Option<Enum> {
|
||||
self.find_enum("core:ops:ControlFlow")
|
||||
}
|
||||
|
|
|
@ -11,10 +11,13 @@
|
|||
//! add:
|
||||
//! asm:
|
||||
//! assert:
|
||||
//! as_mut: sized
|
||||
//! as_ref: sized
|
||||
//! async_fn: fn, tuple, future, copy
|
||||
//! bool_impl: option, fn
|
||||
//! builtin_impls:
|
||||
//! borrow: sized
|
||||
//! borrow_mut: borrow
|
||||
//! cell: copy, drop
|
||||
//! clone: sized
|
||||
//! coerce_pointee: derive, sized, unsize, coerce_unsized, dispatch_from_dyn
|
||||
|
@ -377,11 +380,30 @@ pub mod convert {
|
|||
fn as_ref(&self) -> &T;
|
||||
}
|
||||
// endregion:as_ref
|
||||
// region:as_mut
|
||||
pub trait AsMut<T: crate::marker::PointeeSized>: crate::marker::PointeeSized {
|
||||
fn as_ref(&mut self) -> &mut T;
|
||||
}
|
||||
// endregion:as_mut
|
||||
// region:infallible
|
||||
pub enum Infallible {}
|
||||
// endregion:infallible
|
||||
}
|
||||
|
||||
pub mod borrow {
|
||||
// region:borrow
|
||||
pub trait Borrow<Borrowed: crate::marker::PointeeSized>: crate::marker::PointeeSized {
|
||||
fn borrow(&self) -> &Borrowed;
|
||||
}
|
||||
// endregion:borrow
|
||||
|
||||
// region:borrow_mut
|
||||
pub trait BorrowMut<Borrowed: crate::marker::PointeeSized>: Borrow<Borrowed> {
|
||||
fn borrow_mut(&mut self) -> &mut Borrowed;
|
||||
}
|
||||
// endregion:borrow_mut
|
||||
}
|
||||
|
||||
pub mod mem {
|
||||
// region:manually_drop
|
||||
use crate::marker::PointeeSized;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue