Skip to content

macro_rules-wrapped asm! fails on att_syntax #77584

Closed
@cuviper

Description

@cuviper

The probe crate uses asm! with att_syntax, because SDT operands are written in ELF notes, to be read by third-party tools expecting that syntax. Recently this has regressed:

~/rust/probe$ cargo check --examples
    Checking probe v0.2.1 (/home/jistone/rust/probe)
error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, or `readonly`, found `att_syntax`
 --> examples/loop.rs:4:5
  |
4 |     probe!(foo, begin);
  |     ^^^^^^^^^^^^^^^^^^^ expected one of 8 possible tokens
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, or `readonly`, found `att_syntax`
 --> examples/loop.rs:8:9
  |
8 |         probe!(foo, loop, i, total);
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected one of 8 possible tokens
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, or `readonly`, found `att_syntax`
  --> examples/loop.rs:11:5
   |
11 |     probe!(foo, end);
   |     ^^^^^^^^^^^^^^^^^ expected one of 8 possible tokens
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 3 previous errors

error: could not compile `probe`

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

cargo bisect-rustc pointed me to #77275 -- cc @petrochenkov. I see that there were regressions with asm! during that review, but not exactly like what I'm seeing here.

Meta

searched nightlies: from nightly-2020-09-28 to nightly-2020-10-04
regressed nightly: nightly-2020-09-30
searched commits: from fc2daaa to 381b445
regressed commit: 26373fb

bisected with cargo-bisect-rustc v0.5.2

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --access github -- check --examples

Metadata

Metadata

Assignees

Labels

A-inline-assemblyArea: Inline assembly (`asm!(…)`)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions