mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
internal: add deref_mut to minicore
This commit is contained in:
parent
2980fd430d
commit
d2c9f3add1
3 changed files with 49 additions and 35 deletions
|
@ -1191,21 +1191,11 @@ fn main() {
|
|||
fn suggest_deref_mut() {
|
||||
check_relevance(
|
||||
r#"
|
||||
#[lang = "deref"]
|
||||
trait Deref {
|
||||
type Target;
|
||||
fn deref(&self) -> &Self::Target;
|
||||
}
|
||||
|
||||
#[lang = "deref_mut"]
|
||||
pub trait DerefMut: Deref {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target;
|
||||
}
|
||||
|
||||
//- minicore: deref_mut
|
||||
struct S;
|
||||
struct T(S);
|
||||
|
||||
impl Deref for T {
|
||||
impl core::ops::Deref for T {
|
||||
type Target = S;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
@ -1213,7 +1203,7 @@ impl Deref for T {
|
|||
}
|
||||
}
|
||||
|
||||
impl DerefMut for T {
|
||||
impl core::ops::DerefMut for T {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.0
|
||||
}
|
||||
|
@ -1232,12 +1222,12 @@ fn main() {
|
|||
lc m [local]
|
||||
lc t [local]
|
||||
lc &mut t [type+local]
|
||||
tt DerefMut []
|
||||
tt Deref []
|
||||
fn foo(…) []
|
||||
st T []
|
||||
st S []
|
||||
fn main() []
|
||||
fn foo(…) []
|
||||
md core []
|
||||
tt Sized []
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue