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

Skip to content

Rollup of 10 pull requests #59433

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

Merged
merged 43 commits into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d56b1fd
Make duration_since use checked_duration_since
faern Mar 22, 2019
1ccad16
Update sys::time impls to have checked_sub_instant
faern Mar 22, 2019
8ba1a97
Expand suggestions for type ascription parse errors
estebank Mar 13, 2019
b1a6c32
Tweak labels
estebank Mar 13, 2019
72a3089
Only suggest let assignment for type ascription if we find an equals …
estebank Mar 13, 2019
81b876b
Hide "type ascription is experimental error" unless it's the only one
estebank Mar 13, 2019
44a086e
Review comment
estebank Mar 20, 2019
d72ef21
Reword type ascription note to reduce verbosity
estebank Mar 23, 2019
752544b
adding mir::StaticKind enum for static and promoted
Mar 23, 2019
fb93f10
code review fixes
Mar 24, 2019
8d7c2bb
replace redundant note in deprecation warning
euclio Mar 24, 2019
5390414
Provide suggestion when using field access instead of path
estebank Mar 18, 2019
4beea17
Deduplicate code for path suggestion
estebank Mar 20, 2019
6315221
Update src/libcore/option.rs
killercup Mar 25, 2019
0e83e96
add missing braces
pnkfelix Mar 25, 2019
0bb36a2
Clarify `{Ord,f32,f64}::clamp` docs a little
tbu- Mar 25, 2019
28c602a
Utilize `?` instead of `return None`.
frewsxcv Mar 25, 2019
b316514
Rollup merge of #59150 - estebank:type-ascription, r=varkor
Centril Mar 26, 2019
90c2d64
Rollup merge of #59232 - saleemjaffer:mir_place_refactor, r=oli-obk
Centril Mar 26, 2019
ba55822
Rollup merge of #59267 - estebank:assoc-const-as-field, r=davidtwco
Centril Mar 26, 2019
4fbe25c
Rollup merge of #59315 - Zoxc:move-query, r=oli-obk
Centril Mar 26, 2019
e132e43
Rollup merge of #59334 - ewk:readme, r=Mark-Simulacrum
Centril Mar 26, 2019
0616b73
Rollup merge of #59362 - pnkfelix:demo-from-iterator-short-circuiting…
Centril Mar 26, 2019
e298691
Rollup merge of #59374 - faern:simplify-checked-duration-since, r=she…
Centril Mar 26, 2019
95e7a50
Rollup merge of #59389 - euclio:deprecated-suggestion, r=varkor
Centril Mar 26, 2019
0677eb1
Rollup merge of #59410 - tbu-:pr_doc_clarifyclamp, r=joshtriplett
Centril Mar 26, 2019
822b4fc
Rollup merge of #59419 - frewsxcv:frewsxcv-qu, r=varkor
Centril Mar 26, 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
remove visit_static from librustc::mir
  • Loading branch information
Saleem Jaffer committed Mar 20, 2019
commit 8829ddadc4f82b43a8653dd1f40839513b6fb2f0
21 changes: 4 additions & 17 deletions src/librustc/mir/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,6 @@ macro_rules! make_mir_visitor {
self.super_place(place, context, location);
}

fn visit_static(&mut self,
static_: & $($mutability)? Static<'tcx>,
context: PlaceContext<'tcx>,
location: Location) {
self.super_static(static_, context, location);
}

fn visit_projection(&mut self,
place: & $($mutability)? PlaceProjection<'tcx>,
context: PlaceContext<'tcx>,
Expand Down Expand Up @@ -737,23 +730,17 @@ macro_rules! make_mir_visitor {
self.visit_local(local, context, location);
}
Place::Base(PlaceBase::Static(static_)) => {
self.visit_static(static_, context, location);
if static_.promoted.is_none() {
self.visit_def_id(& $($mutability)? static_.def_id, location);
}
self.visit_ty(& $($mutability)? static_.ty, TyContext::Location(location));
}
Place::Projection(proj) => {
self.visit_projection(proj, context, location);
}
}
}

fn super_static(&mut self,
static_: & $($mutability)? Static<'tcx>,
_context: PlaceContext<'tcx>,
location: Location) {
let Static { def_id, ty, promoted: _ } = static_;
self.visit_def_id(def_id, location);
self.visit_ty(ty, TyContext::Location(location));
}

fn super_projection(&mut self,
proj: & $($mutability)? PlaceProjection<'tcx>,
context: PlaceContext<'tcx>,
Expand Down
23 changes: 15 additions & 8 deletions src/librustc_mir/monomorphize/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,19 +650,26 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
self.super_terminator_kind(block, kind, location);
}

fn visit_static(&mut self,
static_: &mir::Static<'tcx>,
fn visit_place(&mut self,
place: &mir::Place<'tcx>,
context: mir::visit::PlaceContext<'tcx>,
location: Location) {
debug!("visiting static {:?} @ {:?}", static_.def_id, location);
match place {
mir::Place::Base(
mir::PlaceBase::Static(box mir::Static{def_id, promoted:None, ..})
) => {
debug!("visiting static {:?} @ {:?}", def_id, location);

let tcx = self.tcx;
let instance = Instance::mono(tcx, static_.def_id);
if should_monomorphize_locally(tcx, &instance) {
self.output.push(MonoItem::Static(static_.def_id));
let tcx = self.tcx;
let instance = Instance::mono(tcx, *def_id);
if should_monomorphize_locally(tcx, &instance) {
self.output.push(MonoItem::Static(*def_id));
}
}
_ => {}
}

self.super_static(static_, context, location);
self.super_place(place, context, location);
}
}

Expand Down
11 changes: 4 additions & 7 deletions src/librustc_mir/transform/qualify_min_const_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,10 @@ fn check_place(
) -> McfResult {
match place {
Place::Base(PlaceBase::Local(_)) => Ok(()),
Place::Base(PlaceBase::Static(st)) => {
match st.promoted {
// promoteds are always fine, they are essentially constants
Some(..) => Ok(()),
None => Err((span, "cannot access `static` items in const fn".into())),
}
}
// promoteds are always fine, they are essentially constants
Place::Base(PlaceBase::Static(box Static {def_id: _, ty: _, promoted: Some(_)})) => Ok(()),
Place::Base(PlaceBase::Static(box Static {def_id: _, ty: _, promoted: None})) =>
Err((span, "cannot access `static` items in const fn".into())),
Place::Projection(proj) => {
match proj.elem {
| ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. }
Expand Down
0