1
Fork 0

Fix rebase issues

This commit is contained in:
varkor 2019-12-06 13:09:03 +00:00
parent 442514884d
commit f1db60ca95
4 changed files with 4 additions and 4 deletions

View file

@ -242,7 +242,7 @@ impl<'tcx> Body<'tcx> {
pub fn vars_iter<'a>(&'a self) -> impl Iterator<Item = Local> + 'a { pub fn vars_iter<'a>(&'a self) -> impl Iterator<Item = Local> + 'a {
(self.arg_count + 1..self.local_decls.len()).filter_map(move |index| { (self.arg_count + 1..self.local_decls.len()).filter_map(move |index| {
let local = Local::new(index); let local = Local::new(index);
self.local_decls[local].is_user_variable().to_option(local) self.local_decls[local].is_user_variable().then_some(local)
}) })
} }

View file

@ -28,7 +28,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![feature(associated_type_bounds)] #![feature(associated_type_bounds)]
#![feature(range_is_empty)] #![feature(range_is_empty)]
#![feature(stmt_expr_attributes)] #![feature(stmt_expr_attributes)]
#![feature(bool_to_option)]
#![feature(trait_alias)] #![feature(trait_alias)]
#![feature(matches_macro)] #![feature(matches_macro)]

View file

@ -29,7 +29,7 @@ fn get_switched_on_type<'tcx>(
// Only bother checking blocks which terminate by switching on a local. // Only bother checking blocks which terminate by switching on a local.
if let Some(local) = get_discriminant_local(&terminator.kind) { if let Some(local) = get_discriminant_local(&terminator.kind) {
let stmt_before_term = (block_data.statements.len() > 0) let stmt_before_term = (block_data.statements.len() > 0)
.then_with(|| &block_data.statements[block_data.statements.len() - 1].kind); .then(|| &block_data.statements[block_data.statements.len() - 1].kind);
if let Some(StatementKind::Assign(box (l, Rvalue::Discriminant(place)))) = stmt_before_term if let Some(StatementKind::Assign(box (l, Rvalue::Discriminant(place)))) = stmt_before_term
{ {
@ -59,7 +59,7 @@ fn variant_discriminants<'tcx>(
.iter_enumerated() .iter_enumerated()
.filter_map(|(idx, layout)| { .filter_map(|(idx, layout)| {
(layout.abi != Abi::Uninhabited) (layout.abi != Abi::Uninhabited)
.then_with(|| ty.discriminant_for_variant(tcx, idx).unwrap().val) .then(|| ty.discriminant_for_variant(tcx, idx).unwrap().val)
}) })
.collect(), .collect(),
} }

View file

@ -1,5 +1,6 @@
//! The main parser interface. //! The main parser interface.
#![feature(bool_to_option)]
#![feature(crate_visibility_modifier)] #![feature(crate_visibility_modifier)]
use syntax::ast; use syntax::ast;