Repository navigation
expected unsuffixed literal or identifier, found IN_ISDIR #122796
Copy link
Copy link
Closed as not planned
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I have the following (open source) code: https://github.com/Thomasdezeeuw/heph/blob/1c7ee4af37627fcfb11749389973fa5e4a34a0bf/rt/src/fs/watch.rs#L354-L466. It's over a 100 lines and I'm not sure what is causing the issue.
This compiled fine since it was added to the repository, latest nightly compiler that is know to work is from rustc 1.78.0-nightly (c67326b06 2024-03-15).
However using the currently nightly compiler, 1.79.0-nightly (a7e4de13c 2024-03-19), fails to compile it giving the following errors:
Details
error: expected unsuffixed literal or identifier, found `IN_ISDIR`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_ACCESS`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_MODIFY`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_ATTRIB`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_CLOSE_WRITE`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_CLOSE_NOWRITE`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_CLOSE`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_OPEN`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_DELETE_SELF`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_MOVE_SELF`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_UNMOUNT`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_MOVED_FROM`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_MOVED_TO`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_MOVE`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_CREATE`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected unsuffixed literal or identifier, found `IN_DELETE`
--> rt/src/fs/watch.rs:454:23
|
354 | bit_checks!(self.event.mask);
| ---------------------------- in this macro invocation
...
454 | #[doc(alias = $bit)]
| ^^^^
|
= note: this error originates in the macro `bit_checks` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `heph-rt` (lib) due to 16 previous errors
make: *** [Makefile.include:21: test] Error 101
Also available on the CI:
- with Clippy: https://github.com/Thomasdezeeuw/heph/actions/runs/8366117475/job/22905578987?pr=617#step:4:59,
- with rustdoc: https://github.com/Thomasdezeeuw/heph/actions/runs/8366117475/job/22905579591?pr=617#step:4:132
There are two problems. First, the regression from the previous nightly. Second, the error message is rather confusing, I have would have no idea what the actual problem is.
Meta
rustc --version --verbose:
rustc 1.79.0-nightly (a7e4de13c 2024-03-19)
binary: rustc
commit-hash: a7e4de13c1785819f4d61da41f6704ed69d5f203
commit-date: 2024-03-19
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity
Thomasdezeeuw commentedon Mar 20, 2024
The code works with nightly-2024-03-16:
jieyouxu commentedon Mar 20, 2024
Exhibit A:
OK on stable, ERROR on nightly 2024-03-19.
Exhibit B:
ERROR on both.
Exhibit C:
ERROR on both.
fmease commentedon Mar 20, 2024
First and foremost, sorry for breaking your crate! However this was an intentional breaking change. We used to not validate attributes on certain kinds of associated functions. We did a crater run and found only a single regression. Therefore I decided to roll with it.
fmease commentedon Mar 20, 2024
Intentionally regressed in #121545.
jieyouxu commentedon Mar 20, 2024
Makes a lot of sense, was about to say the stable behavior is the surprising one lol
fmease commentedon Mar 20, 2024
@Thomasdezeeuw Your
#[doc(alias = $bit)]attribute is malformed, the latest rustc is correct here. The doc-alias takes a string literal IIRC. To fix this, you can do#[doc(alias = stringify!($bit))].See also: https://doc.rust-lang.org/rustdoc/advanced-features.html#add-aliases-for-an-item-in-documentation-search
jieyouxu commentedon Mar 20, 2024
If this is an intentional regression, we can probably close this issue?
fmease commentedon Mar 20, 2024
The diagnostic isn't great tho lol, we should open an issue if there isn't one already. We are not expecting an identifier.
Thomasdezeeuw commentedon Mar 21, 2024
@jieyouxu @fmease thanks for the responses.
Any chance we can reopen (or create another issue) to improve the diagnostic message though? Because I won't have guessed from the error message that the problem was in the doc attributed.
jieyouxu commentedon Mar 21, 2024
Feel free to create an issue for the diagnostic (which is actionable)
fmease commentedon Mar 22, 2024
I will look into that later.
Rollup merge of rust-lang#124778 - fmease:fix-diag-msg-parse-meta-ite…
Rollup merge of rust-lang#124778 - fmease:fix-diag-msg-parse-meta-ite…
Unrolled build for rust-lang#124778
Rollup merge of #124778 - fmease:fix-diag-msg-parse-meta-item, r=nnet…
Rollup merge of #124778 - fmease:fix-diag-msg-parse-meta-item, r=nnet…