mimblewimble / grin

Minimal implementation of the Mimblewimble protocol.
https://grin.mw/
Apache License 2.0
5.04k stars 990 forks source link

Compiling error Linux error[E0310]: the parameter type `T` may not live long enough #3780

Closed MCM-Mike closed 9 months ago

MCM-Mike commented 9 months ago

I am getting errors when compiling the latest Note: checking out 'v5.2.0'. version.

Rust:

rustc 1.76.0 (07dca489a 2024-02-04)

Compiling from v5.2.0

info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: checking for self-update

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.76.0 (07dca489a 2024-02-04)

info: cleaning up downloads & tmp directories
You are not currently on a branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

Previous HEAD position was 70d45465 version number update for 5.2.0 tag
Switched to branch 'master'
From https://github.com/mimblewimble/grin
 ! [rejected]          v5.1.1     -> v5.1.1  (would clobber existing tag)
Note: checking out 'v5.2.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 70d45465 version number update for 5.2.0 tag
v5.2.0
     Removed 1147 files, 445.2MiB total
   Compiling libc v0.2.148
   Compiling proc-macro2 v1.0.67
   Compiling unicode-ident v1.0.12
   Compiling autocfg v1.1.0
   Compiling serde v1.0.188
   Compiling cfg-if v1.0.0
   Compiling memchr v2.6.3
   Compiling cfg-if v0.1.10
   Compiling syn v1.0.109
   Compiling version_check v0.9.4
   Compiling lazy_static v1.4.0
   Compiling rand_core v0.4.2
   Compiling fnv v1.0.7
   Compiling itoa v1.0.9
   Compiling once_cell v1.18.0
   Compiling typenum v1.17.0
   Compiling bytes v0.5.6
   Compiling rand_core v0.3.1
   Compiling autocfg v0.1.8
   Compiling futures-core v0.3.28
   Compiling glob v0.3.1
   Compiling bitflags v1.3.2
   Compiling hashbrown v0.12.3
   Compiling generic-array v0.14.7
   Compiling ryu v1.0.15
   Compiling num-traits v0.2.16
   Compiling num-integer v0.1.45
   Compiling slab v0.4.9
   Compiling indexmap v1.9.3
   Compiling quote v1.0.33
   Compiling syn v2.0.37
   Compiling clang-sys v1.6.1
   Compiling serde_json v1.0.107
   Compiling aho-corasick v1.1.1
   Compiling num-iter v0.1.43
   Compiling iana-time-zone v0.1.57
   Compiling crc32fast v1.3.2
   Compiling regex-syntax v0.7.5
   Compiling pkg-config v0.3.27
   Compiling minimal-lexical v0.2.1
   Compiling jobserver v0.1.26
   Compiling signal-hook-registry v1.4.1
   Compiling net2 v0.2.39
   Compiling iovec v0.1.4
   Compiling cc v1.0.83
   Compiling nom v7.1.3
   Compiling libloading v0.7.4
   Compiling rand_chacha v0.1.1
   Compiling rand_pcg v0.1.2
   Compiling linked-hash-map v0.5.6
   Compiling bindgen v0.59.2
   Compiling adler v1.0.2
   Compiling nodrop v0.1.14
   Compiling miniz_oxide v0.7.1
   Compiling digest v0.9.0
   Compiling rand v0.6.5
   Compiling scopeguard v1.2.0
   Compiling futures-sink v0.3.28
   Compiling lazycell v1.3.0
   Compiling smallvec v1.11.1
   Compiling shlex v1.2.0
   Compiling peeking_take_while v0.1.2
   Compiling rustc-hash v1.1.0
   Compiling traitobject v0.1.0
   Compiling subtle v2.4.1
   Compiling thiserror v1.0.49
   Compiling unsafe-any v0.4.2
   Compiling lock_api v0.3.4
   Compiling parking_lot_core v0.7.3
   Compiling yaml-rust v0.4.5
   Compiling block-buffer v0.9.0
   Compiling num_cpus v1.16.0
   Compiling rand_os v0.1.3
   Compiling regex-automata v0.3.8
   Compiling ring v0.16.20
   Compiling grin_secp256k1zkp v0.7.12
   Compiling backtrace v0.3.69
   Compiling cexpr v0.6.0
   Compiling ordered-float v1.1.1
   Compiling num-bigint v0.2.6
   Compiling rand_hc v0.1.0
   Compiling rand_isaac v0.1.1
   Compiling rand_xorshift v0.1.1
   Compiling rand_jitter v0.1.4
   Compiling quick-error v1.2.3
   Compiling byteorder v1.4.3
   Compiling gimli v0.28.0
   Compiling futures-channel v0.3.28
   Compiling odds v0.2.26
   Compiling opaque-debug v0.3.0
   Compiling futures-task v0.3.28
   Compiling pin-project-lite v0.2.13
   Compiling arrayvec v0.4.12
   Compiling pin-project-lite v0.1.12
   Compiling humantime v1.3.0
   Compiling arrayvec v0.3.25
   Compiling parking_lot v0.10.2
   Compiling crypto-mac v0.11.1
   Compiling typemap v0.3.3
   Compiling flate2 v1.0.27
   Compiling thread-id v3.3.0
   Compiling rand v0.5.6
   Compiling object v0.32.1
   Compiling regex v1.9.5
   Compiling num-rational v0.2.4
   Compiling num-complex v0.2.4
   Compiling log-mdc v0.1.0
   Compiling serde_derive v1.0.188
   Compiling zeroize_derive v1.4.2
   Compiling thiserror-impl v1.0.49
   Compiling tokio-macros v0.2.6
   Compiling addr2line v0.21.0
   Compiling untrusted v0.7.1
   Compiling cpufeatures v0.2.9
   Compiling base64ct v1.6.0
   Compiling rustc-serialize v0.3.24
   Compiling same-file v1.0.6
   Compiling rand_core v0.6.4
   Compiling arc-swap v0.4.8
   Compiling spin v0.5.2
error[E0310]: the parameter type `T` may not live long enough
    --> /grin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustc-serialize-0.3.24/src/serialize.rs:1155:5
     |
1155 |     fn decode<D: Decoder>(d: &mut D) -> Result<Cow<'static, T>, D::Error> {
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |     |
     |     the parameter type `T` must be valid for the static lifetime...
     |     ...so that the type `T` will meet its required lifetime bounds...
     |
note: ...that is required by this bound
    --> /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/borrow.rs:180:30
help: consider adding an explicit lifetime bound
     |
1151 | impl<'a, T: ?Sized + 'static> Decodable for Cow<'a, T>
     |                    +++++++++

   Compiling futures-util v0.3.28
   Compiling zeroize v1.6.0
   Compiling rustc-demangle v0.1.23
   Compiling password-hash v0.2.3
   Compiling walkdir v2.4.0
   Compiling sha2 v0.9.9
   Compiling futures-macro v0.3.28
For more information about this error, try `rustc --explain E0310`.
error: could not compile `rustc-serialize` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
yeastplume commented 9 months ago

should be fixed #3781

MCM-Mike commented 9 months ago

should be fixed #3781

Using this #3781 it seems to be working fine again:


warning: use of deprecated associated function `chrono::NaiveDateTime::from_timestamp`: use `from_timestamp_opt()` instead
   --> servers/src/mining/mine_block.rs:171:64
    |
171 |     b.header.timestamp = DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(now_sec, 0), Utc);
    |                                                                   ^^^^^^^^^^^^^^

   Compiling grin_config v5.2.1-beta.1 (/opt/grin/build/grin/config)
warning: `grin_servers` (lib) generated 6 warnings
warning: use of deprecated associated function `chrono::NaiveDateTime::from_timestamp`: use `from_timestamp_opt()` instead
  --> src/bin/tui/mining.rs:67:39 
   |
67 |         let naive_datetime = NaiveDateTime::from_timestamp(
   |                                             ^^^^^^^^^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

warning: use of deprecated associated function `chrono::DateTime::<Tz>::from_utc`: Use TimeZone::from_utc_datetime() or DateTime::from_naive_utc_and_offset instead
  --> src/bin/tui/mining.rs:74:43 
   |
74 |         let datetime: DateTime<Utc> = DateTime::from_utc(naive_datetime, Utc);
   |                                                 ^^^^^^^^

warning: use of deprecated associated function `chrono::NaiveDateTime::from_timestamp`: use `from_timestamp_opt()` instead
   --> src/bin/tui/mining.rs:129:39
    |
129 |         let naive_datetime = NaiveDateTime::from_timestamp(self.time as i64, 0);
    |                                             ^^^^^^^^^^^^^^

warning: use of deprecated associated function `chrono::DateTime::<Tz>::from_utc`: Use TimeZone::from_utc_datetime() or DateTime::from_naive_utc_and_offset instead
   --> src/bin/tui/mining.rs:130:43
    |
130 |         let datetime: DateTime<Utc> = DateTime::from_utc(naive_datetime, Utc);
    |                                                 ^^^^^^^^

warning: use of deprecated method `chrono::DateTime::<Tz>::timestamp_nanos`: use `timestamp_nanos_opt()` instead
  --> src/bin/tui/status.rs:74:40 
   |
74 |                     let start = stat.prev_update_time.timestamp_nanos();
   |                                                       ^^^^^^^^^^^^^^^

warning: use of deprecated method `chrono::DateTime::<Tz>::timestamp_nanos`: use `timestamp_nanos_opt()` instead
  --> src/bin/tui/status.rs:75:27 
   |
75 |                     let fin = Utc::now().timestamp_nanos();
   |                                          ^^^^^^^^^^^^^^^

warning: `grin` (bin "grin") generated 6 warnings
    Finished release [optimized] target(s) in 1m 33s
warning: the following packages contain code that will be rejected by a future version of Rust: cargo-lock v4.0.1, grin_secp256k1zkp v0.7.12, traitobject v0.1.0
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`