Skip to content

Commit e5a0c89

Browse files
committed
Fix Copy attribute UI test
1 parent e1b469d commit e5a0c89

File tree

6 files changed

+19
-18
lines changed

6 files changed

+19
-18
lines changed

crates/swift-bridge-ir/src/codegen/codegen_tests/generic_opaque_rust_type_codegen_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ mod generic_opaque_rust_type_copy {
275275
const _ : () = {
276276
let _ : [u8 ; std :: mem :: size_of :: < super :: SomeType<u32, u16> > ()] = [0 ; 6usize] ;
277277
fn _assert_copy () {
278-
swift_bridge :: assert_copy :: < super :: SomeType<u32,u16> > () ;
278+
swift_bridge::copy_support::assert_copy::<super::SomeType<u32,u16>>();
279279
}
280280
}
281281
},

crates/swift-bridge-ir/src/codegen/codegen_tests/opaque_rust_type_codegen_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ mod extern_rust_copy_type {
235235
const _: () = {
236236
let _: [u8; std::mem::size_of::<super::SomeType>()] = [0; 32usize];
237237
fn _assert_copy() {
238-
swift_bridge::assert_copy::<super::SomeType>();
238+
swift_bridge::copy_support::assert_copy::<super::SomeType>();
239239
}
240240
};
241241
},

crates/swift-bridge-ir/src/codegen/generate_rust_tokens.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl ToTokens for SwiftBridgeModule {
148148
const _: () = {
149149
let _: [u8; std::mem::size_of::<super::#ty_name #generics>()] = [0; #size];
150150
fn _assert_copy() {
151-
#swift_bridge_path::assert_copy::<super::#ty_name #generics>();
151+
#swift_bridge_path::copy_support::assert_copy::<super::#ty_name #generics>();
152152
}
153153
};
154154
};

crates/swift-bridge-macro/tests/ui/invalid-copy-attribute.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-
2828
= note: this error originates in the attribute macro `swift_bridge::bridge` (in Nightly builds, run with -Z macro-backtrace for more info)
2929

3030
error[E0277]: the trait bound `DoesNotImplementCopy: Copy` is not satisfied
31-
--> tests/ui/invalid-copy-attribute.rs:8:14
32-
|
33-
8 | type DoesNotImplementCopy;
34-
| ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `DoesNotImplementCopy`
35-
|
31+
--> tests/ui/invalid-copy-attribute.rs:8:14
32+
|
33+
8 | type DoesNotImplementCopy;
34+
| ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `DoesNotImplementCopy`
35+
|
3636
note: required by a bound in `assert_copy`
37-
--> $WORKSPACE/src/lib.rs
38-
|
39-
| pub fn assert_copy<T: Copy>() {}
40-
| ^^^^ required by this bound in `assert_copy`
37+
--> $WORKSPACE/src/copy_support.rs
38+
|
39+
| pub fn assert_copy<T: Copy>() {}
40+
| ^^^^ required by this bound in `assert_copy`
4141
help: consider annotating `DoesNotImplementCopy` with `#[derive(Copy)]`
42-
|
43-
15 | #[derive(Copy)]
44-
|
42+
|
43+
15| #[derive(Copy)]
44+
|

src/copy_support.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub fn assert_copy<T: Copy>() {}

src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ pub mod async_support;
1515
#[doc(hidden)]
1616
pub mod boxed_fn_support;
1717

18+
#[doc(hidden)]
19+
pub mod copy_support;
20+
1821
#[doc(hidden)]
1922
#[repr(C)]
2023
pub struct FfiSlice<T> {
@@ -99,6 +102,3 @@ pub trait SharedEnum {
99102
pub extern "C" fn __swift_bridge__null_pointer() -> *const std::ffi::c_void {
100103
std::ptr::null()
101104
}
102-
103-
#[doc(hidden)]
104-
pub fn assert_copy<T: Copy>() {}

0 commit comments

Comments
 (0)