4146 Commits

Author SHA1 Message Date
David Tolnay
b6f339ca36
Resolve repr_packed_without_abi clippy lint in tests
warning: item uses `packed` representation without ABI-qualification
       --> test_suite/tests/test_gen.rs:774:5
        |
    772 |       #[repr(packed)]
        |              ------ `packed` representation set here
    773 |       #[allow(dead_code)]
    774 | /     struct Packed {
    775 | |         x: u8,
    776 | |         y: u16,
    777 | |     }
        | |_____^
        |
        = warning: unqualified `#[repr(packed)]` defaults to `#[repr(Rust, packed)]`, which has no stable ABI
        = help: qualify the desired ABI explicity via `#[repr(C, packed)]` or `#[repr(Rust, packed)]`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#repr_packed_without_abi
    note: the lint level is defined here
       --> test_suite/tests/test_gen.rs:5:9
        |
    5   | #![deny(warnings)]
        |         ^^^^^^^^
        = note: `#[warn(clippy::repr_packed_without_abi)]` implied by `#[warn(warnings)]`

    warning: item uses `packed` representation without ABI-qualification
       --> test_suite/tests/test_gen.rs:919:1
        |
    918 |   #[repr(packed)]
        |          ------ `packed` representation set here
    919 | / pub struct RemotePacked {
    920 | |     pub a: u16,
    921 | |     pub b: u32,
    922 | | }
        | |_^
        |
        = warning: unqualified `#[repr(packed)]` defaults to `#[repr(Rust, packed)]`, which has no stable ABI
        = help: qualify the desired ABI explicity via `#[repr(C, packed)]` or `#[repr(Rust, packed)]`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#repr_packed_without_abi

    warning: item uses `packed` representation without ABI-qualification
       --> test_suite/tests/test_gen.rs:927:1
        |
    925 |   #[repr(packed)]
        |          ------ `packed` representation set here
    926 |   #[serde(remote = "RemotePacked")]
    927 | / pub struct RemotePackedDef {
    928 | |     a: u16,
    929 | |     b: u32,
    930 | | }
        | |_^
        |
        = warning: unqualified `#[repr(packed)]` defaults to `#[repr(Rust, packed)]`, which has no stable ABI
        = help: qualify the desired ABI explicity via `#[repr(C, packed)]` or `#[repr(Rust, packed)]`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#repr_packed_without_abi

    warning: item uses `packed` representation without ABI-qualification
       --> test_suite/tests/test_gen.rs:937:1
        |
    936 |   #[repr(packed)]
        |          ------ `packed` representation set here
    937 | / pub struct RemotePackedNonCopy {
    938 | |     pub a: u16,
    939 | |     pub b: String,
    940 | | }
        | |_^
        |
        = warning: unqualified `#[repr(packed)]` defaults to `#[repr(Rust, packed)]`, which has no stable ABI
        = help: qualify the desired ABI explicity via `#[repr(C, packed)]` or `#[repr(Rust, packed)]`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#repr_packed_without_abi

    warning: item uses `packed` representation without ABI-qualification
       --> test_suite/tests/test_gen.rs:945:1
        |
    943 |   #[repr(packed)]
        |          ------ `packed` representation set here
    944 |   #[serde(remote = "RemotePackedNonCopy")]
    945 | / pub struct RemotePackedNonCopyDef {
    946 | |     a: u16,
    947 | |     b: String,
    948 | | }
        | |_^
        |
        = warning: unqualified `#[repr(packed)]` defaults to `#[repr(Rust, packed)]`, which has no stable ABI
        = help: qualify the desired ABI explicity via `#[repr(C, packed)]` or `#[repr(Rust, packed)]`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#repr_packed_without_abi
