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/
|
||||
/mingw-build/
|
||||
build/
|
||||
!/compiler/rustc_mir_build/src/build/
|
||||
/build-rust-analyzer/
|
||||
/dist/
|
||||
/unicode-downloads
|
||||
|
@ -73,19 +73,34 @@ pub(crate) fn as_rvalue(
|
||||
}
|
||||
ExprKind::Binary { op, lhs, rhs } => {
|
||||
let lhs = unpack!(
|
||||
block =
|
||||
this.as_operand(block, scope, &this.thir[lhs], LocalInfo::Boring, NeedsTemporary::Maybe)
|
||||
block = this.as_operand(
|
||||
block,
|
||||
scope,
|
||||
&this.thir[lhs],
|
||||
LocalInfo::Boring,
|
||||
NeedsTemporary::Maybe
|
||||
)
|
||||
);
|
||||
let rhs = unpack!(
|
||||
block =
|
||||
this.as_operand(block, scope, &this.thir[rhs], LocalInfo::Boring, NeedsTemporary::No)
|
||||
block = this.as_operand(
|
||||
block,
|
||||
scope,
|
||||
&this.thir[rhs],
|
||||
LocalInfo::Boring,
|
||||
NeedsTemporary::No
|
||||
)
|
||||
);
|
||||
this.build_binary_op(block, op, expr_span, expr.ty, lhs, rhs)
|
||||
}
|
||||
ExprKind::Unary { op, arg } => {
|
||||
let arg = unpack!(
|
||||
block =
|
||||
this.as_operand(block, scope, &this.thir[arg], LocalInfo::Boring, NeedsTemporary::No)
|
||||
block = this.as_operand(
|
||||
block,
|
||||
scope,
|
||||
&this.thir[arg],
|
||||
LocalInfo::Boring,
|
||||
NeedsTemporary::No
|
||||
)
|
||||
);
|
||||
// Check for -MIN on signed integers
|
||||
if this.check_overflow && op == UnOp::Neg && expr.ty.is_signed() {
|
||||
@ -272,8 +287,13 @@ pub(crate) fn as_rvalue(
|
||||
}
|
||||
ExprKind::Pointer { cast, source } => {
|
||||
let source = unpack!(
|
||||
block =
|
||||
this.as_operand(block, scope, &this.thir[source], LocalInfo::Boring, NeedsTemporary::No)
|
||||
block = this.as_operand(
|
||||
block,
|
||||
scope,
|
||||
&this.thir[source],
|
||||
LocalInfo::Boring,
|
||||
NeedsTemporary::No
|
||||
)
|
||||
);
|
||||
block.and(Rvalue::Cast(CastKind::Pointer(cast), source, expr.ty))
|
||||
}
|
||||
@ -502,8 +522,10 @@ pub(crate) fn as_rvalue(
|
||||
Category::of(&expr.kind),
|
||||
Some(Category::Rvalue(RvalueFunc::AsRvalue) | Category::Constant)
|
||||
));
|
||||
let operand =
|
||||
unpack!(block = this.as_operand(block, scope, expr, LocalInfo::Boring, NeedsTemporary::No));
|
||||
let operand = unpack!(
|
||||
block =
|
||||
this.as_operand(block, scope, expr, LocalInfo::Boring, NeedsTemporary::No)
|
||||
);
|
||||
block.and(Rvalue::Use(operand))
|
||||
}
|
||||
}
|
||||
@ -662,8 +684,9 @@ fn build_zero_repeat(
|
||||
// Repeating a const does nothing
|
||||
} else {
|
||||
// For a non-const, we may need to generate an appropriate `Drop`
|
||||
let value_operand =
|
||||
unpack!(block = this.as_operand(block, scope, value, LocalInfo::Boring, NeedsTemporary::No));
|
||||
let value_operand = unpack!(
|
||||
block = this.as_operand(block, scope, value, LocalInfo::Boring, NeedsTemporary::No)
|
||||
);
|
||||
if let Operand::Move(to_drop) = value_operand {
|
||||
let success = this.cfg.start_new_block();
|
||||
this.cfg.terminate(
|
||||
|
@ -2252,7 +2252,9 @@ fn declare_binding(
|
||||
user_ty: None,
|
||||
source_info,
|
||||
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 {
|
||||
name,
|
||||
|
@ -876,21 +876,18 @@ fn args_and_body(
|
||||
} => {
|
||||
self.local_decls[local].mutability = mutability;
|
||||
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 {
|
||||
LocalInfo::User(
|
||||
BindingForm::ImplicitSelf(kind),
|
||||
)
|
||||
} else {
|
||||
let binding_mode = ty::BindingMode::BindByValue(mutability);
|
||||
LocalInfo::User(BindingForm::Var(
|
||||
VarBindingForm {
|
||||
**self.local_decls[local].local_info.as_mut().assert_crate_local() =
|
||||
if let Some(kind) = param.self_kind {
|
||||
LocalInfo::User(BindingForm::ImplicitSelf(kind))
|
||||
} else {
|
||||
let binding_mode = ty::BindingMode::BindByValue(mutability);
|
||||
LocalInfo::User(BindingForm::Var(VarBindingForm {
|
||||
binding_mode,
|
||||
opt_ty_info: param.ty_span,
|
||||
opt_match_place: Some((None, span)),
|
||||
pat_span: span,
|
||||
},
|
||||
))
|
||||
};
|
||||
}))
|
||||
};
|
||||
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) {
|
||||
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) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user