Unverified Commit a2f17cff authored by Taiki Endo's avatar Taiki Endo Committed by GitHub
Browse files

Support raw pointer in cargo-check-external-types (#1643)

parent e179bea6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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!())?
            }
+1 −0
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@ pub type NotExternalReferencing = u32;
pub type ExternalReferencingTypedef = SomeStruct;
pub type OptionalExternalReferencingTypedef = Option<SomeStruct>;
pub type DynExternalReferencingTypedef = Box<dyn SimpleTrait>;
pub type ExternalReferencingRawPtr = *const SomeStruct;

pub fn fn_with_external_trait_bounds<I, O, E, T>(_thing: T)
where
+6 −6
Original line number Diff line number Diff line
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<I, O, E, T>(_thing: T)
125 | pub fn fn_with_external_trait_bounds<I, O, E, T>(_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`
+36 −28
Original line number Diff line number Diff line
@@ -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<I, O, E, T>(_thing: T)
125 | pub fn fn_with_external_trait_bounds<I, O, E, T>(_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<I, O, E, T>(_thing: T)
125 | pub fn fn_with_external_trait_bounds<I, O, E, T>(_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<I, O, E, T>(_thing: T)
125 | pub fn fn_with_external_trait_bounds<I, O, E, T>(_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<T>
146 |     type MyGAT<T>
    | ...
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<T: SimpleTrait>(&self, thing: Self::MyGAT<T>);
150 |     fn some_fn<T: SimpleTrait>(&self, thing: Self::MyGAT<T>);
    |     ^-------------------------------------------------------^
    |
    = 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
+11 −10
Original line number Diff line number Diff line
| 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 |