mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Bump rustfmt version
Also switches on formatting of the mir build module
This commit is contained in:
parent
f6cb45ad01
commit
d5b760ba62
@ -506,7 +506,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||||||
let count = generics
|
let count = generics
|
||||||
.params
|
.params
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|param| matches!(param.kind, ast::GenericParamKind::Lifetime { .. }))
|
.filter(|param| {
|
||||||
|
matches!(param.kind, ast::GenericParamKind::Lifetime { .. })
|
||||||
|
})
|
||||||
.count();
|
.count();
|
||||||
self.lctx.type_def_lifetime_params.insert(def_id.to_def_id(), count);
|
self.lctx.type_def_lifetime_params.insert(def_id.to_def_id(), count);
|
||||||
}
|
}
|
||||||
|
@ -598,7 +598,7 @@ impl<'a> TraitDef<'a> {
|
|||||||
|
|
||||||
let mut ty_params = params
|
let mut ty_params = params
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|param| matches!(param.kind, ast::GenericParamKind::Type{..}))
|
.filter(|param| matches!(param.kind, ast::GenericParamKind::Type { .. }))
|
||||||
.peekable();
|
.peekable();
|
||||||
|
|
||||||
if ty_params.peek().is_some() {
|
if ty_params.peek().is_some() {
|
||||||
|
@ -36,7 +36,7 @@ macro_rules! forward_inner_docs {
|
|||||||
($e:expr => $i:item) => {
|
($e:expr => $i:item) => {
|
||||||
#[doc = $e]
|
#[doc = $e]
|
||||||
$i
|
$i
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// In general, the `DiagnosticBuilder` uses deref to allow access to
|
/// In general, the `DiagnosticBuilder` uses deref to allow access to
|
||||||
|
@ -122,11 +122,13 @@ impl Annotation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_multiline(&self) -> bool {
|
pub fn is_multiline(&self) -> bool {
|
||||||
matches!(self.annotation_type,
|
matches!(
|
||||||
|
self.annotation_type,
|
||||||
AnnotationType::Multiline(_)
|
AnnotationType::Multiline(_)
|
||||||
| AnnotationType::MultilineStart(_)
|
| AnnotationType::MultilineStart(_)
|
||||||
| AnnotationType::MultilineLine(_)
|
| AnnotationType::MultilineLine(_)
|
||||||
| AnnotationType::MultilineEnd(_))
|
| AnnotationType::MultilineEnd(_)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn len(&self) -> usize {
|
pub fn len(&self) -> usize {
|
||||||
@ -158,7 +160,10 @@ impl Annotation {
|
|||||||
|
|
||||||
pub fn takes_space(&self) -> bool {
|
pub fn takes_space(&self) -> bool {
|
||||||
// Multiline annotations always have to keep vertical space.
|
// Multiline annotations always have to keep vertical space.
|
||||||
matches!(self.annotation_type, AnnotationType::MultilineStart(_) | AnnotationType::MultilineEnd(_))
|
matches!(
|
||||||
|
self.annotation_type,
|
||||||
|
AnnotationType::MultilineStart(_) | AnnotationType::MultilineEnd(_)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1543,10 +1543,10 @@ pub fn is_range_literal(expr: &Expr<'_>) -> bool {
|
|||||||
**qpath,
|
**qpath,
|
||||||
QPath::LangItem(
|
QPath::LangItem(
|
||||||
LangItem::Range
|
LangItem::Range
|
||||||
| LangItem::RangeTo
|
| LangItem::RangeTo
|
||||||
| LangItem::RangeFrom
|
| LangItem::RangeFrom
|
||||||
| LangItem::RangeFull
|
| LangItem::RangeFull
|
||||||
| LangItem::RangeToInclusive,
|
| LangItem::RangeToInclusive,
|
||||||
_,
|
_,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
@ -132,7 +132,12 @@ impl Visitor<'tcx> for TypeParamSpanVisitor<'tcx> {
|
|||||||
[segment]
|
[segment]
|
||||||
if segment
|
if segment
|
||||||
.res
|
.res
|
||||||
.map(|res| matches!(res, Res::SelfTy(_, _) | Res::Def(hir::def::DefKind::TyParam, _)))
|
.map(|res| {
|
||||||
|
matches!(
|
||||||
|
res,
|
||||||
|
Res::SelfTy(_, _) | Res::Def(hir::def::DefKind::TyParam, _)
|
||||||
|
)
|
||||||
|
})
|
||||||
.unwrap_or(false) =>
|
.unwrap_or(false) =>
|
||||||
{
|
{
|
||||||
self.types.push(path.span);
|
self.types.push(path.span);
|
||||||
|
@ -569,9 +569,9 @@ impl<'hir> Map<'hir> {
|
|||||||
self.find(self.get_parent_node(id)),
|
self.find(self.get_parent_node(id)),
|
||||||
Some(
|
Some(
|
||||||
Node::Item(_)
|
Node::Item(_)
|
||||||
| Node::TraitItem(_)
|
| Node::TraitItem(_)
|
||||||
| Node::ImplItem(_)
|
| Node::ImplItem(_)
|
||||||
| Node::Expr(Expr { kind: ExprKind::Closure(..), .. }),
|
| Node::Expr(Expr { kind: ExprKind::Closure(..), .. }),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -962,8 +962,7 @@ impl<'tcx> LocalDecl<'tcx> {
|
|||||||
opt_ty_info: _,
|
opt_ty_info: _,
|
||||||
opt_match_place: _,
|
opt_match_place: _,
|
||||||
pat_span: _,
|
pat_span: _,
|
||||||
})
|
}) | BindingForm::ImplicitSelf(ImplicitSelfKind::Imm),
|
||||||
| BindingForm::ImplicitSelf(ImplicitSelfKind::Imm),
|
|
||||||
)))
|
)))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -980,8 +979,7 @@ impl<'tcx> LocalDecl<'tcx> {
|
|||||||
opt_ty_info: _,
|
opt_ty_info: _,
|
||||||
opt_match_place: _,
|
opt_match_place: _,
|
||||||
pat_span: _,
|
pat_span: _,
|
||||||
})
|
}) | BindingForm::ImplicitSelf(_),
|
||||||
| BindingForm::ImplicitSelf(_),
|
|
||||||
)))
|
)))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,17 @@ impl<'tcx> TyS<'tcx> {
|
|||||||
pub fn is_primitive_ty(&self) -> bool {
|
pub fn is_primitive_ty(&self) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
self.kind(),
|
self.kind(),
|
||||||
Bool | Char | Str | Int(_) | Uint(_) | Float(_)
|
Bool | Char
|
||||||
| Infer(
|
| Str
|
||||||
InferTy::IntVar(_)
|
| Int(_)
|
||||||
| InferTy::FloatVar(_)
|
| Uint(_)
|
||||||
| InferTy::FreshIntTy(_)
|
| Float(_)
|
||||||
| InferTy::FreshFloatTy(_)
|
| Infer(
|
||||||
)
|
InferTy::IntVar(_)
|
||||||
|
| InferTy::FloatVar(_)
|
||||||
|
| InferTy::FreshIntTy(_)
|
||||||
|
| InferTy::FreshFloatTy(_)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -646,11 +646,14 @@ impl<T> Trait<T> for X {
|
|||||||
let current_method_ident = body_owner.and_then(|n| n.ident()).map(|i| i.name);
|
let current_method_ident = body_owner.and_then(|n| n.ident()).map(|i| i.name);
|
||||||
|
|
||||||
// We don't want to suggest calling an assoc fn in a scope where that isn't feasible.
|
// We don't want to suggest calling an assoc fn in a scope where that isn't feasible.
|
||||||
let callable_scope = matches!(body_owner, Some(
|
let callable_scope = matches!(
|
||||||
|
body_owner,
|
||||||
|
Some(
|
||||||
hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(..), .. })
|
hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(..), .. })
|
||||||
| hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn(..), .. })
|
| hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn(..), .. })
|
||||||
| hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Fn(..), .. }),
|
| hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Fn(..), .. }),
|
||||||
));
|
)
|
||||||
|
);
|
||||||
let impl_comparison = matches!(
|
let impl_comparison = matches!(
|
||||||
cause_code,
|
cause_code,
|
||||||
ObligationCauseCode::CompareImplMethodObligation { .. }
|
ObligationCauseCode::CompareImplMethodObligation { .. }
|
||||||
|
@ -1871,8 +1871,14 @@ impl<'tcx> TyS<'tcx> {
|
|||||||
pub fn is_scalar(&self) -> bool {
|
pub fn is_scalar(&self) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
self.kind(),
|
self.kind(),
|
||||||
Bool | Char | Int(_) | Float(_) | Uint(_) | FnDef(..) | FnPtr(_) | RawPtr(_)
|
Bool | Char
|
||||||
| Infer(IntVar(_) | FloatVar(_))
|
| Int(_)
|
||||||
|
| Float(_)
|
||||||
|
| Uint(_)
|
||||||
|
| FnDef(..)
|
||||||
|
| FnPtr(_)
|
||||||
|
| RawPtr(_)
|
||||||
|
| Infer(IntVar(_) | FloatVar(_))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ use crate::build::{BlockAnd, BlockAndExtension, Builder};
|
|||||||
use crate::thir::*;
|
use crate::thir::*;
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_hir::HirId;
|
use rustc_hir::HirId;
|
||||||
use rustc_middle::middle::region;
|
|
||||||
use rustc_middle::hir::place::ProjectionKind as HirProjectionKind;
|
use rustc_middle::hir::place::ProjectionKind as HirProjectionKind;
|
||||||
|
use rustc_middle::middle::region;
|
||||||
use rustc_middle::mir::AssertKind::BoundsCheck;
|
use rustc_middle::mir::AssertKind::BoundsCheck;
|
||||||
use rustc_middle::mir::*;
|
use rustc_middle::mir::*;
|
||||||
use rustc_middle::ty::{self, CanonicalUserTypeAnnotation, Ty, TyCtxt, Variance};
|
use rustc_middle::ty::{self, CanonicalUserTypeAnnotation, Ty, TyCtxt, Variance};
|
||||||
@ -57,7 +57,8 @@ crate enum PlaceBase {
|
|||||||
/// DefId of the closure
|
/// DefId of the closure
|
||||||
closure_def_id: DefId,
|
closure_def_id: DefId,
|
||||||
/// The trait closure implements, `Fn`, `FnMut`, `FnOnce`
|
/// The trait closure implements, `Fn`, `FnMut`, `FnOnce`
|
||||||
closure_kind: ty::ClosureKind },
|
closure_kind: ty::ClosureKind,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `PlaceBuilder` is used to create places during MIR construction. It allows you to "build up" a
|
/// `PlaceBuilder` is used to create places during MIR construction. It allows you to "build up" a
|
||||||
@ -81,8 +82,7 @@ crate struct PlaceBuilder<'tcx> {
|
|||||||
fn convert_to_hir_projections_and_truncate_for_capture<'tcx>(
|
fn convert_to_hir_projections_and_truncate_for_capture<'tcx>(
|
||||||
mir_projections: &[PlaceElem<'tcx>],
|
mir_projections: &[PlaceElem<'tcx>],
|
||||||
) -> Vec<HirProjectionKind> {
|
) -> Vec<HirProjectionKind> {
|
||||||
|
let mut hir_projections = Vec::new();
|
||||||
let mut hir_projections = Vec::new();
|
|
||||||
|
|
||||||
for mir_projection in mir_projections {
|
for mir_projection in mir_projections {
|
||||||
let hir_projection = match mir_projection {
|
let hir_projection = match mir_projection {
|
||||||
@ -91,20 +91,20 @@ fn convert_to_hir_projections_and_truncate_for_capture<'tcx>(
|
|||||||
// We will never encouter this for multivariant enums,
|
// We will never encouter this for multivariant enums,
|
||||||
// read the comment for `Downcast`.
|
// read the comment for `Downcast`.
|
||||||
HirProjectionKind::Field(field.index() as u32, VariantIdx::new(0))
|
HirProjectionKind::Field(field.index() as u32, VariantIdx::new(0))
|
||||||
},
|
}
|
||||||
ProjectionElem::Downcast(..) => {
|
ProjectionElem::Downcast(..) => {
|
||||||
// This projections exist only for enums that have
|
// This projections exist only for enums that have
|
||||||
// multiple variants. Since such enums that are captured
|
// multiple variants. Since such enums that are captured
|
||||||
// completely, we can stop here.
|
// completely, we can stop here.
|
||||||
break
|
break;
|
||||||
},
|
}
|
||||||
ProjectionElem::Index(..)
|
ProjectionElem::Index(..)
|
||||||
| ProjectionElem::ConstantIndex { .. }
|
| ProjectionElem::ConstantIndex { .. }
|
||||||
| ProjectionElem::Subslice { .. } => {
|
| ProjectionElem::Subslice { .. } => {
|
||||||
// We don't capture array-access projections.
|
// We don't capture array-access projections.
|
||||||
// We can stop here as arrays are captured completely.
|
// We can stop here as arrays are captured completely.
|
||||||
break
|
break;
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
hir_projections.push(hir_projection);
|
hir_projections.push(hir_projection);
|
||||||
@ -181,9 +181,9 @@ fn find_capture_matching_projections<'a, 'tcx>(
|
|||||||
// If an ancestor is found, `idx` is the index within the list of captured places
|
// If an ancestor is found, `idx` is the index within the list of captured places
|
||||||
// for root variable `var_hir_id` and `capture` is the `ty::CapturedPlace` itself.
|
// for root variable `var_hir_id` and `capture` is the `ty::CapturedPlace` itself.
|
||||||
let (idx, capture) = root_variable_min_captures.iter().enumerate().find(|(_, capture)| {
|
let (idx, capture) = root_variable_min_captures.iter().enumerate().find(|(_, capture)| {
|
||||||
let possible_ancestor_proj_kinds =
|
let possible_ancestor_proj_kinds =
|
||||||
capture.place.projections.iter().map(|proj| proj.kind).collect();
|
capture.place.projections.iter().map(|proj| proj.kind).collect();
|
||||||
is_ancestor_or_same_capture(&possible_ancestor_proj_kinds, &hir_projections)
|
is_ancestor_or_same_capture(&possible_ancestor_proj_kinds, &hir_projections)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// Convert index to be from the presepective of the entire closure_min_captures map
|
// Convert index to be from the presepective of the entire closure_min_captures map
|
||||||
@ -213,35 +213,34 @@ fn to_upvars_resolved_place_builder<'a, 'tcx>(
|
|||||||
ty::ClosureKind::FnOnce => {}
|
ty::ClosureKind::FnOnce => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let (capture_index, capture) =
|
let (capture_index, capture) = if let Some(capture_details) =
|
||||||
if let Some(capture_details) = find_capture_matching_projections(
|
find_capture_matching_projections(
|
||||||
typeck_results,
|
typeck_results,
|
||||||
var_hir_id,
|
var_hir_id,
|
||||||
closure_def_id,
|
closure_def_id,
|
||||||
&from_builder.projection,
|
&from_builder.projection,
|
||||||
) {
|
) {
|
||||||
capture_details
|
capture_details
|
||||||
} else {
|
} else {
|
||||||
if !tcx.features().capture_disjoint_fields {
|
if !tcx.features().capture_disjoint_fields {
|
||||||
bug!(
|
bug!(
|
||||||
"No associated capture found for {:?}[{:#?}] even though \
|
"No associated capture found for {:?}[{:#?}] even though \
|
||||||
capture_disjoint_fields isn't enabled",
|
capture_disjoint_fields isn't enabled",
|
||||||
var_hir_id,
|
var_hir_id,
|
||||||
from_builder.projection
|
from_builder.projection
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// FIXME(project-rfc-2229#24): Handle this case properly
|
// FIXME(project-rfc-2229#24): Handle this case properly
|
||||||
debug!(
|
debug!(
|
||||||
"No associated capture found for {:?}[{:#?}]",
|
"No associated capture found for {:?}[{:#?}]",
|
||||||
var_hir_id,
|
var_hir_id, from_builder.projection,
|
||||||
from_builder.projection,
|
);
|
||||||
);
|
}
|
||||||
}
|
return Err(var_hir_id);
|
||||||
return Err(var_hir_id);
|
};
|
||||||
};
|
|
||||||
|
|
||||||
let closure_ty =
|
let closure_ty = typeck_results
|
||||||
typeck_results.node_type(tcx.hir().local_def_id_to_hir_id(closure_def_id.expect_local()));
|
.node_type(tcx.hir().local_def_id_to_hir_id(closure_def_id.expect_local()));
|
||||||
|
|
||||||
let substs = match closure_ty.kind() {
|
let substs = match closure_ty.kind() {
|
||||||
ty::Closure(_, substs) => ty::UpvarSubsts::Closure(substs),
|
ty::Closure(_, substs) => ty::UpvarSubsts::Closure(substs),
|
||||||
@ -256,7 +255,8 @@ fn to_upvars_resolved_place_builder<'a, 'tcx>(
|
|||||||
// we know that the capture exists and is the `capture_index`-th capture.
|
// we know that the capture exists and is the `capture_index`-th capture.
|
||||||
let var_ty = substs.tupled_upvars_ty().tuple_element_ty(capture_index).unwrap();
|
let var_ty = substs.tupled_upvars_ty().tuple_element_ty(capture_index).unwrap();
|
||||||
|
|
||||||
upvar_resolved_place_builder = upvar_resolved_place_builder.field(Field::new(capture_index), var_ty);
|
upvar_resolved_place_builder =
|
||||||
|
upvar_resolved_place_builder.field(Field::new(capture_index), var_ty);
|
||||||
|
|
||||||
// If the variable is captured via ByRef(Immutable/Mutable) Borrow,
|
// If the variable is captured via ByRef(Immutable/Mutable) Borrow,
|
||||||
// we need to deref it
|
// we need to deref it
|
||||||
@ -270,8 +270,9 @@ fn to_upvars_resolved_place_builder<'a, 'tcx>(
|
|||||||
|
|
||||||
// We used some of the projections to build the capture itself,
|
// We used some of the projections to build the capture itself,
|
||||||
// now we apply the remaining to the upvar resolved place.
|
// now we apply the remaining to the upvar resolved place.
|
||||||
upvar_resolved_place_builder.projection.extend(
|
upvar_resolved_place_builder
|
||||||
curr_projections.drain(next_projection..));
|
.projection
|
||||||
|
.extend(curr_projections.drain(next_projection..));
|
||||||
|
|
||||||
Ok(upvar_resolved_place_builder)
|
Ok(upvar_resolved_place_builder)
|
||||||
}
|
}
|
||||||
@ -356,7 +357,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
|
|
||||||
/// This is used when constructing a compound `Place`, so that we can avoid creating
|
/// This is used when constructing a compound `Place`, so that we can avoid creating
|
||||||
/// intermediate `Place` values until we know the full set of projections.
|
/// intermediate `Place` values until we know the full set of projections.
|
||||||
crate fn as_place_builder<M>(&mut self, block: BasicBlock, expr: M) -> BlockAnd<PlaceBuilder<'tcx>>
|
crate fn as_place_builder<M>(
|
||||||
|
&mut self,
|
||||||
|
block: BasicBlock,
|
||||||
|
expr: M,
|
||||||
|
) -> BlockAnd<PlaceBuilder<'tcx>>
|
||||||
where
|
where
|
||||||
M: Mirror<'tcx, Output = Expr<'tcx>>,
|
M: Mirror<'tcx, Output = Expr<'tcx>>,
|
||||||
{
|
{
|
||||||
@ -627,7 +632,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
if is_outermost_index {
|
if is_outermost_index {
|
||||||
self.read_fake_borrows(block, fake_borrow_temps, source_info)
|
self.read_fake_borrows(block, fake_borrow_temps, source_info)
|
||||||
} else {
|
} else {
|
||||||
base_place = base_place.expect_upvars_resolved(self.hir.tcx(), self.hir.typeck_results());
|
base_place =
|
||||||
|
base_place.expect_upvars_resolved(self.hir.tcx(), self.hir.typeck_results());
|
||||||
self.add_fake_borrows_of_base(
|
self.add_fake_borrows_of_base(
|
||||||
&base_place,
|
&base_place,
|
||||||
block,
|
block,
|
||||||
@ -679,7 +685,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
let tcx = self.hir.tcx();
|
let tcx = self.hir.tcx();
|
||||||
let local = match base_place.base {
|
let local = match base_place.base {
|
||||||
PlaceBase::Local(local) => local,
|
PlaceBase::Local(local) => local,
|
||||||
PlaceBase::Upvar { .. } => bug!("Expected PlacseBase::Local found Upvar")
|
PlaceBase::Upvar { .. } => bug!("Expected PlacseBase::Local found Upvar"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let place_ty = Place::ty_from(local, &base_place.projection, &self.local_decls, tcx);
|
let place_ty = Place::ty_from(local, &base_place.projection, &self.local_decls, tcx);
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
use rustc_index::vec::Idx;
|
use rustc_index::vec::Idx;
|
||||||
|
|
||||||
|
use crate::build::expr::as_place::PlaceBase;
|
||||||
use crate::build::expr::category::{Category, RvalueFunc};
|
use crate::build::expr::category::{Category, RvalueFunc};
|
||||||
use crate::build::{BlockAnd, BlockAndExtension, Builder};
|
use crate::build::{BlockAnd, BlockAndExtension, Builder};
|
||||||
use crate::build::expr::as_place::PlaceBase;
|
|
||||||
use crate::thir::*;
|
use crate::thir::*;
|
||||||
use rustc_middle::middle::region;
|
use rustc_middle::middle::region;
|
||||||
use rustc_middle::mir::AssertKind;
|
use rustc_middle::mir::AssertKind;
|
||||||
@ -274,7 +274,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
| ExprKind::ValueTypeAscription { .. } => {
|
| ExprKind::ValueTypeAscription { .. } => {
|
||||||
// these do not have corresponding `Rvalue` variants,
|
// these do not have corresponding `Rvalue` variants,
|
||||||
// so make an operand and then return that
|
// so make an operand and then return that
|
||||||
debug_assert!(!matches!(Category::of(&expr.kind), Some(Category::Rvalue(RvalueFunc::AsRvalue))));
|
debug_assert!(!matches!(
|
||||||
|
Category::of(&expr.kind),
|
||||||
|
Some(Category::Rvalue(RvalueFunc::AsRvalue))
|
||||||
|
));
|
||||||
let operand = unpack!(block = this.as_operand(block, scope, expr));
|
let operand = unpack!(block = this.as_operand(block, scope, expr));
|
||||||
block.and(Rvalue::Use(operand))
|
block.and(Rvalue::Use(operand))
|
||||||
}
|
}
|
||||||
@ -401,34 +404,39 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
// We are capturing a path that starts off a local variable in the parent.
|
// We are capturing a path that starts off a local variable in the parent.
|
||||||
// The mutability of the current capture is same as the mutability
|
// The mutability of the current capture is same as the mutability
|
||||||
// of the local declaration in the parent.
|
// of the local declaration in the parent.
|
||||||
PlaceBase::Local(local) => this.local_decls[local].mutability,
|
PlaceBase::Local(local) => this.local_decls[local].mutability,
|
||||||
// Parent is a closure and we are capturing a path that is captured
|
// Parent is a closure and we are capturing a path that is captured
|
||||||
// by the parent itself. The mutability of the current capture
|
// by the parent itself. The mutability of the current capture
|
||||||
// is same as that of the capture in the parent closure.
|
// is same as that of the capture in the parent closure.
|
||||||
PlaceBase::Upvar { .. } => {
|
PlaceBase::Upvar { .. } => {
|
||||||
let enclosing_upvars_resolved = arg_place_builder.clone().into_place(
|
let enclosing_upvars_resolved =
|
||||||
this.hir.tcx(),
|
arg_place_builder.clone().into_place(this.hir.tcx(), this.hir.typeck_results());
|
||||||
this.hir.typeck_results());
|
|
||||||
|
|
||||||
match enclosing_upvars_resolved.as_ref() {
|
match enclosing_upvars_resolved.as_ref() {
|
||||||
PlaceRef { local, projection: &[ProjectionElem::Field(upvar_index, _), ..] }
|
PlaceRef {
|
||||||
|
local,
|
||||||
|
projection: &[ProjectionElem::Field(upvar_index, _), ..],
|
||||||
|
}
|
||||||
| PlaceRef {
|
| PlaceRef {
|
||||||
local,
|
local,
|
||||||
projection: &[ProjectionElem::Deref, ProjectionElem::Field(upvar_index, _), ..] } => {
|
projection:
|
||||||
// Not in a closure
|
&[ProjectionElem::Deref, ProjectionElem::Field(upvar_index, _), ..],
|
||||||
debug_assert!(
|
} => {
|
||||||
local == Local::new(1),
|
// Not in a closure
|
||||||
"Expected local to be Local(1), found {:?}",
|
debug_assert!(
|
||||||
local
|
local == Local::new(1),
|
||||||
);
|
"Expected local to be Local(1), found {:?}",
|
||||||
// Not in a closure
|
local
|
||||||
debug_assert!(
|
);
|
||||||
this.upvar_mutbls.len() > upvar_index.index(),
|
// Not in a closure
|
||||||
"Unexpected capture place, upvar_mutbls={:#?}, upvar_index={:?}",
|
debug_assert!(
|
||||||
this.upvar_mutbls, upvar_index
|
this.upvar_mutbls.len() > upvar_index.index(),
|
||||||
);
|
"Unexpected capture place, upvar_mutbls={:#?}, upvar_index={:?}",
|
||||||
this.upvar_mutbls[upvar_index.index()]
|
this.upvar_mutbls,
|
||||||
}
|
upvar_index
|
||||||
|
);
|
||||||
|
this.upvar_mutbls[upvar_index.index()]
|
||||||
|
}
|
||||||
_ => bug!("Unexpected capture place"),
|
_ => bug!("Unexpected capture place"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -439,9 +447,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
Mutability::Mut => BorrowKind::Mut { allow_two_phase_borrow: false },
|
Mutability::Mut => BorrowKind::Mut { allow_two_phase_borrow: false },
|
||||||
};
|
};
|
||||||
|
|
||||||
let arg_place = arg_place_builder.into_place(
|
let arg_place = arg_place_builder.into_place(this.hir.tcx(), this.hir.typeck_results());
|
||||||
this.hir.tcx(),
|
|
||||||
this.hir.typeck_results());
|
|
||||||
|
|
||||||
this.cfg.push_assign(
|
this.cfg.push_assign(
|
||||||
block,
|
block,
|
||||||
|
@ -10,7 +10,7 @@ use rustc_data_structures::stack::ensure_sufficient_stack;
|
|||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_middle::middle::region;
|
use rustc_middle::middle::region;
|
||||||
use rustc_middle::mir::*;
|
use rustc_middle::mir::*;
|
||||||
use rustc_middle::ty::{CanonicalUserTypeAnnotation};
|
use rustc_middle::ty::CanonicalUserTypeAnnotation;
|
||||||
|
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
@ -38,7 +38,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
let expr_span = expr.span;
|
let expr_span = expr.span;
|
||||||
let source_info = this.source_info(expr_span);
|
let source_info = this.source_info(expr_span);
|
||||||
|
|
||||||
let expr_is_block_or_scope = matches!(expr.kind, ExprKind::Block { .. } | ExprKind::Scope { .. });
|
let expr_is_block_or_scope =
|
||||||
|
matches!(expr.kind, ExprKind::Block { .. } | ExprKind::Scope { .. });
|
||||||
|
|
||||||
let schedule_drop = move |this: &mut Self| {
|
let schedule_drop = move |this: &mut Self| {
|
||||||
if let Some(drop_scope) = scope {
|
if let Some(drop_scope) = scope {
|
||||||
@ -68,7 +69,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
this.match_expr(destination, scope, expr_span, block, scrutinee, arms)
|
this.match_expr(destination, scope, expr_span, block, scrutinee, arms)
|
||||||
}
|
}
|
||||||
ExprKind::If { cond, then, else_opt } => {
|
ExprKind::If { cond, then, else_opt } => {
|
||||||
let place = unpack!(block = this.as_temp(block, Some(this.local_scope()), cond, Mutability::Mut));
|
let place = unpack!(
|
||||||
|
block = this.as_temp(block, Some(this.local_scope()), cond, Mutability::Mut)
|
||||||
|
);
|
||||||
let operand = Operand::Move(Place::from(place));
|
let operand = Operand::Move(Place::from(place));
|
||||||
|
|
||||||
let mut then_block = this.cfg.start_new_block();
|
let mut then_block = this.cfg.start_new_block();
|
||||||
@ -100,14 +103,17 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
join_block.unit()
|
join_block.unit()
|
||||||
},
|
}
|
||||||
ExprKind::NeverToAny { source } => {
|
ExprKind::NeverToAny { source } => {
|
||||||
let source = this.hir.mirror(source);
|
let source = this.hir.mirror(source);
|
||||||
let is_call = matches!(source.kind, ExprKind::Call { .. } | ExprKind::InlineAsm { .. });
|
let is_call =
|
||||||
|
matches!(source.kind, ExprKind::Call { .. } | ExprKind::InlineAsm { .. });
|
||||||
|
|
||||||
// (#66975) Source could be a const of type `!`, so has to
|
// (#66975) Source could be a const of type `!`, so has to
|
||||||
// exist in the generated MIR.
|
// exist in the generated MIR.
|
||||||
unpack!(block = this.as_temp(block, Some(this.local_scope()), source, Mutability::Mut,));
|
unpack!(
|
||||||
|
block = this.as_temp(block, Some(this.local_scope()), source, Mutability::Mut,)
|
||||||
|
);
|
||||||
|
|
||||||
// This is an optimization. If the expression was a call then we already have an
|
// This is an optimization. If the expression was a call then we already have an
|
||||||
// unreachable block. Don't bother to terminate it and create a new one.
|
// unreachable block. Don't bother to terminate it and create a new one.
|
||||||
@ -313,7 +319,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
.field(n, ty)
|
.field(n, ty)
|
||||||
.into_place(this.hir.tcx(), this.hir.typeck_results()),
|
.into_place(this.hir.tcx(), this.hir.typeck_results()),
|
||||||
)
|
)
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
} else {
|
} else {
|
||||||
|
@ -1692,15 +1692,21 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
let e = self.hir.mirror(e.clone());
|
let e = self.hir.mirror(e.clone());
|
||||||
let source_info = self.source_info(e.span);
|
let source_info = self.source_info(e.span);
|
||||||
(e.span, self.test_bool(block, e, source_info))
|
(e.span, self.test_bool(block, e, source_info))
|
||||||
},
|
}
|
||||||
Guard::IfLet(pat, scrutinee) => {
|
Guard::IfLet(pat, scrutinee) => {
|
||||||
let scrutinee_span = scrutinee.span();
|
let scrutinee_span = scrutinee.span();
|
||||||
let scrutinee_place = unpack!(block = self.lower_scrutinee(block, scrutinee.clone(), scrutinee_span));
|
let scrutinee_place = unpack!(
|
||||||
|
block = self.lower_scrutinee(block, scrutinee.clone(), scrutinee_span)
|
||||||
|
);
|
||||||
let mut guard_candidate = Candidate::new(scrutinee_place, &pat, false);
|
let mut guard_candidate = Candidate::new(scrutinee_place, &pat, false);
|
||||||
let wildcard = Pat::wildcard_from_ty(pat.ty);
|
let wildcard = Pat::wildcard_from_ty(pat.ty);
|
||||||
let mut otherwise_candidate = Candidate::new(scrutinee_place, &wildcard, false);
|
let mut otherwise_candidate = Candidate::new(scrutinee_place, &wildcard, false);
|
||||||
let fake_borrow_temps =
|
let fake_borrow_temps = self.lower_match_tree(
|
||||||
self.lower_match_tree(block, pat.span, false, &mut [&mut guard_candidate, &mut otherwise_candidate]);
|
block,
|
||||||
|
pat.span,
|
||||||
|
false,
|
||||||
|
&mut [&mut guard_candidate, &mut otherwise_candidate],
|
||||||
|
);
|
||||||
self.declare_bindings(
|
self.declare_bindings(
|
||||||
None,
|
None,
|
||||||
pat.span.to(arm_span.unwrap()),
|
pat.span.to(arm_span.unwrap()),
|
||||||
|
@ -32,9 +32,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
) {
|
) {
|
||||||
let tcx = self.hir.tcx();
|
let tcx = self.hir.tcx();
|
||||||
let (min_length, exact_size) = match place.ty(&self.local_decls, tcx).ty.kind() {
|
let (min_length, exact_size) = match place.ty(&self.local_decls, tcx).ty.kind() {
|
||||||
ty::Array(_, length) => {
|
ty::Array(_, length) => (length.eval_usize(tcx, self.hir.param_env), true),
|
||||||
(length.eval_usize(tcx, self.hir.param_env), true)
|
|
||||||
}
|
|
||||||
_ => ((prefix.len() + suffix.len()).try_into().unwrap(), false),
|
_ => ((prefix.len() + suffix.len()).try_into().unwrap(), false),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -838,9 +838,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
_ => span_bug!(self.fn_span, "upvars with non-closure env ty {:?}", closure_ty),
|
_ => span_bug!(self.fn_span, "upvars with non-closure env ty {:?}", closure_ty),
|
||||||
};
|
};
|
||||||
let capture_tys = upvar_substs.upvar_tys();
|
let capture_tys = upvar_substs.upvar_tys();
|
||||||
let captures_with_tys = hir_typeck_results
|
let captures_with_tys =
|
||||||
.closure_min_captures_flattened(fn_def_id)
|
hir_typeck_results.closure_min_captures_flattened(fn_def_id).zip(capture_tys);
|
||||||
.zip(capture_tys);
|
|
||||||
|
|
||||||
self.upvar_mutbls = captures_with_tys
|
self.upvar_mutbls = captures_with_tys
|
||||||
.enumerate()
|
.enumerate()
|
||||||
@ -848,7 +847,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
let capture = captured_place.info.capture_kind;
|
let capture = captured_place.info.capture_kind;
|
||||||
let var_id = match captured_place.place.base {
|
let var_id = match captured_place.place.base {
|
||||||
HirPlaceBase::Upvar(upvar_id) => upvar_id.var_path.hir_id,
|
HirPlaceBase::Upvar(upvar_id) => upvar_id.var_path.hir_id,
|
||||||
_ => bug!("Expected an upvar")
|
_ => bug!("Expected an upvar"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mutability = captured_place.mutability;
|
let mutability = captured_place.mutability;
|
||||||
|
@ -931,10 +931,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
let local_scope = self.local_scope();
|
let local_scope = self.local_scope();
|
||||||
let scope = self.scopes.scopes.last_mut().unwrap();
|
let scope = self.scopes.scopes.last_mut().unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(scope.region_scope, local_scope, "local scope is not the topmost scope!",);
|
||||||
scope.region_scope, local_scope,
|
|
||||||
"local scope is not the topmost scope!",
|
|
||||||
);
|
|
||||||
|
|
||||||
// look for moves of a local variable, like `MOVE(_X)`
|
// look for moves of a local variable, like `MOVE(_X)`
|
||||||
let locals_moved = operands
|
let locals_moved = operands
|
||||||
@ -1046,9 +1043,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
matches!(
|
matches!(
|
||||||
self.cfg.block_data(start).terminator().kind,
|
self.cfg.block_data(start).terminator().kind,
|
||||||
TerminatorKind::Assert { .. }
|
TerminatorKind::Assert { .. }
|
||||||
| TerminatorKind::Call {..}
|
| TerminatorKind::Call { .. }
|
||||||
| TerminatorKind::DropAndReplace { .. }
|
| TerminatorKind::DropAndReplace { .. }
|
||||||
| TerminatorKind::FalseUnwind { .. }
|
| TerminatorKind::FalseUnwind { .. }
|
||||||
),
|
),
|
||||||
"diverge_from called on block with terminator that cannot unwind."
|
"diverge_from called on block with terminator that cannot unwind."
|
||||||
);
|
);
|
||||||
|
@ -41,13 +41,16 @@ impl<'a> Parser<'a> {
|
|||||||
},
|
},
|
||||||
NonterminalKind::Block => match token.kind {
|
NonterminalKind::Block => match token.kind {
|
||||||
token::OpenDelim(token::Brace) => true,
|
token::OpenDelim(token::Brace) => true,
|
||||||
token::Interpolated(ref nt) => !matches!(**nt, token::NtItem(_)
|
token::Interpolated(ref nt) => !matches!(
|
||||||
| token::NtPat(_)
|
**nt,
|
||||||
| token::NtTy(_)
|
token::NtItem(_)
|
||||||
| token::NtIdent(..)
|
| token::NtPat(_)
|
||||||
| token::NtMeta(_)
|
| token::NtTy(_)
|
||||||
| token::NtPath(_)
|
| token::NtIdent(..)
|
||||||
| token::NtVis(_)),
|
| token::NtMeta(_)
|
||||||
|
| token::NtPath(_)
|
||||||
|
| token::NtVis(_)
|
||||||
|
),
|
||||||
_ => false,
|
_ => false,
|
||||||
},
|
},
|
||||||
NonterminalKind::Path | NonterminalKind::Meta => match token.kind {
|
NonterminalKind::Path | NonterminalKind::Meta => match token.kind {
|
||||||
|
@ -553,7 +553,8 @@ impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'tcx> {
|
|||||||
// optional. They inherit stability from their parents when unannotated.
|
// optional. They inherit stability from their parents when unannotated.
|
||||||
if !matches!(
|
if !matches!(
|
||||||
i.kind,
|
i.kind,
|
||||||
hir::ItemKind::Impl(hir::Impl { of_trait: None, .. }) | hir::ItemKind::ForeignMod { .. }
|
hir::ItemKind::Impl(hir::Impl { of_trait: None, .. })
|
||||||
|
| hir::ItemKind::ForeignMod { .. }
|
||||||
) {
|
) {
|
||||||
self.check_missing_stability(i.hir_id, i.span);
|
self.check_missing_stability(i.hir_id, i.span);
|
||||||
}
|
}
|
||||||
|
@ -1659,12 +1659,15 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
|||||||
match missing {
|
match missing {
|
||||||
MissingLifetimeSpot::Generics(generics) => {
|
MissingLifetimeSpot::Generics(generics) => {
|
||||||
let (span, sugg) = if let Some(param) = generics.params.iter().find(|p| {
|
let (span, sugg) = if let Some(param) = generics.params.iter().find(|p| {
|
||||||
!matches!(p.kind, hir::GenericParamKind::Type {
|
!matches!(
|
||||||
synthetic: Some(hir::SyntheticTyParamKind::ImplTrait),
|
p.kind,
|
||||||
..
|
hir::GenericParamKind::Type {
|
||||||
} | hir::GenericParamKind::Lifetime {
|
synthetic: Some(hir::SyntheticTyParamKind::ImplTrait),
|
||||||
kind: hir::LifetimeParamKind::Elided,
|
..
|
||||||
})
|
} | hir::GenericParamKind::Lifetime {
|
||||||
|
kind: hir::LifetimeParamKind::Elided,
|
||||||
|
}
|
||||||
|
)
|
||||||
}) {
|
}) {
|
||||||
(param.span.shrink_to_lo(), format!("{}, ", lifetime_ref))
|
(param.span.shrink_to_lo(), format!("{}, ", lifetime_ref))
|
||||||
} else {
|
} else {
|
||||||
@ -1844,10 +1847,13 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
|||||||
msg = "consider introducing a named lifetime parameter".to_string();
|
msg = "consider introducing a named lifetime parameter".to_string();
|
||||||
should_break = true;
|
should_break = true;
|
||||||
if let Some(param) = generics.params.iter().find(|p| {
|
if let Some(param) = generics.params.iter().find(|p| {
|
||||||
!matches!(p.kind, hir::GenericParamKind::Type {
|
!matches!(
|
||||||
synthetic: Some(hir::SyntheticTyParamKind::ImplTrait),
|
p.kind,
|
||||||
..
|
hir::GenericParamKind::Type {
|
||||||
})
|
synthetic: Some(hir::SyntheticTyParamKind::ImplTrait),
|
||||||
|
..
|
||||||
|
}
|
||||||
|
)
|
||||||
}) {
|
}) {
|
||||||
(param.span.shrink_to_lo(), "'a, ".to_string())
|
(param.span.shrink_to_lo(), "'a, ".to_string())
|
||||||
} else {
|
} else {
|
||||||
|
@ -526,7 +526,7 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_indirect(&self) -> bool {
|
pub fn is_indirect(&self) -> bool {
|
||||||
matches!(self.mode, PassMode::Indirect {..})
|
matches!(self.mode, PassMode::Indirect { .. })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_sized_indirect(&self) -> bool {
|
pub fn is_sized_indirect(&self) -> bool {
|
||||||
|
@ -1190,9 +1190,12 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||||||
normalized_ty, data.ty
|
normalized_ty, data.ty
|
||||||
);
|
);
|
||||||
|
|
||||||
let is_normalized_ty_expected = !matches!(obligation.cause.code, ObligationCauseCode::ItemObligation(_)
|
let is_normalized_ty_expected = !matches!(
|
||||||
| ObligationCauseCode::BindingObligation(_, _)
|
obligation.cause.code,
|
||||||
| ObligationCauseCode::ObjectCastObligation(_));
|
ObligationCauseCode::ItemObligation(_)
|
||||||
|
| ObligationCauseCode::BindingObligation(_, _)
|
||||||
|
| ObligationCauseCode::ObjectCastObligation(_)
|
||||||
|
);
|
||||||
|
|
||||||
if let Err(error) = self.at(&obligation.cause, obligation.param_env).eq_exp(
|
if let Err(error) = self.at(&obligation.cause, obligation.param_env).eq_exp(
|
||||||
is_normalized_ty_expected,
|
is_normalized_ty_expected,
|
||||||
|
@ -290,9 +290,9 @@ fn suggest_restriction(
|
|||||||
generics
|
generics
|
||||||
.params
|
.params
|
||||||
.iter()
|
.iter()
|
||||||
.filter(
|
.filter(|p| {
|
||||||
|p| !matches!(p.kind, hir::GenericParamKind::Type { synthetic: Some(_), ..}),
|
!matches!(p.kind, hir::GenericParamKind::Type { synthetic: Some(_), .. })
|
||||||
)
|
})
|
||||||
.next(),
|
.next(),
|
||||||
super_traits,
|
super_traits,
|
||||||
) {
|
) {
|
||||||
|
@ -496,14 +496,15 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||||||
) -> bool {
|
) -> bool {
|
||||||
let explicit = !seg.infer_args;
|
let explicit = !seg.infer_args;
|
||||||
let impl_trait = generics.params.iter().any(|param| {
|
let impl_trait = generics.params.iter().any(|param| {
|
||||||
matches!(param.kind, ty::GenericParamDefKind::Type {
|
matches!(
|
||||||
synthetic:
|
param.kind,
|
||||||
Some(
|
ty::GenericParamDefKind::Type {
|
||||||
hir::SyntheticTyParamKind::ImplTrait
|
synthetic: Some(
|
||||||
| hir::SyntheticTyParamKind::FromAttr,
|
hir::SyntheticTyParamKind::ImplTrait | hir::SyntheticTyParamKind::FromAttr,
|
||||||
),
|
),
|
||||||
..
|
..
|
||||||
})
|
}
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
if explicit && impl_trait {
|
if explicit && impl_trait {
|
||||||
|
@ -274,10 +274,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let autoborrow_mut = adj.iter().any(|adj| {
|
let autoborrow_mut = adj.iter().any(|adj| {
|
||||||
matches!(adj, &Adjustment {
|
matches!(
|
||||||
kind: Adjust::Borrow(AutoBorrow::Ref(_, AutoBorrowMutability::Mut { .. })),
|
adj,
|
||||||
..
|
&Adjustment {
|
||||||
})
|
kind: Adjust::Borrow(AutoBorrow::Ref(_, AutoBorrowMutability::Mut { .. })),
|
||||||
|
..
|
||||||
|
}
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
match self.typeck_results.borrow_mut().adjustments_mut().entry(expr.hir_id) {
|
match self.typeck_results.borrow_mut().adjustments_mut().entry(expr.hir_id) {
|
||||||
|
@ -173,9 +173,11 @@ macro_rules! default_impl {
|
|||||||
impl Default for $t {
|
impl Default for $t {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[doc = $doc]
|
#[doc = $doc]
|
||||||
fn default() -> $t { $v }
|
fn default() -> $t {
|
||||||
|
$v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
default_impl! { (), (), "Returns the default value of `()`" }
|
default_impl! { (), (), "Returns the default value of `()`" }
|
||||||
|
@ -6,7 +6,7 @@ merge_derives = false
|
|||||||
# by default we ignore everything in the repository
|
# by default we ignore everything in the repository
|
||||||
# tidy only checks files which are not ignored, each entry follows gitignore style
|
# tidy only checks files which are not ignored, each entry follows gitignore style
|
||||||
ignore = [
|
ignore = [
|
||||||
"build",
|
"/build/",
|
||||||
"/vendor/",
|
"/vendor/",
|
||||||
|
|
||||||
# tests for now are not formatted, as they are sometimes pretty-printing constrained
|
# tests for now are not formatted, as they are sometimes pretty-printing constrained
|
||||||
|
@ -15,7 +15,7 @@ fn main() {
|
|||||||
|
|
||||||
// check_version warnings are not printed during setup
|
// check_version warnings are not printed during setup
|
||||||
let changelog_suggestion =
|
let changelog_suggestion =
|
||||||
if matches!(config.cmd, Subcommand::Setup {..}) { None } else { check_version(&config) };
|
if matches!(config.cmd, Subcommand::Setup { .. }) { None } else { check_version(&config) };
|
||||||
|
|
||||||
// NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the
|
// NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the
|
||||||
// changelog warning, not the `x.py setup` message.
|
// changelog warning, not the `x.py setup` message.
|
||||||
|
@ -19,7 +19,7 @@ rustc: beta
|
|||||||
# bootstrapping issues with use of new syntax in this repo. If you're looking at
|
# bootstrapping issues with use of new syntax in this repo. If you're looking at
|
||||||
# the beta/stable branch, this key should be omitted, as we don't want to depend
|
# the beta/stable branch, this key should be omitted, as we don't want to depend
|
||||||
# on rustfmt from nightly there.
|
# on rustfmt from nightly there.
|
||||||
rustfmt: nightly-2020-11-19
|
rustfmt: nightly-2021-01-28
|
||||||
|
|
||||||
# When making a stable release the process currently looks like:
|
# When making a stable release the process currently looks like:
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user