@@ -1463,6 +1463,11 @@ fn expand_unique_ptr(
1463
1463
1464
1464
let can_construct_from_value = types. is_maybe_trivial ( ident) ;
1465
1465
let new_method = if can_construct_from_value {
1466
+ let raw_mut = if rustversion:: cfg!( since( 1.82 ) ) {
1467
+ quote ! ( & raw mut )
1468
+ } else {
1469
+ quote ! ( & mut )
1470
+ } ;
1466
1471
Some ( quote ! {
1467
1472
fn __new( value: Self ) -> :: cxx:: core:: mem:: MaybeUninit <* mut :: cxx:: core:: ffi:: c_void> {
1468
1473
#UnsafeExtern extern "C" {
@@ -1471,7 +1476,7 @@ fn expand_unique_ptr(
1471
1476
}
1472
1477
let mut repr = :: cxx:: core:: mem:: MaybeUninit :: uninit( ) ;
1473
1478
unsafe {
1474
- __uninit( & mut repr) . cast:: <#ident #ty_generics>( ) . write( value) ;
1479
+ __uninit( #raw_mut repr) . cast:: <#ident #ty_generics>( ) . write( value) ;
1475
1480
}
1476
1481
repr
1477
1482
}
@@ -1483,6 +1488,16 @@ fn expand_unique_ptr(
1483
1488
let begin_span = explicit_impl. map_or ( key. begin_span , |explicit| explicit. impl_token . span ) ;
1484
1489
let end_span = explicit_impl. map_or ( key. end_span , |explicit| explicit. brace_token . span . join ( ) ) ;
1485
1490
let unsafe_token = format_ident ! ( "unsafe" , span = begin_span) ;
1491
+ let raw_const = if rustversion:: cfg!( since( 1.82 ) ) {
1492
+ quote_spanned ! ( end_span=> & raw const )
1493
+ } else {
1494
+ quote_spanned ! ( end_span=> & )
1495
+ } ;
1496
+ let raw_mut = if rustversion:: cfg!( since( 1.82 ) ) {
1497
+ quote_spanned ! ( end_span=> & raw mut )
1498
+ } else {
1499
+ quote_spanned ! ( end_span=> & mut )
1500
+ } ;
1486
1501
1487
1502
quote_spanned ! { end_span=>
1488
1503
#[ automatically_derived]
@@ -1497,7 +1512,7 @@ fn expand_unique_ptr(
1497
1512
}
1498
1513
let mut repr = :: cxx:: core:: mem:: MaybeUninit :: uninit( ) ;
1499
1514
unsafe {
1500
- __null( & mut repr) ;
1515
+ __null( #raw_mut repr) ;
1501
1516
}
1502
1517
repr
1503
1518
}
@@ -1509,7 +1524,7 @@ fn expand_unique_ptr(
1509
1524
}
1510
1525
let mut repr = :: cxx:: core:: mem:: MaybeUninit :: uninit( ) ;
1511
1526
unsafe {
1512
- __raw( & mut repr, raw. cast( ) ) ;
1527
+ __raw( #raw_mut repr, raw. cast( ) ) ;
1513
1528
}
1514
1529
repr
1515
1530
}
@@ -1518,22 +1533,22 @@ fn expand_unique_ptr(
1518
1533
#[ link_name = #link_get]
1519
1534
fn __get( this: * const :: cxx:: core:: mem:: MaybeUninit <* mut :: cxx:: core:: ffi:: c_void>) -> * const :: cxx:: core:: ffi:: c_void;
1520
1535
}
1521
- unsafe { __get( & repr) . cast( ) }
1536
+ unsafe { __get( #raw_const repr) . cast( ) }
1522
1537
}
1523
1538
unsafe fn __release( mut repr: :: cxx:: core:: mem:: MaybeUninit <* mut :: cxx:: core:: ffi:: c_void>) -> * mut Self {
1524
1539
#UnsafeExtern extern "C" {
1525
1540
#[ link_name = #link_release]
1526
1541
fn __release( this: * mut :: cxx:: core:: mem:: MaybeUninit <* mut :: cxx:: core:: ffi:: c_void>) -> * mut :: cxx:: core:: ffi:: c_void;
1527
1542
}
1528
- unsafe { __release( & mut repr) . cast( ) }
1543
+ unsafe { __release( #raw_mut repr) . cast( ) }
1529
1544
}
1530
1545
unsafe fn __drop( mut repr: :: cxx:: core:: mem:: MaybeUninit <* mut :: cxx:: core:: ffi:: c_void>) {
1531
1546
#UnsafeExtern extern "C" {
1532
1547
#[ link_name = #link_drop]
1533
1548
fn __drop( this: * mut :: cxx:: core:: mem:: MaybeUninit <* mut :: cxx:: core:: ffi:: c_void>) ;
1534
1549
}
1535
1550
unsafe {
1536
- __drop( & mut repr) ;
1551
+ __drop( #raw_mut repr) ;
1537
1552
}
1538
1553
}
1539
1554
}
@@ -1769,6 +1784,17 @@ fn expand_cxx_vector(
1769
1784
None
1770
1785
} ;
1771
1786
1787
+ let raw_const = if rustversion:: cfg!( since( 1.82 ) ) {
1788
+ quote_spanned ! ( end_span=> & raw const )
1789
+ } else {
1790
+ quote_spanned ! ( end_span=> & )
1791
+ } ;
1792
+ let raw_mut = if rustversion:: cfg!( since( 1.82 ) ) {
1793
+ quote_spanned ! ( end_span=> & raw mut )
1794
+ } else {
1795
+ quote_spanned ! ( end_span=> & mut )
1796
+ } ;
1797
+
1772
1798
quote_spanned ! { end_span=>
1773
1799
#[ automatically_derived]
1774
1800
#unsafe_token impl #impl_generics :: cxx:: private:: VectorElement for #elem #ty_generics {
@@ -1807,7 +1833,7 @@ fn expand_cxx_vector(
1807
1833
}
1808
1834
let mut repr = :: cxx:: core:: mem:: MaybeUninit :: uninit( ) ;
1809
1835
unsafe {
1810
- __unique_ptr_null( & mut repr) ;
1836
+ __unique_ptr_null( #raw_mut repr) ;
1811
1837
}
1812
1838
repr
1813
1839
}
@@ -1818,7 +1844,7 @@ fn expand_cxx_vector(
1818
1844
}
1819
1845
let mut repr = :: cxx:: core:: mem:: MaybeUninit :: uninit( ) ;
1820
1846
unsafe {
1821
- __unique_ptr_raw( & mut repr, raw) ;
1847
+ __unique_ptr_raw( #raw_mut repr, raw) ;
1822
1848
}
1823
1849
repr
1824
1850
}
@@ -1827,22 +1853,22 @@ fn expand_cxx_vector(
1827
1853
#[ link_name = #link_unique_ptr_get]
1828
1854
fn __unique_ptr_get #impl_generics( this: * const :: cxx:: core:: mem:: MaybeUninit <* mut :: cxx:: core:: ffi:: c_void>) -> * const :: cxx:: CxxVector <#elem #ty_generics>;
1829
1855
}
1830
- unsafe { __unique_ptr_get( & repr) }
1856
+ unsafe { __unique_ptr_get( #raw_const repr) }
1831
1857
}
1832
1858
unsafe fn __unique_ptr_release( mut repr: :: cxx:: core:: mem:: MaybeUninit <* mut :: cxx:: core:: ffi:: c_void>) -> * mut :: cxx:: CxxVector <Self > {
1833
1859
#UnsafeExtern extern "C" {
1834
1860
#[ link_name = #link_unique_ptr_release]
1835
1861
fn __unique_ptr_release #impl_generics( this: * mut :: cxx:: core:: mem:: MaybeUninit <* mut :: cxx:: core:: ffi:: c_void>) -> * mut :: cxx:: CxxVector <#elem #ty_generics>;
1836
1862
}
1837
- unsafe { __unique_ptr_release( & mut repr) }
1863
+ unsafe { __unique_ptr_release( #raw_mut repr) }
1838
1864
}
1839
1865
unsafe fn __unique_ptr_drop( mut repr: :: cxx:: core:: mem:: MaybeUninit <* mut :: cxx:: core:: ffi:: c_void>) {
1840
1866
#UnsafeExtern extern "C" {
1841
1867
#[ link_name = #link_unique_ptr_drop]
1842
1868
fn __unique_ptr_drop( this: * mut :: cxx:: core:: mem:: MaybeUninit <* mut :: cxx:: core:: ffi:: c_void>) ;
1843
1869
}
1844
1870
unsafe {
1845
- __unique_ptr_drop( & mut repr) ;
1871
+ __unique_ptr_drop( #raw_mut repr) ;
1846
1872
}
1847
1873
}
1848
1874
}
0 commit comments