-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #67106 - petrochenkov:docerr, r=matthewjasper
resolve: Resolve visibilities on fields with non-builtin attributes Follow-up to #66669. The first commit is primary (and also a backport candidate), the other ones are further cleanups. In this case it's not strictly necessary to avoid reporting errors during speculative resolution because 1) all visibilities are resolved non-speculatively sooner or later and 2) error reporting infrastructure merges identical errors with identical spans anyway. Fixes #67006 r? @matthewjasper
- Loading branch information
Showing
5 changed files
with
162 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Non-builtin attributes do not mess with field visibility resolution (issue #67006). | ||
|
||
mod internal { | ||
struct S { | ||
#[rustfmt::skip] | ||
pub(in crate::internal) field: u8 // OK | ||
} | ||
|
||
struct Z( | ||
#[rustfmt::skip] | ||
pub(in crate::internal) u8 // OK | ||
); | ||
} | ||
|
||
struct S { | ||
#[rustfmt::skip] | ||
pub(in nonexistent) field: u8 //~ ERROR failed to resolve | ||
} | ||
|
||
struct Z( | ||
#[rustfmt::skip] | ||
pub(in nonexistent) u8 //~ ERROR failed to resolve | ||
); | ||
|
||
fn main() {} |
15 changes: 15 additions & 0 deletions
15
src/test/ui/attributes/field-attributes-vis-unresolved.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error[E0433]: failed to resolve: maybe a missing crate `nonexistent`? | ||
--> $DIR/field-attributes-vis-unresolved.rs:17:12 | ||
| | ||
LL | pub(in nonexistent) field: u8 | ||
| ^^^^^^^^^^^ maybe a missing crate `nonexistent`? | ||
|
||
error[E0433]: failed to resolve: maybe a missing crate `nonexistent`? | ||
--> $DIR/field-attributes-vis-unresolved.rs:22:12 | ||
| | ||
LL | pub(in nonexistent) u8 | ||
| ^^^^^^^^^^^ maybe a missing crate `nonexistent`? | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0433`. |