Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tarpaulin fails with Error: cannot find attribute 'skip' in this scope" with rust 1.52.0 even if skip isn't used #756

Closed
Licenser opened this issue May 7, 2021 · 32 comments
Assignees

Comments

@Licenser
Copy link

Licenser commented May 7, 2021

Describe the bug

When trying to run tarpaulin in our project with rust v1.52.0 it fails with the error:

error: Broken pipe (os error 32)
warning: build failed, waiting for other jobs to finish...
error: Broken pipe (os error 32)
error: build failed
May 07 11:14:50.974 ERROR cargo_tarpaulin: Failed to compile tests! Error: cannot find attribute `skip` in this scope
Error: "Failed to compile tests! Error: cannot find attribute `skip` in this scope"

tarpaulin works with rust 1.51.0 and we do not use the skip attribute in the codebase

To Reproduce

clone https://github.com/tremor-rs/tremor-runtime and update the rust-toolchain file to 1.52.0

Expected behavior

projects working in 1.51.0 also work in 1.52.0

@Licenser Licenser changed the title Tarpaulin fails with Error: cannot find attribute skip in this scope" with rust 1.52.0 even if skip isn't used Tarpaulin fails with Error: cannot find attribute 'skip' in this scope" with rust 1.52.0 even if skip isn't used May 7, 2021
@xd009642
Copy link
Owner

xd009642 commented May 7, 2021

Interestingly, I got the same error but with a better message, it seems the error comes from an older version of bitvec which is used by nom (which is used by syslog_loose and hdrhistogram). It's bitvec 0.19.5 and they're currently on 0.22.3.

Also, nom can't update to the later bitvec which doesn't have the issue without bumping their MSRV so it might not be easily solvable. I think the issue there is likely down to the breaking change in the tarpaulin attributes and there is --avoid-cfg-tarpaulin to persist with the old behaviour (although that will make your tarpaulin attributes to ignore code useless).

I tried with --avoid-cfg-tarpaulin and got another issue with the crate procedural-masquerade (a member of rust-cssparser) so now just looking into that

@xd009642
Copy link
Owner

xd009642 commented May 7, 2021

oh I realised you're on 0.16.0 instead of one of the alphas so don't have --avoid-cfg-tarpaulin. But with 0.16.0 and 0.18.0-alpha3 I do get the skip error on rust 1.51 and 1.52 so not sure what changed there. Maybe one of the dependencies that pulled in bitvec had a patch bump that's being bought in that changes the bitvec version 🤔

@Licenser
Copy link
Author

Licenser commented May 7, 2021

Oi, would it be possible to ignore attributes in dependencies? Making sure that all 700 dependencies have their tests written with up-to-date tarpaulin attributes will be a bit of a nightmare. if tarpaulin gains more traction the rust ecosystem tendencies to small dependencies / crates could make that a bigger problem for breaking changes in the future.

Maybe one of the dependencies that pulled in bitvec had a patch bump that's being bought in that changes the bitvec version

they all should be locked in the lockfile so a updated rust-toolchaiun should ™️ not cause a change in dependencies

@xd009642
Copy link
Owner

xd009642 commented May 7, 2021

Oi, would it be possible to ignore attributes in dependencies?

We'd need a way to apply rust flags to only the top level crate and not the dependencies, unless there's something rust can do that I'm not aware of. I tried to do this once by calling rustc directly but it didn't work very well. The attributes also had the breaking change in 0.14.0 after I found minimal use of them in peoples code I don't expect a change like that again anytime soon. (Also, there is the flag to enable the legacy behaviour)

they all should be locked in the lockfile so a updated rust-toolchaiun should tm not cause a change in dependencies

So in my own production rust I rely on --locked to force it to use exactly what's in the lockfile as there seems to be some instances where things can slightly change

jtgeibel added a commit to jtgeibel/crates.io that referenced this issue May 7, 2021
The coverage analysis currently fails while compiling `bitvec`. This is
tracked as xd009642/tarpaulin#756.
jtgeibel added a commit to jtgeibel/crates.io that referenced this issue May 7, 2021
The coverage analysis currently fails while compiling `bitvec`. This is
tracked as xd009642/tarpaulin#756.
Turbo87 added a commit to Turbo87/crates.io that referenced this issue May 9, 2021
Turbo87 added a commit to Turbo87/crates.io that referenced this issue May 9, 2021
Turbo87 added a commit to Turbo87/crates.io that referenced this issue May 9, 2021
bors added a commit to rust-lang/crates.io that referenced this issue May 10, 2021
CI: Cycle cargo binary cache and add `--avoid-cfg-tarpaulin` to tarpaulin

