Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump rust version to 1.82 #6672

Merged
merged 7 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ concurrency:
env:
CARGO_TERM_COLOR: always
REGISTRY: ghcr.io
RUST_VERSION: 1.79.0
NIGHTLY_RUST_VERSION: nightly-2024-07-16
RUST_VERSION: 1.82.0
NIGHTLY_RUST_VERSION: nightly-2024-10-21

jobs:
get-fuel-core-version:
Expand Down
2 changes: 1 addition & 1 deletion forc-pkg/src/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ impl std::ops::Deref for PackageManifestFile {
/// This can be configured using environment variables:
/// - use `FORC_IMPLICIT_STD_PATH` for the path for the std-lib;
/// - use `FORC_IMPLICIT_STD_GIT`, `FORC_IMPLICIT_STD_GIT_TAG` and/or `FORC_IMPLICIT_STD_GIT_BRANCH` to configure
/// the git repo of the std-lib.
/// the git repo of the std-lib.
fn implicit_std_dep() -> Dependency {
if let Ok(path) = std::env::var("FORC_IMPLICIT_STD_PATH") {
return Dependency::Detailed(DependencyDetails {
Expand Down
27 changes: 12 additions & 15 deletions forc-pkg/src/pkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -893,22 +893,19 @@ fn validate_version(member_manifests: &MemberManifestFiles) -> Result<()> {
/// If required minimum forc version is higher than current forc version return an error with
/// upgrade instructions
fn validate_pkg_version(pkg_manifest: &PackageManifestFile) -> Result<()> {
match &pkg_manifest.project.forc_version {
Some(min_forc_version) => {
// Get the current version of the toolchain
let crate_version = env!("CARGO_PKG_VERSION");
let toolchain_version = semver::Version::parse(crate_version)?;
if toolchain_version < *min_forc_version {
bail!(
"{:?} requires forc version {} but current forc version is {}\nUpdate the toolchain by following: https://fuellabs.github.io/sway/v{}/introduction/installation.html",
pkg_manifest.project.name,
min_forc_version,
crate_version,
crate_version
);
}
if let Some(min_forc_version) = &pkg_manifest.project.forc_version {
// Get the current version of the toolchain
let crate_version = env!("CARGO_PKG_VERSION");
let toolchain_version = semver::Version::parse(crate_version)?;
if toolchain_version < *min_forc_version {
bail!(
"{:?} requires forc version {} but current forc version is {}\nUpdate the toolchain by following: https://fuellabs.github.io/sway/v{}/introduction/installation.html",
pkg_manifest.project.name,
min_forc_version,
crate_version,
crate_version
);
}
None => {}
};
Ok(())
}
Expand Down
6 changes: 3 additions & 3 deletions forc/src/cli/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ forc_util::cli_examples! {
/// - `script`, `predicate` and `contract` projects will produce their bytecode in binary format `<project-name>.bin`.
///
/// - `script` projects will also produce a file containing the hash of the bytecode binary
/// `<project-name>-bin-hash` (using `fuel_cypto::Hasher`).
/// `<project-name>-bin-hash` (using `fuel_cypto::Hasher`).
///
/// - `predicate` projects will also produce a file containing the **root** hash of the bytecode binary
/// `<project-name>-bin-root` (using `fuel_tx::Contract::root_from_code`).
/// `<project-name>-bin-root` (using `fuel_tx::Contract::root_from_code`).
///
/// - `contract` and `library` projects will also produce the public ABI in JSON format
/// `<project-name>-abi.json`.
/// `<project-name>-abi.json`.
#[derive(Debug, Default, Parser)]
#[clap(bin_name = "forc build", version, after_help = help())]
pub struct Command {
Expand Down
4 changes: 2 additions & 2 deletions sway-core/src/asm_generation/fuel/analyses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ use crate::asm_lang::{ControlFlowOp, Label, Op, VirtualRegister};
/// Two tables are generated: `live_in` and `live_out`. Each row in the tables corresponds to an
/// instruction in the program.
/// * A virtual register is in the `live_out` table for a given instruction if it is live on any
/// of that node's out-edges
/// of that node's out-edges
/// * A virtual register is in the `live_in` table for a given instruction if it is live on any
/// of that node's in-edges
/// of that node's in-edges
///
///
/// Algorithm:
Expand Down
14 changes: 7 additions & 7 deletions sway-core/src/asm_generation/fuel/programs/abstract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ impl AbstractProgram {
/// Right now, it looks like this:
///
/// WORD OP
/// 1 MOV $scratch $pc
/// - JMPF $zero i2
/// 2 DATA_START (0-32) (in bytes, offset from $is)
/// - DATA_START (32-64)
/// 3 LW $ds $scratch 1
/// - ADD $ds $ds $scratch
/// 4 .program_start:
/// [1] MOV $scratch $pc
/// [-] JMPF $zero i2
/// [2] DATA_START (0-32) (in bytes, offset from $is)
/// [-] DATA_START (32-64)
/// [3] LW $ds $scratch 1
/// [-] ADD $ds $ds $scratch
/// [4] .program_start:
IGI-111 marked this conversation as resolved.
Show resolved Hide resolved
fn build_prologue(&mut self) -> AllocatedAbstractInstructionSet {
let label = self.reg_seqr.get_label();
AllocatedAbstractInstructionSet {
Expand Down
7 changes: 4 additions & 3 deletions sway-core/src/asm_generation/fuel/register_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ impl RegisterPool {
/// add edges (v, b_1), ..., (v, b_n) for any b_i different from c.
/// 3. for non-MOVE def of virtual register v with live_out virtual registers b_1, ..., b_n:
/// add edges (v, b_1), ..., (v, b_n)
/// ===============================================================================================
///
/// ===============================================================================================
pub(crate) fn create_interference_graph(
ops: &[Op],
live_out: &[BTreeSet<VirtualRegister>],
Expand Down Expand Up @@ -191,8 +191,8 @@ pub(crate) fn create_interference_graph(
/// * When two registers are coalesced, a new node with a new virtual register (generated using the
/// register sequencer) is created in the interference graph.
/// * When a MOVE instruction is removed, the offset of each subsequent instruction has to be
/// updated, as well as the immediate values for some or all jump instructions (`ji`, `jnei`, and
/// `jnzi for now).
/// updated, as well as the immediate values for some or all jump instructions (`ji`, `jnei`, and
/// `jnzi for now).
///
pub(crate) fn coalesce_registers(
ops: &[Op],
Expand Down Expand Up @@ -386,6 +386,7 @@ fn compute_def_use_points(ops: &[Op]) -> FxHashMap<VirtualRegister, (Vec<usize>,
/// 3. If some vertex n still has k or more neighbors, then the graph may not be k colorable.
/// We still add it to the stack as is, as a potential spill. When popping, if we still
/// can't colour it, then it becomes an actual spill.
///
/// ===============================================================================================
///
pub(crate) fn color_interference_graph(
Expand Down
1 change: 1 addition & 0 deletions sway-core/src/language/ty/expression/reassignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub enum TyReassignmentTarget {
/// E.g.:
/// - *my_ref
/// - **if x > 0 { &mut &mut a } else { &mut &mut b }
///
/// The [TyExpression] is guaranteed to be of [TyExpressionVariant::Deref].
Deref(Box<TyExpression>),
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::mutable_key_type)]
use std::{
collections::{BTreeMap, HashMap, HashSet},
sync::Arc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
//! for a particular match branch (arm):
//! - branch condition: Overall condition that must be `true` for the branch to match.
//! - result variable declarations: Variable declarations that needs to be added to the
//! match branch result, before the actual body. Here we distinguish between the variables
//! actually declared in the match arm pattern and so called "tuple variables" that are
//! compiler generated and contain values for variables extracted out of individual OR variants.
//! match branch result, before the actual body. Here we distinguish between the variables
//! actually declared in the match arm pattern and so called "tuple variables" that are
//! compiler generated and contain values for variables extracted out of individual OR variants.
//! - OR variant index variables: Variable declarations that are generated in case of having
//! variables in OR patterns. Index variables hold 1-based index of the OR variant being matched
//! or zero if non of the OR variants has matched.
//! variables in OR patterns. Index variables hold 1-based index of the OR variant being matched
//! or zero if non of the OR variants has matched.
//!
//! Afterwards, these three artifacts coming from every individual branch are glued together in the
//! [crate::ty::TyMatchExpression] to form the final desugaring.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,12 @@ type CarryOverTupleDeclarations = Vec<VarDecl>;
/// via [ty::TyMatchBranch]:
/// - branch condition: Overall condition that must be `true` for the branch to match.
/// - result variable declarations: Variable declarations that needs to be added to the
/// match branch result, before the actual body. Here we distinguish between the variables
/// actually declared in the match arm pattern and so called "tuple variables" that are
/// compiler generated and contain values for variables extracted out of individual OR variants.
/// match branch result, before the actual body. Here we distinguish between the variables
/// actually declared in the match arm pattern and so called "tuple variables" that are
/// compiler generated and contain values for variables extracted out of individual OR variants.
/// - OR variant index variables: Variable declarations that are generated in case of having
/// variables in OR patterns. Index variables hold 1-based index of the OR variant being matched
/// or zero if non of the OR variants has matched.
/// variables in OR patterns. Index variables hold 1-based index of the OR variant being matched
/// or zero if non of the OR variants has matched.
///
/// ## Algorithm Overview
/// The algorithm traverses the `req_decl_tree` bottom up from left to right and collects the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,7 @@ impl ty::TyExpression {
/// Returns the position of the first match arm that is an "interior" arm, meaning:
/// - arm is a catch-all arm
/// - arm is not the last match arm
///
/// or `None` if such arm does not exist.
/// Note that the arm can be the first arm.
fn interior_catch_all_arm_position(arms_reachability: &[ReachableReport]) -> Option<usize> {
Expand Down
1 change: 1 addition & 0 deletions sway-core/src/semantic_analysis/type_check_context.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::mutable_key_type)]
use std::collections::{HashMap, VecDeque};

use crate::{
Expand Down
1 change: 1 addition & 0 deletions sway-core/src/type_system/id.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::mutable_key_type)]
use indexmap::IndexMap;
use sway_error::{
error::CompileError,
Expand Down
1 change: 1 addition & 0 deletions sway-core/src/type_system/unify/occurs_check.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::mutable_key_type)]
use crate::{engine_threading::Engines, type_system::priv_prelude::*};

/// Helper struct to perform the occurs check.
Expand Down
11 changes: 4 additions & 7 deletions sway-lsp/src/utils/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,10 @@ fn is_sway_fence(s: &str) -> bool {
let mut seen_sway_tags = false;
let mut seen_other_tags = false;

let tokens = s
.trim()
.split(|c| matches!(c, ',' | ' ' | '\t'))
.filter_map(|t| {
let t = t.trim();
(!t.is_empty()).then_some(t)
});
let tokens = s.trim().split([',', ' ', '\t']).filter_map(|t| {
let t = t.trim();
(!t.is_empty()).then_some(t)
});

for token in tokens {
match token {
Expand Down
2 changes: 1 addition & 1 deletion swayfmt/src/comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub fn write_comments(

// If the already formatted code ends with some pattern and doesn't already end with a newline,
// we want to add a newline here.
if formatted_code.ends_with(&['{', '}']) && !formatted_code.ends_with('\n') {
if formatted_code.ends_with(['{', '}']) && !formatted_code.ends_with('\n') {
writeln!(formatted_code)?;
}

Expand Down
Loading