Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #65804

Merged
merged 26 commits into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ff1860a
Fix the start/end byte positions in the compiler JSON output
Rantanen Oct 3, 2019
0b5ee56
PlaceElem<'tcx> should be Copy
spastorino Oct 11, 2019
2705412
Move as_local impl to from Place to PlaceRef
spastorino Oct 21, 2019
c787fe3
Fix check of `statx`
oxalica Oct 22, 2019
190802c
Pattern match over PlaceRef rather than Place
spastorino Oct 20, 2019
a19aed2
Add intern table for `List<PlaceElem<'tcx>>`
spastorino Oct 11, 2019
d32c286
Intern place projection
spastorino Oct 20, 2019
180fc41
Move Place::elem methods and friends to TyCtxt
spastorino Oct 21, 2019
5f5903d
Add ignore-tidy-filelength on ty/context
spastorino Oct 22, 2019
10f1bc7
Some tweaks
oxalica Oct 22, 2019
18ae175
Prevent unnecessary allocation in PathBuf::set_extension.
m-ou-se Oct 23, 2019
01a1bcb
Fix default "disable-shortcuts" feature value
GuillaumeGomez Oct 23, 2019
d7f6ba8
move panictry! to where it is used.
Centril Oct 11, 2019
0a5b38f
move Attribute::with_desugared_doc to librustdoc
Centril Oct 11, 2019
5ff7349
move report_invalid_macro_expansion_item to item.rs
Centril Oct 25, 2019
e0590ea
RFC 2008: Stabilization
davidtwco Sep 20, 2019
9e3e3a4
with_desugared_doc: correctly refer to `attr` instead of `self`
Centril Oct 25, 2019
959b6e3
Rollup merge of #64639 - davidtwco:rfc-2008-stabilization, r=Centril
Centril Oct 25, 2019
1f93be1
Rollup merge of #65074 - Rantanen:json-byte-pos, r=matklad
Centril Oct 25, 2019
8bb039f
Rollup merge of #65315 - spastorino:intern-place-projection, r=oli-obk
Centril Oct 25, 2019
f1d747a
Rollup merge of #65685 - oxalica:statx-eperm, r=alexcrichton
Centril Oct 25, 2019
3e3f21c
Rollup merge of #65731 - fusion-engineering-forks:set-extension, r=dt…
Centril Oct 25, 2019
07b5c2a
Rollup merge of #65740 - GuillaumeGomez:fix-disable-shortcut-feature,…
Centril Oct 25, 2019
0bfe483
Rollup merge of #65787 - Centril:panictry, r=davidtwco
Centril Oct 25, 2019
cbcbba2
Rollup merge of #65789 - Centril:with-desugared-doc, r=davidtwco
Centril Oct 25, 2019
c0bbb4b
Rollup merge of #65790 - Centril:move-report-invalid, r=davidtwco
Centril Oct 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Pattern match over PlaceRef rather than Place
This prepares the code base for when projection is interned. Place's
projection field is going to be `&List<PlaceElem<'tcx>>` so we won't be
able to pattern match against it.
  • Loading branch information