2024-12-26 18:33:33 -08:00
David Tolnay
2a5caea1a8
Merge pull request #2872 from dtolnay/ehpersonality
Drop #[lang = "eh_personality"] from no-std test
2024-12-20 04:33:24 -08:00
David Tolnay
b9f93f99aa
Add no-std CI on stable compiler 2024-12-20 04:30:14 -08:00
David Tolnay
eb5cd476ba
Drop #[lang = "eh_personality"] from no-std test 2024-12-20 04:28:35 -08:00
David Tolnay
8478a3b7dd
Merge pull request #2871 from dtolnay/nostdstart
Replace #[start] with extern fn main
2024-12-20 04:28:27 -08:00
David Tolnay
dbb909136e
Replace #[start] with extern fn main 2024-12-20 04:20:26 -08:00
David Tolnay
ad8dd4148b
Release 1.0.216 2024-12-10 18:05:39 -08:00
David Tolnay
f91d2ed9ae
Merge pull request #2868 from dtolnay/automaticallyderived
Mark all generated trait impls as #[automatically_derived]
2024-12-10 18:04:42 -08:00
David Tolnay
9497463718
Mark all generated trait impls as #[automatically_derived] 2024-12-10 17:57:05 -08:00
Oli Scherer
46e9ecfcdd
Merge pull request #2866 from tdittr/mark-visitors-as-generated
Mark generated `impl de::Visitor` blocks as `#[automatically_derived]`
2024-12-09 11:58:24 +01:00
Tamme Dittrich
e9c399c822 Mark generated impl de::Visitor blocks as #[automatically_derived]
This hides the generated visitors and field visitors from code
coverage.
2024-12-05 17:26:13 +01:00
David Tolnay
b9dbfcb4ac
Switch out fnv in favor of foldhash in test 2024-11-16 12:24:05 -08:00
David Tolnay
c270e27a4d
Use BuildHasher instead of Hasher in collection macros 2024-11-16 12:23:34 -08:00
David Tolnay
0307f604ea
Resolve question_mark clippy lint in build script
warning: this `match` expression can be replaced with `?`
       --> serde/build.rs:111:17
        |
    111 |       let rustc = match env::var_os("RUSTC") {
        |  _________________^
    112 | |         Some(rustc) => rustc,
    113 | |         None => return None,
    114 | |     };
        | |_____^ help: try instead: `env::var_os("RUSTC")?`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
        = note: `-W clippy::question-mark` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::question_mark)]`

    warning: this `match` expression can be replaced with `?`
       --> serde/build.rs:131:16
        |
    131 |       let next = match pieces.next() {
        |  ________________^
    132 | |         Some(next) => next,
    133 | |         None => return None,
    134 | |     };
        | |_____^ help: try instead: `pieces.next()?`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
2024-11-15 18:57:00 -08:00
David Tolnay
8939af48fe
Release 1.0.215 2024-11-11 13:03:35 -08:00
David Tolnay
fa5d58cd00
Use ui test syntax that does not interfere with rustfmt 2024-11-10 23:50:37 -08:00
David Tolnay
1a3cf4b3c1
Update PR 2562 ui tests 2024-11-10 23:46:31 -08:00
David Tolnay
7d96352e96
Merge pull request #2857 from dtolnay/collide
Revert the colliding aliases hard error (PRs #2562 & #2853)
2024-11-10 23:37:01 -08:00
David Tolnay
111ecc5d8c
Update ui tests for warning on colliding aliases 2024-11-10 23:31:55 -08:00
David Tolnay
edd6fe954b
Revert "Add checks for conflicts for aliases"
This reverts commit 5f9fffa53e8a48d9e1f32b1735542207c42f3ead.
2024-11-10 23:31:55 -08:00
David Tolnay
a20e9249c5
Revert "pacify clippy"
This reverts commit 951ca5ace0ca0abf9b44e0d6c76005fbd3b77c5c.
2024-11-10 23:31:55 -08:00
David Tolnay
b1353a99cd
Merge pull request #2856 from dtolnay/dename
Produce a separate warning for every colliding name
2024-11-10 23:31:44 -08:00
David Tolnay
c59e876bb3
Produce a separate warning for every colliding name 2024-11-10 23:23:09 -08:00
David Tolnay
7f1e697c0d
Merge pull request #2855 from dtolnay/namespan
Produce unreachable_patterns warning when deserialization names collide
2024-11-10 23:21:46 -08:00
David Tolnay
373edcd055
Keep track of a span for alias strings 2024-11-10 23:08:40 -08:00
David Tolnay
f0b5c4f857
Move MultiName to a new module 2024-11-10 22:32:49 -08:00
David Tolnay
3035d4fa34
Rename Name -> MultiName 2024-11-10 22:32:49 -08:00
David Tolnay
60ac737439
Prevent upload-artifact step from causing CI failure
This step has been failing way more than reasonable across my various repos.

    With the provided path, there will be 1 file uploaded
    Artifact name is valid!
    Root directory input is valid!
    Attempt 1 of 5 failed with error: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact. Retrying request in 3000 ms...
    Attempt 2 of 5 failed with error: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact. Retrying request in 6029 ms...
    Attempt 3 of 5 failed with error: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact. Retrying request in 8270 ms...
    Attempt 4 of 5 failed with error: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact. Retrying request in 12577 ms...
    Error: Failed to CreateArtifact: Failed to make request after 5 attempts: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact
2024-11-08 21:45:52 -05:00
Oli Scherer
a95b0d301e
Merge pull request #2853 from serde-rs/oli-obk-patch-1
pacify clippy
2024-11-01 15:25:08 +01:00
Oli Scherer
951ca5ace0
pacify clippy 2024-11-01 15:20:51 +01:00
Oli Scherer
adf05a5bf6
Merge pull request #2562 from Mingun/alias-check
Add checks for conflicts for aliases
2024-11-01 15:14:15 +01:00
David Tolnay
418062165f
Release 1.0.214 2024-10-28 09:41:44 -07:00
David Tolnay
210373b3b6
Merge pull request #2568 from Mingun/into_deserializer-for-deserializers
Implement `IntoDeserializer` for all `Deserializer`s in `serde:🇩🇪:value` module
2024-10-28 09:40:57 -07:00
Mingun
5f9fffa53e Add checks for conflicts for aliases
- Check that alias is not the same as name of other field (it still can be the name of owning field/variant)
- Check that aliases are unique, i. e. two different fields does not use the same alias
2024-10-25 19:18:31 +05:00
Mingun
9cda015733 Implement IntoDeserializer for all Deserializers in serde:🇩🇪:value module
Unfortunately, blanket implementation IntoDeserializer for Deserializer is impossible
right now because this would be a breaking change. External crates may have this
such implementation (and serde_json actually have it for Value)
2024-10-25 19:17:50 +05:00
David Tolnay
58a8d22931
Release 1.0.213 2024-10-22 11:14:58 -07:00
David Tolnay
ef0ed22593
Merge pull request #2847 from dtolnay/newtypewith
Hygiene for macro-generated newtype struct deserialization with `with` attr
2024-10-22 11:14:18 -07:00
David Tolnay
79925ac394
Ignore dead_code warning in regression test
warning: field `0` is never read
      --> test_suite/tests/regression/issue2846.rs:8:45
       |
    8  |         pub struct S(#[serde(with = $with)] i32);
       |                    - field in this struct   ^^^
    ...
    12 | declare_in_macro!("with");
       | ------------------------- in this macro invocation
       |
       = help: consider removing this field
       = note: `#[warn(dead_code)]` on by default
       = note: this warning originates in the macro `declare_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
2024-10-22 11:10:52 -07:00
David Tolnay
b60e4092ec
Hygiene for macro-generated newtype struct deserialization with 'with' attr 2024-10-22 11:10:40 -07:00
David Tolnay
fdc36e5c06
Add regression test for issue 2846
error[E0425]: cannot find value `__e` in this scope
      --> test_suite/tests/regression/issue2846.rs:12:19
       |
    12 | declare_in_macro!("with");
       |                   ^^^^^^ not found in this scope
2024-10-22 11:08:22 -07:00
David Tolnay
49e11ce1ba
Ignore trivially_copy_pass_by_ref pedantic clippy lint in test
warning: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
      --> test_suite/tests/regression/issue2844.rs:18:28
       |
    18 |     pub fn serialize<S>(_: &i32, _: S) -> Result<S::Ok, S::Error>
       |                            ^^^^ help: consider passing by value instead: `i32`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
       = note: `-W clippy::trivially-copy-pass-by-ref` implied by `-W clippy::pedantic`
       = help: to override `-W clippy::pedantic` add `#[allow(clippy::trivially_copy_pass_by_ref)]`
2024-10-22 09:56:12 -07:00
David Tolnay
7ae1b5f8f3
Release 1.0.212 2024-10-22 09:41:55 -07:00
David Tolnay
1ac054b34a
Merge pull request #2845 from dtolnay/withlocal
Fix hygiene of macro-generated local variable accesses in serde(with) wrappers
2024-10-22 09:41:27 -07:00
David Tolnay
1e36ef551d
Fix hygiene of macro-generated local variable accesses in serde(with) wrappers 2024-10-22 09:38:06 -07:00
David Tolnay
0058c7226e
Add regression test for issue 2844
error[E0424]: expected value, found module `self`
      --> test_suite/tests/regression/issue2844.rs:13:19
       |
    5  |         #[derive(Serialize, Deserialize)]
       |                  --------- this function has a `self` parameter, but a macro invocation can only access identifiers it receives from parameters
    ...
    13 | declare_in_macro!("with");
       |                   ^^^^^^ `self` value is a keyword only available in methods with a `self` parameter

    error[E0425]: cannot find value `__s` in this scope
      --> test_suite/tests/regression/issue2844.rs:13:19
       |
    13 | declare_in_macro!("with");
       |                   ^^^^^^ not found in this scope

    error[E0425]: cannot find value `__deserializer` in this scope
      --> test_suite/tests/regression/issue2844.rs:13:19
       |
    13 | declare_in_macro!("with");
       |                   ^^^^^^ not found in this scope
2024-10-22 09:37:58 -07:00
David Tolnay
29d4f3e887
Format regression tests with rustfmt 2024-10-22 09:28:10 -07:00
David Tolnay
1b8310d98a
Release 1.0.211 2024-10-21 23:27:57 -07:00
David Tolnay
af4c388dff
Merge pull request #2843 from dtolnay/fieldwithaliases
Collect field ident and aliases into a struct
2024-10-21 23:23:28 -07:00
David Tolnay
09f6d9361d
Collect field ident and aliases into a struct 2024-10-21 23:16:05 -07:00
David Tolnay
1f9eb8300f
Merge pull request #2842 from dtolnay/identsaliases
Rename field_names_idents -> field_idents_aliases
2024-10-21 23:13:23 -07:00