Has anyone ever encountered this error while tryin...
# general
s
Has anyone ever encountered this error while trying to compile pants itself?
Copy code
error[E0658]: use of unstable library feature `result_flattening`
...
error: could not compile `sharded_lmdb` (lib) due to 7 previous errors
warning: build failed, waiting for other jobs to finish...
w
This is on
main
?
s
yup. full build error:
Copy code
 pants fmt
[=== 00:00 Building native code... ===]
  Downloaded pyo3-build-config v0.27.2
  Downloaded pyo3-macros-backend v0.27.2
  Downloaded pyo3-macros v0.27.2
  Downloaded pyo3-ffi v0.27.2
  Downloaded pyo3 v0.27.2
  Downloaded 5 crates (1.3MiB) in 3.71s (largest was `pyo3` at 1.1MiB)
   Compiling pyo3-build-config v0.27.2
   Compiling sharded_lmdb v0.0.1 (/Users/alex/Projects/pants/src/rust/sharded_lmdb)
   Compiling logging v0.0.1 (/Users/alex/Projects/pants/src/rust/logging)
   Compiling generic-array v0.14.7
   Compiling nails v0.13.0
   Compiling tree-sitter-typescript v0.23.2
   Compiling tree-sitter-dockerfile v0.3.0 (<https://github.com/pantsbuild/tree-sitter-dockerfile.git?rev=508588913c93a30e7ef09a4ac3ecdee955b7b950#50858891>)
   Compiling tree-sitter-python v0.25.0
error[E0658]: use of unstable library feature `result_flattening`
   --> sharded_lmdb/src/lib.rs:300:14
    |
300 |             .flatten()
    |              ^^^^^^^
    |
    = note: see issue #70142 <<https://github.com/rust-lang/rust/issues/70142>> for more information

error[E0658]: use of unstable library feature `result_flattening`
   --> sharded_lmdb/src/lib.rs:370:14
    |
370 |             .flatten()
    |              ^^^^^^^
    |
    = note: see issue #70142 <<https://github.com/rust-lang/rust/issues/70142>> for more information

error[E0658]: use of unstable library feature `result_flattening`
   --> sharded_lmdb/src/lib.rs:430:14
    |
430 |             .flatten()
    |              ^^^^^^^
    |
    = note: see issue #70142 <<https://github.com/rust-lang/rust/issues/70142>> for more information

error[E0658]: use of unstable library feature `result_flattening`
   --> sharded_lmdb/src/lib.rs:517:14
    |
517 |             .flatten()
    |              ^^^^^^^
    |
    = note: see issue #70142 <<https://github.com/rust-lang/rust/issues/70142>> for more information

error[E0658]: use of unstable library feature `result_flattening`
   --> sharded_lmdb/src/lib.rs:613:14
    |
613 |             .flatten()
    |              ^^^^^^^
    |
    = note: see issue #70142 <<https://github.com/rust-lang/rust/issues/70142>> for more information

   Compiling uname v0.1.1
error[E0658]: use of unstable library feature `result_flattening`
   --> sharded_lmdb/src/lib.rs:636:14
    |
636 |             .flatten()
    |              ^^^^^^^
    |
    = note: see issue #70142 <<https://github.com/rust-lang/rust/issues/70142>> for more information

error[E0658]: use of unstable library feature `result_flattening`
   --> sharded_lmdb/src/lib.rs:689:14
    |
689 |             .flatten()
    |              ^^^^^^^
    |
    = note: see issue #70142 <<https://github.com/rust-lang/rust/issues/70142>> for more information

   Compiling rayon-core v1.12.1
   Compiling peg-runtime v0.8.5
   Compiling tree-sitter-language v0.1.5
   Compiling parking v2.2.1
   Compiling serde_spanned v0.6.9
For more information about this error, try `rustc --explain E0658`.
error: could not compile `sharded_lmdb` (lib) due to 7 previous errors
warning: build failed, waiting for other jobs to finish...
w
Hmm, it's not happening in CI as far as I can tell, so that's bizarre. Assuming rustup is installed, it should grab the toolchain file, and then be good to go. What OS/platform are you running on? I'm about to dash out of the office, unfortunately, so I can't help right now. But I can look into it when I'm back tonight
s
That would be great! I have rustup installed. was using stable, tried switching to nightly when i ran into this, didn't change anything. I'm on macos-aarch64
w
We use 1.91 right now, with a PR for 1.92 in progress
Okay, same env as me - so yeah, this doesnt make sense at all. I wiped my entire rust/cargo/rustup ecosystem by ~accide~nt intentionally, so I should be in a new-build state. Will check if I run into this. You can also hop into the src/rust directory and try building using cargo commands there directly. The commands we use are, I think in one of the files sourced by
{ROOT}/pants
or
ROOT}/cargo
Anyways, gotta dash - will look later if no one has figured it out!
👍 1
s
just to confirm:
Copy code
cd src/rust
cargo build --features=extension-module --release -p engine -p client -p sandboxer
as specified in
{ROOT}/pants
shell sources, produces the same errors
h
Very weird.
result_flattening
was stabilized in Rust 1.74.0 and we are well past that
Somehow you are on an earlier Rust
For sanity, what is in
src/rust/rust-toolchain
?
s
ok, that's extra weird! the contents of
src/rust/rust-toolchain
match what's on github:
Copy code
[toolchain]
channel = "1.91.0"
# NB: We don't list the components (namely `clippy` and `rustfmt`) and instead rely on either the
#  the profile being "default" (by-and-large the default profile) or the nice error message from
#  `cargo fmt` and `cargo clippy` if the required component isn't installed
#  This is so the Pants-compiled engine (which uses the "minimal" profile) doesn't download/install
#  these as they are unnecessary.
my rustup stable toolchain version is 1.91.1 and my rustup nightly toolchain is 1.93.0
I just ran
rustup update
and it bumped them to 1.92 .x and 1.94,x respectively
maybe something in my PATH is messed up... hang on
hmmm.... strange, my
rustc
points to homebrew... and is v1.88 i don't recall having installed rust via homebrew, but i guess that's the issue
h
So something is wrong with our bootstrapping logic, since I'm pretty sure the toolchain should be controlled by the toolchain file above
Have you installed standard rustup via https://rustup.rs/ ?
I guess that your
rustc
and
cargo
and friends are pointing to homebrew and not rustup-controlled toolchains
s
yup, rustup is installed and should be working, but the rustc/cargo provided by homebrew overrides the rustc/cargo provided by rustup, and ignored the
rust-toolchain
file. uninstalling homebrew's rust allowedrustup's rust to kick in and it worked immediately. pants was able to successfully compile. maybe there's a way for the bootstrapping logic to detect if it's running cargo/rustc provided by rustup and warn if it isn't... I'm not really sure.
Anyway, I'm not unstuck and able to contribute to the project. Thanks @happy-kitchen-89482!!!
h
Great!
w
Funnily enough, something similar to this is why I deleted all my rust/cargo - I didn't see anything like this, but Homebrew doing weird stuff overall.
Glad you figured it out!