Skip to content

Commit

Permalink
update platform010 & platform010-aarch64 symlinks
Browse files Browse the repository at this point in the history
Summary: Upgrade toolchain to 1.83.0

Reviewed By: dtolnay

Differential Revision: D67041293

fbshipit-source-id: 6b8039d953e044d51ab61d3c5c4fadf442eb166b
  • Loading branch information
capickett authored and facebook-github-bot committed Dec 18, 2024
1 parent e92fb33 commit 3479807
Show file tree
Hide file tree
Showing 56 changed files with 100 additions and 130 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-07-21
cargo +nightly-2024-07-21 install --git https://github.com/facebook/buck2.git buck2
rustup install nightly-2024-10-13
cargo +nightly-2024-10-13 install --git https://github.com/facebook/buck2.git buck2
```

### Side note: using [Nix] to compile the source
Expand Down
17 changes: 9 additions & 8 deletions app/buck2/src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//! This module sets up a shared panic hook to run before unwinding/termination for crash reporting.
use std::panic;
use std::panic::PanicInfo;
use std::panic::PanicHookInfo;

use buck2_error::BuckErrorContext;
use fbinit::FacebookInit;
Expand Down Expand Up @@ -49,13 +49,13 @@ pub fn initialize() -> anyhow::Result<()> {
///
/// The panic hook is called on the same thread that the panic occurred. It is possible to perform a backtrace here
/// to collect additional information.
fn the_panic_hook(fb: FacebookInit, info: &PanicInfo) {
fn the_panic_hook(fb: FacebookInit, info: &PanicHookInfo) {
imp::write_panic_to_scribe(fb, info);
}

mod imp {
use std::collections::HashMap;
use std::panic::PanicInfo;
use std::panic::PanicHookInfo;
use std::time::Duration;

use backtrace::Backtrace;
Expand Down Expand Up @@ -106,13 +106,13 @@ mod imp {
.collect()
}

/// Extracts a stringly-formatted payload from the given PanicInfo - usually the argument to `panic!`.
fn get_message_for_panic(info: &PanicInfo) -> String {
/// Extracts a stringly-formatted payload from the given PanicHookInfo - usually the argument to `panic!`.
fn get_message_for_panic(info: &PanicHookInfo) -> String {
// Rust panic payloads can be anything, but they generally take one of two forms:
// 1. &'static str, for panics with a constant string parameter,
// 2. String, for panics that use the format `{}` syntax to construct a message.
//
// Since PanicInfo's Display implementation is implemented in libcore, it can't cover the String case (which is)
// Since PanicHookInfo's Display implementation is implemented in libcore, it can't cover the String case (which is)
// a liballoc exclusive), so this code here checks for formatted messages and uses that as the message if present.
if let Some(literal_msg) = info.payload().downcast_ref::<&str>() {
(*literal_msg).to_owned()
Expand Down Expand Up @@ -144,8 +144,8 @@ mod imp {
map
}

/// Writes a representation of the given `PanicInfo` to Scribe, via the `StructuredError` event.
pub(crate) fn write_panic_to_scribe(fb: FacebookInit, info: &PanicInfo) {
/// Writes a representation of the given `PanicHookInfo` to Scribe, via the `StructuredError` event.
pub(crate) fn write_panic_to_scribe(fb: FacebookInit, info: &PanicHookInfo) {
let message = get_message_for_panic(info);
let location = info.location().map(|loc| Location {
file: loc.file().to_owned(),
Expand Down Expand Up @@ -239,6 +239,7 @@ mod imp {
/* retry_attempts */ 5,
/* message_batch_size */ None,
) {
#[allow(unreachable_patterns)]
Ok(Some(sink)) => sink,
_ => {
// We're already panicking and we can't connect to the scribe daemon? Things are bad and we're SOL.
Expand Down
4 changes: 2 additions & 2 deletions app/buck2_bxl/src/bxl/starlark_defs/analysis_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ fn starlark_analysis_result_methods(builder: &mut MethodsBuilder) {

/// Converts the analysis result into a `dependency`. Currently, you can only get a `dependency` without any
/// transitions. This means that you cannot create an exec dep or toolchain from an analysis result.
///
/// We may support other dependency transition types in the future.
///
/// This is useful for passing in the results of `ctx.analysis()` into anon targets.
///
/// Sample usage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ enum ViaError {
/// This is not exposed to starlark but rather, used by operations exposed to starlark to run
/// code.
/// This also provides a handle for dice.
pub(crate) trait BxlDiceComputations {
// via() below provides a more useful api for consumers.
fn via_impl<'a: 'b, 'b>(
Expand Down
40 changes: 19 additions & 21 deletions app/buck2_bxl/src/bxl/starlark_defs/target_list_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,28 +435,26 @@ impl<'v> TargetListExpr<'v, ConfiguredTargetNode> {
) -> buck2_error::Result<TargetListExpr<'v, ConfiguredTargetNode>> {
match value.typed {
ConfiguredTargetListArg::ConfiguredTargetSet(s) => {
return Ok(Self::TargetSet(Cow::Borrowed(s)));
}
ConfiguredTargetListArg::TargetSet(s) => {
return Ok(TargetListExpr::Iterable(
dice.try_compute_join(s.0.iter(), |dice, node| {
async move {
Self::check_allow_unconfigured(
allow_unconfigured,
&node.label().to_string(),
global_cfg_options,
)?;

buck2_error::Ok(TargetExpr::Label(Cow::Owned(
dice.get_configured_target(node.label(), global_cfg_options)
.await?,
)))
}
.boxed()
})
.await?,
));
Ok(Self::TargetSet(Cow::Borrowed(s)))
}
ConfiguredTargetListArg::TargetSet(s) => Ok(TargetListExpr::Iterable(
dice.try_compute_join(s.0.iter(), |dice, node| {
async move {
Self::check_allow_unconfigured(
allow_unconfigured,
&node.label().to_string(),
global_cfg_options,
)?;

buck2_error::Ok(TargetExpr::Label(Cow::Owned(
dice.get_configured_target(node.label(), global_cfg_options)
.await?,
)))
}
.boxed()
})
.await?,
)),
ConfiguredTargetListArg::TargetList(unpack) => {
let mut resolved = vec![];

Expand Down
4 changes: 2 additions & 2 deletions app/buck2_client/src/commands/rage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ impl RageCommand {
&'a self,
title: &'a str,
command: impl FnOnce() -> Fut,
) -> LocalBoxFuture<RageSection<T>>
) -> LocalBoxFuture<'a, RageSection<T>>
where
Fut: Future<Output = buck2_error::Result<T>> + 'a,
T: std::fmt::Display + 'a,
Expand All @@ -366,7 +366,7 @@ impl RageCommand {
&'a self,
title: &'a str,
command: Option<impl FnOnce() -> Fut>,
) -> LocalBoxFuture<RageSection<T>>
) -> LocalBoxFuture<'a, RageSection<T>>
where
Fut: Future<Output = buck2_error::Result<T>> + 'a,
T: std::fmt::Display + 'a,
Expand Down
1 change: 0 additions & 1 deletion app/buck2_client_ctx/src/command_outcome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ where
{
fn from_residual(result: Result<Infallible, E>) -> Self {
match result {
Ok(infallible) => match infallible {},
Err(err) => Self::Failure(ExitResult::err(err.into())),
}
}
Expand Down
1 change: 0 additions & 1 deletion app/buck2_client_ctx/src/exit_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ impl<E: Into<::buck2_error::Error>> FromResidual<Result<Infallible, E>> for Exit
#[track_caller]
fn from_residual(residual: Result<Infallible, E>) -> ExitResult {
match residual {
Ok(infallible) => match infallible {},
// E -> buck2_error::Error -> ExitResult
Err(e) => Self::err(e.into()),
}
Expand Down
1 change: 0 additions & 1 deletion app/buck2_client_ctx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#![feature(once_cell_try)]
#![feature(error_generic_member_access)]
#![feature(option_get_or_insert_default)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(try_blocks)]
Expand Down
2 changes: 1 addition & 1 deletion app/buck2_client_ctx/src/streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fn default_subscribers<'a, T: StreamingCommand>(
if let Some(build_graph_stats) = try_get_build_graph_stats(cmd, ctx)? {
subscribers.push(build_graph_stats)
}
let representative_config_flags = if let Some(v) = ctx.maybe_paths()? {
let representative_config_flags = if let Some(_v) = ctx.maybe_paths()? {
matches.get_representative_config_flags()?
} else {
Vec::new()
Expand Down
1 change: 1 addition & 0 deletions app/buck2_client_ctx/src/subscribers/build_graph_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ impl BuildGraphStats {
}

async fn send_events(&self, events: Vec<buck2_events::BuckEvent>) {
#[allow(unreachable_patterns)]
if let Ok(Some(sink)) =
new_remote_event_sink_if_enabled(self.fb, 1, Duration::from_millis(100), 2, None)
{
Expand Down
2 changes: 1 addition & 1 deletion app/buck2_client_ctx/src/subscribers/event_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<'a> EventLog<'a> {
async_cleanup_context: AsyncCleanupContext<'a>,
command_name: String,
log_size_counter_bytes: Option<Arc<AtomicU64>>,
) -> buck2_error::Result<EventLog> {
) -> buck2_error::Result<EventLog<'a>> {
Ok(Self {
async_cleanup_context: Some(async_cleanup_context),
writer: WriteEventLog::new(
Expand Down
1 change: 1 addition & 0 deletions app/buck2_client_ctx/src/subscribers/recorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ impl<'a> InvocationRecorder<'a> {
}
}

#[allow(unreachable_patterns)]
if let Ok(Some(scribe_sink)) =
new_remote_event_sink_if_enabled(self.fb, 1, Duration::from_millis(500), 5, None)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ pub struct Cutoffs {
}

/// This component renders each event and a timer indicating for how long the event has been ongoing.
struct TimedListBody<'c> {
cutoffs: &'c Cutoffs,
state: &'c SuperConsoleState,
Expand Down
1 change: 0 additions & 1 deletion app/buck2_cmd_completion_client/src/complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ pub struct CompleteCommand {
/// 3. When corrections are necessary to create a label that buck2 will accept,
/// make the corrections first, then next-step completions in a second
/// stage.
impl CompleteCommand {
pub fn exec(self, matches: BuckArgMatches<'_>, ctx: ClientCommandContext<'_>) -> ExitResult {
let lockfile = buck2_env!("COMPLETION_VERIFY_LOCKFILE", applicability = testing)?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl PathSanitizer {
fn relative_to_project<'a>(
&'a self,
dir: &'a AbsNormPath,
) -> buck2_error::Result<Cow<ProjectRelativePath>> {
) -> buck2_error::Result<Cow<'a, ProjectRelativePath>> {
self.project_root().relativize(dir)
}
}
Expand Down
1 change: 0 additions & 1 deletion app/buck2_cmd_starlark_client/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ impl StreamingCommand for StarlarkDebugAttachCommand {
/// to DAP "output" events. Without this, at best these would go to stderr, but vscode's
/// executable DAP client ignores stderr, so this subscriber allows us to get that information
/// into somewhere visible to the user.
struct ConvertToDap;

impl ConvertToDap {
Expand Down
4 changes: 2 additions & 2 deletions app/buck2_common/src/build_count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ impl BuildCountMap {
}

// If the target has never been successfully built it won't be in the map, in that case its count is 0.
return patterns
patterns
.target_patterns
.iter()
.map(|v| self.0.get(&v.value).copied().unwrap_or(Default::default()))
.min()
.unwrap(); // target_patterns is non-empty, so min() should return Some
.unwrap() // target_patterns is non-empty, so min() should return Some
}
}

Expand Down
3 changes: 1 addition & 2 deletions app/buck2_common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
//! Common core components of buck2
#![feature(io_error_more)]
#![feature(try_trait_v2)]
#![feature(is_sorted)]
#![feature(map_try_insert)]
#![feature(never_type)]
#![feature(try_trait_v2)]
#![feature(used_with_arg)]
#![feature(let_chains)]

Expand Down
1 change: 0 additions & 1 deletion app/buck2_core/src/async_once_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ impl<T> AsyncOnceCell<T> {
.await
{
Ok(val) => val,
Err(infallible) => match infallible {},
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/buck2_core/src/env/__macro_refs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ macro register($var:expr, ty=$ty:ty, default=$default:expr, applicability=$appli
};
}}

/// Code below returns anyhow::Error, it is used while we transition from anyhow to buck2_error in buck2/app
/// TODO(minglunli): Delete the code below once we have fully transitioned to buck2_error
// Code below returns anyhow::Error, it is used while we transition from anyhow to buck2_error in buck2/app
// TODO(minglunli): Delete the code below once we have fully transitioned to buck2_error

/// This macro is used to register environment variables that are used by Buck2.
///
Expand Down
4 changes: 2 additions & 2 deletions app/buck2_core/src/env/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl<T> EnvHelper<T> {
// `EnvHelper` caches computed value. When it is used like
// `EnvHelper::new(...).get(...)`, it performs unnecessary work.
// To avoid it, we require `'static` lifetime, to force placing `EnvHelper` in static variable.
pub fn get(&'static self) -> buck2_error::Result<Option<&T>> {
pub fn get(&'static self) -> buck2_error::Result<Option<&'static T>> {
let var = self.var;
let convert = self.convert;

Expand All @@ -54,7 +54,7 @@ impl<T> EnvHelper<T> {
.with_buck_error_context(|| format!("Invalid value for ${}", var))
}

pub fn get_anyhow(&'static self) -> anyhow::Result<Option<&T>> {
pub fn get_anyhow(&'static self) -> anyhow::Result<Option<&'static T>> {
self.get().map_err(anyhow::Error::from)
}
}
21 changes: 8 additions & 13 deletions app/buck2_core/src/pattern/ascii_pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,37 +243,32 @@ mod tests {
"yyy",
];

fn test_is_prefix_of_impl<'p>(
ascii: impl AsciiPattern + Copy,
str_pattern: impl Pattern<'p> + Copy,
) {
fn test_is_prefix_of_impl(ascii: impl AsciiPattern + Copy, str_pattern: impl Pattern + Copy) {
for s in STRINGS {
assert_eq!(ascii.is_prefix_of(s), str_pattern.is_prefix_of(s));
}
}

fn test_is_suffix_of_impl<'p>(
ascii: impl AsciiPattern + Copy,
str_pattern: impl Pattern<'p, Searcher = impl ReverseSearcher<'p>> + Copy,
str_pattern: impl Pattern<Searcher<'p> = impl ReverseSearcher<'p>> + Copy,
) {
for s in STRINGS {
assert_eq!(ascii.is_suffix_of(s), str_pattern.is_suffix_of(s));
}
}

fn test_first_index_in_impl<'p>(
ascii: impl AsciiPattern + Copy,
str_pattern: impl Pattern<'p> + Copy,
) {
fn test_first_index_in_impl(ascii: impl AsciiPattern + Copy, str_pattern: impl Pattern + Copy) {
for s in STRINGS {
assert_eq!(ascii.first_index_in(s), s.find(str_pattern));
}
}

fn test_last_index_in_impl<'p>(
ascii: impl AsciiPattern + Copy,
str_pattern: impl Pattern<'p, Searcher = impl ReverseSearcher<'p>> + Copy,
) {
fn test_last_index_in_impl<P>(ascii: impl AsciiPattern + Copy, str_pattern: P)
where
P: Pattern + Copy,
for<'p> <P as Pattern>::Searcher<'p>: ReverseSearcher<'p>,
{
for s in STRINGS {
assert_eq!(ascii.last_index_in(s), s.rfind(str_pattern));
}
Expand Down
6 changes: 3 additions & 3 deletions app/buck2_core/src/pattern/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ pub fn maybe_split_cell_alias_and_relative_path<'a>(
fn lex_provider_pattern<'a>(
pattern: &'a str,
strip_package_trailing_slash: bool,
) -> buck2_error::Result<PatternParts<ProvidersPatternExtra>> {
) -> buck2_error::Result<PatternParts<'a, ProvidersPatternExtra>> {
let (cell_alias, pattern) = match split1_opt_ascii(pattern, AsciiStr2::new("//")) {
Some((a, p)) => (Some(trim_prefix_ascii(a, AsciiChar::new('@'))), p),
None => (None, pattern),
Expand Down Expand Up @@ -723,7 +723,7 @@ fn split_cfg(s: &str) -> Option<(&str, &str)> {
pub fn lex_configured_providers_pattern<'a>(
pattern: &'a str,
strip_package_trailing_slash: bool,
) -> buck2_error::Result<PatternParts<ConfiguredProvidersPatternExtra>> {
) -> buck2_error::Result<PatternParts<'a, ConfiguredProvidersPatternExtra>> {
let (provider_pattern, cfg) = match split_cfg(pattern) {
Some((providers, cfg)) => {
let provider_pattern = lex_provider_pattern(providers, strip_package_trailing_slash)?;
Expand All @@ -744,7 +744,7 @@ pub fn lex_configured_providers_pattern<'a>(
pub fn lex_target_pattern<'a, T: PatternType>(
pattern: &'a str,
strip_package_trailing_slash: bool,
) -> buck2_error::Result<PatternParts<T>> {
) -> buck2_error::Result<PatternParts<'a, T>> {
let provider_pattern = lex_configured_providers_pattern(pattern, strip_package_trailing_slash)?;
provider_pattern
.try_map(|extra| T::from_configured_providers(extra))
Expand Down
Loading

0 comments on commit 3479807

Please sign in to comment.