You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using an interpolated variable by-ref twice in a macro causes borrowck errors #8367
traitFoo{fnby_val(self){}fnby_ref(&self){}}implFooforint{}fnmain(){macro_rules! t (($a:expr) => {{// $a.by_val(); $a.by_val();
$a.by_ref(); $a.by_ref();}});t!(1i);}
macro-use-twice.rs:15:7: 15:9 error: borrowed value does not live long enough
macro-use-twice.rs:15 t!(1i);
^~
macro-use-twice.rs:8:4: 13:6 note: in expansion of t!
macro-use-twice.rs:15:4: 15:11 note: expansion site
macro-use-twice.rs:9:23: 12:9 note: borrowed pointer must be valid for the block at 9:23...
macro-use-twice.rs:9 ($a:expr) => { {
macro-use-twice.rs:10 //$a.by_val(); $a.by_val();
macro-use-twice.rs:11 $a.by_ref(); $a.by_ref();
macro-use-twice.rs:12 } }
macro-use-twice.rs:15:7: 11:37 note: ...but borrowed value is only valid for the method call at 15:7
macro-use-twice.rs:8:4: 13:6 note: in expansion of t!
macro-use-twice.rs:15:4: 15:11 note: expansion site
macro-use-twice.rs:15:7: 15:9 error: borrowed value does not live long enough
macro-use-twice.rs:15 t!(1i);
^~
macro-use-twice.rs:8:4: 13:6 note: in expansion of t!
macro-use-twice.rs:15:4: 15:11 note: expansion site
macro-use-twice.rs:9:23: 12:9 note: borrowed pointer must be valid for the block at 9:23...
macro-use-twice.rs:9 ($a:expr) => { {
macro-use-twice.rs:10 //$a.by_val(); $a.by_val();
macro-use-twice.rs:11 $a.by_ref(); $a.by_ref();
macro-use-twice.rs:12 } }
macro-use-twice.rs:15:7: 11:37 note: ...but borrowed value is only valid for the method call at 15:7
macro-use-twice.rs:8:4: 13:6 note: in expansion of t!
macro-use-twice.rs:15:4: 15:11 note: expansion site
error: aborting due to 2 previous errors
Activity
After expansion, fold and renumber AST nodes to ensure that each AST …
Delay assignment of node ids until after expansion. Ensures that each…
auto merge of #9088 : nikomatsakis/rust/issue-6304-AST-tree-not-DAG, …
Auto merge of rust-lang#8441 - Jarcho:needless_borrow_temp, r=flip1995
Auto merge of rust-lang#8355 - Jarcho:explicit_auto_deref_2, r=flip1995