Skip to content

Commit

Permalink
Update fbcode and xplat Rust toolchain
Browse files Browse the repository at this point in the history
Summary:
Release notes: https://blog.rust-lang.org/2024/06/13/Rust-1.79.0.html

Stabilized features:

- `absolute_path`
- `associated_type_bounds`
- `inline_const`
- `pointer_is_aligned`
- `slice_ptr_len`

This release raises a new warning when a trait impl contains a signature that is more refined than the corresponding signature in the trait, impacting `buck2_query`.

```lang=text
warning: impl trait in impl method signature does not match trait method signature
  --> fbcode/buck2/app/buck2_query/src/query/environment/tests.rs:73:30
   |
73 |     fn deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
  ::: fbcode/buck2/app/buck2_query/src/query/environment.rs:98:30
   |
98 |     fn deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a;
   |                              ----------------------------------------------- return type from trait method defined here
   |
   = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
   = note: we are soliciting feedback, see issue #121718 <rust-lang/rust#121718> for more information
   = note: `#[warn(refining_impl_trait_internal)]` on by default
help: replace the return type so that it matches the trait
   |
73 |     fn deps<'a>(&'a self) -> impl Iterator<Item = &'a <Self as node::LabeledNode>::Key> + std::marker::Send + 'a {
   |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

It also contains changes to the `dead_code` lint, which are addressed in {D59622902} and {D59623034}.

Reviewed By: zertosh

Differential Revision: D58982552

fbshipit-source-id: a17eaf91d07234209fddf5cbdebce4424dda57ae
  • Loading branch information
David Tolnay authored and facebook-github-bot committed Jul 11, 2024
1 parent a10182f commit bddcd85
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 33 deletions.
4 changes: 2 additions & 2 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ cargo install --path=app/buck2
Or, alternatively, install it directly from GitHub:

```sh
rustup install nightly-2024-03-17
cargo +nightly-2024-03-17 install --git https://github.com/facebook/buck2.git buck2
rustup install nightly-2024-04-28
cargo +nightly-2024-04-28 install --git https://github.com/facebook/buck2.git buck2
```

### Side note: using [Nix] to compile the source
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 @@ -17,7 +17,6 @@
#![feature(io_error_more)]
#![feature(once_cell_try)]
#![feature(try_blocks)]
#![cfg_attr(windows, feature(absolute_path))]
#![feature(used_with_arg)]
#![feature(let_chains)]

Expand Down
10 changes: 5 additions & 5 deletions app/buck2_query/src/query/environment/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,23 @@ impl QueryTarget for TestTarget {
unimplemented!()
}

fn deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
fn deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a {
Box::new(self.deps.iter())
}

fn exec_deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
fn exec_deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a {
Box::new(std::iter::empty())
}

fn target_deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
fn target_deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a {
Box::new(std::iter::empty())
}

fn configuration_deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
fn configuration_deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a {
Box::new(std::iter::empty())
}

fn toolchain_deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
fn toolchain_deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a {
Box::new(std::iter::empty())
}

Expand Down
35 changes: 25 additions & 10 deletions app/buck2_query/src/query/syntax/simple/eval/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,39 @@ impl QueryTarget for Target {
unimplemented!()
}

fn deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
unimplemented!()
fn deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a {
let _iterator: Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a>;
unimplemented!();
#[allow(unreachable_code)]
_iterator
}

fn exec_deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
unimplemented!()
fn exec_deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a {
let _iterator: Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a>;
unimplemented!();
#[allow(unreachable_code)]
_iterator
}

fn target_deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
unimplemented!()
fn target_deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a {
let _iterator: Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a>;
unimplemented!();
#[allow(unreachable_code)]
_iterator
}

fn configuration_deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
unimplemented!()
fn configuration_deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a {
let _iterator: Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a>;
unimplemented!();
#[allow(unreachable_code)]
_iterator
}

fn toolchain_deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
unimplemented!()
fn toolchain_deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a {
let _iterator: Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a>;
unimplemented!();
#[allow(unreachable_code)]
_iterator
}

fn special_attrs_for_each<E, F: FnMut(&str, &Self::Attr<'_>) -> Result<(), E>>(
Expand Down
28 changes: 20 additions & 8 deletions app/buck2_query/src/query/traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,20 +308,32 @@ mod tests {
unimplemented!()
}

fn exec_deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
unimplemented!()
fn exec_deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a {
let _iterator: Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a>;
unimplemented!();
#[allow(unreachable_code)]
_iterator
}

fn target_deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
unimplemented!()
fn target_deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a {
let _iterator: Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a>;
unimplemented!();
#[allow(unreachable_code)]
_iterator
}

fn configuration_deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
unimplemented!()
fn configuration_deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a {
let _iterator: Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a>;
unimplemented!();
#[allow(unreachable_code)]
_iterator
}

fn toolchain_deps<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a> {
unimplemented!()
fn toolchain_deps<'a>(&'a self) -> impl Iterator<Item = &'a Self::Key> + Send + 'a {
let _iterator: Box<dyn Iterator<Item = &'a Self::Key> + Send + 'a>;
unimplemented!();
#[allow(unreachable_code)]
_iterator
}
}

Expand Down
4 changes: 2 additions & 2 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ To get started, first install [rustup](https://rustup.rs/), then compile the
`buck2` executable:

```bash
rustup install nightly-2024-03-17
cargo +nightly-2024-03-17 install --git https://github.com/facebook/buck2.git buck2
rustup install nightly-2024-04-28
cargo +nightly-2024-04-28 install --git https://github.com/facebook/buck2.git buck2
```

The above commands install `buck2` into a suitable directory, such as
Expand Down
4 changes: 2 additions & 2 deletions gazebo/gazebo/src/ext/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use std::str::pattern::*;
/// Extension traits on [`str`].
///
/// Set the configuration option `str_pattern_extensions` to enable the associated methods.
/// The setting `str_pattern_extensions` requires the unstable features
/// `pattern` and `associated_type_bounds`, so only works with Rust nightly.
/// The setting `str_pattern_extensions` requires the unstable feature `pattern`,
/// so only works with Rust nightly.
pub trait StrExt {
/// Like `split`, but only separates off the first element. For example:
///
Expand Down
1 change: 0 additions & 1 deletion gazebo/gazebo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

#![cfg_attr(feature = "str_pattern_extensions", feature(pattern))]
#![cfg_attr(feature = "str_pattern_extensions", feature(associated_type_bounds))]

//! A collection of well-tested primitives that have been useful. Most modules stand alone.
Expand Down
4 changes: 2 additions & 2 deletions rust-toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -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.78.0-nightly (766bdce74 2024-03-16)
channel = "nightly-2024-03-17"
# @rustc_version: rustc 1.79.0-nightly (aed2187d5 2024-04-27)
channel = "nightly-2024-04-28"
components = ["llvm-tools-preview","rustc-dev","rust-src"]

0 comments on commit bddcd85

Please sign in to comment.