Skip to content

Commit 0335ebf

Browse files
authored
fixing build (#6)
1 parent c7c4b66 commit 0335ebf

8 files changed

+17
-23
lines changed

.github/workflows/ci.yml

+1-8
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
rust: [nightly, beta, stable, 1.67.0, 1.70.0, 1.74.0]
24+
rust: [nightly, beta, stable, 1.70.0, 1.74.0]
2525
os: [ubuntu]
2626
include:
2727
- name: Cargo on macOS
@@ -60,13 +60,6 @@ jobs:
6060
shell: bash
6161
- run: cargo run --manifest-path demo/Cargo.toml
6262
- run: cargo test --workspace ${{steps.testsuite.outputs.exclude}}
63-
if: matrix.rust != '1.67.0'
64-
- run: cargo check --no-default-features --features alloc
65-
env:
66-
RUSTFLAGS: --cfg compile_error_if_std ${{env.RUSTFLAGS}}
67-
- run: cargo check --no-default-features
68-
env:
69-
RUSTFLAGS: --cfg compile_error_if_alloc --cfg cxx_experimental_no_alloc ${{env.RUSTFLAGS}}
7063
- uses: actions/upload-artifact@v4
7164
if: matrix.os == 'ubuntu' && matrix.rust == 'nightly' && always()
7265
with:

demo/src/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ mod ffi {
1010
extern "Rust" {
1111
type MultiBuf;
1212

13-
fn next_chunk(buf: &mut MultiBuf) -> &[u8];
13+
#[allow(clippy::needless_lifetimes)]
14+
unsafe fn next_chunk<'a>(buf: &'a mut MultiBuf) -> &'a [u8];
1415
}
1516

1617
// C++ types and signatures exposed to Rust.

tests/ui/bad_explicit_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod ffi {
44
x: u8,
55
}
66

7-
impl fn() -> &S {}
7+
impl<'a> fn() -> &'a S {}
88
}
99

1010
fn main() {}

tests/ui/bad_explicit_impl.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: unsupported Self type of explicit impl
22
--> tests/ui/bad_explicit_impl.rs:7:5
33
|
4-
7 | impl fn() -> &S {}
5-
| ^^^^^^^^^^^^^^^^^^
4+
7 | impl<'a> fn() -> &'a S {}
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/mut_return.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ mod ffi {
77
unsafe extern "C++" {
88
type Thing;
99

10-
fn f(t: &Thing) -> Pin<&mut CxxString>;
11-
unsafe fn g(t: &Thing) -> Pin<&mut CxxString>;
12-
fn h(t: Box<Mut>) -> Pin<&mut CxxString>;
10+
fn f<'a>(t: &'a Thing) -> Pin<&'a mut CxxString>;
11+
unsafe fn g<'a>(t: &'a Thing) -> Pin<&'a mut CxxString>;
12+
fn h<'a>(t: Box<Mut>) -> Pin<&'a mut CxxString>;
1313
fn i<'a>(t: Box<Mut<'a>>) -> Pin<&'a mut CxxString>;
14-
fn j(t: &Thing) -> &mut [u8];
14+
fn j<'a>(t: &'a Thing) -> &'a mut [u8];
1515
}
1616
}
1717

tests/ui/mut_return.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: &mut return type is not allowed unless there is a &mut argument
22
--> tests/ui/mut_return.rs:10:9
33
|
4-
10 | fn f(t: &Thing) -> Pin<&mut CxxString>;
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
10 | fn f<'a>(t: &'a Thing) -> Pin<&'a mut CxxString>;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error: &mut return type is not allowed unless there is a &mut argument
88
--> tests/ui/mut_return.rs:14:9
99
|
10-
14 | fn j(t: &Thing) -> &mut [u8];
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10+
14 | fn j<'a>(t: &'a Thing) -> &'a mut [u8];
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/ptr_unsupported.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mod ffi {
33
unsafe extern "C++" {
44
type C;
55

6-
fn get_ptr_to_reference() -> *mut &C;
6+
fn get_ptr_to_reference<'a>() -> *mut &'a C;
77
fn get_uniqueptr_to_ptr() -> UniquePtr<*mut C>;
88
fn get_vector_of_ptr() -> UniquePtr<CxxVector<*mut C>>;
99
}

tests/ui/ptr_unsupported.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: C++ does not allow pointer to reference as a type
22
--> tests/ui/ptr_unsupported.rs:6:38
33
|
4-
6 | fn get_ptr_to_reference() -> *mut &C;
5-
| ^^^^^^^
4+
6 | fn get_ptr_to_reference<'a>() -> *mut &'a C;
5+
| ^^^^^^^^^^
66

77
error: unsupported unique_ptr target type
88
--> tests/ui/ptr_unsupported.rs:7:38

0 commit comments

Comments
 (0)