Commit Graph

487 Commits

Author SHA1 Message Date
徐未来
b110613bee cxx 1.0.91升级至1.0.97
Signed-off-by: 徐未来 <xuweilai2@huawei.com>
2024-04-02 19:59:25 +08:00
openharmony_ci
96698d870d
回退 'Pull Request !11 : cxx1.0.91升级至1.0.97' 2024-04-02 03:30:32 +00:00
徐未来
e4f6feee96 1.0.91升级至1.0.97
Signed-off-by: 徐未来 <xuweilai2@huawei.com>
2024-03-08 16:36:47 +08:00
David Tolnay
46040d0912
Support cxx_name containing name that is Rust keyword 2023-01-07 12:02:52 -08:00
David Tolnay
40bb0d3779
Resolve needless_borrow clippy lint
error: the borrowed expression implements the required traits
      --> syntax/check.rs:91:25
       |
    91 |         cx.error(ident, &msg);
       |                         ^^^^ help: change this to: `msg`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
       = note: `-D clippy::needless-borrow` implied by `-D clippy::all`
2022-12-29 18:34:05 -08:00
David Tolnay
33432a868d
Provide a suggestion to replace quoted raw identifier 2022-11-08 00:50:54 -08:00
David Tolnay
9f47a6218f
Allow raw identifier outside of quotes only 2022-11-08 00:40:51 -08:00
David Tolnay
8a029059c1
Support raw identifiers in namespace attribute
As in: #[namespace = ::my::company::r#box::implementation]
2022-11-08 00:35:10 -08:00
David Tolnay
152b89b08b
No-std fixes for Box, String, Pin, c_char 2022-10-21 09:18:48 -07:00
David Tolnay
b122cff91d
Allow Vec<bool> to pass syntax check 2022-09-27 17:38:47 -07:00
David Tolnay
30427e0205
Propagate attrs from extern mod onto all contents
#[cxx::bridge]
    mod ffi {
        #[allow(clippy::too_many_arguments)]
        extern "Rust" {
            fn repro(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) -> bool;
        }
    }

Before:

    warning: this function has too many arguments (8/7)
     --> src/main.rs:5:12
      |
    5 |         fn repro(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) -> bool;
      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: `#[warn(clippy::too_many_arguments)]` on by default
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments

After: no lint.
2022-07-04 09:33:54 -07:00
David Tolnay
e41be2f96b
Begin development on async fn support 2022-01-18 17:58:16 -08:00
David Tolnay
97d7d53c44
Wrap async fn error message 2022-01-18 17:29:01 -08:00
David Tolnay
d58307a1f0
Rename variants_from_header optin to "experimental-enum-variants-from-header"
In preparation for "experimental-async-fn" as a completely orthogonal
experimental feature.
2022-01-18 17:29:01 -08:00
David Tolnay
c1f2176154
Handle module-level cfg attributes 2022-01-18 00:39:25 -08:00
David Tolnay
7bafde28f4
Run cfg evaluator to strip syntax tree 2022-01-17 19:54:54 -08:00
David Tolnay
502022a476
Parse attributes on impl blocks 2022-01-17 19:05:47 -08:00
David Tolnay
2476aff7b2
Store parsed cfg attributes into syntax tree 2022-01-17 18:47:30 -08:00
David Tolnay
b9781f0d03
Add parser for cfg expressions 2022-01-17 14:10:10 -08:00
David Tolnay
5c58322742
Format with rustfmt 1.4.38
Apparently 7fae55596e makes a difference in how rustfmt wants to format this enum.
2022-01-17 13:49:01 -08:00
David Tolnay
7fae55596e
Resolve dead code warnings uncovered by rustc_privacy/rustc_resolve refactor
warning: associated function is never used: `checked_succ`
       --> gen/build/src/syntax/discriminant.rs:183:18
        |
    183 |     pub const fn checked_succ(self) -> Option<Self> {
        |                  ^^^^^^^^^^^^
        |
        = note: `#[warn(dead_code)]` on by default

    warning: associated function is never used: `ty`
       --> gen/build/src/syntax/tokens.rs:305:12
        |
    305 |     pub fn ty(&self) -> ReceiverType {
        |            ^^

    warning: associated function is never used: `ty_self`
       --> gen/build/src/syntax/tokens.rs:310:12
        |
    310 |     pub fn ty_self(&self) -> ReceiverTypeSelf {
        |            ^^^^^^^

    warning: variant is never constructed: `Foreign`
       --> gen/build/src/syntax/mod.rs:122:5
        |
    122 |     Foreign { rust_type: Path },
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^

    warning: associated function is never used: `checked_succ`
       --> macro/src/syntax/discriminant.rs:183:18
        |
    183 |     pub const fn checked_succ(self) -> Option<Self> {
        |                  ^^^^^^^^^^^^
        |
        = note: `#[warn(dead_code)]` on by default

    warning: associated function is never used: `is_empty`
      --> macro/src/syntax/doc.rs:22:12
       |
    22 |     pub fn is_empty(&self) -> bool {
       |            ^^^^^^^^

    warning: associated function is never used: `to_string`
      --> macro/src/syntax/doc.rs:26:12
       |
    26 |     pub fn to_string(&self) -> String {
       |            ^^^^^^^^^

    warning: associated function is never used: `remove`
       --> macro/src/syntax/map.rs:127:16
        |
    127 |         pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
        |                ^^^^^^

    warning: associated function is never used: `to_fully_qualified`
      --> macro/src/syntax/names.rs:24:12
       |
    24 |     pub fn to_fully_qualified(&self) -> String {
       |            ^^^^^^^^^^^^^^^^^^

    warning: associated function is never used: `prefix_with`
      --> macro/src/syntax/symbol.rs:44:12
       |
    44 |     pub fn prefix_with(&self, prefix: &str) -> Symbol {
       |            ^^^^^^^^^^^

    warning: variant is never constructed: `Foreign`
       --> macro/src/syntax/mod.rs:122:5
        |
    122 |     Foreign { rust_type: Path },
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2022-01-10 18:50:49 -08:00
David Tolnay
def09ab798
Add link to cxx-async repo in async error message 2021-12-12 20:25:28 -08:00
David Tolnay
338636308b
Pass through serde attributes 2021-12-05 19:37:43 -08:00
David Tolnay
0faefeb777
Merge pull request #941 from rookboom/master
Added Serde Serialize/Deserialize traits
2021-10-26 19:50:07 -07:00
Johan Verwey
b3ac95e814
Added Serde Serialize/Deserialize traits 2021-10-26 19:48:43 -07:00
David Tolnay
989ce7db0f
Resolve to_string_in_format_args clippy lint
error: `to_string` applied to a type that implements `Display` in `format!` args
      --> syntax/symbol.rs:45:44
       |
    45 |         Symbol(format!("{}{}", prefix, self.to_string()))
       |                                            ^^^^^^^^^^^^ help: remove this
       |
       = note: `-D clippy::to-string-in-format-args` implied by `-D clippy::all`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
2021-10-22 19:28:33 -07:00
David Tolnay
9754a725f5
Pass through doc(hidden) attribute 2021-10-05 16:27:08 -04:00
David Tolnay
d9a561cf48
Delete unused span field from ForeignName
warning: field is never read: `span`
      --> macro/src/syntax/names.rs:12:5
       |
    12 |     span: Span,
       |     ^^^^^^^^^^
       |
       = note: `#[warn(dead_code)]` on by default
2021-09-12 05:08:34 -07:00
David Tolnay
c59a4022cd
Avoid inheriting formatter flags in some Display impls
The previous implementation would produce wrong unintentional output
when formatting with alignment or padding, such as {:<15}.
2021-07-29 13:34:55 -07:00
David Tolnay
20cb73ae6f
Support slice of trivial extern type alias 2021-07-23 14:16:46 -07:00
David Tolnay
9b252141c0
Ignore whether variants_from_header attr is outer or inner 2021-04-22 20:35:35 -07:00
David Tolnay
4584958676
Support enum repr types from std::os::raw 2021-04-22 20:04:03 -07:00
David Tolnay
3b58d1c799
Move empty enum check to before filling in variants 2021-04-22 20:04:02 -07:00
David Tolnay
e2250bca87
Parse discriminant values from clang AST 2021-04-22 20:04:02 -07:00
David Tolnay
8a893c79ed
Extract variant info from ast dump 2021-04-22 20:04:02 -07:00
David Tolnay
2b62812419
Store original Attribute of the variants_from_header for spans 2021-04-22 20:04:01 -07:00
David Tolnay
bbf96674a2
Implicltly extern type for enums sourced from header 2021-04-22 20:04:01 -07:00
David Tolnay
2cf2d0c7b2
Preserve item inner attrs 2021-04-22 20:04:01 -07:00
David Tolnay
dd8320320c
Implement variants_from_header checking 2021-04-21 18:23:21 -07:00
David Tolnay
15bf509509
Parse #![variants_from_header] inner attribute 2021-04-21 18:21:56 -07:00
David Tolnay
c5f472ef62
Factor out helper for identifying maybe trivial types 2021-04-16 15:16:19 -07:00
David Tolnay
757f7ff85f
Support inner attributes inside bridge
Example:

    #[cxx::bridge]
    mod ffi {
        #![deny(missing_docs)]

        unsafe extern "C++" {
            include!("example/include/header.h");

            /// wow
            fn f();
        }
    }

    pub use self::ffi::*;
2021-04-13 20:52:25 -07:00
David Tolnay
65b8338411
Add padding around member functions that have documentation 2021-04-13 20:23:19 -07:00
David Tolnay
8a0abfdfb1
Touch up BareFn type parsing 2021-04-10 13:47:40 -07:00
David Tolnay
281d49ac95
Store span of method receiver colon tokens 2021-04-10 13:44:31 -07:00
David Tolnay
f6cad33f31
Store span of function argument colon tokens 2021-04-10 13:42:07 -07:00
David Tolnay
c46b0fa065
Make errors rustc already catches specific to C++ generator 2021-04-08 18:45:16 -07:00
David Tolnay
ef1b70d0db
Diagnostic for invalid lifetime param 'static 2021-04-08 18:45:08 -07:00
David Tolnay
22cb28882a
Recognize mutable slice in return position of a safe function 2021-03-28 04:23:06 -04:00
David Tolnay
ffd6f84833
Recognize mutable slice argument as permitting mutable return 2021-03-28 04:17:56 -04:00