Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

v0.1.1 has a token hygeiene bug. #95

Closed
seunlanlege opened this issue Apr 18, 2018 · 4 comments
Closed

v0.1.1 has a token hygeiene bug. #95

seunlanlege opened this issue Apr 18, 2018 · 4 comments

Comments

@seunlanlege
Copy link

Marking a function as async or using async_block, causes variables used in macro invocations to be unresolved.

Minimal Code to reproduce

#[async]
pub fn test() -> Result<(), ()> {
	let lk = "haha, i'm a str";
	let res = Ok::<_, bool>(true);
	println!("{}", lk);
	println!("{:?}", &res);
	Ok(())
}

which compiles with the errors,

error[E0425]: cannot find value `lk` in this scope
 --> <println macros>:3:44
  |
3 | ) => ( print ! ( concat ! ( $ fmt , "\n" ) , $ ( $ arg ) * ) ) ;
  |                                            ^ not found in this scope

error[E0425]: cannot find value `res` in this scope
 --> <println macros>:3:44
  |
3 | ) => ( print ! ( concat ! ( $ fmt , "\n" ) , $ ( $ arg ) * ) ) ;
  |                                            ^ not found in this scope

error[E0425]: cannot find value `res` in this scope
  |
  = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0425`.
error: Could not compile `paysquare`.

To learn more, run the command again with --verbose.

@seunlanlege
Copy link
Author

The same also goes for serde_json's json! macro @withoutboats @alexcrichton.

@seunlanlege
Copy link
Author

We might need to revisit #90

@alexcrichton
Copy link
Owner

This is likely related to or the same as rust-lang/rust#50061 which I'll try to investigate soon

@alexcrichton
Copy link
Owner

Yes this is definitely caused by rust-lang/rust#50061, an accidental regression from rust-lang/rust#49154

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants