Handle<NodeRef<marker::Mut<'a>, K, V, NodeType>, marker::KV> {
pub fn into_kv_mut(self) -> (&'a mut K, &'a mut V) {
- let (mut keys, mut vals) = self.node.into_slices_mut();
+ let (keys, vals) = self.node.into_slices_mut();
unsafe {
(keys.get_unchecked_mut(self.idx), vals.get_unchecked_mut(self.idx))
}
impl<'a, K, V, NodeType> Handle<NodeRef<marker::Mut<'a>, K, V, NodeType>, marker::KV> {
pub fn kv_mut(&mut self) -> (&mut K, &mut V) {
unsafe {
- let (mut keys, mut vals) = self.node.reborrow_mut().into_slices_mut();
+ let (keys, vals) = self.node.reborrow_mut().into_slices_mut();
(keys.get_unchecked_mut(self.idx), vals.get_unchecked_mut(self.idx))
}
}
type Item = &'a mut T;
type IntoIter = slice::IterMut<'a, T>;
- fn into_iter(mut self) -> slice::IterMut<'a, T> {
+ fn into_iter(self) -> slice::IterMut<'a, T> {
self.iter_mut()
}
}
type Item = &'a mut T;
type IntoIter = IterMut<'a, T>;
- fn into_iter(mut self) -> IterMut<'a, T> {
+ fn into_iter(self) -> IterMut<'a, T> {
self.iter_mut()
}
}
where F : FnMut<A>
{
type Output = F::Output;
- extern "rust-call" fn call_once(mut self, args: A) -> F::Output {
+ extern "rust-call" fn call_once(self, args: A) -> F::Output {
(*self).call_mut(args)
}
}
type Item = &'a mut T;
type IntoIter = IterMut<'a, T>;
- fn into_iter(mut self) -> IterMut<'a, T> {
+ fn into_iter(self) -> IterMut<'a, T> {
self.iter_mut()
}
}
type Item = &'a mut T;
type IntoIter = IterMut<'a, T>;
- fn into_iter(mut self) -> IterMut<'a, T> {
+ fn into_iter(self) -> IterMut<'a, T> {
self.iter_mut()
}
}
/// -------- this type is the same as a type argument in the other type, not highlighted
/// ```
fn highlight_outer(&self,
- mut value: &mut DiagnosticStyledString,
- mut other_value: &mut DiagnosticStyledString,
+ value: &mut DiagnosticStyledString,
+ other_value: &mut DiagnosticStyledString,
name: String,
sub: &ty::subst::Substs<'tcx>,
pos: usize,
{
debug!("fully_normalize(value={:?})", value);
- let mut selcx = &mut SelectionContext::new(infcx);
+ let selcx = &mut SelectionContext::new(infcx);
// FIXME (@jroesch) ISSUE 26721
// I'm not sure if this is a bug or not, needs further investigation.
// It appears that by reusing the fulfillment_cx here we incur more
never_obligation.predicate = never_obligation.predicate.map_bound(|mut trait_pred| {
// Swap out () with ! so we can check if the trait is impld for !
{
- let mut trait_ref = &mut trait_pred.trait_ref;
+ let trait_ref = &mut trait_pred.trait_ref;
let unit_substs = trait_ref.substs;
let mut never_substs = Vec::with_capacity(unit_substs.len());
never_substs.push(From::from(tcx.types.never));
match self.sty {
TyAdt(def, substs) => {
{
- let mut substs_set = visited.entry(def.did).or_insert(FxHashSet::default());
+ let substs_set = visited.entry(def.did).or_insert(FxHashSet::default());
if !substs_set.insert(substs) {
// We are already calculating the inhabitedness of this type.
// The type must contain a reference to itself. Break the
}
}
let ret = def.uninhabited_from(visited, tcx, substs);
- let mut substs_set = visited.get_mut(&def.did).unwrap();
+ let substs_set = visited.get_mut(&def.did).unwrap();
substs_set.remove(substs);
ret
},
fn arg_ty(&self,
ty: &AllocatorTy,
args: &mut Vec<Arg>,
- mut ident: &mut FnMut() -> Ident) -> P<Expr> {
+ ident: &mut FnMut() -> Ident) -> P<Expr> {
match *ty {
AllocatorTy::Layout => {
let usize = self.cx.path_ident(self.span, Ident::from_str("usize"));
fn ret_ty(&self,
ty: &AllocatorTy,
args: &mut Vec<Arg>,
- mut ident: &mut FnMut() -> Ident,
+ ident: &mut FnMut() -> Ident,
expr: P<Expr>) -> (P<Ty>, P<Expr>)
{
match *ty {
let body_id = tcx.hir.body_owned_by(owner_id);
let tables = tcx.typeck_tables_of(owner_def_id);
let region_maps = tcx.region_maps(owner_def_id);
- let mut bccx = &mut BorrowckCtxt { tcx, tables, region_maps, owner_def_id };
+ let bccx = &mut BorrowckCtxt { tcx, tables, region_maps, owner_def_id };
let body = bccx.tcx.hir.body(body_id);
let start = source_array_vec.len();
let tail = self.tail_start;
{
- let mut arr = &mut source_array_vec.values as &mut [ManuallyDrop<_>];
+ let arr = &mut source_array_vec.values as &mut [ManuallyDrop<_>];
let src = arr.as_ptr().offset(tail as isize);
let dst = arr.as_mut_ptr().offset(start as isize);
ptr::copy(src, dst, self.tail_len);
pub fn add(&mut self, source: usize, target: usize) -> bool {
let (start, _) = self.range(source);
let (word, mask) = word_mask(target);
- let mut vector = &mut self.vector[..];
+ let vector = &mut self.vector[..];
let v1 = vector[start + word];
let v2 = v1 | mask;
vector[start + word] = v2;
type IntoIter = slice::IterMut<'a, T>;
#[inline]
- fn into_iter(mut self) -> slice::IterMut<'a, T> {
+ fn into_iter(self) -> slice::IterMut<'a, T> {
self.raw.iter_mut()
}
}
match Command::new(pager_name).stdin(Stdio::piped()).spawn() {
Ok(mut pager) => {
- if let Some(mut pipe) = pager.stdin.as_mut() {
+ if let Some(pipe) = pager.stdin.as_mut() {
if pipe.write_all(content.as_bytes()).is_err() {
fallback_to_println = true;
}
_ => {},
}
- let mut bfs_queue = &mut VecDeque::new();
+ let bfs_queue = &mut VecDeque::new();
let mut add_child = |bfs_queue: &mut VecDeque<_>, child: def::Export, parent: DefId| {
let child = child.def.def_id();
self.schedule_drop(span, extent, &Lvalue::Local(local_id), var_ty);
}
- pub fn visit_bindings<F>(&mut self, pattern: &Pattern<'tcx>, mut f: &mut F)
+ pub fn visit_bindings<F>(&mut self, pattern: &Pattern<'tcx>, f: &mut F)
where F: FnMut(&mut Self, Mutability, Name, NodeId, Span, Ty<'tcx>)
{
match *pattern.kind {
value,
obligations);
- let mut fulfill_cx = &mut self.fulfillment_cx;
+ let fulfill_cx = &mut self.fulfillment_cx;
for obligation in obligations {
fulfill_cx.register_predicate_obligation(self.infcx, obligation);
}
hir::ItemTrait(.., ref trait_item_refs) => {
self.check_item(item.id).generics().predicates();
for trait_item_ref in trait_item_refs {
- let mut check = self.check_item(trait_item_ref.id.node_id);
+ let check = self.check_item(trait_item_ref.id.node_id);
check.generics().predicates();
if trait_item_ref.kind != hir::AssociatedItemKind::Type ||
trait_item_ref.defaultness.has_value() {
}
hir::ItemImpl(.., ref trait_ref, _, ref impl_item_refs) => {
{
- let mut check = self.check_item(item.id);
+ let check = self.check_item(item.id);
check.ty().generics().predicates();
if trait_ref.is_some() {
check.impl_trait_ref();
// Ensure that `resolution` isn't borrowed when defining in the module's glob importers,
// during which the resolution might end up getting re-defined via a glob cycle.
let (binding, t) = {
- let mut resolution = &mut *self.resolution(module, ident, ns).borrow_mut();
+ let resolution = &mut *self.resolution(module, ident, ns).borrow_mut();
let old_binding = resolution.binding();
let t = f(self, resolution);
let mut output = i.to_string(scx.tcx());
output.push_str(" @@");
let mut empty = Vec::new();
- let mut cgus = item_to_cgus.get_mut(i).unwrap_or(&mut empty);
+ let cgus = item_to_cgus.get_mut(i).unwrap_or(&mut empty);
cgus.as_mut_slice().sort_by_key(|&(ref name, _)| name.clone());
cgus.dedup();
for &(ref cgu_name, (linkage, _)) in cgus.iter() {
CodegenUnit::empty(codegen_unit_name.clone())
};
- let mut codegen_unit = codegen_units.entry(codegen_unit_name.clone())
+ let codegen_unit = codegen_units.entry(codegen_unit_name.clone())
.or_insert_with(make_codegen_unit);
let (linkage, visibility) = match trans_item.explicit_linkage(tcx) {
}
}
- if let Some(mut augment_error) = augment_error {
+ if let Some(augment_error) = augment_error {
augment_error(&mut db);
}
// We can't use normalize_associated_types_in as it will pollute the
// fcx's fulfillment context after this probe is over.
let cause = traits::ObligationCause::misc(self.span, self.body_id);
- let mut selcx = &mut traits::SelectionContext::new(self.fcx);
+ let selcx = &mut traits::SelectionContext::new(self.fcx);
let traits::Normalized { value: xform_self_ty, obligations } =
traits::normalize(selcx, self.param_env, cause, &xform_self_ty);
debug!("assemble_inherent_impl_probe: xform_self_ty = {:?}",
// as it will pollute the fcx's fulfillment context after this probe
// is over.
let cause = traits::ObligationCause::misc(self.span, self.body_id);
- let mut selcx = &mut traits::SelectionContext::new(self.fcx);
+ let selcx = &mut traits::SelectionContext::new(self.fcx);
let traits::Normalized { value: xform_self_ty, obligations } =
traits::normalize(selcx, self.param_env, cause, &xform_self_ty);
let tail_expr_ty = tail_expr.map(|t| self.check_expr_with_expectation(t, expected));
let mut enclosing_breakables = self.enclosing_breakables.borrow_mut();
- let mut ctxt = enclosing_breakables.find_breakable(blk.id);
- let mut coerce = ctxt.coerce.as_mut().unwrap();
+ let ctxt = enclosing_breakables.find_breakable(blk.id);
+ let coerce = ctxt.coerce.as_mut().unwrap();
if let Some(tail_expr_ty) = tail_expr_ty {
let tail_expr = tail_expr.unwrap();
let cause = self.cause(tail_expr.span,
lhs_expr: &'gcx hir::Expr,
lhs_ty: Ty<'tcx>,
rhs_ty: Ty<'tcx>,
- mut err: &mut errors::DiagnosticBuilder) -> bool {
+ err: &mut errors::DiagnosticBuilder) -> bool {
// If this function returns true it means a note was printed, so we don't need
// to print the normal "implementation of `std::ops::Add` might be missing" note
let mut is_string_addition = false;
type Item = (&'a K, &'a mut V);
type IntoIter = IterMut<'a, K, V>;
- fn into_iter(mut self) -> IterMut<'a, K, V> {
+ fn into_iter(self) -> IterMut<'a, K, V> {
self.iter_mut()
}
}
#[cold]
fn call_inner(&'static self,
ignore_poisoning: bool,
- mut init: &mut FnMut(bool)) {
+ init: &mut FnMut(bool)) {
let mut state = self.state.load(Ordering::SeqCst);
'outer: loop {
use mem;
-fn next_u32(mut fill_buf: &mut FnMut(&mut [u8])) -> u32 {
+fn next_u32(fill_buf: &mut FnMut(&mut [u8])) -> u32 {
let mut buf: [u8; 4] = [0; 4];
fill_buf(&mut buf);
unsafe { mem::transmute::<[u8; 4], u32>(buf) }
}
-fn next_u64(mut fill_buf: &mut FnMut(&mut [u8])) -> u64 {
+fn next_u64(fill_buf: &mut FnMut(&mut [u8])) -> u64 {
let mut buf: [u8; 8] = [0; 8];
fill_buf(&mut buf);
unsafe { mem::transmute::<[u8; 8], u64>(buf) }
fn nameize<I: Iterator<Item=NamedMatch>>(sess: &ParseSess, ms: &[TokenTree], mut res: I)
-> NamedParseResult {
- fn n_rec<I: Iterator<Item=NamedMatch>>(sess: &ParseSess, m: &TokenTree, mut res: &mut I,
+ fn n_rec<I: Iterator<Item=NamedMatch>>(sess: &ParseSess, m: &TokenTree, res: &mut I,
ret_val: &mut HashMap<Ident, Rc<NamedMatch>>)
-> Result<(), (syntax_pos::Span, String)> {
match *m {
/* error messages here could be improved with links to orig. rules */
if token_name_eq(&parser.token, &token::Eof) {
if eof_items.len() == 1 {
- let matches = eof_items[0].matches.iter_mut().map(|mut dv| {
+ let matches = eof_items[0].matches.iter_mut().map(|dv| {
Rc::make_mut(dv).pop().unwrap()
});
return nameize(sess, ms, matches);
fn trace_macros_note(cx: &mut ExtCtxt, sp: Span, message: String) {
let sp = sp.macro_backtrace().last().map(|trace| trace.call_site).unwrap_or(sp);
- let mut values: &mut Vec<String> = cx.expansions.entry(sp).or_insert_with(Vec::new);
+ let values: &mut Vec<String> = cx.expansions.entry(sp).or_insert_with(Vec::new);
values.push(message);
}