diff --git a/.github/workflows/windows_release_build.yml b/.github/workflows/windows_release_build.yml index b095c1205b..5fa53533e4 100644 --- a/.github/workflows/windows_release_build.yml +++ b/.github/workflows/windows_release_build.yml @@ -32,8 +32,8 @@ jobs: - name: zig version run: zig version - - name: install rust nightly 1.65 - run: rustup install nightly-2022-09-17 + - name: install rust nightly 1.68 + run: rustup install nightly-2023-01-22 - name: set up llvm 13 run: | diff --git a/.github/workflows/windows_tests.yml b/.github/workflows/windows_tests.yml index 3388162109..3abb55781d 100644 --- a/.github/workflows/windows_tests.yml +++ b/.github/workflows/windows_tests.yml @@ -36,8 +36,8 @@ jobs: - name: zig version run: zig version - - name: install rust nightly 1.65 - run: rustup install nightly-2022-09-17 + - name: install rust nightly 1.68 + run: rustup install nightly-2023-01-22 - name: set up llvm 13 run: | diff --git a/crates/compiler/build/src/link.rs b/crates/compiler/build/src/link.rs index 3cfad4a100..6210f8790a 100644 --- a/crates/compiler/build/src/link.rs +++ b/crates/compiler/build/src/link.rs @@ -629,7 +629,7 @@ pub fn rebuild_host( // on windows, we need the nightly toolchain so we can use `-Z export-executable-symbols` // using `+nightly` only works when running cargo through rustup let mut cmd = rustup(); - cmd.args(["run", "nightly-2022-09-17", "cargo"]); + cmd.args(["run", "nightly-2023-01-22", "cargo"]); cmd } else { diff --git a/crates/compiler/can/src/annotation.rs b/crates/compiler/can/src/annotation.rs index 473fcdbc24..e80033c1e3 100644 --- a/crates/compiler/can/src/annotation.rs +++ b/crates/compiler/can/src/annotation.rs @@ -1134,7 +1134,7 @@ fn canonicalize_has_clause( } #[allow(clippy::too_many_arguments)] -fn can_extension_type<'a>( +fn can_extension_type( env: &mut Env, pol: CanPolarity, scope: &mut Scope, @@ -1142,7 +1142,7 @@ fn can_extension_type<'a>( introduced_variables: &mut IntroducedVariables, local_aliases: &mut VecMap, references: &mut VecSet, - opt_ext: &Option<&Loc>>, + opt_ext: &Option<&Loc>, ext_problem_kind: roc_problem::can::ExtensionTypeKind, ) -> (Type, ExtImplicitOpenness) { fn valid_record_ext_type(typ: &Type) -> bool { @@ -1451,10 +1451,10 @@ fn can_assigned_fields<'a>( // TODO trim down these arguments! #[allow(clippy::too_many_arguments)] -fn can_assigned_tuple_elems<'a>( +fn can_assigned_tuple_elems( env: &mut Env, pol: CanPolarity, - elems: &&[Loc>], + elems: &&[Loc], scope: &mut Scope, var_store: &mut VarStore, introduced_variables: &mut IntroducedVariables, diff --git a/crates/compiler/can/src/def.rs b/crates/compiler/can/src/def.rs index ee0879f180..426d5aa5e1 100644 --- a/crates/compiler/can/src/def.rs +++ b/crates/compiler/can/src/def.rs @@ -1051,7 +1051,6 @@ fn canonicalize_value_defs<'a>( for (def_index, pending_def) in pending_value_defs.iter().enumerate() { let mut new_bindings = BindingsFromPattern::new(pending_def.loc_pattern()) - .into_iter() .peekable(); if new_bindings.peek().is_none() { @@ -1339,8 +1338,8 @@ fn canonicalize_type_defs<'a>( /// Resolve all pending abilities, to add them to scope. #[allow(clippy::too_many_arguments)] -fn resolve_abilities<'a>( - env: &mut Env<'a>, +fn resolve_abilities( + env: &mut Env, output: &mut Output, var_store: &mut VarStore, scope: &mut Scope, @@ -2813,8 +2812,8 @@ fn to_pending_value_def<'a>( } /// Make aliases recursive -fn correct_mutual_recursive_type_alias<'a>( - env: &mut Env<'a>, +fn correct_mutual_recursive_type_alias( + env: &mut Env, original_aliases: VecMap, var_store: &mut VarStore, ) -> VecMap { @@ -3022,8 +3021,8 @@ fn correct_mutual_recursive_type_alias<'a>( unsafe { VecMap::zip(symbols_introduced, aliases) } } -fn make_tag_union_of_alias_recursive<'a>( - env: &mut Env<'a>, +fn make_tag_union_of_alias_recursive( + env: &mut Env, alias_name: Symbol, alias: &mut Alias, others: Vec, @@ -3215,8 +3214,8 @@ fn make_tag_union_recursive_help<'a, 'b>( } } -fn mark_cyclic_alias<'a>( - env: &mut Env<'a>, +fn mark_cyclic_alias( + env: &mut Env, typ: &mut Type, symbol: Symbol, alias_kind: AliasKind, diff --git a/crates/compiler/can/src/module.rs b/crates/compiler/can/src/module.rs index 105c7b0950..01417483ac 100644 --- a/crates/compiler/can/src/module.rs +++ b/crates/compiler/can/src/module.rs @@ -195,11 +195,11 @@ enum GeneratedInfo { } impl GeneratedInfo { - fn from_header_type<'a>( + fn from_header_type( env: &mut Env, scope: &mut Scope, var_store: &mut VarStore, - header_type: &HeaderType<'a>, + header_type: &HeaderType, ) -> Self { match header_type { HeaderType::Hosted { diff --git a/crates/compiler/can/src/pattern.rs b/crates/compiler/can/src/pattern.rs index 195957969f..d881ad4257 100644 --- a/crates/compiler/can/src/pattern.rs +++ b/crates/compiler/can/src/pattern.rs @@ -321,8 +321,8 @@ pub fn canonicalize_def_header_pattern<'a>( #[derive(PartialEq, Eq, Clone, Copy)] pub struct PermitShadows(pub bool); -fn canonicalize_pattern_symbol<'a>( - env: &mut Env<'a>, +fn canonicalize_pattern_symbol( + env: &mut Env, scope: &mut Scope, output: &mut Output, region: Region, diff --git a/crates/compiler/can/src/traverse.rs b/crates/compiler/can/src/traverse.rs index e2c657fff8..c22096ea72 100644 --- a/crates/compiler/can/src/traverse.rs +++ b/crates/compiler/can/src/traverse.rs @@ -122,7 +122,7 @@ pub fn walk_decls(visitor: &mut V, decls: &Declarations) { None => Pattern::Identifier(loc_symbol.value), }; - let function_def = &decls.function_bodies[function_index.index() as usize]; + let function_def = &decls.function_bodies[function_index.index()]; DeclarationInfo::Function { loc_symbol, @@ -133,7 +133,7 @@ pub fn walk_decls(visitor: &mut V, decls: &Declarations) { } } Destructure(destructure_index) => { - let destructure = &decls.destructs[destructure_index.index() as usize]; + let destructure = &decls.destructs[destructure_index.index()]; let loc_pattern = &destructure.loc_pattern; let loc_expr = &decls.expressions[index]; diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs index f1292387aa..5261cf009c 100644 --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -2600,7 +2600,7 @@ pub fn constrain_decls( cycle_mark, ); - index += length as usize; + index += length; } } diff --git a/crates/compiler/derive/src/encoding.rs b/crates/compiler/derive/src/encoding.rs index 183d489db1..4073e960a9 100644 --- a/crates/compiler/derive/src/encoding.rs +++ b/crates/compiler/derive/src/encoding.rs @@ -55,7 +55,6 @@ pub(crate) fn derive_to_encoder( // Generalized tuple var so we can reuse this impl between many tuples: // if arity = n, this is (t1, ..., tn) for fresh t1, ..., tn. let flex_elems = (0..arity) - .into_iter() .map(|idx| (idx as usize, env.subs.fresh_unnamed_flex_var())) .collect::>(); let elems = TupleElems::insert_into_subs(env.subs, flex_elems); diff --git a/crates/compiler/derive/src/hash.rs b/crates/compiler/derive/src/hash.rs index 1f597f2dda..f01a28eac2 100644 --- a/crates/compiler/derive/src/hash.rs +++ b/crates/compiler/derive/src/hash.rs @@ -131,7 +131,6 @@ fn hash_tuple(env: &mut Env<'_>, fn_name: Symbol, arity: u32) -> (Variable, Expr // TODO: avoid an allocation here by pre-allocating the indices and variables `TupleElems` // will be instantiated with. let flex_elems: Vec<_> = (0..arity) - .into_iter() .map(|i| (i as usize, env.subs.fresh_unnamed_flex_var())) .collect(); let elems = TupleElems::insert_into_subs(env.subs, flex_elems); diff --git a/crates/compiler/fmt/src/annotation.rs b/crates/compiler/fmt/src/annotation.rs index 1091b81458..23da7721af 100644 --- a/crates/compiler/fmt/src/annotation.rs +++ b/crates/compiler/fmt/src/annotation.rs @@ -65,15 +65,15 @@ impl Newlines { pub trait Formattable { fn is_multiline(&self) -> bool; - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, _newlines: Newlines, indent: u16, ); - fn format<'buf>(&self, buf: &mut Buf<'buf>, indent: u16) { + fn format(&self, buf: &mut Buf, indent: u16) { self.format_with_options(buf, Parens::NotNeeded, Newlines::No, indent); } } @@ -87,9 +87,9 @@ where (*self).is_multiline() } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, parens: Parens, newlines: Newlines, indent: u16, @@ -97,7 +97,7 @@ where (*self).format_with_options(buf, parens, newlines, indent) } - fn format<'buf>(&self, buf: &mut Buf<'buf>, indent: u16) { + fn format(&self, buf: &mut Buf, indent: u16) { (*self).format(buf, indent) } } @@ -120,9 +120,9 @@ where self.value.is_multiline() } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, parens: Parens, newlines: Newlines, indent: u16, @@ -131,7 +131,7 @@ where .format_with_options(buf, parens, newlines, indent) } - fn format<'buf>(&self, buf: &mut Buf<'buf>, indent: u16) { + fn format(&self, buf: &mut Buf, indent: u16) { self.value.format(buf, indent) } } @@ -141,9 +141,9 @@ impl<'a> Formattable for UppercaseIdent<'a> { false } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, _newlines: Newlines, _indent: u16, @@ -206,9 +206,9 @@ impl<'a> Formattable for TypeAnnotation<'a> { } } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, parens: Parens, newlines: Newlines, indent: u16, @@ -424,9 +424,9 @@ impl<'a> Formattable for AssignedField<'a, TypeAnnotation<'a>> { is_multiline_assigned_field_help(self) } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, newlines: Newlines, indent: u16, @@ -441,9 +441,9 @@ impl<'a> Formattable for AssignedField<'a, Expr<'a>> { is_multiline_assigned_field_help(self) } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, newlines: Newlines, indent: u16, @@ -466,9 +466,9 @@ fn is_multiline_assigned_field_help(afield: &AssignedField<'_, T } } -fn format_assigned_field_help<'a, 'buf, T>( - zelf: &AssignedField<'a, T>, - buf: &mut Buf<'buf>, +fn format_assigned_field_help< T>( + zelf: &AssignedField, + buf: &mut Buf, indent: u16, separator_spaces: usize, is_multiline: bool, @@ -545,9 +545,9 @@ impl<'a> Formattable for Tag<'a> { } } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, _newlines: Newlines, indent: u16, @@ -592,9 +592,9 @@ impl<'a> Formattable for HasClause<'a> { false } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, parens: Parens, newlines: Newlines, indent: u16, @@ -623,9 +623,9 @@ impl<'a> Formattable for HasImpls<'a> { } } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, parens: Parens, newlines: Newlines, indent: u16, @@ -662,9 +662,9 @@ impl<'a> Formattable for HasAbility<'a> { } } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, parens: Parens, newlines: Newlines, indent: u16, @@ -703,9 +703,9 @@ impl<'a> Formattable for HasAbilities<'a> { } } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, parens: Parens, newlines: Newlines, indent: u16, diff --git a/crates/compiler/fmt/src/def.rs b/crates/compiler/fmt/src/def.rs index d45e37b733..58a214078a 100644 --- a/crates/compiler/fmt/src/def.rs +++ b/crates/compiler/fmt/src/def.rs @@ -15,9 +15,9 @@ impl<'a> Formattable for Defs<'a> { !self.tags.is_empty() } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, _newlines: Newlines, indent: u16, @@ -57,9 +57,9 @@ impl<'a> Formattable for TypeDef<'a> { } } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, newlines: Newlines, indent: u16, @@ -171,9 +171,9 @@ impl<'a> Formattable for TypeHeader<'a> { self.vars.iter().any(|v| v.is_multiline()) } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, _newlines: Newlines, indent: u16, @@ -205,9 +205,9 @@ impl<'a> Formattable for ValueDef<'a> { } } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, newlines: Newlines, indent: u16, @@ -314,8 +314,8 @@ fn should_outdent(mut rhs: &TypeAnnotation) -> bool { } } -fn fmt_dbg_in_def<'a, 'buf>( - buf: &mut Buf<'buf>, +fn fmt_dbg_in_def<'a>( + buf: &mut Buf, condition: &'a Loc>, is_multiline: bool, indent: u16, @@ -335,8 +335,8 @@ fn fmt_dbg_in_def<'a, 'buf>( condition.format(buf, return_indent); } -fn fmt_expect<'a, 'buf>( - buf: &mut Buf<'buf>, +fn fmt_expect<'a>( + buf: &mut Buf, condition: &'a Loc>, is_multiline: bool, indent: u16, @@ -356,8 +356,8 @@ fn fmt_expect<'a, 'buf>( condition.format(buf, return_indent); } -fn fmt_expect_fx<'a, 'buf>( - buf: &mut Buf<'buf>, +fn fmt_expect_fx<'a>( + buf: &mut Buf, condition: &'a Loc>, is_multiline: bool, indent: u16, @@ -377,24 +377,24 @@ fn fmt_expect_fx<'a, 'buf>( condition.format(buf, return_indent); } -pub fn fmt_value_def<'a, 'buf>( - buf: &mut Buf<'buf>, - def: &roc_parse::ast::ValueDef<'a>, +pub fn fmt_value_def( + buf: &mut Buf, + def: &roc_parse::ast::ValueDef, indent: u16, ) { def.format(buf, indent); } -pub fn fmt_type_def<'a, 'buf>(buf: &mut Buf<'buf>, def: &roc_parse::ast::TypeDef<'a>, indent: u16) { +pub fn fmt_type_def(buf: &mut Buf, def: &roc_parse::ast::TypeDef, indent: u16) { def.format(buf, indent); } -pub fn fmt_defs<'a, 'buf>(buf: &mut Buf<'buf>, defs: &Defs<'a>, indent: u16) { +pub fn fmt_defs(buf: &mut Buf, defs: &Defs, indent: u16) { defs.format(buf, indent); } -pub fn fmt_body<'a, 'buf>( - buf: &mut Buf<'buf>, +pub fn fmt_body<'a>( + buf: &mut Buf, pattern: &'a Pattern<'a>, body: &'a Expr<'a>, indent: u16, @@ -462,9 +462,9 @@ impl<'a> Formattable for AbilityMember<'a> { self.name.value.is_multiline() || self.typ.is_multiline() } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, _newlines: Newlines, indent: u16, diff --git a/crates/compiler/fmt/src/expr.rs b/crates/compiler/fmt/src/expr.rs index b644f185c0..9721aea3cc 100644 --- a/crates/compiler/fmt/src/expr.rs +++ b/crates/compiler/fmt/src/expr.rs @@ -103,9 +103,9 @@ impl<'a> Formattable for Expr<'a> { } } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, parens: Parens, newlines: Newlines, indent: u16, @@ -551,7 +551,7 @@ fn starts_with_newline(expr: &Expr) -> bool { } } -fn format_str_segment<'a, 'buf>(seg: &StrSegment<'a>, buf: &mut Buf<'buf>, indent: u16) { +fn format_str_segment(seg: &StrSegment, buf: &mut Buf, indent: u16) { use StrSegment::*; match seg { @@ -614,7 +614,7 @@ fn push_op(buf: &mut Buf, op: BinOp) { } } -pub fn fmt_str_literal<'buf>(buf: &mut Buf<'buf>, literal: StrLiteral, indent: u16) { +pub fn fmt_str_literal(buf: &mut Buf, literal: StrLiteral, indent: u16) { use roc_parse::ast::StrLiteral::*; match literal { @@ -673,8 +673,8 @@ pub fn fmt_str_literal<'buf>(buf: &mut Buf<'buf>, literal: StrLiteral, indent: u } } -fn fmt_binops<'a, 'buf>( - buf: &mut Buf<'buf>, +fn fmt_binops<'a>( + buf: &mut Buf, lefts: &'a [(Loc>, Loc)], loc_right_side: &'a Loc>, part_of_multi_line_binops: bool, @@ -704,9 +704,9 @@ fn fmt_binops<'a, 'buf>( loc_right_side.format_with_options(buf, Parens::InOperator, Newlines::Yes, indent); } -fn format_spaces<'a, 'buf>( - buf: &mut Buf<'buf>, - spaces: &[CommentOrNewline<'a>], +fn format_spaces( + buf: &mut Buf, + spaces: &[CommentOrNewline], newlines: Newlines, indent: u16, ) { @@ -738,8 +738,8 @@ fn is_when_patterns_multiline(when_branch: &WhenBranch) -> bool { is_multiline_patterns } -fn fmt_when<'a, 'buf>( - buf: &mut Buf<'buf>, +fn fmt_when<'a>( + buf: &mut Buf, loc_condition: &'a Loc>, branches: &[&'a WhenBranch<'a>], indent: u16, @@ -920,8 +920,8 @@ fn fmt_when<'a, 'buf>( } } -fn fmt_dbg<'a, 'buf>( - buf: &mut Buf<'buf>, +fn fmt_dbg<'a>( + buf: &mut Buf, condition: &'a Loc>, continuation: &'a Loc>, is_multiline: bool, @@ -947,8 +947,8 @@ fn fmt_dbg<'a, 'buf>( continuation.format(buf, indent); } -fn fmt_expect<'a, 'buf>( - buf: &mut Buf<'buf>, +fn fmt_expect<'a>( + buf: &mut Buf, condition: &'a Loc>, continuation: &'a Loc>, is_multiline: bool, @@ -974,8 +974,8 @@ fn fmt_expect<'a, 'buf>( continuation.format(buf, indent); } -fn fmt_if<'a, 'buf>( - buf: &mut Buf<'buf>, +fn fmt_if<'a>( + buf: &mut Buf, branches: &'a [(Loc>, Loc>)], final_else: &'a Loc>, is_multiline: bool, @@ -1123,8 +1123,8 @@ fn fmt_if<'a, 'buf>( final_else.format(buf, return_indent); } -fn fmt_closure<'a, 'buf>( - buf: &mut Buf<'buf>, +fn fmt_closure<'a>( + buf: &mut Buf, loc_patterns: &'a [Loc>], loc_ret: &'a Loc>, indent: u16, @@ -1224,8 +1224,8 @@ fn fmt_closure<'a, 'buf>( } } -fn fmt_backpassing<'a, 'buf>( - buf: &mut Buf<'buf>, +fn fmt_backpassing<'a>( + buf: &mut Buf, loc_patterns: &'a [Loc>], loc_body: &'a Loc>, loc_ret: &'a Loc>, @@ -1312,8 +1312,8 @@ fn pattern_needs_parens_when_backpassing(pat: &Pattern) -> bool { } } -fn fmt_record<'a, 'buf>( - buf: &mut Buf<'buf>, +fn fmt_record<'a>( + buf: &mut Buf, update: Option<&'a Loc>>, fields: Collection<'a, Loc>>>, indent: u16, @@ -1404,9 +1404,9 @@ fn fmt_record<'a, 'buf>( } } -fn format_field_multiline<'a, 'buf, T>( - buf: &mut Buf<'buf>, - field: &AssignedField<'a, T>, +fn format_field_multiline( + buf: &mut Buf, + field: &AssignedField, indent: u16, separator_prefix: &str, ) where diff --git a/crates/compiler/fmt/src/module.rs b/crates/compiler/fmt/src/module.rs index ab818b9ed0..e5e44884e6 100644 --- a/crates/compiler/fmt/src/module.rs +++ b/crates/compiler/fmt/src/module.rs @@ -86,9 +86,9 @@ impl Formattable for Option { } } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, parens: crate::annotation::Parens, newlines: Newlines, indent: u16, @@ -111,9 +111,9 @@ impl<'a> Formattable for ProvidesTo<'a> { || self.to_keyword.is_multiline() } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: crate::annotation::Parens, _newlines: Newlines, indent: u16, @@ -130,9 +130,9 @@ impl<'a> Formattable for PlatformRequires<'a> { is_collection_multiline(&self.rigids) || self.signature.is_multiline() } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: crate::annotation::Parens, _newlines: Newlines, indent: u16, @@ -146,9 +146,9 @@ impl<'a, V: Formattable> Formattable for Spaces<'a, V> { !self.before.is_empty() || !self.after.is_empty() || self.item.is_multiline() } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, parens: crate::annotation::Parens, newlines: Newlines, indent: u16, @@ -164,9 +164,9 @@ impl<'a, K: Formattable, V: Formattable> Formattable for KeywordItem<'a, K, V> { self.keyword.is_multiline() || self.item.is_multiline() } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, parens: Parens, newlines: Newlines, indent: u16, @@ -177,7 +177,7 @@ impl<'a, K: Formattable, V: Formattable> Formattable for KeywordItem<'a, K, V> { } } -pub fn fmt_interface_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a InterfaceHeader<'a>) { +pub fn fmt_interface_header<'a>(buf: &mut Buf, header: &'a InterfaceHeader<'a>) { buf.indent(0); buf.push_str("interface"); let indent = INDENT; @@ -193,7 +193,7 @@ pub fn fmt_interface_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a Interface fmt_imports(buf, header.imports.item, indent); } -pub fn fmt_hosted_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a HostedHeader<'a>) { +pub fn fmt_hosted_header<'a>(buf: &mut Buf, header: &'a HostedHeader<'a>) { buf.indent(0); buf.push_str("hosted"); let indent = INDENT; @@ -210,7 +210,7 @@ pub fn fmt_hosted_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a HostedHeader fmt_exposes(buf, header.generates_with.item, indent); } -pub fn fmt_app_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a AppHeader<'a>) { +pub fn fmt_app_header<'a>(buf: &mut Buf, header: &'a AppHeader<'a>) { buf.indent(0); buf.push_str("app"); let indent = INDENT; @@ -229,7 +229,7 @@ pub fn fmt_app_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a AppHeader<'a>) header.provides.format(buf, indent); } -pub fn fmt_package_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a PackageHeader<'a>) { +pub fn fmt_package_header<'a>(buf: &mut Buf, header: &'a PackageHeader<'a>) { buf.indent(0); buf.push_str("package"); let indent = INDENT; @@ -243,7 +243,7 @@ pub fn fmt_package_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a PackageHead fmt_packages(buf, header.packages.item, indent); } -pub fn fmt_platform_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a PlatformHeader<'a>) { +pub fn fmt_platform_header<'a>(buf: &mut Buf, header: &'a PlatformHeader<'a>) { buf.indent(0); buf.push_str("platform"); let indent = INDENT; @@ -262,7 +262,7 @@ pub fn fmt_platform_header<'a, 'buf>(buf: &mut Buf<'buf>, header: &'a PlatformHe fmt_provides(buf, header.provides.item, None, indent); } -fn fmt_requires<'a, 'buf>(buf: &mut Buf<'buf>, requires: &PlatformRequires<'a>, indent: u16) { +fn fmt_requires(buf: &mut Buf, requires: &PlatformRequires, indent: u16) { fmt_collection(buf, indent, Braces::Curly, requires.rigids, Newlines::No); buf.push_str(" {"); @@ -276,9 +276,9 @@ impl<'a> Formattable for TypedIdent<'a> { false } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, _newlines: Newlines, indent: u16, @@ -293,7 +293,7 @@ impl<'a> Formattable for TypedIdent<'a> { } } -fn fmt_package_name<'buf>(buf: &mut Buf<'buf>, name: PackageName, indent: u16) { +fn fmt_package_name(buf: &mut Buf, name: PackageName, indent: u16) { buf.indent(indent); buf.push('"'); buf.push_str_allow_spaces(name.to_str()); @@ -312,9 +312,9 @@ impl<'a, T: Formattable> Formattable for Spaced<'a, T> { } } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, parens: crate::annotation::Parens, newlines: Newlines, indent: u16, @@ -335,16 +335,16 @@ impl<'a, T: Formattable> Formattable for Spaced<'a, T> { } } -fn fmt_imports<'a, 'buf>( - buf: &mut Buf<'buf>, +fn fmt_imports<'a>( + buf: &mut Buf, loc_entries: Collection<'a, Loc>>>, indent: u16, ) { fmt_collection(buf, indent, Braces::Square, loc_entries, Newlines::No) } -fn fmt_provides<'a, 'buf>( - buf: &mut Buf<'buf>, +fn fmt_provides<'a>( + buf: &mut Buf, loc_exposed_names: Collection<'a, Loc>>>, loc_provided_types: Option>>>>, indent: u16, @@ -356,7 +356,7 @@ fn fmt_provides<'a, 'buf>( } } -fn fmt_to<'buf>(buf: &mut Buf<'buf>, to: To, indent: u16) { +fn fmt_to(buf: &mut Buf, to: To, indent: u16) { match to { To::ExistingPackage(name) => { buf.push_str(name); @@ -365,8 +365,8 @@ fn fmt_to<'buf>(buf: &mut Buf<'buf>, to: To, indent: u16) { } } -fn fmt_exposes<'buf, N: Formattable + Copy + core::fmt::Debug>( - buf: &mut Buf<'buf>, +fn fmt_exposes( + buf: &mut Buf, loc_entries: Collection<'_, Loc>>, indent: u16, ) { @@ -374,17 +374,17 @@ fn fmt_exposes<'buf, N: Formattable + Copy + core::fmt::Debug>( } pub trait FormatName { - fn format<'buf>(&self, buf: &mut Buf<'buf>); + fn format(&self, buf: &mut Buf); } impl<'a> FormatName for &'a str { - fn format<'buf>(&self, buf: &mut Buf<'buf>) { + fn format(&self, buf: &mut Buf) { buf.push_str(self) } } impl<'a> FormatName for ModuleName<'a> { - fn format<'buf>(&self, buf: &mut Buf<'buf>) { + fn format(&self, buf: &mut Buf) { buf.push_str(self.as_str()); } } @@ -394,9 +394,9 @@ impl<'a> Formattable for ModuleName<'a> { false } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, _newlines: Newlines, _indent: u16, @@ -410,9 +410,9 @@ impl<'a> Formattable for ExposedName<'a> { false } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, _newlines: Newlines, indent: u16, @@ -423,13 +423,13 @@ impl<'a> Formattable for ExposedName<'a> { } impl<'a> FormatName for ExposedName<'a> { - fn format<'buf>(&self, buf: &mut Buf<'buf>) { + fn format(&self, buf: &mut Buf) { buf.push_str(self.as_str()); } } -fn fmt_packages<'a, 'buf>( - buf: &mut Buf<'buf>, +fn fmt_packages<'a>( + buf: &mut Buf, loc_entries: Collection<'a, Loc>>>, indent: u16, ) { @@ -441,9 +441,9 @@ impl<'a> Formattable for PackageEntry<'a> { false } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, _newlines: Newlines, indent: u16, @@ -457,9 +457,9 @@ impl<'a> Formattable for ImportsEntry<'a> { false } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, _newlines: Newlines, indent: u16, @@ -467,14 +467,14 @@ impl<'a> Formattable for ImportsEntry<'a> { fmt_imports_entry(buf, self, indent); } } -fn fmt_packages_entry<'a, 'buf>(buf: &mut Buf<'buf>, entry: &PackageEntry<'a>, indent: u16) { +fn fmt_packages_entry(buf: &mut Buf, entry: &PackageEntry, indent: u16) { buf.push_str(entry.shorthand); buf.push(':'); fmt_default_spaces(buf, entry.spaces_after_shorthand, indent); fmt_package_name(buf, entry.package_name.value, indent); } -fn fmt_imports_entry<'a, 'buf>(buf: &mut Buf<'buf>, entry: &ImportsEntry<'a>, indent: u16) { +fn fmt_imports_entry(buf: &mut Buf, entry: &ImportsEntry, indent: u16) { use roc_parse::header::ImportsEntry::*; buf.indent(indent); diff --git a/crates/compiler/fmt/src/pattern.rs b/crates/compiler/fmt/src/pattern.rs index e1d4265569..3775b4cc35 100644 --- a/crates/compiler/fmt/src/pattern.rs +++ b/crates/compiler/fmt/src/pattern.rs @@ -4,8 +4,8 @@ use crate::spaces::{fmt_comments_only, fmt_spaces, NewlineAt, INDENT}; use crate::Buf; use roc_parse::ast::{Base, CommentOrNewline, Pattern, PatternAs}; -pub fn fmt_pattern<'a, 'buf>( - buf: &mut Buf<'buf>, +pub fn fmt_pattern<'a>( + buf: &mut Buf, pattern: &'a Pattern<'a>, indent: u16, parens: Parens, @@ -18,9 +18,9 @@ impl<'a> Formattable for PatternAs<'a> { self.spaces_before.iter().any(|s| s.is_comment()) } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, _parens: Parens, _newlines: Newlines, indent: u16, @@ -85,9 +85,9 @@ impl<'a> Formattable for Pattern<'a> { } } - fn format_with_options<'buf>( + fn format_with_options( &self, - buf: &mut Buf<'buf>, + buf: &mut Buf, parens: Parens, newlines: Newlines, indent: u16, diff --git a/crates/compiler/fmt/src/spaces.rs b/crates/compiler/fmt/src/spaces.rs index 172b7c7d9f..35b921a822 100644 --- a/crates/compiler/fmt/src/spaces.rs +++ b/crates/compiler/fmt/src/spaces.rs @@ -21,9 +21,9 @@ use crate::{Ast, Buf}; /// The number of spaces to indent. pub const INDENT: u16 = 4; -pub fn fmt_default_spaces<'a, 'buf>( - buf: &mut Buf<'buf>, - spaces: &[CommentOrNewline<'a>], +pub fn fmt_default_spaces( + buf: &mut Buf, + spaces: &[CommentOrNewline], indent: u16, ) { if spaces.is_empty() { @@ -32,9 +32,9 @@ pub fn fmt_default_spaces<'a, 'buf>( fmt_spaces(buf, spaces.iter(), indent); } } -pub fn fmt_default_newline<'a, 'buf>( - buf: &mut Buf<'buf>, - spaces: &[CommentOrNewline<'a>], +pub fn fmt_default_newline( + buf: &mut Buf, + spaces: &[CommentOrNewline], indent: u16, ) { if spaces.is_empty() { @@ -153,7 +153,7 @@ pub fn fmt_comments_only<'a, 'buf, I>( } } -fn fmt_comment<'buf>(buf: &mut Buf<'buf>, comment: &str) { +fn fmt_comment(buf: &mut Buf, comment: &str) { // The '#' in a comment should always be preceded by a newline or a space, // unless it's the very beginning of the buffer. if !buf.is_empty() && !buf.ends_with_space() && !buf.ends_with_newline() { @@ -192,7 +192,7 @@ where count } -fn fmt_docs<'buf>(buf: &mut Buf<'buf>, docs: &str) { +fn fmt_docs(buf: &mut Buf, docs: &str) { // The "##" in a doc comment should always be preceded by a newline or a space, // unless it's the very beginning of the buffer. if !buf.is_empty() && !buf.ends_with_space() && !buf.ends_with_newline() { diff --git a/crates/compiler/mono/src/inc_dec.rs b/crates/compiler/mono/src/inc_dec.rs index e2b644ec00..75188b666f 100644 --- a/crates/compiler/mono/src/inc_dec.rs +++ b/crates/compiler/mono/src/inc_dec.rs @@ -25,9 +25,9 @@ use crate::{ /** Insert the reference count operations for procedures. */ -pub fn insert_inc_dec_operations<'a, 'i>( +pub fn insert_inc_dec_operations<'a>( arena: &'a Bump, - layout_interner: &'i STLayoutInterner<'a>, + layout_interner: &STLayoutInterner<'a>, procedures: &mut HashMap<(Symbol, ProcLayout), Proc<'a>, BuildHasherDefault>, ) { // Create a SymbolRcTypesEnv for the procedures as they get referenced but should be marked as non reference counted. @@ -401,9 +401,9 @@ impl<'v> RefcountEnvironment<'v> { /** Insert the reference counting operations into a statement. */ -fn insert_inc_dec_operations_proc<'a, 'i>( +fn insert_inc_dec_operations_proc<'a>( arena: &'a Bump, - mut symbol_rc_types_env: SymbolRcTypesEnv<'a, 'i>, + mut symbol_rc_types_env: SymbolRcTypesEnv<'a, '_>, proc: &mut Proc<'a>, ) { // Clone the symbol_rc_types_env and insert the symbols in the current procedure. diff --git a/crates/compiler/mono/src/ir.rs b/crates/compiler/mono/src/ir.rs index af41bb0ca0..cc6e5c16a7 100644 --- a/crates/compiler/mono/src/ir.rs +++ b/crates/compiler/mono/src/ir.rs @@ -72,8 +72,8 @@ roc_error_macros::assert_sizeof_wasm!(Call, 44); roc_error_macros::assert_sizeof_wasm!(CallType, 36); roc_error_macros::assert_sizeof_non_wasm!(Literal, 3 * 8); -roc_error_macros::assert_sizeof_non_wasm!(Expr, 9 * 8); -roc_error_macros::assert_sizeof_non_wasm!(Stmt, 12 * 8); +roc_error_macros::assert_sizeof_non_wasm!(Expr, 10 * 8); +roc_error_macros::assert_sizeof_non_wasm!(Stmt, 13 * 8); roc_error_macros::assert_sizeof_non_wasm!(ProcLayout, 5 * 8); roc_error_macros::assert_sizeof_non_wasm!(Call, 9 * 8); roc_error_macros::assert_sizeof_non_wasm!(CallType, 7 * 8); @@ -279,8 +279,9 @@ impl AbilityAliases { } } -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)] pub enum CapturedSymbols<'a> { + #[default] None, Captured(&'a [(Symbol, Variable)]), } @@ -294,12 +295,6 @@ impl<'a> CapturedSymbols<'a> { } } -impl<'a> Default for CapturedSymbols<'a> { - fn default() -> Self { - CapturedSymbols::None - } -} - #[derive(Clone, Debug, PartialEq)] pub struct Proc<'a> { pub name: LambdaName<'a>, @@ -2722,8 +2717,8 @@ fn patterns_to_when<'a>( /// { x } -> body /// /// conversion of one-pattern when expressions will do the most optimal thing -fn pattern_to_when<'a>( - env: &mut Env<'a, '_>, +fn pattern_to_when( + env: &mut Env<'_, '_>, pattern_var: Variable, pattern: Loc, body_var: Variable, @@ -5740,8 +5735,8 @@ fn compile_struct_like<'a, L, UnusedLayout>( } #[inline(always)] -fn late_resolve_ability_specialization<'a>( - env: &mut Env<'a, '_>, +fn late_resolve_ability_specialization( + env: &mut Env<'_, '_>, member: Symbol, specialization_id: Option, specialization_var: Variable, diff --git a/crates/compiler/mono/src/ir/decision_tree.rs b/crates/compiler/mono/src/ir/decision_tree.rs index c5c1a48425..d81fbae021 100644 --- a/crates/compiler/mono/src/ir/decision_tree.rs +++ b/crates/compiler/mono/src/ir/decision_tree.rs @@ -1193,7 +1193,7 @@ fn extract<'a>( /// FIND IRRELEVANT BRANCHES -fn is_irrelevant_to<'a>(selected_path: &[PathInstruction], branch: &Branch<'a>) -> bool { +fn is_irrelevant_to(selected_path: &[PathInstruction], branch: &Branch) -> bool { match branch .patterns .iter() @@ -1720,7 +1720,7 @@ fn test_to_comparison<'a>( Test::IsFloat(test_int, precision) => { // TODO maybe we can actually use i64 comparison here? - let test_float = f64::from_bits(test_int as u64); + let test_float = f64::from_bits(test_int); let lhs = Expr::Literal(Literal::Float(test_float)); let lhs_symbol = env.unique_symbol(); stores.push((lhs_symbol, Layout::float_width(precision), lhs)); @@ -2240,7 +2240,7 @@ fn decide_to_branching<'a>( let tag = match test { Test::IsInt(v, _) => i128::from_ne_bytes(v) as u64, - Test::IsFloat(v, _) => v as u64, + Test::IsFloat(v, _) => v, Test::IsBit(v) => v as u64, Test::IsByte { tag_id, .. } => tag_id as u64, Test::IsCtor { tag_id, .. } => tag_id as u64, diff --git a/crates/compiler/mono/src/layout.rs b/crates/compiler/mono/src/layout.rs index a90a275234..bcd07d254e 100644 --- a/crates/compiler/mono/src/layout.rs +++ b/crates/compiler/mono/src/layout.rs @@ -457,7 +457,7 @@ macro_rules! cached { } pub type TagIdIntType = u16; -pub const MAX_ENUM_SIZE: usize = (std::mem::size_of::() * 8) as usize; +pub const MAX_ENUM_SIZE: usize = std::mem::size_of::() * 8; const GENERATE_NULLABLE: bool = true; #[derive(Debug, Clone, Copy)] @@ -898,7 +898,7 @@ impl<'a> UnionLayout<'a> { } => { debug_assert_ne!(nullable_id, tag_id != 0); - other_fields[index as usize] + other_fields[index] } }; diff --git a/crates/compiler/mono/src/reset_reuse.rs b/crates/compiler/mono/src/reset_reuse.rs index ac57ca2fdc..e47cbff03c 100644 --- a/crates/compiler/mono/src/reset_reuse.rs +++ b/crates/compiler/mono/src/reset_reuse.rs @@ -1128,8 +1128,8 @@ impl<'a> ReuseEnvironment<'a> { /** Check if a layout can be reused. by verifying if the layout is a union and if the tag is not nullable. */ -fn can_reuse_layout<'a, 'i>( - layout_interner: &'i STLayoutInterner<'a>, +fn can_reuse_layout<'a>( + layout_interner: &STLayoutInterner<'a>, environment: &ReuseEnvironment<'a>, layout: &InLayout<'a>, ) -> Reuse { diff --git a/crates/compiler/region/src/all.rs b/crates/compiler/region/src/all.rs index f2b188b104..9b556b76b4 100644 --- a/crates/compiler/region/src/all.rs +++ b/crates/compiler/region/src/all.rs @@ -105,14 +105,14 @@ impl Position { #[must_use] pub const fn bump_column(self, count: u32) -> Self { Self { - offset: self.offset + count as u32, + offset: self.offset + count, } } #[must_use] pub fn bump_invisible(self, count: u32) -> Self { Self { - offset: self.offset + count as u32, + offset: self.offset + count, } } @@ -126,7 +126,7 @@ impl Position { #[must_use] pub const fn sub(self, count: u32) -> Self { Self { - offset: self.offset - count as u32, + offset: self.offset - count, } } @@ -376,7 +376,7 @@ impl LineInfo { let column = offset - self.line_offsets[line]; LineColumn { line: line as u32, - column: column as u32, + column, } } diff --git a/crates/compiler/solve/src/solve.rs b/crates/compiler/solve/src/solve.rs index 349e8427dc..00a5b0d9a3 100644 --- a/crates/compiler/solve/src/solve.rs +++ b/crates/compiler/solve/src/solve.rs @@ -2537,14 +2537,14 @@ enum TypeToVar { } #[allow(clippy::too_many_arguments)] -fn type_to_variable<'a>( +fn type_to_variable( subs: &mut Subs, rank: Rank, pools: &mut Pools, problems: &mut Vec, abilities_store: &AbilitiesStore, obligation_cache: &mut ObligationCache, - arena: &'a bumpalo::Bump, + arena: &bumpalo::Bump, aliases: &mut Aliases, types: &mut Types, typ: Index, diff --git a/crates/compiler/solve/src/specialize.rs b/crates/compiler/solve/src/specialize.rs index 7ba2fe5799..d6344f70fc 100644 --- a/crates/compiler/solve/src/specialize.rs +++ b/crates/compiler/solve/src/specialize.rs @@ -545,7 +545,7 @@ fn compact_lambda_set( Err(()) => { // Do nothing other than to remove the concrete lambda to drop from the lambda set, // which we already did in 1b above. - trace_compact!(3iter_end_skipped. subs, t_f1); + trace_compact!(3iter_end_skipped.subs, t_f1); return OneCompactionResult::Compacted { new_obligations: Default::default(), new_lambda_sets_to_specialize: Default::default(), @@ -568,7 +568,7 @@ fn compact_lambda_set( Err(()) => { // Do nothing other than to remove the concrete lambda to drop from the lambda set, // which we already did in 1b above. - trace_compact!(3iter_end_skipped. subs, t_f1); + trace_compact!(3iter_end_skipped.subs, t_f1); return OneCompactionResult::Compacted { new_obligations: Default::default(), new_lambda_sets_to_specialize: Default::default(), @@ -581,7 +581,7 @@ fn compact_lambda_set( let t_f2 = deep_copy_var_in(subs, target_rank, pools, t_f2, arena); // 3. Unify `t_f1 ~ t_f2`. - trace_compact!(3iter_start. subs, this_lambda_set, t_f1, t_f2); + trace_compact!(3iter_start.subs, this_lambda_set, t_f1, t_f2); let (vars, new_obligations, new_lambda_sets_to_specialize, _meta) = unify( &mut UEnv::new(subs), t_f1, @@ -590,7 +590,7 @@ fn compact_lambda_set( Polarity::Pos, ) .expect_success("ambient functions don't unify"); - trace_compact!(3iter_end. subs, t_f1); + trace_compact!(3iter_end.subs, t_f1); introduce(subs, target_rank, pools, &vars); diff --git a/crates/compiler/types/src/pretty_print.rs b/crates/compiler/types/src/pretty_print.rs index 25527f0f72..590d410f02 100644 --- a/crates/compiler/types/src/pretty_print.rs +++ b/crates/compiler/types/src/pretty_print.rs @@ -1285,8 +1285,8 @@ fn write_flat_type<'a>( } } -pub fn push_union<'a, L: Label>( - subs: &'a Subs, +pub fn push_union( + subs: &Subs, tags: &UnionLabels, fields: &mut Vec<(L, Vec)>, ) { diff --git a/crates/compiler/unify/src/unify.rs b/crates/compiler/unify/src/unify.rs index 4b6d737dfb..95bf05d78e 100644 --- a/crates/compiler/unify/src/unify.rs +++ b/crates/compiler/unify/src/unify.rs @@ -1360,8 +1360,8 @@ fn separate_union_lambdas( let mut buckets: VecMap = VecMap::with_capacity(fields1.len() + fields2.len()); let (mut fields_left, mut fields_right) = ( - fields1.iter_all().into_iter().peekable(), - fields2.iter_all().into_iter().peekable(), + fields1.iter_all().peekable(), + fields2.iter_all().peekable(), ); loop { diff --git a/crates/repl_wasm/build.rs b/crates/repl_wasm/build.rs index 0ed3b1b4dd..7cb3d02149 100644 --- a/crates/repl_wasm/build.rs +++ b/crates/repl_wasm/build.rs @@ -31,7 +31,7 @@ fn main() { let builtins_host_tempfile = roc_bitcode::host_wasm_tempfile() .expect("failed to write host builtins object to tempfile"); - let output = Command::new(&zig_executable()) + let output = Command::new(zig_executable()) .args([ "wasm-ld", builtins_host_tempfile.path().to_str().unwrap(), @@ -67,7 +67,7 @@ fn build_wasm_platform(out_dir: &str, source_path: &str) -> PathBuf { let mut platform_obj = PathBuf::from(out_dir).join(PLATFORM_FILENAME); platform_obj.set_extension(OBJECT_EXTENSION); - Command::new(&zig_executable()) + Command::new(zig_executable()) .args([ "build-lib", "-target", diff --git a/crates/vendor/pathfinding/src/lib.rs b/crates/vendor/pathfinding/src/lib.rs index 8044a7fed9..6846cc276c 100644 --- a/crates/vendor/pathfinding/src/lib.rs +++ b/crates/vendor/pathfinding/src/lib.rs @@ -219,7 +219,7 @@ where }) .collect(); if prev_group.is_empty() { - let remaining: Vec = preds_map.into_iter().map(|(node, _)| node).collect(); + let remaining: Vec = preds_map.into_keys().collect(); return Err((Vec::new(), remaining)); } for node in &prev_group { @@ -241,7 +241,7 @@ where } groups.push(mem::replace(&mut prev_group, next_group)); if prev_group.is_empty() { - let remaining: Vec = preds_map.into_iter().map(|(node, _)| node).collect(); + let remaining: Vec = preds_map.into_keys().collect(); return Err((groups, remaining)); } } diff --git a/crates/wasi-libc-sys/build.rs b/crates/wasi-libc-sys/build.rs index 1ef3bda1ea..74a2cd6a37 100644 --- a/crates/wasi-libc-sys/build.rs +++ b/crates/wasi-libc-sys/build.rs @@ -38,7 +38,7 @@ fn main() { .unwrap(); // Copy libc to where Cargo expects the output of this crate - fs::copy(&libc_path, &out_file).unwrap(); + fs::copy(libc_path, &out_file).unwrap(); println!( "cargo:rustc-env=WASI_LIBC_PATH={}", diff --git a/crates/wasm_interp/src/instance.rs b/crates/wasm_interp/src/instance.rs index 036d092597..8454a384d1 100644 --- a/crates/wasm_interp/src/instance.rs +++ b/crates/wasm_interp/src/instance.rs @@ -948,7 +948,7 @@ impl<'a, I: ImportDispatcher> Instance<'a, I> { let memory_index = self.fetch_immediate_u32(module); assert_eq!(memory_index, 0); let old_bytes = self.memory.len() as u32; - let old_pages = old_bytes / MemorySection::PAGE_SIZE as u32; + let old_pages = old_bytes / MemorySection::PAGE_SIZE; let grow_pages = self.value_store.pop_u32()?; let grow_bytes = grow_pages * MemorySection::PAGE_SIZE; let new_bytes = old_bytes + grow_bytes; @@ -1700,7 +1700,7 @@ impl<'a, I: ImportDispatcher> Instance<'a, I> { } else { // For calls, we print special debug stuff in do_call let base = self.current_frame.locals_start + self.current_frame.locals_count; - let slice = self.value_store.get_slice(base as usize); + let slice = self.value_store.get_slice(base); eprintln!("{:06x} {:17} {:x?}", file_offset, debug_string, slice); } let is_return = op_code == RETURN || (op_code == END && implicit_return); diff --git a/crates/wasm_interp/src/tests/test_basics.rs b/crates/wasm_interp/src/tests/test_basics.rs index 94791ee696..c0b56cec85 100644 --- a/crates/wasm_interp/src/tests/test_basics.rs +++ b/crates/wasm_interp/src/tests/test_basics.rs @@ -37,7 +37,7 @@ fn test_loop_help(end: i32, expected: i32) { // loop buf.push(OpCode::LOOP as u8); - buf.push(ValueType::VOID as u8); + buf.push(ValueType::VOID); // local.get $i buf.push(OpCode::GETLOCAL as u8); @@ -135,7 +135,7 @@ fn test_if_else_help(condition: i32, expected: i32) { // if buf.push(OpCode::IF as u8); - buf.push(ValueType::VOID as u8); + buf.push(ValueType::VOID); // i32.const 111 buf.push(OpCode::I32CONST as u8); @@ -599,7 +599,7 @@ fn test_call_return_no_args() { ValueType::I32 as u8, OpCode::BLOCK as u8, /* */ // call from inside a block. callee's implicit return should still work correctly. - ValueType::VOID as u8, + ValueType::VOID, OpCode::CALL as u8, 1, // function 1 OpCode::SETLOCAL as u8, diff --git a/devtools/flake.lock b/devtools/flake.lock index 188156be58..133ab3f20c 100644 --- a/devtools/flake.lock +++ b/devtools/flake.lock @@ -1,12 +1,15 @@ { "nodes": { "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -84,11 +87,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1673134516, - "narHash": "sha256-mAZQKqkNQbBmJnmUU0blOfkKlgMSSVyPHdeWeuKad8U=", + "lastModified": 1673796341, + "narHash": "sha256-1kZi9OkukpNmOaPY7S5/+SlCDOuYnP3HkXHvNDyLQcc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f6f44561884c3470e2b783683d5dbac42dfc833b", + "rev": "6dccdc458512abce8d19f74195bb20fdb067df50", "type": "github" }, "original": { @@ -106,8 +109,8 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1673266343, - "narHash": "sha256-HQGjNhCte1wgvo5/SUL1OjIpfoUCQ8vC/2k0gi7UtmQ=", + "lastModified": 1681824025, + "narHash": "sha256-ZMFUKoJ03ZY2qmulhpL4i6J0q0fm2Rc/yjo9f7geCZ4=", "path": "/home/username/gitrepos/roc1/roc", "type": "path" }, @@ -131,11 +134,11 @@ ] }, "locked": { - "lastModified": 1673231106, - "narHash": "sha256-Tbw4N/TL+nHmxF8RBoOJbl/6DRRzado/9/ttPEzkGr8=", + "lastModified": 1673922364, + "narHash": "sha256-U0XIY/Y/x4fFtlCZKMtWlqOYUnLiXj4F42GQHxWuPow=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "3488cec01351c2f1086b02a3a61808be7a25103e", + "rev": "4e0f9b8a5102387f8d19901bced16a256a6ccdc7", "type": "github" }, "original": { @@ -143,6 +146,21 @@ "repo": "rust-overlay", "type": "github" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/devtools/flake.nix b/devtools/flake.nix index f63f90d792..a57c192eaf 100644 --- a/devtools/flake.nix +++ b/devtools/flake.nix @@ -1,5 +1,5 @@ { - description = "Allows sharing dependencies between dev tools and roc"; + description = "Allows sharing dependencies between dev tools and roc. Prevents version GLIBC_2.36 not found."; inputs = { # change this path to the path of your roc folder @@ -24,7 +24,7 @@ vscodeWithExtensions = pkgs.vscode-with-extensions.override { vscodeExtensions = with pkgs.vscode-extensions; [ matklad.rust-analyzer - eamodio.gitlens + # eamodio.gitlens bbenoist.nix vadimcn.vscode-lldb tamasfe.even-better-toml @@ -33,13 +33,12 @@ { name = "roc-lang-support"; publisher = "benjamin-thomas"; - version = "0.0.3"; + version = "0.0.4"; # keep this sha for the first run, nix will tell you the correct one to change it to sha256 = "sha256-mabNegZ+XPQ6EIHFk6jz2mAPLHAU6Pm3w0SiFB7IE+s="; } ] ; - }; in [ vscodeWithExtensions devInputs ]; diff --git a/examples/platform-switching/rust-platform/rust-toolchain.toml b/examples/platform-switching/rust-platform/rust-toolchain.toml index 1932d9560f..2cb7a980c5 100644 --- a/examples/platform-switching/rust-platform/rust-toolchain.toml +++ b/examples/platform-switching/rust-platform/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.65.0" +channel = "1.68.2" profile = "default" diff --git a/flake.lock b/flake.lock index 1715e271fa..22e5d0f256 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,15 @@ { "nodes": { "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -31,12 +34,15 @@ } }, "flake-utils_3": { + "inputs": { + "systems": "systems_2" + }, "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -53,11 +59,11 @@ ] }, "locked": { - "lastModified": 1672992692, - "narHash": "sha256-/eLQLSNIa22ARTZbk+x8i0iE8khe1eiHWkuxgTVXZ7g=", + "lastModified": 1676383589, + "narHash": "sha256-KCkWZXCjH+C4Kn7fUGSrEl5btk+sERHhZueSsvVbPWc=", "owner": "guibou", "repo": "nixGL", - "rev": "643e730efb981ffaf8478f441ec9b9aeea1c89f5", + "rev": "c917918ab9ebeee27b0dd657263d3f57ba6bb8ad", "type": "github" }, "original": { @@ -98,11 +104,11 @@ ] }, "locked": { - "lastModified": 1673922364, - "narHash": "sha256-U0XIY/Y/x4fFtlCZKMtWlqOYUnLiXj4F42GQHxWuPow=", + "lastModified": 1682043560, + "narHash": "sha256-ZsF4Yee9pQbvLtwSVGgYux+az4yFSLXrxPyGHm3ptJM=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "4e0f9b8a5102387f8d19901bced16a256a6ccdc7", + "rev": "48037a6f8faeee138ede96bf607bc95c9dab9aec", "type": "github" }, "original": { @@ -110,6 +116,36 @@ "repo": "rust-overlay", "type": "github" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 8751835c29..96742690cc 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -3,14 +3,14 @@ # - update `channel = "RUST_VERSION"` # - update `channel = "RUST_VERSION"` in examples/platform-switching/rust-platform/rust-toolchain.toml # - to update the nightly version: -# - Find the latest nightly release that matches RUST_VERSION here: https://github.com/oxalica/rust-overlay/tree/master/manifests/nightly/2022 +# - Find the latest nightly release that matches RUST_VERSION here: https://github.com/oxalica/rust-overlay/tree/master/manifests/nightly/2023 # - update `channel = "nightly-OLD_DATE"` below # - update nightly-OLD_DATE in .github/workflows/windows.yml # - update nightly-OLD_DATE in crates/compiler/build/src/link.rs -channel = "1.65.0" # check ^^^ when changing this -# -# channel = "nightly-2022-09-17" # 1.65 nightly to be able to use unstable features +channel = "1.68.2" # check ^^^ when changing this +# +# channel = "nightly-2023-01-22" # 1.68.0 nightly to be able to use unstable features profile = "default" components = [ # for usages of rust-analyzer or similar tools inside `nix develop`