spastorino committed Oct 22, 2019
commit 190802cfca41df76fd7ef45d2915c89938a5904a
16 changes: 8 additions & 8 deletions src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1908,15 +1908,15 @@ impl<'tcx> Place<'tcx> {
//
// FIXME: can we safely swap the semantics of `fn base_local` below in here instead?
pub fn local_or_deref_local(&self) -> Option<Local> {
match self {
Place {
base: PlaceBase::Local(local),
projection: box [],
match self.as_ref() {
PlaceRef {
base: &PlaceBase::Local(local),
projection: &[],
} |
Place {
base: PlaceBase::Local(local),
projection: box [ProjectionElem::Deref],
} => Some(*local),
PlaceRef {
base: &PlaceBase::Local(local),
projection: &[ProjectionElem::Deref],
} => Some(local),
_ => None,
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/librustc_codegen_ssa/mir/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,7 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
location: Location) {
debug!("visit_assign(place={:?}, rvalue={:?})", place, rvalue);

if let mir::Place {
base: mir::PlaceBase::Local(index),
projection: box [],
} = *place {
if let Some(index) = place.as_local() {
self.assign(index, location);
let decl_span = self.fx.mir.local_decls[index].source_info.span;
if !self.fx.rvalue_creates_operand(rvalue, decl_span) {
Expand Down
84 changes: 34 additions & 50 deletions src/librustc_codegen_ssa/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use rustc_index::vec::Idx;
use rustc::middle::lang_items;
use rustc::ty::{self, Ty, TypeFoldable, Instance};
use rustc::ty::layout::{self, LayoutOf, HasTyCtxt, FnTypeExt};
use rustc::mir::{self, Place, PlaceBase, Static, StaticKind};
use rustc::mir::{self, PlaceBase, Static, StaticKind};
use rustc::mir::interpret::PanicInfo;
use rustc_target::abi::call::{ArgType, FnType, PassMode};
use rustc_target::spec::abi::Abi;
Expand Down Expand Up @@ -630,53 +630,43 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
// checked by const-qualification, which also
// promotes any complex rvalues to constants.
if i == 2 && intrinsic.unwrap().starts_with("simd_shuffle") {
match *arg {
match arg {
// The shuffle array argument is usually not an explicit constant,
// but specified directly in the code. This means it gets promoted
// and we can then extract the value by evaluating the promoted.
mir::Operand::Copy(
Place {
base: PlaceBase::Static(box Static {
kind: StaticKind::Promoted(promoted, _),
mir::Operand::Copy(place) | mir::Operand::Move(place) => {
if let mir::PlaceRef {
base:
&PlaceBase::Static(box Static {
kind: StaticKind::Promoted(promoted, _),
ty,
def_id: _,
}),
projection: &[],
} = place.as_ref()
{
let param_env = ty::ParamEnv::reveal_all();
let cid = mir::interpret::GlobalId {
instance: self.instance,
promoted: Some(promoted),
};
let c = bx.tcx().const_eval(param_env.and(cid));
let (llval, ty) = self.simd_shuffle_indices(
&bx,
terminator.source_info.span,
ty,
def_id: _,
}),
projection: box [],
c,
);
return OperandRef {
val: Immediate(llval),
layout: bx.layout_of(ty),
};
} else {
span_bug!(span, "shuffle indices must be constant");
}
) |
mir::Operand::Move(
Place {
base: PlaceBase::Static(box Static {
kind: StaticKind::Promoted(promoted, _),
ty,
def_id: _,
}),
projection: box [],
}
) => {
let param_env = ty::ParamEnv::reveal_all();
let cid = mir::interpret::GlobalId {
instance: self.instance,
promoted: Some(promoted),
};
let c = bx.tcx().const_eval(param_env.and(cid));
let (llval, ty) = self.simd_shuffle_indices(
&bx,
terminator.source_info.span,
ty,
c,
);
return OperandRef {
val: Immediate(llval),
layout: bx.layout_of(ty),
};

}
mir::Operand::Copy(_) |
mir::Operand::Move(_) => {
span_bug!(span, "shuffle indices must be constant");
}
mir::Operand::Constant(ref constant) => {

mir::Operand::Constant(constant) => {
let c = self.eval_mir_constant(constant);
let (llval, ty) = self.simd_shuffle_indices(
&bx,
Expand Down Expand Up @@ -1117,10 +1107,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
if fn_ret.is_ignore() {
return ReturnDest::Nothing;
}
let dest = if let mir::Place {
base: mir::PlaceBase::Local(index),
projection: box [],
} = *dest {
let dest = if let Some(index) = dest.as_local() {
match self.locals[index] {
LocalRef::Place(dest) => dest,
LocalRef::UnsizedPlace(_) => bug!("return type must be sized"),
Expand Down Expand Up @@ -1178,10 +1165,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
src: &mir::Operand<'tcx>,
dst: &mir::Place<'tcx>
) {
if let mir::Place {
base: mir::PlaceBase::Local(index),
projection: box [],
} = *dst {
if let Some(index) = dst.as_local() {
match self.locals[index] {
LocalRef::Place(place) => self.codegen_transmute_into(bx, src, place),
LocalRef::UnsizedPlace(_) => bug!("transmute must not involve unsized locals"),
Expand Down
5 changes: 1 addition & 4 deletions src/librustc_codegen_ssa/mir/rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
) -> Bx::Value {
// ZST are passed as operands and require special handling
// because codegen_place() panics if Local is operand.
if let mir::Place {
base: mir::PlaceBase::Local(index),
projection: box [],
} = *place {
if let Some(index) = place.as_local() {
if let LocalRef::Operand(Some(op)) = self.locals[index] {
if let ty::Array(_, n) = op.layout.ty.kind {
let n = n.eval_usize(bx.cx().tcx(), ty::ParamEnv::reveal_all());
Expand Down
11 changes: 4 additions & 7 deletions src/librustc_codegen_ssa/mir/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
self.set_debug_loc(&mut bx, statement.source_info);
match statement.kind {
mir::StatementKind::Assign(box(ref place, ref rvalue)) => {
if let mir::Place {
base: mir::PlaceBase::Local(index),
projection: box [],
} = place {
match self.locals[*index] {
if let Some(index) = place.as_local() {
match self.locals[index] {
LocalRef::Place(cg_dest) => {
self.codegen_rvalue(bx, cg_dest, rvalue)
}
Expand All @@ -30,7 +27,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
}
LocalRef::Operand(None) => {
let (mut bx, operand) = self.codegen_rvalue_operand(bx, rvalue);
if let Some(name) = self.mir.local_decls[*index].name {
if let Some(name) = self.mir.local_decls[index].name {
match operand.val {
OperandValue::Ref(x, ..) |
OperandValue::Immediate(x) => {
Expand All @@ -44,7 +41,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
}
}
}
self.locals[*index] = LocalRef::Operand(Some(operand));
self.locals[index] = LocalRef::Operand(Some(operand));
bx
}
LocalRef::Operand(Some(op)) => {
Expand Down
5 changes: 1 addition & 4 deletions src/librustc_mir/borrow_check/borrow_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,7 @@ impl<'a, 'tcx> GatherBorrows<'a, 'tcx> {
// TEMP = &foo
//
// so extract `temp`.
let temp = if let &mir::Place {
base: mir::PlaceBase::Local(temp),
projection: box [],
} = assigned_place {
let temp = if let Some(temp) = assigned_place.as_local() {
temp
} else {
span_bug!(
Expand Down
Loading