Skip to content

kclvm no longer builds on rust 1.89 because of serde_yaml #1986

@Stinjul

Description

@Stinjul

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Run make build with rustc version 1.89 (through rustup or your package manager)

As I noticed the issue on NixOS where all kcl related packages are currently broken on nixpkgs unstable because they updated the default rust version to 1.89, you can also reproduce this by simply building any kcl package from nixpkgs unstable using the nix package manager:

nix build github:NixOS/nixpkgs#kcl
nix build github:NixOS/nixpkgs#kcl-language-server
nix build github:NixOS/nixpkgs#kclvm

2. What did you expect to see? (Required)

Succesful build of kclvm (and packages that depend on it)

3. What did you see instead (Required)

An error at the end of the build log:

build log
error: implicit autoref creates a reference to the dereference of a raw pointer
  --> third-party/serde_yaml/src/libyaml/error.rs:21:28
   |
21 |             kind: unsafe { (*parser).error },
   |                            ^^------^^^^^^^
   |                              |
   |                              this raw pointer has type `*const yaml_parser_t`
   |
   = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
   = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
   = note: `#[deny(dangerous_implicit_autorefs)]` on by default
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
   |
21 |             kind: unsafe { (&(*parser)).error },
   |                            ++         +

error: implicit autoref creates a reference to the dereference of a raw pointer
  --> third-party/serde_yaml/src/libyaml/error.rs:22:50
   |
22 |             problem: match NonNull::new(unsafe { (*parser).problem as *mut _ }) {
   |                                                  ^^------^^^^^^^^^
   |                                                    |
   |                                                    this raw pointer has type `*const yaml_parser_t`
   |
   = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
   = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
   |
22 |             problem: match NonNull::new(unsafe { (&(*parser)).problem as *mut _ }) {
   |                                                  ++         +

error: implicit autoref creates a reference to the dereference of a raw pointer
  --> third-party/serde_yaml/src/libyaml/error.rs:26:38
   |
26 |             problem_offset: unsafe { (*parser).problem_offset },
   |                                      ^^------^^^^^^^^^^^^^^^^
   |                                        |
   |                                        this raw pointer has type `*const yaml_parser_t`
   |
   = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
   = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
   |
26 |             problem_offset: unsafe { (&(*parser)).problem_offset },
   |                                      ++         +

error: implicit autoref creates a reference to the dereference of a raw pointer
  --> third-party/serde_yaml/src/libyaml/error.rs:28:31
   |
28 |                 sys: unsafe { (*parser).problem_mark },
   |                               ^^------^^^^^^^^^^^^^^
   |                                 |
   |                                 this raw pointer has type `*const yaml_parser_t`
   |
   = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
   = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
   |
28 |                 sys: unsafe { (&(*parser)).problem_mark },
   |                               ++         +

error: implicit autoref creates a reference to the dereference of a raw pointer
  --> third-party/serde_yaml/src/libyaml/error.rs:30:50
   |
30 |             context: match NonNull::new(unsafe { (*parser).context as *mut _ }) {
   |                                                  ^^------^^^^^^^^^
   |                                                    |
   |                                                    this raw pointer has type `*const yaml_parser_t`
   |
   = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
   = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
   |
30 |             context: match NonNull::new(unsafe { (&(*parser)).context as *mut _ }) {
   |                                                  ++         +

error: implicit autoref creates a reference to the dereference of a raw pointer
  --> third-party/serde_yaml/src/libyaml/error.rs:35:31
   |
35 |                 sys: unsafe { (*parser).context_mark },
   |                               ^^------^^^^^^^^^^^^^^
   |                                 |
   |                                 this raw pointer has type `*const yaml_parser_t`
   |
   = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
   = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
   |
35 |                 sys: unsafe { (&(*parser)).context_mark },
   |                               ++         +

error: implicit autoref creates a reference to the dereference of a raw pointer
  --> third-party/serde_yaml/src/libyaml/error.rs:42:28
   |
42 |             kind: unsafe { (*emitter).error },
   |                            ^^-------^^^^^^^
   |                              |
   |                              this raw pointer has type `*const yaml_emitter_t`
   |
   = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
   = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
   |
42 |             kind: unsafe { (&(*emitter)).error },
   |                            ++          +

error: implicit autoref creates a reference to the dereference of a raw pointer
  --> third-party/serde_yaml/src/libyaml/error.rs:43:50
   |
43 |             problem: match NonNull::new(unsafe { (*emitter).problem as *mut _ }) {
   |                                                  ^^-------^^^^^^^^^
   |                                                    |
   |                                                    this raw pointer has type `*const yaml_emitter_t`
   |
   = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
   = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
   |
43 |             problem: match NonNull::new(unsafe { (&(*emitter)).problem as *mut _ }) {
   |                                                  ++          +

error: implicit autoref creates a reference to the dereference of a raw pointer
  --> third-party/serde_yaml/src/libyaml/parser.rs:87:16
   |
87 |             if (*parser).error != sys::YAML_NO_ERROR {
   |                ^^------^^^^^^^
   |                  |
   |                  this raw pointer has type `*mut yaml_parser_t`
   |
   = note: creating a reference requires the pointer target to be valid and imposes aliasing requirements
   = note: references are created through calls to explicit `Deref(Mut)::deref(_mut)` implementations
help: try using a raw pointer method instead; or if this reference is intentional, make it explicit
   |
87 |             if (&(*parser)).error != sys::YAML_NO_ERROR {
   |                ++         +

warning: hiding a lifetime that's elided elsewhere is confusing
  --> third-party/serde_yaml/src/mapping.rs:81:18
   |
81 |     pub fn entry(&mut self, k: Value) -> Entry {
   |                  ^^^^^^^^^               ----- the same lifetime is hidden here
   |                  |
   |                  the lifetime is elided here
   |
   = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
   = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: use `'_` for type paths
   |
81 |     pub fn entry(&mut self, k: Value) -> Entry<'_> {
   |                                               ++++

warning: hiding a lifetime that's elided elsewhere is confusing
   --> third-party/serde_yaml/src/mapping.rs:188:17
    |
188 |     pub fn iter(&self) -> Iter {
    |                 ^^^^^     ---- the same lifetime is hidden here
    |                 |
    |                 the lifetime is elided here
    |
    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
    |
188 |     pub fn iter(&self) -> Iter<'_> {
    |                               ++++

warning: hiding a lifetime that's elided elsewhere is confusing
   --> third-party/serde_yaml/src/mapping.rs:197:21
    |
197 |     pub fn iter_mut(&mut self) -> IterMut {
    |                     ^^^^^^^^^     ------- the same lifetime is hidden here
    |                     |
    |                     the lifetime is elided here
    |
    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
    |
197 |     pub fn iter_mut(&mut self) -> IterMut<'_> {
    |                                          ++++

warning: hiding a lifetime that's elided elsewhere is confusing
   --> third-party/serde_yaml/src/mapping.rs:204:17
    |
204 |     pub fn keys(&self) -> Keys {
    |                 ^^^^^     ---- the same lifetime is hidden here
    |                 |
    |                 the lifetime is elided here
    |
    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
    |
204 |     pub fn keys(&self) -> Keys<'_> {
    |                               ++++

warning: hiding a lifetime that's elided elsewhere is confusing
   --> third-party/serde_yaml/src/mapping.rs:218:19
    |
218 |     pub fn values(&self) -> Values {
    |                   ^^^^^     ------ the same lifetime is hidden here
    |                   |
    |                   the lifetime is elided here
    |
    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
    |
218 |     pub fn values(&self) -> Values<'_> {
    |                                   ++++

warning: hiding a lifetime that's elided elsewhere is confusing
   --> third-party/serde_yaml/src/mapping.rs:225:23
    |
225 |     pub fn values_mut(&mut self) -> ValuesMut {
    |                       ^^^^^^^^^     --------- the same lifetime is hidden here
    |                       |
    |                       the lifetime is elided here
    |
    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
    |
225 |     pub fn values_mut(&mut self) -> ValuesMut<'_> {
    |                                              ++++

warning: hiding a lifetime that's elided elsewhere is confusing
   --> third-party/serde_yaml/src/number.rs:555:34
    |
555 | pub(crate) fn unexpected(number: &Number) -> Unexpected {
    |                                  ^^^^^^^     ---------- the same lifetime is hidden here
    |                                  |
    |                                  the lifetime is elided here
    |
    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
    |
555 | pub(crate) fn unexpected(number: &Number) -> Unexpected<'_> {
    |                                                        ++++

warning: hiding a lifetime that's elided elsewhere is confusing
    --> third-party/serde_yaml/src/value/de.rs:1231:30
     |
1231 |     pub(crate) fn unexpected(&self) -> Unexpected {
     |                              ^^^^^     ---------- the same lifetime is hidden here
     |                              |
     |                              the lifetime is elided here
     |
     = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
     |
1231 |     pub(crate) fn unexpected(&self) -> Unexpected<'_> {
     |                                                  ++++

warning: `serde_yaml` (lib) generated 8 warnings
error: could not compile `serde_yaml` (lib) due to 9 previous errors; 8 warnings emitted
warning: build failed, waiting for other jobs to finish...
make: *** [Makefile:26: build] Error 101

4. What is your KCL components version? (Required)

v0.11.2

Extra info

This is caused by the following PR in rust that got released with 1.89
rust-lang/rust#141661

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions