diff --git a/tools/cargo-check-external-types/src/visitor.rs b/tools/cargo-check-external-types/src/visitor.rs index 2ed9d1b8a6894c3f18b1306df9766483ea8b52a4..9eff6ea9f4306de17cd5921654a4f77b0832cbc6 100644 --- a/tools/cargo-check-external-types/src/visitor.rs +++ b/tools/cargo-check-external-types/src/visitor.rs @@ -322,7 +322,9 @@ impl Visitor { } } Type::Infer => unimplemented!("visit_type Type::Infer"), - Type::RawPointer { type_: _, .. } => unimplemented!("visit_type Type::RawPointer"), + Type::RawPointer { type_, .. } => { + self.visit_type(path, what, type_).context(here!())? + } Type::BorrowedRef { type_, .. } => { self.visit_type(path, what, type_).context(here!())? } diff --git a/tools/cargo-check-external-types/test-workspace/test-crate/src/lib.rs b/tools/cargo-check-external-types/test-workspace/test-crate/src/lib.rs index b17bb16f03521337fb2ffcc3f36cd108a89cf10f..8fd3bcb73cdad0c5ce3daf82517accc0e5e634ab 100644 --- a/tools/cargo-check-external-types/test-workspace/test-crate/src/lib.rs +++ b/tools/cargo-check-external-types/test-workspace/test-crate/src/lib.rs @@ -120,6 +120,7 @@ pub type NotExternalReferencing = u32; pub type ExternalReferencingTypedef = SomeStruct; pub type OptionalExternalReferencingTypedef = Option; pub type DynExternalReferencingTypedef = Box; +pub type ExternalReferencingRawPtr = *const SomeStruct; pub fn fn_with_external_trait_bounds(_thing: T) where diff --git a/tools/cargo-check-external-types/tests/allow-some-types-expected-output.txt b/tools/cargo-check-external-types/tests/allow-some-types-expected-output.txt index 78fe40ac753218512b14999a8193c7cfed6f3fdb..c0f42ec87de10150c31550d346b8a01f5e40e76d 100644 --- a/tools/cargo-check-external-types/tests/allow-some-types-expected-output.txt +++ b/tools/cargo-check-external-types/tests/allow-some-types-expected-output.txt @@ -1,19 +1,19 @@ error: Unapproved external type `external_lib::AssociatedGenericTrait` referenced in public API - --> test-crate/src/lib.rs:124:1 + --> test-crate/src/lib.rs:125:1 | -124 | pub fn fn_with_external_trait_bounds(_thing: T) +125 | pub fn fn_with_external_trait_bounds(_thing: T) | ... -131 | }␊ +132 | }␊ | ^ | = in trait bound of `test_crate::fn_with_external_trait_bounds` error: Unapproved external type `external_lib::AssociatedGenericTrait` referenced in public API - --> test-crate/src/lib.rs:135:5 + --> test-crate/src/lib.rs:136:5 | -135 | type OtherThing: AssociatedGenericTrait< +136 | type OtherThing: AssociatedGenericTrait< | ... -139 | >;␊ +140 | >;␊ | ^^ | = in trait bound of `test_crate::SomeTraitWithExternalDefaultTypes::OtherThing` diff --git a/tools/cargo-check-external-types/tests/default-config-expected-output.txt b/tools/cargo-check-external-types/tests/default-config-expected-output.txt index f4fef16f4615097bc54bad856543cbf6880a706e..6c897ab447965b85dcbb39a4c328058ad59974d2 100644 --- a/tools/cargo-check-external-types/tests/default-config-expected-output.txt +++ b/tools/cargo-check-external-types/tests/default-config-expected-output.txt @@ -236,98 +236,106 @@ error: Unapproved external type `external_lib::SimpleTrait` referenced in public | = in generic arg of `test_crate::DynExternalReferencingTypedef` +error: Unapproved external type `external_lib::SomeStruct` referenced in public API + --> test-crate/src/lib.rs:123:1 + | +123 | pub type ExternalReferencingRawPtr = *const SomeStruct; + | ^-----------------------------------------------------^ + | + = in typedef type of `test_crate::ExternalReferencingRawPtr` + error: Unapproved external type `external_lib::AssociatedGenericTrait` referenced in public API - --> test-crate/src/lib.rs:124:1 + --> test-crate/src/lib.rs:125:1 | -124 | pub fn fn_with_external_trait_bounds(_thing: T) +125 | pub fn fn_with_external_trait_bounds(_thing: T) | ... -131 | }␊ +132 | }␊ | ^ | = in trait bound of `test_crate::fn_with_external_trait_bounds` error: Unapproved external type `external_lib::SomeOtherStruct` referenced in public API - --> test-crate/src/lib.rs:124:1 + --> test-crate/src/lib.rs:125:1 | -124 | pub fn fn_with_external_trait_bounds(_thing: T) +125 | pub fn fn_with_external_trait_bounds(_thing: T) | ... -131 | }␊ +132 | }␊ | ^ | = in generic arg of `test_crate::fn_with_external_trait_bounds` error: Unapproved external type `external_lib::SomeStruct` referenced in public API - --> test-crate/src/lib.rs:124:1 + --> test-crate/src/lib.rs:125:1 | -124 | pub fn fn_with_external_trait_bounds(_thing: T) +125 | pub fn fn_with_external_trait_bounds(_thing: T) | ... -131 | }␊ +132 | }␊ | ^ | = in generic arg of `test_crate::fn_with_external_trait_bounds` error: Unapproved external type `external_lib::SimpleTrait` referenced in public API - --> test-crate/src/lib.rs:134:5 + --> test-crate/src/lib.rs:135:5 | -134 | type Thing: SimpleTrait; +135 | type Thing: SimpleTrait; | ^----------------------^ | = in trait bound of `test_crate::SomeTraitWithExternalDefaultTypes::Thing` error: Unapproved external type `external_lib::AssociatedGenericTrait` referenced in public API - --> test-crate/src/lib.rs:135:5 + --> test-crate/src/lib.rs:136:5 | -135 | type OtherThing: AssociatedGenericTrait< +136 | type OtherThing: AssociatedGenericTrait< | ... -139 | >;␊ +140 | >;␊ | ^^ | = in trait bound of `test_crate::SomeTraitWithExternalDefaultTypes::OtherThing` error: Unapproved external type `external_lib::SomeOtherStruct` referenced in public API - --> test-crate/src/lib.rs:135:5 + --> test-crate/src/lib.rs:136:5 | -135 | type OtherThing: AssociatedGenericTrait< +136 | type OtherThing: AssociatedGenericTrait< | ... -139 | >;␊ +140 | >;␊ | ^^ | = in generic default binding of `test_crate::SomeTraitWithExternalDefaultTypes::OtherThing` error: Unapproved external type `external_lib::SomeStruct` referenced in public API - --> test-crate/src/lib.rs:135:5 + --> test-crate/src/lib.rs:136:5 | -135 | type OtherThing: AssociatedGenericTrait< +136 | type OtherThing: AssociatedGenericTrait< | ... -139 | >;␊ +140 | >;␊ | ^^ | = in generic default binding of `test_crate::SomeTraitWithExternalDefaultTypes::OtherThing` error: Unapproved external type `external_lib::SimpleTrait` referenced in public API - --> test-crate/src/lib.rs:145:5 + --> test-crate/src/lib.rs:146:5 | -145 | type MyGAT +146 | type MyGAT | ... -147 | T: SimpleTrait;␊ +148 | T: SimpleTrait;␊ | ^-----------------^ | = in trait bound of `test_crate::SomeTraitWithGenericAssociatedType::MyGAT` error: Unapproved external type `external_lib::SimpleTrait` referenced in public API - --> test-crate/src/lib.rs:149:5 + --> test-crate/src/lib.rs:150:5 | -149 | fn some_fn(&self, thing: Self::MyGAT); +150 | fn some_fn(&self, thing: Self::MyGAT); | ^-------------------------------------------------------^ | = in trait bound of `test_crate::SomeTraitWithGenericAssociatedType::some_fn` error: Unapproved external type `external_lib::SimpleNewType` referenced in public API - --> test-crate/src/lib.rs:157:5 + --> test-crate/src/lib.rs:158:5 | -157 | pub const OTHER_CONST: SimpleNewType = SimpleNewType(5); +158 | pub const OTHER_CONST: SimpleNewType = SimpleNewType(5); | ^------------------------------------------------------^ | = in struct field of `test_crate::AssocConstStruct::OTHER_CONST` -38 errors emitted +39 errors emitted diff --git a/tools/cargo-check-external-types/tests/output-format-markdown-table-expected-output.md b/tools/cargo-check-external-types/tests/output-format-markdown-table-expected-output.md index 0d8a1cce5887818519a6cefbaf6b18fd33ab362c..9674fff9d6b141288a27eeab911f3a0845dce6a1 100644 --- a/tools/cargo-check-external-types/tests/output-format-markdown-table-expected-output.md +++ b/tools/cargo-check-external-types/tests/output-format-markdown-table-expected-output.md @@ -1,20 +1,20 @@ | Crate | Type | Used In | | --- | --- | --- | -| external_lib | external_lib::AssociatedGenericTrait | test-crate/src/lib.rs:124:0 | -| external_lib | external_lib::AssociatedGenericTrait | test-crate/src/lib.rs:135:4 | -| external_lib | external_lib::SimpleNewType | test-crate/src/lib.rs:157:4 | +| external_lib | external_lib::AssociatedGenericTrait | test-crate/src/lib.rs:125:0 | +| external_lib | external_lib::AssociatedGenericTrait | test-crate/src/lib.rs:136:4 | +| external_lib | external_lib::SimpleNewType | test-crate/src/lib.rs:158:4 | | external_lib | external_lib::SimpleTrait | test-crate/src/lib.rs:104:4 | | external_lib | external_lib::SimpleTrait | test-crate/src/lib.rs:122:0 | -| external_lib | external_lib::SimpleTrait | test-crate/src/lib.rs:134:4 | -| external_lib | external_lib::SimpleTrait | test-crate/src/lib.rs:145:4 | -| external_lib | external_lib::SimpleTrait | test-crate/src/lib.rs:149:4 | +| external_lib | external_lib::SimpleTrait | test-crate/src/lib.rs:135:4 | +| external_lib | external_lib::SimpleTrait | test-crate/src/lib.rs:146:4 | +| external_lib | external_lib::SimpleTrait | test-crate/src/lib.rs:150:4 | | external_lib | external_lib::SimpleTrait | test-crate/src/lib.rs:38:0 | | external_lib | external_lib::SimpleTrait | test-crate/src/lib.rs:38:0 | | external_lib | external_lib::SimpleTrait | test-crate/src/lib.rs:47:0 | | external_lib | external_lib::SimpleTrait | test-crate/src/lib.rs:89:4 | | external_lib | external_lib::SimpleTrait | test-crate/src/lib.rs:92:8 | -| external_lib | external_lib::SomeOtherStruct | test-crate/src/lib.rs:124:0 | -| external_lib | external_lib::SomeOtherStruct | test-crate/src/lib.rs:135:4 | +| external_lib | external_lib::SomeOtherStruct | test-crate/src/lib.rs:125:0 | +| external_lib | external_lib::SomeOtherStruct | test-crate/src/lib.rs:136:4 | | external_lib | external_lib::SomeOtherStruct | test-crate/src/lib.rs:72:4 | | external_lib | external_lib::SomeStruct | test-crate/src/lib.rs:109:0 | | external_lib | external_lib::SomeStruct | test-crate/src/lib.rs:110:0 | @@ -22,8 +22,9 @@ | external_lib | external_lib::SomeStruct | test-crate/src/lib.rs:116:4 | | external_lib | external_lib::SomeStruct | test-crate/src/lib.rs:120:0 | | external_lib | external_lib::SomeStruct | test-crate/src/lib.rs:121:0 | -| external_lib | external_lib::SomeStruct | test-crate/src/lib.rs:124:0 | -| external_lib | external_lib::SomeStruct | test-crate/src/lib.rs:135:4 | +| external_lib | external_lib::SomeStruct | test-crate/src/lib.rs:123:0 | +| external_lib | external_lib::SomeStruct | test-crate/src/lib.rs:125:0 | +| external_lib | external_lib::SomeStruct | test-crate/src/lib.rs:136:4 | | external_lib | external_lib::SomeStruct | test-crate/src/lib.rs:38:0 | | external_lib | external_lib::SomeStruct | test-crate/src/lib.rs:43:0 | | external_lib | external_lib::SomeStruct | test-crate/src/lib.rs:54:0 |