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

&[u8] is not interned but taken as individual u8 #5

Open
oli-obk opened this issue May 12, 2015 · 2 comments
Open

&[u8] is not interned but taken as individual u8 #5

oli-obk opened this issue May 12, 2015 · 2 comments

Comments

@oli-obk
Copy link

oli-obk commented May 12, 2015

let x: &[u8] = b"hi";
let y = quote_stmt!(cx, let z = $x;);

may cause unreadable errors with broken spans in similar code and in this code causes z to have type u8 instead of &[u8]

my workaround is to manually create the LitBinary:

let x = syntax::ast::LitBinary(std::rc::Rc::new(x.iter().cloned().collect()));
let x = Spanned {
    node: x,
    span: sp,
};
@oli-obk
Copy link
Author

oli-obk commented May 12, 2015

Maybe these implementations https://github.com/erickt/rust-quasi/blob/master/src/lib.rs#L37-49 could be changed to an impl for Iterator<Item=T>

@erickt
Copy link

erickt commented May 19, 2015

Yuck. That's a good point and unfortunate that this happened. Given that this was just trying to simplify inlining a Vec, perhaps we should just pull this impl and replace it with a [u8] impl for byte strings.

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

No branches or pull requests

2 participants