Skip to content

Commit

Permalink
Pass through cfg attrs
Browse files Browse the repository at this point in the history
Otherwise things like cfg(target_os = "android") cannot be used
within a cxx bridge.

Resolves error:
error: unsupported attribute
 --> system/bt/gd/rust/common/src/sys_prop.rs:4:1
  |
4 | #[cfg(target_os = "android")]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

When updating to cxx version 1.0.x in AOSP.
https://cs.android.com/android/platform/superproject/+/master:system/bt/gd/rust/common/src/sys_prop.rs;l=3
  • Loading branch information
jeffvanderstoep committed Mar 2, 2021
1 parent 3dafaed commit d97e707
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions syntax/attrs.rs
Expand Up @@ -131,6 +131,10 @@ pub fn parse(cx: &mut Errors, attrs: Vec<Attribute>, mut parser: Parser) -> Othe
// https://doc.rust-lang.org/reference/attributes/diagnostics.html
passthrough_attrs.push(attr);
continue;
} else if attr.path.is_ident("cfg")
{
passthrough_attrs.push(attr);
continue;
} else if attr.path.segments.len() > 1 {
let tool = &attr.path.segments.first().unwrap().ident;
if tool == "rustfmt" {
Expand Down

0 comments on commit d97e707

Please sign in to comment.