mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
address review comments
This commit is contained in:
parent
3a58b2b3b0
commit
675c4aa2c1
1
.gitignore
vendored
1
.gitignore
vendored
@ -42,6 +42,7 @@ no_llvm_build
|
|||||||
/llvm/
|
/llvm/
|
||||||
/mingw-build/
|
/mingw-build/
|
||||||
build/
|
build/
|
||||||
|
!/compiler/rustc_mir_build/src/build/
|
||||||
/build-rust-analyzer/
|
/build-rust-analyzer/
|
||||||
/dist/
|
/dist/
|
||||||
/unicode-downloads
|
/unicode-downloads
|
||||||
|
@ -73,19 +73,34 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
ExprKind::Binary { op, lhs, rhs } => {
|
ExprKind::Binary { op, lhs, rhs } => {
|
||||||
let lhs = unpack!(
|
let lhs = unpack!(
|
||||||
block =
|
block = this.as_operand(
|
||||||
this.as_operand(block, scope, &this.thir[lhs], LocalInfo::Boring, NeedsTemporary::Maybe)
|
block,
|
||||||
|
scope,
|
||||||
|
&this.thir[lhs],
|
||||||
|
LocalInfo::Boring,
|
||||||
|
NeedsTemporary::Maybe
|
||||||
|
)
|
||||||
);
|
);
|
||||||
let rhs = unpack!(
|
let rhs = unpack!(
|
||||||
block =
|
block = this.as_operand(
|
||||||
this.as_operand(block, scope, &this.thir[rhs], LocalInfo::Boring, NeedsTemporary::No)
|
block,
|
||||||
|
scope,
|
||||||
|
&this.thir[rhs],
|
||||||
|
LocalInfo::Boring,
|
||||||
|
NeedsTemporary::No
|
||||||
|
)
|
||||||
);
|
);
|
||||||
this.build_binary_op(block, op, expr_span, expr.ty, lhs, rhs)
|
this.build_binary_op(block, op, expr_span, expr.ty, lhs, rhs)
|
||||||
}
|
}
|
||||||
ExprKind::Unary { op, arg } => {
|
ExprKind::Unary { op, arg } => {
|
||||||
let arg = unpack!(
|
let arg = unpack!(
|
||||||
block =
|
block = this.as_operand(
|
||||||
this.as_operand(block, scope, &this.thir[arg], LocalInfo::Boring, NeedsTemporary::No)
|
block,
|
||||||
|
scope,
|
||||||
|
&this.thir[arg],
|
||||||
|
LocalInfo::Boring,
|
||||||
|
NeedsTemporary::No
|
||||||
|
)
|
||||||
);
|
);
|
||||||
// Check for -MIN on signed integers
|
// Check for -MIN on signed integers
|
||||||
if this.check_overflow && op == UnOp::Neg && expr.ty.is_signed() {
|
if this.check_overflow && op == UnOp::Neg && expr.ty.is_signed() {
|
||||||
@ -272,8 +287,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
ExprKind::Pointer { cast, source } => {
|
ExprKind::Pointer { cast, source } => {
|
||||||
let source = unpack!(
|
let source = unpack!(
|
||||||
block =
|
block = this.as_operand(
|
||||||
this.as_operand(block, scope, &this.thir[source], LocalInfo::Boring, NeedsTemporary::No)
|
block,
|
||||||
|
scope,
|
||||||
|
&this.thir[source],
|
||||||
|
LocalInfo::Boring,
|
||||||
|
NeedsTemporary::No
|
||||||
|
)
|
||||||
);
|
);
|
||||||
block.and(Rvalue::Cast(CastKind::Pointer(cast), source, expr.ty))
|
block.and(Rvalue::Cast(CastKind::Pointer(cast), source, expr.ty))
|
||||||
}
|
}
|
||||||
@ -502,8 +522,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
Category::of(&expr.kind),
|
Category::of(&expr.kind),
|
||||||
Some(Category::Rvalue(RvalueFunc::AsRvalue) | Category::Constant)
|
Some(Category::Rvalue(RvalueFunc::AsRvalue) | Category::Constant)
|
||||||
));
|
));
|
||||||
let operand =
|
let operand = unpack!(
|
||||||
unpack!(block = this.as_operand(block, scope, expr, LocalInfo::Boring, NeedsTemporary::No));
|
block =
|
||||||
|
this.as_operand(block, scope, expr, LocalInfo::Boring, NeedsTemporary::No)
|
||||||
|
);
|
||||||
block.and(Rvalue::Use(operand))
|
block.and(Rvalue::Use(operand))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -662,8 +684,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
// Repeating a const does nothing
|
// Repeating a const does nothing
|
||||||
} else {
|
} else {
|
||||||
// For a non-const, we may need to generate an appropriate `Drop`
|
// For a non-const, we may need to generate an appropriate `Drop`
|
||||||
let value_operand =
|
let value_operand = unpack!(
|
||||||
unpack!(block = this.as_operand(block, scope, value, LocalInfo::Boring, NeedsTemporary::No));
|
block = this.as_operand(block, scope, value, LocalInfo::Boring, NeedsTemporary::No)
|
||||||
|
);
|
||||||
if let Operand::Move(to_drop) = value_operand {
|
if let Operand::Move(to_drop) = value_operand {
|
||||||
let success = this.cfg.start_new_block();
|
let success = this.cfg.start_new_block();
|
||||||
this.cfg.terminate(
|
this.cfg.terminate(
|
||||||
|
@ -2252,7 +2252,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
user_ty: None,
|
user_ty: None,
|
||||||
source_info,
|
source_info,
|
||||||
internal: false,
|
internal: false,
|
||||||
local_info: ClearCrossCrate::Set(Box::new(LocalInfo::User(BindingForm::RefForGuard))),
|
local_info: ClearCrossCrate::Set(Box::new(LocalInfo::User(
|
||||||
|
BindingForm::RefForGuard,
|
||||||
|
))),
|
||||||
});
|
});
|
||||||
self.var_debug_info.push(VarDebugInfo {
|
self.var_debug_info.push(VarDebugInfo {
|
||||||
name,
|
name,
|
||||||
|
@ -876,20 +876,17 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
} => {
|
} => {
|
||||||
self.local_decls[local].mutability = mutability;
|
self.local_decls[local].mutability = mutability;
|
||||||
self.local_decls[local].source_info.scope = self.source_scope;
|
self.local_decls[local].source_info.scope = self.source_scope;
|
||||||
**self.local_decls[local].local_info.as_mut().assert_crate_local() = if let Some(kind) = param.self_kind {
|
**self.local_decls[local].local_info.as_mut().assert_crate_local() =
|
||||||
LocalInfo::User(
|
if let Some(kind) = param.self_kind {
|
||||||
BindingForm::ImplicitSelf(kind),
|
LocalInfo::User(BindingForm::ImplicitSelf(kind))
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
let binding_mode = ty::BindingMode::BindByValue(mutability);
|
let binding_mode = ty::BindingMode::BindByValue(mutability);
|
||||||
LocalInfo::User(BindingForm::Var(
|
LocalInfo::User(BindingForm::Var(VarBindingForm {
|
||||||
VarBindingForm {
|
|
||||||
binding_mode,
|
binding_mode,
|
||||||
opt_ty_info: param.ty_span,
|
opt_ty_info: param.ty_span,
|
||||||
opt_match_place: Some((None, span)),
|
opt_match_place: Some((None, span)),
|
||||||
pat_span: span,
|
pat_span: span,
|
||||||
},
|
}))
|
||||||
))
|
|
||||||
};
|
};
|
||||||
self.var_indices.insert(var, LocalsForNode::One(local));
|
self.var_indices.insert(var, LocalsForNode::One(local));
|
||||||
}
|
}
|
||||||
|
@ -228,6 +228,11 @@ fn is_unexplained_ignore(extension: &str, line: &str) -> bool {
|
|||||||
|
|
||||||
pub fn check(path: &Path, bad: &mut bool) {
|
pub fn check(path: &Path, bad: &mut bool) {
|
||||||
fn skip(path: &Path) -> bool {
|
fn skip(path: &Path) -> bool {
|
||||||
|
if path.file_name().map_or(false, |name| name.to_string_lossy().starts_with(".#")) {
|
||||||
|
// vim or emacs temporary file
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if filter_dirs(path) || skip_markdown_path(path) {
|
if filter_dirs(path) || skip_markdown_path(path) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user