Skip to content

tests(fix): Exclude unused features from failing a test#174

Open
polarathene wants to merge 1 commit into
sunfishcode:mainfrom
polarathene:patch-3
Open

tests(fix): Exclude unused features from failing a test#174
polarathene wants to merge 1 commit into
sunfishcode:mainfrom
polarathene:patch-3

Conversation

@polarathene

@polarathene polarathene commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This resolves a current test failure (CI failure log) caused by lint warnings emitted to stderr due to (introduced from the recent Nightly version bump):

I am not sure how you'd like to approach resolving this.

  • I chose to only apply it to the affected test case rather than globally within c-scape/src/lib.rs by adding a #![allow(unused_features)].
  • Another alternative would be to expect the stderr output instead with the lint warnings.
CI test failure output (click to expand)

CI failure log, relevant snippet:

     Running tests/example_crates.rs (target/debug/deps/example_crates-4423017ae3c0b04a)

running 12 tests
test example_crate_c_gull_example_panic_abort ... ok
test example_crate_c_gull_unwinding ... ok
test example_crate_c_gull_example ... ok
test example_crate_c_scape_example ... ok
test example_crate_c_scape_example_panic_abort ... ok
test example_crate_c_scape_unwinding ... ok
test example_crate_c_gull_lto ... ok
test example_crate_custom_allocator ... ok
test example_crate_libc_replacement ... FAILED
test example_crate_dns ... ok
test example_crate_threadsafe_setenv_lookup ... ok
test example_crate_threadsafe_setenv_getenv ... ok

failures:

---- example_crate_libc_replacement stdout ----

thread 'example_crate_libc_replacement' (9924) panicked at tests/example_crates.rs:39:40:
Unexpected stderr, failed diff original var
├── original: 
├── diff: 
│   --- 	orig
│   +++ 	var
│   @@ -0,0 +1,14 @@
│   +warning: feature `thread_local` is declared but not used
│   + --> /home/runner/work/c-ward/c-ward/c-scape/src/lib.rs:5:12
│   +  |
│   +5 | #![feature(thread_local)] // for `pthread_getspecific` etc.
│   +  |            ^^^^^^^^^^^^
│   +  |
│   +  = note: `#[warn(unused_features)]` (part of `#[warn(unused)]`) on by default
│   +
│   +warning: feature `linkage` is declared but not used
│   + --> /home/runner/work/c-ward/c-ward/c-scape/src/lib.rs:8:12
│   +  |
│   +8 | #![feature(linkage)] // for `malloc` etc.
│   +  |            ^^^^^^^
│   +
└── var as str: warning: feature `thread_local` is declared but not used
     --> /home/runner/work/c-ward/c-ward/c-scape/src/lib.rs:5:12
      |
    5 | #![feature(thread_local)] // for `pthread_getspecific` etc.
      |            ^^^^^^^^^^^^
      |
      = note: `#[warn(unused_features)]` (part of `#[warn(unused)]`) on by default
    
    warning: feature `linkage` is declared but not used
     --> /home/runner/work/c-ward/c-ward/c-scape/src/lib.rs:8:12
      |
    8 | #![feature(linkage)] // for `malloc` etc.
      |            ^^^^^^^
    

command=`cd "example-crates/libc-replacement" && "cargo" "run" "--quiet" "--target=x86_64-unknown-linux-gnu"`
code=0
stdout=```
Hello, world! uid=1001
Hello world with printf! gid=1001
Hello world from `atexit_func`
```

stderr=```
warning: feature `thread_local` is declared but not used
 --> /home/runner/work/c-ward/c-ward/c-scape/src/lib.rs:5:12
  |
5 | #![feature(thread_local)] // for `pthread_getspecific` etc.
  |            ^^^^^^^^^^^^
  |
  = note: `#[warn(unused_features)]` (part of `#[warn(unused)]`) on by default

warning: feature `linkage` is declared but not used
 --> /home/runner/work/c-ward/c-ward/c-scape/src/lib.rs:8:12
  |
8 | #![feature(linkage)] // for `malloc` etc.
  |            ^^^^^^^

```

Separately within this same file is a removal that was missed as part of PR #169, which didn't cause any failures but does removal a warning (as per referenced PR).

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 this pull request may close these issues.

1 participant