see xd009642/tarpaulin#756

r? `@ghost`
@Licenser
Copy link
Author

I tried it with --locked, same codebase, ran tarpaulin with the rust-toolchain being 1.51.0 and it compiles then change the rust-toolchain to 1.52.1 and re-execute cargo tarpaulin --locked and it fails. I don't know what it is but something that changed between 1.51.0 and 1.52.0 did cause a degradation :(

@r3dlight
Copy link

r3dlight commented May 11, 2021

Hi,
Same issue here using Rust 1.52.0.

Compiling bitvec v0.19.5
error: Broken pipe (os error 32)
warning: build failed, waiting for other jobs to finish...
error: Broken pipe (os error 32)
error: build failed
May 11 13:17:29.567 ERROR cargo_tarpaulin: Failed to compile tests! Error: bitvec: cannot find attribute `skip` in this scope
Error: "Failed to compile tests! Error: bitvec: cannot find attribute `skip` in this scope"

@Licenser
Copy link
Author

Update: I did try with the 18 alpha, which gets past it and compilation. the procedural-masquerade error is based on a false positive in a warning: rust-lang/rust#83125 and can be solved with #![allow(proc_macro_back_compat)]

with that tarpaulin runs again :D

so the 18-alpha is a workaround but I'm still curious what causes the degradation 😅

@ralpha
Copy link

ralpha commented May 11, 2021

Had the same issue, also with bitvec.
Updating tarpaulin to the latest alpha version (EDIT: v0.18.x is out of alpha by now)
( cargo install cargo-tarpaulin --version 0.18.3 )
And adding the --avoid-cfg-tarpaulin flag solved the problem.

On my repo I had no further errors/warnings.

@Geal
Copy link

Geal commented Jun 24, 2021

hello, I'm really sorry about the issues with bitvec and nom. I started the work on nom 7 which should fix them, but the rest of what I'd like to pass in that version is not ready yet, so in the meantime I published nom 7.0.0-alpha1 which only includes dependency updates.
Could you check if it works for you?

@Licenser
Copy link
Author

Hi Geal, don't be sorry :)! I can't test it sadly since nom isn't a direct dependency but rather pulled in in a number of different versions over a few other sub dependencies :(

@Igosuki
Copy link

Igosuki commented Aug 1, 2021

@Licenser You can use [patch.crates-io] if you're feeling lucky

vgeddes added a commit to Snowfork/snowbridge that referenced this issue Sep 28, 2021
vgeddes added a commit to Snowfork/snowbridge that referenced this issue Sep 28, 2021
* Update to Polkadot 0.9.9

* Update runtimes and tests

* Make actions workflow use newer rustc

* Update benchmarks

* Fix xd009642/tarpaulin#756

* Update deps for ethash and ethabi-decode
@0xAlcibiades
Copy link

I'm still encountering this issue on the latest release.

@xd009642
Copy link
Owner

@djc so it's not in tarpaulins dependency tree but rather projects wih tarpaulin being ran on them and there is the --avoid-cfg-tarpaulin flag to solve this. One thing I'm going to start doing is working on finding any users of nom 6 and submitting PRs to update the nom version to make sure as much as possible can be moved on from. I've just submitted this one which should fix it for tremor HdrHistogram/HdrHistogram_rust#102 and any other users of the hdrhistogram crate

@xd009642
Copy link
Owner

xd009642 commented Oct 24, 2021

So anyone using hdrhistogram can now upgrade to 7.4.0 and that will be one more instance of skip removed from their dependency tree (and maybe the last one). I've just had to go to a PC without everything installed but iirc it was the only instance of skip in tremor @Licenser

@jonhoo
Copy link

jonhoo commented Oct 24, 2021

7.4.0* :)

@xd009642
Copy link
Owner

Oops, used to everyone being like me and too shy to go 1.0.0 😅

@Geal
Copy link

Geal commented Oct 24, 2021

It's just a number, it's fine 😁

@Licenser
Copy link
Author

I'll check :D

@Licenser
Copy link
Author

Yay it is the last! 🚀

@Licenser
Copy link
Author

And with updating to 0.18.3 free 2% test coverage :D 🚀 from our side this is fully resolved :)

@xd009642
Copy link
Owner

If everyone else with issues wants to check and let me know the projects if they still fail. I'll go on a hunt around the ecosystem upgrading things as needs be 😄 also if I don't hear anything else in a month or so I'll probably close this issue as inactive

@ehiggs
Copy link

ehiggs commented Nov 13, 2021

I still get this on cargo-tarpaulin version: 0.18.5, rustc 1.56.1 (59eed8a2a 2021-11-01).

@xd009642
Copy link
Owner

@ehiggs have you used --avoid-cfg-tarpaulin to switch to the legacy behaviour, and do you have the code open so I can track which dependency is bringing in the old style attributes?

@ehiggs
Copy link

ehiggs commented Nov 13, 2021

I used cargo tarpaulin --avoid-cfg-tarpaulin and it worked now 🎉 . You responded before I could delete my comment. 😱

@xd009642
Copy link
Owner

I was already on github doing some stuff 😅. I'd still be interested in what the dependency is and if it's been updated or needs updating though

@ehiggs
Copy link

ehiggs commented Nov 13, 2021

   Compiling bitvec v0.19.5
error: Broken pipe (os error 32)
warning: build failed, waiting for other jobs to finish...
error: Broken pipe (os error 32)
error: build failed
Nov 13 17:22:48.505 ERROR cargo_tarpaulin: Failed to compile tests! Error: bitvec: cannot find attribute `skip` in this scope
Error: "Failed to compile tests! Error: bitvec: cannot find attribute `skip` in this scope"
├── askama v0.10.5
│   ├── askama_derive v0.10.5 (proc-macro)
│   │   ├── askama_shared v0.11.1
│   │   │   ├── askama_escape v0.10.1
│   │   │   ├── humansize v1.1.1
│   │   │   ├── nom v6.1.2
│   │   │   │   ├── bitvec v0.19.5
│   │   │   │   │   ├── funty v1.1.0
│   │   │   │   │   ├── radium v0.5.3
│   │   │   │   │   ├── tap v1.0.1
│   │   │   │   │   └── wyz v0.2.0
│   │   │   │   ├── funty v1.1.0
│   │   │   │   ├── lexical-core v0.7.6
│   │   │   │   │   ├── arrayvec v0.5.2
│   │   │   │   │   ├── bitflags v1.3.2
│   │   │   │   │   ├── cfg-if v1.0.0
│   │   │   │   │   ├── ryu v1.0.5
│   │   │   │   │   └── static_assertions v1.1.0
│   │   │   │   └── memchr v2.4.1
│   │   │   │   [build-dependencies]
│   │   │   │   └── version_check v0.9.3
│   │   │   ├── num-traits v0.2.14
│   │   │   │   [build-dependencies]
│   │   │   │   └── autocfg v1.0.1
│   │   │   ├── percent-encoding v2.1.0
│   │   │   ├── proc-macro2 v1.0.30 (*)
│   │   │   ├── quote v1.0.10 (*)
│   │   │   ├── serde v1.0.130 (*)
│   │   │   ├── syn v1.0.80 (*)
│   │   │   └── toml v0.5.8
│   │   │       └── serde v1.0.130 (*)
│   │   ├── proc-macro2 v1.0.30 (*)
│   │   └── syn v1.0.80 (*)
│   ├── askama_escape v0.10.1
│   └── askama_shared v0.11.1 (*)

@xd009642
Copy link
Owner

Okay just checked and the askama 0.12 beta has nom at 0.7 so you'll be able to remove the flag once the next version of askama is released (unless you wanted to move to a beta release ofc).

@djc
Copy link

djc commented Nov 13, 2021

The next version of Askama will hopefully be released soon, so it will no longer trigger this problem.

@Licenser
Copy link
Author

Licenser commented Apr 4, 2022

Closing this as it's been resolved for us :)

@Licenser Licenser closed this as completed Apr 4, 2022
alistair-singh pushed a commit to Snowfork/snowbridge-nft that referenced this issue Apr 21, 2022
* Update to Polkadot 0.9.9

* Update runtimes and tests

* Make actions workflow use newer rustc

* Update benchmarks

* Fix xd009642/tarpaulin#756

* Update deps for ethash and ethabi-decode
@0xAlcibiades
Copy link

Seeing this again @xd009642:

Jul 22 19:51:04.606ERROR cargo_tarpaulin: Failed to compile tests! Error: coins-core: cannot find attribute `skip` in this scope
Error: "Failed to compile tests! Error: coins-core: cannot find attribute `skip` in this scope"
Error: The process '/home/runner/.cargo/bin/cargo' failed with exit code 1

@xd009642
Copy link
Owner

@0xAlcibiades you can use --avoid-cfg-tarpaulin but whatever library is printing in the legacy skip macro should be updated (either bumping the dependency or PRing it and releasing a new one)

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

Successfully merging a pull request may close this issue.

10 participants