Skip to content

Instantly share code, notes, and snippets.

@KiChjang
Created September 21, 2017 19:37
Show Gist options
  • Save KiChjang/f99667878363e5189aaf707897d0af5c to your computer and use it in GitHub Desktop.
Save KiChjang/f99667878363e5189aaf707897d0af5c to your computer and use it in GitHub Desktop.
warning: unused variable: `foo`
--> src/test/compile-fail/borrowck/borrowck-and-init.rs:14:9
|
14 | let foo = false && { i = 5; true };
| ^^^
|
= note: #[warn(unused_variables)] on by default
= note: to avoid this warning, consider using `_foo` instead
warning: unused variable: `bar`
--> src/test/compile-fail/borrowck/borrowck-and-init.rs:15:9
|
15 | let bar = i + 5; //~ ERROR use of possibly uninitialized variable: `i`
| ^^^
|
= note: to avoid this warning, consider using `_bar` instead
error[E0381]: use of possibly uninitialized variable: `i` (Ast)
--> src/test/compile-fail/borrowck/borrowck-and-init.rs:15:15
|
15 | let bar = i + 5; //~ ERROR use of possibly uninitialized variable: `i`
| ^ use of possibly uninitialized `i`
DEBUG:rustc_mir::borrow_check: run query mir_borrowck: main
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_statement(bb0[0], StorageLive(_1)): borrows in effect: [] borrows generated: [] inits: [] uninits: [_0, _1, _2, _3, _4, _5, _6]
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_statement(bb0[1], StorageLive(_2)): borrows in effect: [] borrows generated: [] inits: [] uninits: [_0, _1, _2, _3, _4, _5, _6]
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_statement(bb0[2], _2 = const false): borrows in effect: [] borrows generated: [] inits: [] uninits: [_0, _1, _2, _3, _4, _5, _6]
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_statement(bb0[3], StorageDead(_3)): borrows in effect: [] borrows generated: [] inits: [_2] uninits: [_0, _1, _3, _4, _5, _6]
error[E0381]: use of possibly uninitialized variable: `_` (Mir)
--> src/test/compile-fail/borrowck/borrowck-and-init.rs:14:39
|
14 | let foo = false && { i = 5; true };
| ^
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_statement(bb0[4], StorageLive(_4)): borrows in effect: [] borrows generated: [] inits: [_2] uninits: [_0, _1, _3, _4, _5, _6]
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_statement(bb0[5], StorageLive(_5)): borrows in effect: [] borrows generated: [] inits: [_2] uninits: [_0, _1, _3, _4, _5, _6]
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_statement(bb0[6], _5 = _1): borrows in effect: [] borrows generated: [] inits: [_2] uninits: [_0, _1, _3, _4, _5, _6]
error[E0381]: use of possibly uninitialized variable: `i` (Mir)
--> src/test/compile-fail/borrowck/borrowck-and-init.rs:15:15
|
15 | let bar = i + 5; //~ ERROR use of possibly uninitialized variable: `i`
| ^
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_statement(bb0[7], _6 = CheckedAdd(_5, const 5isize)): borrows in effect: [] borrows generated: [] inits: [_2, _5] uninits: [_0, _1, _3, _4, _6]
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_terminator(bb0[8], Terminator { source_info: SourceInfo { span: src/test/compile-fail/borrowck/borrowck-and-init.rs:15:15: 15:20, scope: scope2 }, kind: assert(!(_6.1: bool), "attempt to add with overflow") -> bb1 }): borrows in effect: [] borrows generated: [] inits: [_2, _5, _6] uninits: [_0, _1, _3, _4]
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_statement(bb1[0], _4 = (_6.0: isize)): borrows in effect: [] borrows generated: [] inits: [_2, _5, _6] uninits: [_0, _1, _3, _4]
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_statement(bb1[1], StorageDead(_5)): borrows in effect: [] borrows generated: [] inits: [_2, _4, _5, _6] uninits: [_0, _1, _3]
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_statement(bb1[2], _0 = ()): borrows in effect: [] borrows generated: [] inits: [_2, _4, _5, _6] uninits: [_0, _1, _3]
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_statement(bb1[3], StorageDead(_4)): borrows in effect: [] borrows generated: [] inits: [_0, _2, _4, _5, _6] uninits: [_1, _3]
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_statement(bb1[4], StorageDead(_2)): borrows in effect: [] borrows generated: [] inits: [_0, _2, _4, _5, _6] uninits: [_1, _3]
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_statement(bb1[5], StorageDead(_1)): borrows in effect: [] borrows generated: [] inits: [_0, _2, _4, _5, _6] uninits: [_1, _3]
error[E0381]: use of possibly uninitialized variable: `i` (Mir)
--> src/test/compile-fail/borrowck/borrowck-and-init.rs:16:2
|
16 | }
| ^
DEBUG:rustc_mir::borrow_check: MirBorrowckCtxt::process_terminator(bb1[6], Terminator { source_info: SourceInfo { span: src/test/compile-fail/borrowck/borrowck-and-init.rs:16:2: 16:2, scope: scope0 }, kind: return }): borrows in effect: [] borrows generated: [] inits: [_0, _2, _4, _5, _6] uninits: [_1, _3]
DEBUG:rustc_mir::borrow_check: mir_borrowck done
error: aborting due to 4 previous errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment