mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Add Ty::Array to walk_mut
This commit is contained in:
parent
f66ca1bd2e
commit
0aedd4fb2f
2 changed files with 35 additions and 35 deletions
|
@ -356,7 +356,7 @@ impl Ty {
|
||||||
fn walk_mut(&mut self, f: &mut impl FnMut(&mut Ty)) {
|
fn walk_mut(&mut self, f: &mut impl FnMut(&mut Ty)) {
|
||||||
f(self);
|
f(self);
|
||||||
match self {
|
match self {
|
||||||
Ty::Slice(t) => Arc::make_mut(t).walk_mut(f),
|
Ty::Slice(t) | Ty::Array(t) => Arc::make_mut(t).walk_mut(f),
|
||||||
Ty::RawPtr(t, _) => Arc::make_mut(t).walk_mut(f),
|
Ty::RawPtr(t, _) => Arc::make_mut(t).walk_mut(f),
|
||||||
Ty::Ref(t, _) => Arc::make_mut(t).walk_mut(f),
|
Ty::Ref(t, _) => Arc::make_mut(t).walk_mut(f),
|
||||||
Ty::Tuple(ts) => {
|
Ty::Tuple(ts) => {
|
||||||
|
@ -1105,7 +1105,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Ty::Tuple(Arc::from(ty_vec))
|
Ty::Tuple(Arc::from(ty_vec))
|
||||||
},
|
}
|
||||||
Expr::Array { exprs } => {
|
Expr::Array { exprs } => {
|
||||||
let elem_ty = match &expected.ty {
|
let elem_ty = match &expected.ty {
|
||||||
Ty::Slice(inner) | Ty::Array(inner) => Ty::clone(&inner),
|
Ty::Slice(inner) | Ty::Array(inner) => Ty::clone(&inner),
|
||||||
|
@ -1117,7 +1117,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Ty::Array(Arc::new(elem_ty))
|
Ty::Array(Arc::new(elem_ty))
|
||||||
},
|
}
|
||||||
Expr::Literal(lit) => match lit {
|
Expr::Literal(lit) => match lit {
|
||||||
Literal::Bool(..) => Ty::Bool,
|
Literal::Bool(..) => Ty::Bool,
|
||||||
Literal::String(..) => Ty::Ref(Arc::new(Ty::Str), Mutability::Shared),
|
Literal::String(..) => Ty::Ref(Arc::new(Ty::Str), Mutability::Shared),
|
||||||
|
|
|
@ -1,52 +1,52 @@
|
||||||
[9; 10) 'x': &str
|
[9; 10) 'x': &str
|
||||||
[18; 19) 'y': isize
|
[18; 19) 'y': isize
|
||||||
[28; 293) '{ ... []; }': ()
|
[28; 293) '{ ... []; }': ()
|
||||||
[38; 39) 'a': [_]
|
[38; 39) 'a': [&str]
|
||||||
[42; 45) '[x]': [_]
|
[42; 45) '[x]': [&str]
|
||||||
[43; 44) 'x': &str
|
[43; 44) 'x': &str
|
||||||
[55; 56) 'b': [_]
|
[55; 56) 'b': [[&str]]
|
||||||
[59; 65) '[a, a]': [_]
|
[59; 65) '[a, a]': [[&str]]
|
||||||
[60; 61) 'a': [_]
|
[60; 61) 'a': [&str]
|
||||||
[63; 64) 'a': [_]
|
[63; 64) 'a': [&str]
|
||||||
[75; 76) 'c': [_]
|
[75; 76) 'c': [[[&str]]]
|
||||||
[79; 85) '[b, b]': [_]
|
[79; 85) '[b, b]': [[[&str]]]
|
||||||
[80; 81) 'b': [_]
|
[80; 81) 'b': [[&str]]
|
||||||
[83; 84) 'b': [_]
|
[83; 84) 'b': [[&str]]
|
||||||
[96; 97) 'd': [_]
|
[96; 97) 'd': [isize]
|
||||||
[100; 112) '[y, 1, 2, 3]': [_]
|
[100; 112) '[y, 1, 2, 3]': [isize]
|
||||||
[101; 102) 'y': isize
|
[101; 102) 'y': isize
|
||||||
[104; 105) '1': isize
|
[104; 105) '1': isize
|
||||||
[107; 108) '2': isize
|
[107; 108) '2': isize
|
||||||
[110; 111) '3': isize
|
[110; 111) '3': isize
|
||||||
[122; 123) 'd': [_]
|
[122; 123) 'd': [isize]
|
||||||
[126; 138) '[1, y, 2, 3]': [_]
|
[126; 138) '[1, y, 2, 3]': [isize]
|
||||||
[127; 128) '1': isize
|
[127; 128) '1': isize
|
||||||
[130; 131) 'y': isize
|
[130; 131) 'y': isize
|
||||||
[133; 134) '2': isize
|
[133; 134) '2': isize
|
||||||
[136; 137) '3': isize
|
[136; 137) '3': isize
|
||||||
[148; 149) 'e': [_]
|
[148; 149) 'e': [isize]
|
||||||
[152; 155) '[y]': [_]
|
[152; 155) '[y]': [isize]
|
||||||
[153; 154) 'y': isize
|
[153; 154) 'y': isize
|
||||||
[165; 166) 'f': [_]
|
[165; 166) 'f': [[isize]]
|
||||||
[169; 175) '[d, d]': [_]
|
[169; 175) '[d, d]': [[isize]]
|
||||||
[170; 171) 'd': [_]
|
[170; 171) 'd': [isize]
|
||||||
[173; 174) 'd': [_]
|
[173; 174) 'd': [isize]
|
||||||
[185; 186) 'g': [_]
|
[185; 186) 'g': [[isize]]
|
||||||
[189; 195) '[e, e]': [_]
|
[189; 195) '[e, e]': [[isize]]
|
||||||
[190; 191) 'e': [_]
|
[190; 191) 'e': [isize]
|
||||||
[193; 194) 'e': [_]
|
[193; 194) 'e': [isize]
|
||||||
[206; 207) 'h': [_]
|
[206; 207) 'h': [i32]
|
||||||
[210; 216) '[1, 2]': [_]
|
[210; 216) '[1, 2]': [i32]
|
||||||
[211; 212) '1': i32
|
[211; 212) '1': i32
|
||||||
[214; 215) '2': i32
|
[214; 215) '2': i32
|
||||||
[226; 227) 'i': [_]
|
[226; 227) 'i': [&str]
|
||||||
[230; 240) '["a", "b"]': [_]
|
[230; 240) '["a", "b"]': [&str]
|
||||||
[231; 234) '"a"': &str
|
[231; 234) '"a"': &str
|
||||||
[236; 239) '"b"': &str
|
[236; 239) '"b"': &str
|
||||||
[251; 252) 'b': [_]
|
[251; 252) 'b': [[&str]]
|
||||||
[255; 265) '[a, ["b"]]': [_]
|
[255; 265) '[a, ["b"]]': [[&str]]
|
||||||
[256; 257) 'a': [_]
|
[256; 257) 'a': [&str]
|
||||||
[259; 264) '["b"]': [_]
|
[259; 264) '["b"]': [&str]
|
||||||
[260; 263) '"b"': &str
|
[260; 263) '"b"': &str
|
||||||
[275; 276) 'x': [u8]
|
[275; 276) 'x': [u8]
|
||||||
[288; 290) '[]': [u8]
|
[288; 290) '[]': [u8]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue