tikv / pprof-rs

A Rust CPU profiler implemented with the help of backtrace-rs
Apache License 2.0
1.26k stars 94 forks source link

Unable to compile pprof with MSRV 1.64.0 #221

Closed Joining7943 closed 10 months ago

Joining7943 commented 10 months ago

Hi! As the title says, compiling pprof with MSRV 1.64.0 fails with:

error: package `addr2line v0.21.0` cannot be built because it requires rustc 1.65 or newer, while the currently active rustc version is 1.64.0

I tracked this down to the backtrace dependency which uses 1.65.0 since version 0.3.69 with which they also updated addr2line from 0.20.0 to 0.21.0.

sticnarf commented 10 months ago

pprof-rs does not directly depend on addr2line. It does not require backtrace >= 0.3.69, either.

So, what you need is just downgrading backtrace in your project to 0.3.68.

Joining7943 commented 10 months ago

Thanks for your reply.

To my knowledge, I can't just downgrade backtrace since it is a transitive dependency in my library crate. Can't you just specify a version of backtrace <=0.3.68? In my opinion, if you specify a msrv of 1.64.0, you should also ensure that pprof can be build with that msrv.

sticnarf commented 10 months ago

IMO libraries needn't specify <= some version to satisfy MSRV. Otherwise, those using higher versions of Rust will fail to use latest versions of the dependencies.

The binary crates can downgrade the version in Cargo.lock using cargo update -p backtrace --precise 0.3.68. Or, they can add backtrace as their direct dependency and specify <=0.3.68 themselves.

sticnarf commented 10 months ago

The new guideline from the Rust blog permits committing lockfiles. So, it's possible to check MSRV in CI with an appropriate committed Cargo.lock.

Joining7943 commented 10 months ago

So, it's possible to check MSRV in CI with an appropriate committed Cargo.lock.

Since they changed their guideline, this looks like a good solution.