Skip to content

Commit 387dcff

Browse files
committed
review comments: clean up
1 parent 2340067 commit 387dcff

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

src/librustc_codegen_llvm/context.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use std::iter;
3030
use std::str;
3131
use std::sync::Arc;
3232
use syntax::symbol::LocalInternedString;
33-
use syntax::source_map::Span;
33+
use syntax::source_map::{DUMMY_SP, Span};
3434
use crate::abi::Abi;
3535

3636
/// There is one `CodegenCx` per compilation unit. Each one has its own LLVM
@@ -861,10 +861,10 @@ impl LayoutOf for CodegenCx<'ll, 'tcx> {
861861
type TyLayout = TyLayout<'tcx>;
862862

863863
fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
864-
self.spanned_layout_of(ty, None)
864+
self.spanned_layout_of(ty, DUMMY_SP)
865865
}
866866

867-
fn spanned_layout_of(&self, ty: Ty<'tcx>, span: Option<Span>) -> Self::TyLayout {
867+
fn spanned_layout_of(&self, ty: Ty<'tcx>, span: Span) -> Self::TyLayout {
868868
self.tcx.layout_of(ty::ParamEnv::reveal_all().and(ty))
869869
.unwrap_or_else(|e| if let LayoutError::SizeOverflow(_) = e {
870870
match span {

src/librustc_codegen_ssa/mir/analyze.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,13 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
182182
rvalue: &mir::Rvalue<'tcx>,
183183
location: Location) {
184184
debug!("visit_assign(place={:?}, rvalue={:?})", place, rvalue);
185-
let mut decl_span = None;
186-
if let mir::PlaceBase::Local(local) = &place.base {
187-
if let Some(decl) = self.fx.mir.local_decls.get(*local) {
188-
decl_span = Some(decl.source_info.span);
189-
}
190-
}
191185

192186
if let mir::Place {
193187
base: mir::PlaceBase::Local(index),
194188
projection: None,
195189
} = *place {
196190
self.assign(index, location);
191+
let decl_span = self.fx.mir.local_decls[index].source_info.span;
197192
if !self.fx.rvalue_creates_operand(rvalue, decl_span) {
198193
self.not_ssa(index);
199194
}

src/librustc_codegen_ssa/mir/rvalue.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc::middle::lang_items::ExchangeMallocFnLangItem;
66
use rustc_apfloat::{ieee, Float, Status, Round};
77
use std::{u128, i128};
88
use syntax::symbol::sym;
9-
use syntax::source_map::Span;
9+
use syntax::source_map::{DUMMY_SP, Span};
1010

1111
use crate::base;
1212
use crate::MemFlags;
@@ -137,7 +137,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
137137
}
138138

139139
_ => {
140-
assert!(self.rvalue_creates_operand(rvalue, None));
140+
assert!(self.rvalue_creates_operand(rvalue, DUMMY_SP));
141141
let (mut bx, temp) = self.codegen_rvalue_operand(bx, rvalue);
142142
temp.val.store(&mut bx, dest);
143143
bx
@@ -171,7 +171,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
171171
rvalue: &mir::Rvalue<'tcx>
172172
) -> (Bx, OperandRef<'tcx, Bx::Value>) {
173173
assert!(
174-
self.rvalue_creates_operand(rvalue, None),
174+
self.rvalue_creates_operand(rvalue, DUMMY_SP),
175175
"cannot codegen {:?} to operand",
176176
rvalue,
177177
);
@@ -696,7 +696,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
696696
}
697697

698698
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
699-
pub fn rvalue_creates_operand(&self, rvalue: &mir::Rvalue<'tcx>, span: Option<Span>) -> bool {
699+
pub fn rvalue_creates_operand(&self, rvalue: &mir::Rvalue<'tcx>, span: Span) -> bool {
700700
match *rvalue {
701701
mir::Rvalue::Ref(..) |
702702
mir::Rvalue::Len(..) |

src/librustc_target/abi/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ pub trait LayoutOf {
10131013
type TyLayout;
10141014

10151015
fn layout_of(&self, ty: Self::Ty) -> Self::TyLayout;
1016-
fn spanned_layout_of(&self, ty: Self::Ty, _span: Option<Span>) -> Self::TyLayout {
1016+
fn spanned_layout_of(&self, ty: Self::Ty, _span: Span) -> Self::TyLayout {
10171017
self.layout_of(ty)
10181018
}
10191019
}

0 commit comments

Comments
 (0)