mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Run cargo fmt on 1.72
This commit is contained in:
parent
3864b43d28
commit
fa76f60cc1
7 changed files with 28 additions and 18 deletions
|
@ -1828,7 +1828,11 @@ impl ModCollector<'_, '_> {
|
||||||
let Some(paths) = attr.parse_path_comma_token_tree(db.upcast(), &hygiene) else {
|
let Some(paths) = attr.parse_path_comma_token_tree(db.upcast(), &hygiene) else {
|
||||||
// `#[macro_use]` (without any paths) found, forget collected names and just import
|
// `#[macro_use]` (without any paths) found, forget collected names and just import
|
||||||
// all visible macros.
|
// all visible macros.
|
||||||
self.def_collector.import_macros_from_extern_crate(target_crate, None, Some(extern_crate_id));
|
self.def_collector.import_macros_from_extern_crate(
|
||||||
|
target_crate,
|
||||||
|
None,
|
||||||
|
Some(extern_crate_id),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
for path in paths {
|
for path in paths {
|
||||||
|
|
|
@ -242,7 +242,7 @@ impl HygieneFrame {
|
||||||
krate,
|
krate,
|
||||||
call_site: None,
|
call_site: None,
|
||||||
def_site: None,
|
def_site: None,
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
let def_site = info.attr_input_or_mac_def_start.map(|it| db.hygiene_frame(it.file_id));
|
let def_site = info.attr_input_or_mac_def_start.map(|it| db.hygiene_frame(it.file_id));
|
||||||
|
|
|
@ -39,8 +39,14 @@ impl CastCheck {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_ref_to_ptr_cast(expr_ty: Ty, cast_ty: Ty, table: &mut InferenceTable<'_>) -> bool {
|
fn check_ref_to_ptr_cast(expr_ty: Ty, cast_ty: Ty, table: &mut InferenceTable<'_>) -> bool {
|
||||||
let Some((expr_inner_ty, _, _)) = expr_ty.as_reference() else { return false; };
|
let Some((expr_inner_ty, _, _)) = expr_ty.as_reference() else {
|
||||||
let Some((cast_inner_ty, _)) = cast_ty.as_raw_ptr() else { return false; };
|
return false;
|
||||||
let TyKind::Array(expr_elt_ty, _) = expr_inner_ty.kind(Interner) else { return false; };
|
};
|
||||||
|
let Some((cast_inner_ty, _)) = cast_ty.as_raw_ptr() else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
let TyKind::Array(expr_elt_ty, _) = expr_inner_ty.kind(Interner) else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
table.coerce(expr_elt_ty, cast_inner_ty).is_ok()
|
table.coerce(expr_elt_ty, cast_inner_ty).is_ok()
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,8 @@ fn layout_of_simd_ty(
|
||||||
// * the homogeneous field type and the number of fields.
|
// * the homogeneous field type and the number of fields.
|
||||||
let (e_ty, e_len, is_array) = if let TyKind::Array(e_ty, _) = f0_ty.kind(Interner) {
|
let (e_ty, e_len, is_array) = if let TyKind::Array(e_ty, _) = f0_ty.kind(Interner) {
|
||||||
// Extract the number of elements from the layout of the array field:
|
// Extract the number of elements from the layout of the array field:
|
||||||
let FieldsShape::Array { count, .. } = db.layout_of_ty(f0_ty.clone(), env.clone())?.fields else {
|
let FieldsShape::Array { count, .. } = db.layout_of_ty(f0_ty.clone(), env.clone())?.fields
|
||||||
|
else {
|
||||||
user_error!("Array with non array layout");
|
user_error!("Array with non array layout");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,9 @@ impl Evaluator<'_> {
|
||||||
};
|
};
|
||||||
match try_const_usize(self.db, len) {
|
match try_const_usize(self.db, len) {
|
||||||
Some(len) => {
|
Some(len) => {
|
||||||
let Some(ty) = subst.as_slice(Interner).get(0).and_then(|it| it.ty(Interner)) else {
|
let Some(ty) =
|
||||||
|
subst.as_slice(Interner).get(0).and_then(|it| it.ty(Interner))
|
||||||
|
else {
|
||||||
return Err(MirEvalError::TypeError("simd type with no ty param"));
|
return Err(MirEvalError::TypeError("simd type with no ty param"));
|
||||||
};
|
};
|
||||||
Ok((len as usize, ty.clone()))
|
Ok((len as usize, ty.clone()))
|
||||||
|
|
|
@ -1201,7 +1201,8 @@ impl<'ctx> MirLowerCtx<'ctx> {
|
||||||
let Some(values) = elements
|
let Some(values) = elements
|
||||||
.iter()
|
.iter()
|
||||||
.map(|it| {
|
.map(|it| {
|
||||||
let Some((o, c)) = self.lower_expr_to_some_operand(*it, current)? else {
|
let Some((o, c)) = self.lower_expr_to_some_operand(*it, current)?
|
||||||
|
else {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
};
|
};
|
||||||
current = c;
|
current = c;
|
||||||
|
@ -1259,7 +1260,8 @@ impl<'ctx> MirLowerCtx<'ctx> {
|
||||||
*expr,
|
*expr,
|
||||||
rhs.project(ProjectionElem::TupleOrClosureField(i)),
|
rhs.project(ProjectionElem::TupleOrClosureField(i)),
|
||||||
span,
|
span,
|
||||||
)? else {
|
)?
|
||||||
|
else {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
};
|
};
|
||||||
current = c;
|
current = c;
|
||||||
|
@ -1268,8 +1270,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
|
||||||
}
|
}
|
||||||
Expr::Underscore => Ok(Some(current)),
|
Expr::Underscore => Ok(Some(current)),
|
||||||
_ => {
|
_ => {
|
||||||
let Some((lhs_place, current)) =
|
let Some((lhs_place, current)) = self.lower_expr_as_place(current, lhs, false)?
|
||||||
self.lower_expr_as_place(current, lhs, false)?
|
|
||||||
else {
|
else {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
};
|
};
|
||||||
|
@ -1286,9 +1287,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
|
||||||
rhs: ExprId,
|
rhs: ExprId,
|
||||||
span: MirSpan,
|
span: MirSpan,
|
||||||
) -> Result<Option<BasicBlockId>> {
|
) -> Result<Option<BasicBlockId>> {
|
||||||
let Some((rhs_op, current)) =
|
let Some((rhs_op, current)) = self.lower_expr_to_some_operand(rhs, current)? else {
|
||||||
self.lower_expr_to_some_operand(rhs, current)?
|
|
||||||
else {
|
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
};
|
};
|
||||||
if matches!(&self.body.exprs[lhs], Expr::Underscore) {
|
if matches!(&self.body.exprs[lhs], Expr::Underscore) {
|
||||||
|
@ -1303,9 +1302,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
|
||||||
self.push_assignment(current, temp.clone(), rhs_op.into(), span);
|
self.push_assignment(current, temp.clone(), rhs_op.into(), span);
|
||||||
return self.lower_destructing_assignment(current, lhs, temp, span);
|
return self.lower_destructing_assignment(current, lhs, temp, span);
|
||||||
}
|
}
|
||||||
let Some((lhs_place, current)) =
|
let Some((lhs_place, current)) = self.lower_expr_as_place(current, lhs, false)? else {
|
||||||
self.lower_expr_as_place(current, lhs, false)?
|
|
||||||
else {
|
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
};
|
};
|
||||||
self.push_assignment(current, lhs_place, rhs_op.into(), span);
|
self.push_assignment(current, lhs_place, rhs_op.into(), span);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue