8000 Rollup of 10 pull requests by Centril · Pull Request #64826 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 10 pull requests #64826

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

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c015927
Fix ICE in rustdoc when merging generic and where bounds in the case …
Nashenas88 Aug 27, 2019
09f6b44
Simplify some code in rustdoc's simplify
Nashenas88 Aug 27, 2019
143b83a
Add regression test for issue, apply suggestion to convert to assert_eq
Nashenas88 Aug 28, 2019
612ef5f
add new tests for re_rebalance_coherence
nikomatsakis Sep 12, 2019
e69d1b6
change to check-pass
nikomatsakis Sep 13, 2019
3f004a1
Fix re-rebalance coherence implementation for fundamental types
weiznich Sep 17, 2019
a9c38d9
Add more tests
weiznich Sep 18, 2019
31b3012
Split line to fix tidy
weiznich Sep 18, 2019
3ee2920
Fix some unused variable warnings
weiznich Sep 22, 2019
d2762ac
Differentiate AArch64 bare-metal targets between hf and non-hf.
andre-richter Sep 18, 2019
2666ae5
Remove whitespace from testname
weiznich Sep 23, 2019
9249a73
More path name fixes
weiznich Sep 24, 2019
5122091
Turn `walk_parent_nodes` method into an iterator
estebank Sep 26, 2019
0ec4513
Fix format macro expansions spans to be macro-generated
rinon Sep 25, 2019
dd38a0f
update rtpSpawn's parameters type(It's prototype has been updated in …
bpangWR Sep 26, 2019
ab86cec
Account for tail expressions when pointing at return type
estebank Sep 26, 2019
7f318f6
[const-prop] Replace `eval_place()` with use of `InterpCx`
wesleywiser Sep 4, 2019
1a78e66
[const-prop] Replace `Use` handling with use of `InterpCx`
wesleywiser Sep 6, 2019
570748d
[const-prop] Replace `Cast` handling with use of `InterpCx`
wesleywiser Sep 6, 2019
243f99e
[const-prop] Replace `NullaryOp` handling with use of `InterpCx`
wesleywiser Sep 6, 2019
0162021
[const-prop] Replace most `UnaryOp` handling with use of `InterpCx`
wesleywiser Sep 6, 2019
233925d
[const-prop] Replace `CheckedBinaryOp` handling with use of `InterpCx`
wesleywiser Sep 9, 2019
bf770f9
[const-prop] Replace some `Binaryp` handling with use of `InterpCx`
wesleywiser Sep 10, 2019
82f38c4
[const-prop] Replace `Ref` handling with use of `InterpCx`
wesleywiser Sep 11, 2019
0d09424
Don't run the ConstProp MIR pass on generators
wesleywiser Sep 13, 2019
0cf9c5b
Respond to code review feedback and fix tidy
wesleywiser Sep 13, 2019
59f2e13
Move Ref-from-arg checking from `step.rs` to `const_prop.rs`
wesleywiser Sep 14, 2019
c8336f3
Work around for #64506
wesleywiser Sep 17, 2019
9b4fae7
Introduce a `ConstPropMachine`
wesleywiser Sep 25, 2019
737fb99
Allow reading non-mutable statics in const prop
wesleywiser Sep 25, 2019
377a70d
Fix div_duration() marked as stable by mistake
JMS55 Sep 26, 2019
c81d359
Merge pull request #30 from Wind-River/update
n-salim Sep 26, 2019
e9aa0e7
Use existing Handler to print query stack
Aaron1011 Sep 26, 2019
97906bc
Add note about global state in try_print_query_stack
Aaron1011 Sep 26, 2019
fdeb4ca
review comments
estebank Sep 26, 2019
821ff46
Include message on tests that should panic
kungfukennyg Sep 24, 2019
65af1ff
Rollup merge of #63937 - Nashenas88:rustdoc_57180, r=GuillaumeGomez
Centril Sep 27, 2019
931b795
Rollup merge of #64419 - wesleywiser:const_prop_use_ecx, r=oli-obk
Centril Sep 27, 2019
0286ed0
Rollup merge of #64546 - weiznich:bugfix/rfc-2451-rerebalance-tests, …
Centril Sep 27, 2019
daa632b
Rollup merge of #64589 - andre-richter:aarch64_bare_metal, r=Amanieu
Centril Sep 27, 2019
9c1b008
Rollup merge of #64745 - kennethbgoodin:should-panic-msg, r=varkor
Centril Sep 27, 2019
b0bfef1
Rollup merge of #64793 - immunant:format_spans, r=matthewjasper
Centril Sep 27, 2019
19f99b8
Rollup merge of #64799 - Aaron1011:fix/double-panic, r=Mark-Simulacrum
Centril Sep 27, 2019
ea31935
Rollup merge of #64802 - estebank:walk-parents-iterator, r=matthewjasper
Centril Sep 27, 2019
c02e798
Rollup merge of #64815 - JMS55:patch-1, r=jonas-schievink
Centril Sep 27, 2019
51f7b2b
Rollup merge of #64818 - Wind-River:master, r=alexcrichton
Centril Sep 27, 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
Allow reading non-mutable statics in const prop
  • Loading branch information
wesleywiser committed Sep 26, 2019
commit 737fb9995915c70d3eb411cc76e87389bf527e38
7 changes: 3 additions & 4 deletions src/librustc_mir/interpret/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,9 @@ pub trait Machine<'mir, 'tcx>: Sized {
frame.locals[local].access()
}

/// Called before a `StaticKind::Static` value is read.
fn before_eval_static(
_ecx: &InterpCx<'mir, 'tcx, Self>,
_place_static: &mir::Static<'tcx>,
/// Called before a `StaticKind::Static` value is accessed.
fn before_access_static(
_allocation: &Allocation,
) -> InterpResult<'tcx> {
Ok(())
}
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_mir/interpret/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
// Make sure we use the ID of the resolved memory, not the lazy one!
let id = raw_const.alloc_id;
let allocation = tcx.alloc_map.lock().unwrap_memory(id);

M::before_access_static(allocation)?;
Cow::Borrowed(allocation)
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_mir/interpret/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,6 @@ where
}

StaticKind::Static => {
M::before_eval_static(self, place_static)?;

let ty = place_static.ty;
assert!(!ty.needs_subst());
let layout = self.layout_of(ty)?;
Expand Down
16 changes: 11 additions & 5 deletions src/librustc_mir/transform/const_prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use rustc::hir::def::DefKind;
use rustc::hir::def_id::DefId;
use rustc::mir::{
AggregateKind, Constant, Location, Place, PlaceBase, Body, Operand, Rvalue,
Local, NullOp, UnOp, StatementKind, Statement, LocalKind, Static,
Local, NullOp, UnOp, StatementKind, Statement, LocalKind,
TerminatorKind, Terminator, ClearCrossCrate, SourceInfo, BinOp,
SourceScope, SourceScopeLocalData, LocalDecl, BasicBlock,
};
Expand All @@ -17,6 +17,7 @@ use rustc::mir::visit::{
};
use rustc::mir::interpret::{Scalar, InterpResult, PanicInfo};
use rustc::ty::{self, Instance, ParamEnv, Ty, TyCtxt};
use syntax::ast::Mutability;
use syntax_pos::{Span, DUMMY_SP};
use rustc::ty::subst::InternalSubsts;
use rustc_data_structures::fx::FxHashMap;
Expand Down Expand Up @@ -229,11 +230,16 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for ConstPropMachine {
l.access()
}

fn before_eval_static(
_ecx: &InterpCx<'mir, 'tcx, Self>,
_place_static: &Static<'tcx>,
fn before_access_static(
allocation: &Allocation<Self::PointerTag, Self::AllocExtra>,
) -> InterpResult<'tcx> {
throw_unsup_format!("can't eval statics in ConstProp");
// if the static allocation is mutable or if it has relocations (it may be legal to mutate
// the memory behind that in the future), then we can't const prop it
if allocation.mutability == Mutability::Mutable || allocation.relocations().len() > 0 {
throw_unsup_format!("can't eval mutable statics in ConstProp");
}

Ok(())
}

fn before_terminator(_ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
Expand Down
27 changes: 27 additions & 0 deletions src/test/mir-opt/const_prop/read_immutable_static.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
static FOO: u8 = 2;

fn main() {
let x = FOO + FOO;
}

// END RUST SOURCE
// START rustc.main.ConstProp.before.mir
// bb0: {
// ...
// _2 = (FOO: u8);
// ...
// _3 = (FOO: u8);
// _1 = Add(move _2, move _3);
// ...
// }
// END rustc.main.ConstProp.before.mir
// START rustc.main.ConstProp.after.mir
// bb0: {
// ...
// _2 = const 2u8;
// ...
// _3 = const 2u8;
// _1 = Add(move _2, move _3);
// ...
// }
// END rustc.main.ConstProp.after.mir
0