diff --git a/HACKING.md b/HACKING.md index 8484add3bbc0..40768643956a 100644 --- a/HACKING.md +++ b/HACKING.md @@ -22,8 +22,8 @@ cargo install --path=app/buck2 Or, alternatively, install it directly from GitHub: ```sh -rustup install nightly-2024-06-08 -cargo +nightly-2024-06-08 install --git https://github.com/facebook/buck2.git buck2 +rustup install nightly-2024-07-21 +cargo +nightly-2024-07-21 install --git https://github.com/facebook/buck2.git buck2 ``` ### Side note: using [Nix] to compile the source diff --git a/allocative/allocative/src/rc_str.rs b/allocative/allocative/src/rc_str.rs index 26f3aa253b74..be9fb5db0349 100644 --- a/allocative/allocative/src/rc_str.rs +++ b/allocative/allocative/src/rc_str.rs @@ -14,6 +14,7 @@ use std::ops::Deref; use std::rc::Rc; #[derive(Clone, Debug, PartialEq, Eq, Ord, PartialOrd)] +#[allow(dead_code)] pub(crate) struct RcStr(Rc); impl<'a> From<&'a str> for RcStr { diff --git a/app/buck2_build_api/src/actions/query.rs b/app/buck2_build_api/src/actions/query.rs index 3b6e98deddc8..1935f600e838 100644 --- a/app/buck2_build_api/src/actions/query.rs +++ b/app/buck2_build_api/src/actions/query.rs @@ -417,14 +417,12 @@ pub fn iter_action_inputs<'a>( type Item = &'a SetProjectionInputs; fn next(&mut self) -> Option { - self.queue.pop_front().map(|node| { + self.queue.pop_front().inspect(|node| { for child in &*node.node.children { if self.visited.insert(child) { self.queue.push_back(child); } } - - node }) } } diff --git a/app/buck2_common/src/lib.rs b/app/buck2_common/src/lib.rs index 4e755da43ef9..386a54e7b319 100644 --- a/app/buck2_common/src/lib.rs +++ b/app/buck2_common/src/lib.rs @@ -11,7 +11,6 @@ //! Common core components of buck2 -#![feature(fs_try_exists)] #![feature(io_error_more)] #![feature(is_sorted)] #![feature(map_try_insert)] diff --git a/app/buck2_common/src/temp_path.rs b/app/buck2_common/src/temp_path.rs index b2e41111d92b..a51d89b4b399 100644 --- a/app/buck2_common/src/temp_path.rs +++ b/app/buck2_common/src/temp_path.rs @@ -75,14 +75,14 @@ mod tests { let temp_path = TempPath::new().unwrap(); let path = temp_path.path().to_path_buf(); - assert!(!fs::try_exists(&path).unwrap()); + assert!(!path.try_exists().unwrap()); fs::write(&path, "hello").unwrap(); - assert!(fs::try_exists(&path).unwrap(), "Sanity check"); + assert!(path.try_exists().unwrap(), "Sanity check"); temp_path.close().unwrap(); - assert!(!fs::try_exists(&path).unwrap()); + assert!(!path.try_exists().unwrap()); } } diff --git a/app/buck2_core/src/env/registry.rs b/app/buck2_core/src/env/registry.rs index 2faa215e3430..d02fdcecff88 100644 --- a/app/buck2_core/src/env/registry.rs +++ b/app/buck2_core/src/env/registry.rs @@ -30,7 +30,7 @@ pub struct EnvInfoEntry { impl EnvInfoEntry { pub fn ty_short(&self) -> &'static str { - self.ty.rfind(':').map_or(self.ty, |i| &self.ty[i + 1..]) + self.ty.rfind(':').map_or(self.ty, |i| &self.ty[i + 2..]) } } @@ -53,7 +53,7 @@ mod tests { assert_eq!( &EnvInfoEntry { name: "TEST_VAR_1", - ty: "std::string::String", + ty: "std :: string :: String", default: None, applicability: Applicability::Internal, }, diff --git a/app/buck2_core/src/fs/fs_util.rs b/app/buck2_core/src/fs/fs_util.rs index 5b8d08c41d39..2ad05a87db99 100644 --- a/app/buck2_core/src/fs/fs_util.rs +++ b/app/buck2_core/src/fs/fs_util.rs @@ -318,7 +318,7 @@ pub fn read_dir_if_exists>(path: P) -> Result>(path: P) -> Result { let _guard = IoCounterKey::Stat.guard(); make_error!( - fs::try_exists(path.as_ref().as_maybe_relativized()), + path.as_ref().as_maybe_relativized().try_exists(), format!("try_exists({})", P::as_ref(&path).display()) ) } @@ -1060,7 +1060,7 @@ mod tests { let dir_path = root.join("dir"); create_dir_all(AbsPath::new(&dir_path)?)?; assert_matches!(remove_file(&dir_path), Err(..)); - assert!(fs::try_exists(&dir_path)?); + assert!(dir_path.try_exists()?); Ok(()) } @@ -1102,7 +1102,7 @@ mod tests { let path = root.join("file"); fs::write(&path, b"regular")?; remove_all(&path)?; - assert!(!fs::try_exists(&path)?); + assert!(!path.try_exists()?); Ok(()) } @@ -1114,7 +1114,7 @@ mod tests { fs::create_dir(&path)?; fs::write(path.join("file"), b"regular file in a dir")?; remove_all(&path)?; - assert!(!fs::try_exists(&path)?); + assert!(!path.try_exists()?); Ok(()) } @@ -1163,7 +1163,7 @@ mod tests { let file_path = root.join("file"); fs::write(&file_path, b"File content")?; assert!(remove_dir_all(&file_path).is_err()); - assert!(fs::try_exists(&file_path)?); + assert!(file_path.try_exists()?); Ok(()) } diff --git a/app/buck2_core/src/fs/paths/abs_norm_path.rs b/app/buck2_core/src/fs/paths/abs_norm_path.rs index 1b5bf2841113..f7dfa0c86053 100644 --- a/app/buck2_core/src/fs/paths/abs_norm_path.rs +++ b/app/buck2_core/src/fs/paths/abs_norm_path.rs @@ -853,7 +853,7 @@ fn verify_abs_path_windows_part(path: &str) -> bool { // TODO(nga): behavior of UNC paths is under-specified in `AbsPath`. let path = path.strip_prefix("\\\\.\\").unwrap_or(path); - for component in path.split(|c| c == '/' || c == '\\') { + for component in path.split(['/', '\\']) { if component == "." || component == ".." { return false; } diff --git a/app/buck2_core/src/lib.rs b/app/buck2_core/src/lib.rs index 6a16497a4321..d07bf00423ea 100644 --- a/app/buck2_core/src/lib.rs +++ b/app/buck2_core/src/lib.rs @@ -9,7 +9,6 @@ #![feature(error_generic_member_access)] #![feature(decl_macro)] -#![feature(fs_try_exists)] #![feature(never_type)] #![feature(pattern)] #![feature(box_patterns)] diff --git a/app/buck2_daemon/src/daemonize.rs b/app/buck2_daemon/src/daemonize.rs index 94fc723f8de1..14d184337e30 100644 --- a/app/buck2_daemon/src/daemonize.rs +++ b/app/buck2_daemon/src/daemonize.rs @@ -200,6 +200,7 @@ type Errno = libc::c_int; /// This error type for `Daemonize` `start` method. #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Dupe)] +#[allow(dead_code)] struct Error { kind: ErrorKind, } diff --git a/app/buck2_test/src/local_resource_registry.rs b/app/buck2_test/src/local_resource_registry.rs index 25ead08c946f..faafa9f2bdb6 100644 --- a/app/buck2_test/src/local_resource_registry.rs +++ b/app/buck2_test/src/local_resource_registry.rs @@ -65,7 +65,7 @@ impl<'a> LocalResourceRegistry<'a> { futures::future::join_all(futs) .await .into_iter() - .collect::>()?; + .collect::>()?; Ok::<(), anyhow::Error>(()) }; diff --git a/docs/about/getting_started.md b/docs/about/getting_started.md index 979d5683020f..1da22d6f26b0 100644 --- a/docs/about/getting_started.md +++ b/docs/about/getting_started.md @@ -18,8 +18,8 @@ To get started, first install [rustup](https://rustup.rs/), then compile the `buck2` executable: ```bash -rustup install nightly-2024-06-08 -cargo +nightly-2024-06-08 install --git https://github.com/facebook/buck2.git buck2 +rustup install nightly-2024-07-21 +cargo +nightly-2024-07-21 install --git https://github.com/facebook/buck2.git buck2 ``` The above commands install `buck2` into a suitable directory, such as diff --git a/gazebo/dupe/src/__macro_refs.rs b/gazebo/dupe/src/__macro_refs.rs index 69713c3d6ecd..8fe16b63ee32 100644 --- a/gazebo/dupe/src/__macro_refs.rs +++ b/gazebo/dupe/src/__macro_refs.rs @@ -12,4 +12,4 @@ use crate::Dupe; #[inline] -pub const fn assert_dupe() {} +pub const fn assert_dupe() {} diff --git a/rust-toolchain b/rust-toolchain index b4c62c124830..d3bf011317fa 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -9,6 +9,6 @@ # * NOTE: You may have to change this file in a follow up commit as ocamlrep # has a dependency on buck2 git trunk. -# @rustc_version: rustc 1.80.0-nightly (804421dff 2024-06-07) -channel = "nightly-2024-06-08" +# @rustc_version: rustc 1.81.0-nightly (506985649 2024-07-20) +channel = "nightly-2024-07-21" components = ["llvm-tools-preview","rustc-dev","rust-src"] diff --git a/starlark-rust/starlark/src/tests/derive/freeze/basic.rs b/starlark-rust/starlark/src/tests/derive/freeze/basic.rs index df4c2e3c21ec..b2b9a908a3f4 100644 --- a/starlark-rust/starlark/src/tests/derive/freeze/basic.rs +++ b/starlark-rust/starlark/src/tests/derive/freeze/basic.rs @@ -19,4 +19,5 @@ use crate as starlark; use crate::values::Freeze; #[derive(Freeze)] +#[allow(dead_code)] struct TestUnitStruct; diff --git a/starlark-rust/starlark/src/tests/uncategorized.rs b/starlark-rust/starlark/src/tests/uncategorized.rs index ecad645689ae..83336029d352 100644 --- a/starlark-rust/starlark/src/tests/uncategorized.rs +++ b/starlark-rust/starlark/src/tests/uncategorized.rs @@ -956,7 +956,7 @@ fn test_fuzzer_59102() { let res: Result = AstModule::parse("hello_world.star", src.to_owned(), &Dialect::Standard); // The panic actually only happens when we format the result - format!("{:?}", res); + let _unused = format!("{:?}", res); } #[test] @@ -966,7 +966,7 @@ fn test_fuzzer_59371() { let res: Result = AstModule::parse("hello_world.star", src.to_owned(), &Dialect::Standard); // The panic actually only happens when we format the result - format!("{:?}", res); + let _unused = format!("{:?}", res); } #[test] diff --git a/starlark-rust/starlark/src/values/error.rs b/starlark-rust/starlark/src/values/error.rs index 35ae7ee32c93..9b5828e148c6 100644 --- a/starlark-rust/starlark/src/values/error.rs +++ b/starlark-rust/starlark/src/values/error.rs @@ -100,10 +100,7 @@ impl ValueError { /// Helper to create an [`OperationNotSupported`](ValueError::OperationNotSupported) error. #[cold] - pub fn unsupported<'v, T, V: StarlarkValue<'v> + ?Sized>( - _left: &V, - op: &str, - ) -> crate::Result { + pub fn unsupported<'v, T, V: StarlarkValue<'v>>(_left: &V, op: &str) -> crate::Result { Self::unsupported_owned(V::TYPE, op, None) } @@ -114,7 +111,7 @@ impl ValueError { /// Helper to create an [`OperationNotSupported`](ValueError::OperationNotSupportedBinary) error. #[cold] - pub fn unsupported_with<'v, T, V: StarlarkValue<'v> + ?Sized>( + pub fn unsupported_with<'v, T, V: StarlarkValue<'v>>( _left: &V, op: &str, right: Value, diff --git a/starlark-rust/starlark/src/values/layout/vtable.rs b/starlark-rust/starlark/src/values/layout/vtable.rs index e43cc85dd46e..227ee0957605 100644 --- a/starlark-rust/starlark/src/values/layout/vtable.rs +++ b/starlark-rust/starlark/src/values/layout/vtable.rs @@ -134,9 +134,9 @@ pub(crate) struct AValueVTable { allocative: unsafe fn(StarlarkValueRawPtr) -> *const dyn Allocative, } -struct GetTypeId<'v, T: StarlarkValue<'v> + ?Sized>(PhantomData<&'v T>); +struct GetTypeId<'v, T: StarlarkValue<'v>>(PhantomData<&'v T>); -impl<'v, T: StarlarkValue<'v> + ?Sized> GetTypeId<'v, T> { +impl<'v, T: StarlarkValue<'v>> GetTypeId<'v, T> { const TYPE_ID: ConstTypeId = ConstTypeId::of::<::StaticType>(); const STARLARK_TYPE_ID: StarlarkTypeId = StarlarkTypeId::of::(); } diff --git a/starlark-rust/starlark/src/values/type_repr.rs b/starlark-rust/starlark/src/values/type_repr.rs index 5cb3fbf017c7..f11b16618852 100644 --- a/starlark-rust/starlark/src/values/type_repr.rs +++ b/starlark-rust/starlark/src/values/type_repr.rs @@ -82,7 +82,7 @@ impl StarlarkTypeRepr for SetType { } } -impl<'v, T: StarlarkValue<'v> + ?Sized> StarlarkTypeRepr for T { +impl<'v, T: StarlarkValue<'v>> StarlarkTypeRepr for T { type Canonical = Self; fn starlark_type_repr() -> Ty { diff --git a/starlark-rust/starlark/src/values/types/string/methods.rs b/starlark-rust/starlark/src/values/types/string/methods.rs index f963ae4c5ee1..55d51c70ceb9 100644 --- a/starlark-rust/starlark/src/values/types/string/methods.rs +++ b/starlark-rust/starlark/src/values/types/string/methods.rs @@ -1093,7 +1093,7 @@ pub(crate) fn string_methods(builder: &mut MethodsBuilder) { let mut s = this; let mut lines: Vec = Vec::new(); loop { - if let Some(x) = s.find(|x| x == '\n' || x == '\r') { + if let Some(x) = s.find(['\n', '\r']) { let y = x; let x = match s.get(y..y + 2) { Some("\r\n") => y + 2, diff --git a/starlark-rust/starlark/src/values/typing/type_compiled/compiled.rs b/starlark-rust/starlark/src/values/typing/type_compiled/compiled.rs index 08a6c7d337ee..f6cb1b55ab8e 100644 --- a/starlark-rust/starlark/src/values/typing/type_compiled/compiled.rs +++ b/starlark-rust/starlark/src/values/typing/type_compiled/compiled.rs @@ -350,13 +350,10 @@ impl<'v, V: ValueLike<'v>> Hash for TypeCompiled { impl<'v, V: ValueLike<'v>> PartialEq for TypeCompiled { #[allow(clippy::manual_unwrap_or)] fn eq(&self, other: &Self) -> bool { - match self.0.to_value().equals(other.0.to_value()) { - Ok(b) => b, - Err(_) => { - // Unreachable, but we should not panic in `PartialEq`. - false - } - } + self.0 + .to_value() + .equals(other.0.to_value()) + .unwrap_or_default() } }