Skip to content

Commit

Permalink
Make lint-non-snake-case-crate proc_macro_ case agnostic to warning
Browse files Browse the repository at this point in the history
The lint-non-snake-case-crate test may emit a warning in stderr if the
target does not support unwinding

```
warning: building proc macro crate with `panic=abort` may crash the compiler should the proc-macro panic
```

Consequently, the test will fail on targets that don't support unwinding
as written.

This change modifies the expected stderr for lint-non-snake-case-crate
in the proc_macro_ to ignore lines that indicate a warning was emitted.
  • Loading branch information
c6c7 committed Oct 15, 2024
1 parent f79fae3 commit dccb028
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: crate `NonSnakeCase` should have a snake case name
--> $DIR/lint-non-snake-case-crate.rs:25:18
--> $DIR/lint-non-snake-case-crate.rs:29:18
|
LL | #![crate_name = "NonSnakeCase"]
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
|
note: the lint level is defined here
--> $DIR/lint-non-snake-case-crate.rs:27:9
--> $DIR/lint-non-snake-case-crate.rs:31:9
|
LL | #![deny(non_snake_case)]
| ^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: crate `NonSnakeCase` should have a snake case name
--> $DIR/lint-non-snake-case-crate.rs:25:18
--> $DIR/lint-non-snake-case-crate.rs:29:18
|
LL | #![crate_name = "NonSnakeCase"]
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
|
note: the lint level is defined here
--> $DIR/lint-non-snake-case-crate.rs:27:9
--> $DIR/lint-non-snake-case-crate.rs:31:9
|
LL | #![deny(non_snake_case)]
| ^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: crate `NonSnakeCase` should have a snake case name
--> $DIR/lint-non-snake-case-crate.rs:25:18
--> $DIR/lint-non-snake-case-crate.rs:29:18
|
LL | #![crate_name = "NonSnakeCase"]
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
|
note: the lint level is defined here
--> $DIR/lint-non-snake-case-crate.rs:27:9
--> $DIR/lint-non-snake-case-crate.rs:31:9
|
LL | #![deny(non_snake_case)]
| ^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
error: crate `NonSnakeCase` should have a snake case name
--> $DIR/lint-non-snake-case-crate.rs:25:18
--> $DIR/lint-non-snake-case-crate.rs:29:18
|
LL | #![crate_name = "NonSnakeCase"]
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
|
note: the lint level is defined here
--> $DIR/lint-non-snake-case-crate.rs:27:9
--> $DIR/lint-non-snake-case-crate.rs:31:9
|
LL | #![deny(non_snake_case)]
| ^^^^^^^^^^^^^^

error: aborting due to 1 previous error

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: crate `NonSnakeCase` should have a snake case name
--> $DIR/lint-non-snake-case-crate.rs:25:18
--> $DIR/lint-non-snake-case-crate.rs:29:18
|
LL | #![crate_name = "NonSnakeCase"]
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
|
note: the lint level is defined here
--> $DIR/lint-non-snake-case-crate.rs:27:9
--> $DIR/lint-non-snake-case-crate.rs:31:9
|
LL | #![deny(non_snake_case)]
| ^^^^^^^^^^^^^^
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
//@[rlib_] compile-flags: --crate-type=rlib
//@[staticlib_] compile-flags: --crate-type=staticlib

// The compiler may emit a warning if the target does not support unwinding, so
// ignore output in addition to the expected error.
//@[proc_macro_] compare-output-lines-by-subset

#![crate_name = "NonSnakeCase"]
//[cdylib_,dylib_,lib_,proc_macro_,rlib_,staticlib_]~^ ERROR crate `NonSnakeCase` should have a snake case name
#![deny(non_snake_case)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: crate `NonSnakeCase` should have a snake case name
--> $DIR/lint-non-snake-case-crate.rs:25:18
--> $DIR/lint-non-snake-case-crate.rs:29:18
|
LL | #![crate_name = "NonSnakeCase"]
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
|
note: the lint level is defined here
--> $DIR/lint-non-snake-case-crate.rs:27:9
--> $DIR/lint-non-snake-case-crate.rs:31:9
|
LL | #![deny(non_snake_case)]
| ^^^^^^^^^^^^^^
Expand Down

0 comments on commit dccb028

Please sign in to comment.