Skip to content

Commit

Permalink
update to Rust 1.65.0
Browse files Browse the repository at this point in the history
Summary:
Added `fbcode` symlinks for `platform010` & `platform010-aarch64` and addressed the following fixes:
* Account for stabilized [`#![feature(backtrace)]`](rust-lang/rust#99573) and [`#![feature(generic_associated_types)]`](rust-lang/rust#99573)
* Account for removal of [`#![feature(result_into_ok_or_err)]`](rust-lang/rust#100604)
* Account for migration of [`std::io::ReadBuf` to `std::io::BorrowBuf|BorrowCursor`](rust-lang/rust#97015)
* Account for [`Error` trait move into core](rust-lang/rust#99917)
* Account for `#[warn(non_camel_case_types)]`
* Various function signature, lifetime requirement changes and lint fixes

Reviewed By: zertosh

Differential Revision: D40923615

fbshipit-source-id: f7ac2828d74edeae39aae517172207b0ee998a59
  • Loading branch information
diliop authored and facebook-github-bot committed Nov 10, 2022
1 parent 7b3841f commit ee7bd12
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 15 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,7 @@ debug = true
[profile.dev]
incremental = true
debug = true
panic = "abort"
split-debuginfo = "unpacked"
gpanic = "abort"
opt-level = 1

[profile.test]
Expand Down
1 change: 0 additions & 1 deletion app/buck2_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
// Because Buck build uses different version of Rust than Cargo build.
#![allow(stable_features)]
#![feature(absolute_path)]
#![feature(backtrace)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(const_fn_trait_bound)]
#![feature(const_panic)]
Expand Down
1 change: 0 additions & 1 deletion buck2_build_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#![feature(type_name_of_val)]
#![feature(never_type)]
#![feature(is_sorted)]
#![feature(generic_associated_types)]
#![feature(trait_alias)]
// Plugins
#![cfg_attr(feature = "gazebo_lint", feature(plugin))]
Expand Down
2 changes: 0 additions & 2 deletions buck2_common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
#![cfg_attr(feature = "gazebo_lint", feature(plugin))]
#![cfg_attr(feature = "gazebo_lint", allow(deprecated))] // :(
#![cfg_attr(feature = "gazebo_lint", plugin(gazebo_lint))]
#![feature(backtrace)]
#![feature(box_syntax)]
#![feature(fs_try_exists)]
#![feature(io_error_more)]
#![feature(is_sorted)]
#![feature(never_type)]
#![feature(pattern)]
#![feature(result_into_ok_or_err)]

#[cfg(test)]
#[macro_use]
Expand Down
8 changes: 4 additions & 4 deletions buck2_common/src/package_listing/file_listing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@ impl PackageFileListing {
use std::cmp::Ordering;
let files = &self.files;
let len = files.len();
let lower = binary_search_by(len, |idx: usize| -> Ordering {
let (Ok(lower) | Err(lower)) = binary_search_by(len, |idx: usize| -> Ordering {
let x = files.get_index(idx).unwrap().as_str();
if x.starts_with(prefix) {
Ordering::Greater
} else {
x.cmp(prefix)
}
});
let upper = binary_search_by(len, |idx: usize| -> Ordering {
let (Ok(upper) | Err(upper)) = binary_search_by(len, |idx: usize| -> Ordering {
let x = files.get_index(idx).unwrap().as_str();
if x.starts_with(prefix) {
Ordering::Less
} else {
x.cmp(prefix)
}
});
(lower.into_ok_or_err()..upper.into_ok_or_err())
.map(|idx: usize| files.get_index(idx).unwrap().as_ref())

(lower..upper).map(|idx: usize| files.get_index(idx).unwrap().as_ref())
}

pub fn contains_file(&self, mut file: &PackageRelativePath) -> bool {
Expand Down
1 change: 0 additions & 1 deletion buck2_interpreter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#![feature(pattern)]
#![feature(try_blocks)]
#![feature(never_type)]
#![feature(result_into_ok_or_err)]
// Plugins
#![cfg_attr(feature = "gazebo_lint", feature(plugin))]
#![cfg_attr(feature = "gazebo_lint", allow(deprecated))] // :(
Expand Down
2 changes: 1 addition & 1 deletion buck2_node/src/attrs/coerced_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub enum CoercedAttr {

// This is just to help understand any impact that changes have to the size of this.
// We store a lot of these, so we try to keep it to a reasonable size.
static_assertions::assert_eq_size!(CoercedAttr, [usize; 5]);
static_assertions::assert_eq_size!(CoercedAttr, [usize; 4]);

/// Provides roughly the stringified version of the starlark code that would produce this attr. For example, a dictionary
/// of string keys and values may result in `{"key1":"value1","key2":"value2"}` (note that strings will explicitly include
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2022-08-06"
channel = "nightly-2022-09-27"
components = ["llvm-tools-preview","rustc-dev"]
1 change: 0 additions & 1 deletion starlark-rust/starlark/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@
#![feature(const_mut_refs)]
#![feature(const_type_id)]
#![cfg_attr(rust_nightly, feature(core_intrinsics))]
#![feature(generic_associated_types)]
#![feature(maybe_uninit_write_slice)]
#![feature(ptr_metadata)]
// Plugins
Expand Down
3 changes: 2 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ def rustfmt(buck2_dir: Path, ci: bool) -> None:
"clippy::needless-match",
"clippy::only-used-in-recursion",
# Other
"clippy::blacklisted-name", # Not using foo, bar, baz in test data is silly
"clippy::disallowed_names", # Not using foo, bar, baz in test data is silly
"clippy::bool-to-int-with-if", # Using if branches to return 1 or 0 is valid, but this complains that we should use `int::from`, which is arguably less clear
"clippy::cognitive_complexity", # This is an arbitrary linter
"clippy::comparison_chain", # Generates worse code and harder to read
"clippy::comparison_to_empty", # x == "" is clearer than x.is_empty()
Expand Down

0 comments on commit ee7bd12

Please sign in to comment.