Change:
} } <del> if let ExprKind::Index(ref seqexpr, ref idx) = expr.kind { let ty = cx.tables.expr_ty(seqexpr); if !is_slice_like(cx, ty) { return None; } let offset = match idx.kind { ExprKind::Binary(op, ref lhs, ref rhs) => match op.node { BinOpKind::Add => { let offset_opt = if same_var(cx, lhs, var) { extract_offset(cx, rhs, var) } else if same_var(cx, rhs, var) { extract_offset(cx, lhs, var) } else { None }; offset_opt.map(Offset::positive) }, BinOpKind::Sub if same_var(cx, lhs, var) => extract_offset(cx, rhs, var).map(Offset::negative), _ => None, }, ExprKind::Path(..) => { if same_var(cx, idx, var) { Some(Offset::positive("0".into())) </del> <ins> match idx.kind { ExprKind::Binary(op, lhs, rhs) => match op.node { BinOpKind::Add => { let offset_opt = if same_var(cx, lhs, var) { extract_offset(cx, rhs, var) } else if same_var(cx, rhs, var) { extract_offset(cx, lhs, var) </ins> } else { None <del> } </del> <ins> }; offset_opt.map(Offset::positive) </ins> }, <ins> BinOpKind::Sub if same_var(cx, lhs, var) => extract_offset(cx, rhs, var).map(Offset::negative), </ins> _ => None, <del> }; offset.map(|o| FixedOffsetVar { var_name: snippet_opt(cx, seqexpr.span).unwrap_or_else(|| "???".into()), offset: o, }) } else { None } } fn fetch_cloned_fixed_offset_var<'a, 'tcx>( cx: &LateContext<'a, 'tcx>, expr: &Expr<'_>, var: HirId, ) -> Option<FixedOffsetVar> { if_chain! { if let ExprKind::MethodCall(ref method, _, ref args) = expr.kind; if method.ident.name == sym!(clone); if args.len() == 1; if let Some(arg) = args.get(0); then { return get_fixed_offset_var(cx, arg, var); } </del> <ins> }, ExprKind::Path(..) if same_var(cx, idx, var) => Some(Offset::positive("0".into())), _ => None, </ins> } <del> get_fixed_offset_var(cx, expr, var) </del> } <del> fn get_indexed_assignments<'a, 'tcx>( cx: &LateContext<'a, 'tcx>, body: &Expr<'_>, var: HirId, ) -> Vec<(FixedOffsetVar, FixedOffsetVar)> { fn get_assignment<'a, 'tcx>( cx: &LateContext<'a, 'tcx>, e: &Expr<'_>, var: HirId, ) -> Option<(FixedOffsetVar, FixedOffsetVar)> { if let ExprKind::Assign(ref lhs, ref rhs, _) = e.kind { match ( get_fixed_offset_var(cx, lhs, var), fetch_cloned_fixed_offset_var(cx, rhs, var), ) { (Some(offset_left), Some(offset_right)) => { // Source and destination must be different if offset_left.var_name == offset_right.var_name { None } else { Some((offset_left, offset_right)) } }, _ => None, } </del> <ins> fn get_assignments<'a, 'tcx>( body: &'tcx Expr<'tcx>, ) -> impl Iterator<Item = Option<(&'tcx Expr<'tcx>, &'tcx Expr<'tcx>)>> { fn get_assignment<'a, 'tcx>(e: &'tcx Expr<'tcx>) -> Option<(&'tcx Expr<'tcx>, &'tcx Expr<'tcx>)> { if let ExprKind::Assign(lhs, rhs, _) = e.kind { Some((lhs, rhs)) </ins> } else { None } } <del> if let ExprKind::Block(ref b, _) = body.kind { let Block { ref stmts, ref expr, .. } = **b; </del> <ins> // This is one of few ways to return different iterators // derived from: https://stackoverflow.com/questions/29760668/conditionally-iterate-over-one-of-several-possible-iterators/52064434#52064434 let mut iter_a = None; let mut iter_b = None; if let ExprKind::Block(b, _) = body.kind { let Block { stmts, expr, .. } = *b; </ins> <del> stmts </del> <ins> iter_a = stmts </ins> .iter() <del> .map(|stmt| match stmt.kind { </del> <ins> .filter_map(|stmt| match stmt.kind { </ins> StmtKind::Local(..) | StmtKind::Item(..) => None, <del> StmtKind::Expr(ref e) | StmtKind::Semi(ref e) => Some(get_assignment(cx, e, var)), </del> <ins> StmtKind::Expr(e) | StmtKind::Semi(e) => Some(e), </ins> }) <del> .chain(expr.as_ref().into_iter().map(|e| Some(get_assignment(cx, &*e, var)))) .filter_map(|op| op) .collect::<Option<Vec<_>>>() .unwrap_or_default() </del> <ins> .chain(expr.into_iter()) .map(get_assignment) .into() </ins> } else { <del> get_assignment(cx, body, var).into_iter().collect() </del> <ins> iter_b = Some(get_assignment(body)) </ins> } <ins> iter_a.into_iter().flatten().chain(iter_b.into_iter()) </ins> } /// Checks for for loops that sequentially copy items from one slice-like

Discussion:
I ran into an issue in where was getting expanded into instead of , which resulted in a compile error. We should add some tests that make sure we can still compile code after macros have been expanded.
To clarify: if I understand you correctly, you're saying that the expansion of error!("...") was being rendered by pprust as log(1,"..."), not that the expansion was actually incorrect. Is that correct? First off, that would obviously be a bug in the pretty-printer, which should be fixed. The larger issue of making sure that pretty-printed code compiles I would nominate for well-covered.
Yep, that was the problem, it's fixed now though. The larger issue still stands.
just a bug, removing milestone/nomination.
Fixed by !
Yay!

When using and together, the compiler complains that is an unused import even when a call to something like exists. Removing gets rid of the warning and the crate compiles. However, the crate will fail to link (for example with ) unless the is there. It seems like the warning is a bug unless the intent is to have also bring in foo itself. Here's a small crate that shows the example. This was originally found in rust-core-foundation.
Looking at the code, that's a genuinely unused import when not compiling with . I ran into this when removing unused imports in the compiler, and you can prefix the import with so that the import is only resolved when testing. Other options I've seen are to have a which is 'd off, or just put the in the function itself.
You're right. In this case I moved the inside the test function.

The macro is required, as is that exact order of the bounds, and the use of the repeated bound in the . (It's not specific to though.) output:
Works now, I'll check in a test case
Test case checked in in . Closing

The following code... ...results in the following error: Both and are loans of , so it should be safe to update to new loan of as updating doesn't cause to be freed.
This works now; I'll check in the test case.
Test case checked in in . Closing

So, after much wrangling with MinGW to get Rust to compile on my Windows partition, I'm trying to get Rust-SDL to work. When compiling it, and then running the demo application, I get the following, somewhat esoteric message: The procedure entry point ZN4bool14extensions9meth80572eq154e94be02e19a92306E could not be located in the dynamic link library core-- Is this a configuration issue? A bug? Me being silly?
I'm suspecting this is a dup of
Well, that puts my mind to rest! Thanks

<prefn main() { #error("%?", x);*/ } </preyields