diff --git a/.github/workflows/ubuntu_x86_64.yml b/.github/workflows/ubuntu_x86_64.yml index 4664238362..8c23c5b5b5 100644 --- a/.github/workflows/ubuntu_x86_64.yml +++ b/.github/workflows/ubuntu_x86_64.yml @@ -30,7 +30,7 @@ jobs: run: cargo run --locked --release format --check crates/compiler/builtins/roc - name: ensure there are no unused dependencies - run: cargo +nightly-2023-12-21 udeps --all-targets + run: cargo +nightly-2024-02-03 udeps --all-targets - name: zig wasm tests run: cd crates/compiler/builtins/bitcode && ./run-wasm-tests.sh diff --git a/.github/workflows/windows_release_build.yml b/.github/workflows/windows_release_build.yml index 34e7698c88..2cb14af3b2 100644 --- a/.github/workflows/windows_release_build.yml +++ b/.github/workflows/windows_release_build.yml @@ -29,8 +29,8 @@ jobs: - name: zig version run: zig version - - name: install rust nightly 1.76.0 - run: rustup install nightly-2023-12-21 + - name: install rust nightly 1.77.0 + run: rustup install nightly-2024-02-03 - name: set up llvm 16 run: | diff --git a/.github/workflows/windows_tests.yml b/.github/workflows/windows_tests.yml index ec6cb1d30e..219ec9fbd6 100644 --- a/.github/workflows/windows_tests.yml +++ b/.github/workflows/windows_tests.yml @@ -37,8 +37,8 @@ jobs: cd crates\compiler\builtins\bitcode\ zig build test - - name: install rust nightly 1.76.0 - run: rustup install nightly-2023-12-21 + - name: install rust nightly 1.77.0 + run: rustup install nightly-2024-02-03 - name: set up llvm 16 run: | diff --git a/Earthfile b/Earthfile index 12b9232725..77344dee25 100644 --- a/Earthfile +++ b/Earthfile @@ -1,6 +1,6 @@ VERSION 0.6 -FROM rust:1.76.0-slim-buster # make sure to update rust-toolchain.toml too so that everything uses the same rust version +FROM rust:1.77.2-slim-buster # make sure to update rust-toolchain.toml too so that everything uses the same rust version WORKDIR /earthbuild prep-debian: diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs index a1cac1d5aa..d0e00d37b2 100644 --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -1157,6 +1157,11 @@ unsafe fn roc_run_native_fast( enum ExecutableFile { #[cfg(target_os = "linux")] MemFd(libc::c_int, PathBuf), + // We store the TempDir in the onDisk variant alongside the path to the executable, + // so that the TempDir doesn't get dropped until after we're done with the path. + // If we didn't do that, then the tempdir would potentially get deleted by the + // TempDir's Drop impl before the file had been executed. + #[allow(dead_code)] #[cfg(not(target_os = "linux"))] OnDisk(TempDir, PathBuf), } @@ -1322,6 +1327,7 @@ fn roc_run_executable_file_path(binary_bytes: &[u8]) -> std::io::Result( let problems = report_problems_monomorphized(&mut loaded); let loaded = loaded; - enum HostRebuildTiming { - BeforeApp(u128), - ConcurrentWithApp(JoinHandle), - } - let opt_rebuild_timing = if let Some(rebuild_thread) = rebuild_thread { if linking_strategy == LinkingStrategy::Additive { let rebuild_duration = rebuild_thread @@ -930,9 +924,9 @@ fn build_loaded_file<'a>( println!("Finished rebuilding the platform in {rebuild_duration} ms\n"); } - Some(HostRebuildTiming::BeforeApp(rebuild_duration)) + None } else { - Some(HostRebuildTiming::ConcurrentWithApp(rebuild_thread)) + Some(rebuild_thread) } } else { None @@ -977,7 +971,7 @@ fn build_loaded_file<'a>( ); } - if let Some(HostRebuildTiming::ConcurrentWithApp(thread)) = opt_rebuild_timing { + if let Some(thread) = opt_rebuild_timing { let rebuild_duration = thread.join().expect("Failed to (re)build platform."); if emit_timings && !is_platform_prebuilt { diff --git a/crates/compiler/can/src/def.rs b/crates/compiler/can/src/def.rs index dec4f04b64..9a807e875b 100644 --- a/crates/compiler/can/src/def.rs +++ b/crates/compiler/can/src/def.rs @@ -150,11 +150,7 @@ impl ExpectsOrDbgs { #[derive(Debug, Clone)] enum PendingValueDef<'a> { /// A standalone annotation with no body - AnnotationOnly( - &'a Loc>, - Loc, - &'a Loc>, - ), + AnnotationOnly(Loc, &'a Loc>), /// A body with no type annotation Body(Loc, &'a Loc>), /// A body with a type annotation @@ -175,7 +171,7 @@ enum PendingValueDef<'a> { impl PendingValueDef<'_> { fn loc_pattern(&self) -> &Loc { match self { - PendingValueDef::AnnotationOnly(_, loc_pattern, _) => loc_pattern, + PendingValueDef::AnnotationOnly(loc_pattern, _) => loc_pattern, PendingValueDef::Body(loc_pattern, _) => loc_pattern, PendingValueDef::TypedBody(_, loc_pattern, _, _) => loc_pattern, PendingValueDef::IngestedFile(loc_pattern, _, _) => loc_pattern, @@ -2208,7 +2204,7 @@ fn canonicalize_pending_value_def<'a>( let pending_abilities_in_scope = &Default::default(); let output = match pending_def { - AnnotationOnly(_, loc_can_pattern, loc_ann) => { + AnnotationOnly(loc_can_pattern, loc_ann) => { // Make types for the body expr, even if we won't end up having a body. let expr_var = var_store.fresh(); let mut vars_by_symbol = SendMap::default(); @@ -2950,7 +2946,6 @@ fn to_pending_value_def<'a>( ); PendingValue::Def(PendingValueDef::AnnotationOnly( - loc_pattern, loc_can_pattern, loc_ann, )) diff --git a/crates/compiler/can/src/suffixed.rs b/crates/compiler/can/src/suffixed.rs index 77f8727df0..6f5b455d7d 100644 --- a/crates/compiler/can/src/suffixed.rs +++ b/crates/compiler/can/src/suffixed.rs @@ -12,7 +12,7 @@ use std::cell::Cell; thread_local! { // we use a thread_local here so that tests consistently give the same pattern - static SUFFIXED_ANSWER_COUNTER: Cell = Cell::new(0); + static SUFFIXED_ANSWER_COUNTER: Cell = const { Cell::new(0) }; } /// Provide an intermediate answer expression and pattern when unwrapping a diff --git a/crates/compiler/mono/src/ir/pattern.rs b/crates/compiler/mono/src/ir/pattern.rs index de0c96e495..c9089d7728 100644 --- a/crates/compiler/mono/src/ir/pattern.rs +++ b/crates/compiler/mono/src/ir/pattern.rs @@ -131,6 +131,8 @@ enum PatternBindingIter<'r, 'a> { enum PatternBindingWork<'r, 'a> { Pat(&'r Pattern<'a>), + #[allow(dead_code)] + // Field will be used once todo is immplemented in next in impl<'r, 'a> Iterator for PatternBindingIter RecordDestruct(&'r DestructType<'a>), } diff --git a/crates/compiler/types/src/pretty_print.rs b/crates/compiler/types/src/pretty_print.rs index 01ff370bb5..f9f6b004a7 100644 --- a/crates/compiler/types/src/pretty_print.rs +++ b/crates/compiler/types/src/pretty_print.rs @@ -960,13 +960,13 @@ fn write_integer<'a>( } } -enum ExtContent<'a> { +enum ExtContent { Empty, - Content(Variable, &'a Content), + Content(Variable), } -impl<'a> ExtContent<'a> { - fn for_tag(subs: &'a Subs, ext: Variable, pol: Polarity, debug_flags: &DebugPrint) -> Self { +impl ExtContent { + fn for_tag(subs: &Subs, ext: Variable, pol: Polarity, debug_flags: &DebugPrint) -> Self { let content = subs.get_content_without_compacting(ext); match content { Content::Structure(FlatType::EmptyTagUnion) => ExtContent::Empty, @@ -983,7 +983,7 @@ impl<'a> ExtContent<'a> { Content::FlexVar(_) | Content::FlexAbleVar(..) | Content::RigidVar(_) - | Content::RigidAbleVar(..) => ExtContent::Content(ext, content), + | Content::RigidAbleVar(..) => ExtContent::Content(ext), other => unreachable!("something weird ended up in an ext var: {:?}", other), } @@ -995,11 +995,11 @@ fn write_ext_content<'a>( ctx: &mut Context<'a>, subs: &'a Subs, buf: &mut String, - ext_content: ExtContent<'a>, + ext_content: ExtContent, parens: Parens, pol: Polarity, ) { - if let ExtContent::Content(var, _) = ext_content { + if let ExtContent::Content(var) = ext_content { // This is an open record or tag union, so print the variable // right after the '}' or ']' // @@ -1050,7 +1050,7 @@ fn write_sorted_tags<'a>( tags: &MutMap>, ext_var: Variable, pol: Polarity, -) -> ExtContent<'a> { +) -> ExtContent { // Sort the fields so they always end up in the same order. let mut sorted_fields = Vec::with_capacity(tags.len()); diff --git a/crates/compiler/unify/src/unify.rs b/crates/compiler/unify/src/unify.rs index ef81cd0c90..765f73d040 100644 --- a/crates/compiler/unify/src/unify.rs +++ b/crates/compiler/unify/src/unify.rs @@ -2533,6 +2533,8 @@ enum Rec { None, Left(Variable), Right(Variable), + #[allow(dead_code)] + // dead_code because of https://github.com/roc-lang/roc/pull/6819/files#r1655317562 Both(Variable, Variable), } diff --git a/crates/glue/tests/test_glue_cli.rs b/crates/glue/tests/test_glue_cli.rs index 119245878f..c00ebe3e4e 100644 --- a/crates/glue/tests/test_glue_cli.rs +++ b/crates/glue/tests/test_glue_cli.rs @@ -67,7 +67,7 @@ mod glue_cli_run { let test_name_str = stringify!($test_name); // TODO after #5924 is fixed; remove this - let skip_on_linux_surgical_linker = ["closures", "option", "nullable_wrapped", "enumeration", "nested_record"]; + let skip_on_linux_surgical_linker = ["closures", "option", "nullable_wrapped", "enumeration", "nested_record", "advanced_recursive_union"]; // Validate linux with the default linker. if !(cfg!(target_os = "linux") && (skip_on_linux_surgical_linker.contains(&test_name_str))) { diff --git a/crates/linker/src/lib.rs b/crates/linker/src/lib.rs index 5f968c6cf2..0906be4118 100644 --- a/crates/linker/src/lib.rs +++ b/crates/linker/src/lib.rs @@ -559,6 +559,7 @@ pub(crate) fn open_mmap_mut(path: &Path, length: usize) -> MmapMut { .read(true) .write(true) .create(true) + .truncate(false) .open(path) .unwrap_or_else(|e| internal_error!("failed to create or open file {path:?}: {e}")); out_file diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs index 41957cdf3f..0033cc7d0d 100644 --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1698,7 +1698,11 @@ fn to_bad_ident_pattern_report<'b>( enum BadIdentNext<'a> { LowercaseAccess(u32), UppercaseAccess(u32), + #[allow(dead_code)] + // The field u32 will be used once todo is implemented in to_bad_ident_expr_report NumberAccess(u32), + #[allow(dead_code)] + // The field str will be used once todo is implemented in to_bad_ident_expr_report Keyword(&'a str), DanglingDot, Other(Option), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs index 36dd105f89..f4d943e70f 100644 --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -154,7 +154,7 @@ fn to_syntax_report<'a>( #[allow(clippy::enum_variant_names)] enum Context { - InNode(Node, Position, Box), + InNode(Node, Position), InDef(Position), InDefFinalExpr(Position), } @@ -185,16 +185,14 @@ fn to_expr_report<'a>( use roc_parse::parser::EExpr; let severity = Severity::RuntimeError; match parse_problem { - EExpr::If(if_, pos) => to_if_report(alloc, lines, filename, context, if_, *pos), - EExpr::When(when, pos) => to_when_report(alloc, lines, filename, context, when, *pos), + EExpr::If(if_, pos) => to_if_report(alloc, lines, filename, if_, *pos), + EExpr::When(when, pos) => to_when_report(alloc, lines, filename, when, *pos), EExpr::Closure(lambda, pos) => { to_lambda_report(alloc, lines, filename, context, lambda, *pos) } - EExpr::List(list, pos) => to_list_report(alloc, lines, filename, context, list, *pos), - EExpr::Str(string, pos) => to_str_report(alloc, lines, filename, context, string, *pos), - EExpr::InParens(expr, pos) => { - to_expr_in_parens_report(alloc, lines, filename, context, expr, *pos) - } + EExpr::List(list, pos) => to_list_report(alloc, lines, filename, list, *pos), + EExpr::Str(string, pos) => to_str_report(alloc, lines, filename, string, *pos), + EExpr::InParens(expr, pos) => to_expr_in_parens_report(alloc, lines, filename, expr, *pos), EExpr::Type(tipe, pos) => to_type_report(alloc, lines, filename, tipe, *pos), EExpr::ElmStyleFunction(region, pos) => { let surroundings = Region::new(start, *pos); @@ -252,7 +250,7 @@ fn to_expr_report<'a>( .indent(4), ])], "->" => match context { - Context::InNode(Node::WhenBranch, _pos, _) => { + Context::InNode(Node::WhenBranch, _pos) => { return to_unexpected_arrow_report(alloc, lines, filename, *pos, start); } @@ -392,7 +390,7 @@ fn to_expr_report<'a>( }; let (context_pos, a_thing) = match context { - Context::InNode(node, pos, _) => match node { + Context::InNode(node, pos) => match node { Node::WhenCondition | Node::WhenBranch | Node::WhenIfGuard => ( pos, alloc.concat([ @@ -603,7 +601,7 @@ fn to_expr_report<'a>( alloc.region_with_subregion(lines.convert_region(surroundings), region, severity); let doc = match context { - Context::InNode(Node::Dbg, _, _) => alloc.stack([ + Context::InNode(Node::Dbg, _) => alloc.stack([ alloc.reflow( r"I am partway through parsing a dbg statement, but I got stuck here:", ), @@ -616,7 +614,7 @@ fn to_expr_report<'a>( ]), ]), ]), - Context::InNode(Node::Expect, _, _) => alloc.stack([ + Context::InNode(Node::Expect, _) => alloc.stack([ alloc.reflow( r"I am partway through parsing an expect statement, but I got stuck here:", ), @@ -964,7 +962,6 @@ fn to_str_report<'a>( alloc: &'a RocDocAllocator<'a>, lines: &LineInfo, filename: PathBuf, - context: Context, parse_problem: &roc_parse::parser::EString<'a>, start: Position, ) -> Report<'a> { @@ -977,7 +974,7 @@ fn to_str_report<'a>( alloc, lines, filename, - Context::InNode(Node::StringFormat, start, Box::new(context)), + Context::InNode(Node::StringFormat, start), expr, pos, ), @@ -1260,7 +1257,6 @@ fn to_expr_in_parens_report<'a>( alloc: &'a RocDocAllocator<'a>, lines: &LineInfo, filename: PathBuf, - context: Context, parse_problem: &roc_parse::parser::EInParens<'a>, start: Position, ) -> Report<'a> { @@ -1273,7 +1269,7 @@ fn to_expr_in_parens_report<'a>( alloc, lines, filename, - Context::InNode(Node::InsideParens, start, Box::new(context)), + Context::InNode(Node::InsideParens, start), expr, pos, ), @@ -1353,7 +1349,6 @@ fn to_list_report<'a>( alloc: &'a RocDocAllocator<'a>, lines: &LineInfo, filename: PathBuf, - context: Context, parse_problem: &roc_parse::parser::EList<'a>, start: Position, ) -> Report<'a> { @@ -1367,7 +1362,7 @@ fn to_list_report<'a>( alloc, lines, filename, - Context::InNode(Node::ListElement, start, Box::new(context)), + Context::InNode(Node::ListElement, start), expr, pos, ), @@ -1465,7 +1460,7 @@ fn to_dbg_or_expect_report<'a>( to_expr_report(alloc, lines, filename, context, e_expr, *condition_start) } roc_parse::parser::EExpect::Continuation(e_expr, continuation_start) => { - let context = Context::InNode(node, start, Box::new(context)); + let context = Context::InNode(node, start); to_expr_report(alloc, lines, filename, context, e_expr, *continuation_start) } @@ -1710,7 +1705,6 @@ fn to_if_report<'a>( alloc: &'a RocDocAllocator<'a>, lines: &LineInfo, filename: PathBuf, - context: Context, parse_problem: &roc_parse::parser::EIf<'a>, start: Position, ) -> Report<'a> { @@ -1723,7 +1717,7 @@ fn to_if_report<'a>( alloc, lines, filename, - Context::InNode(Node::IfCondition, start, Box::new(context)), + Context::InNode(Node::IfCondition, start), expr, pos, ), @@ -1732,7 +1726,7 @@ fn to_if_report<'a>( alloc, lines, filename, - Context::InNode(Node::IfThenBranch, start, Box::new(context)), + Context::InNode(Node::IfThenBranch, start), expr, pos, ), @@ -1741,7 +1735,7 @@ fn to_if_report<'a>( alloc, lines, filename, - Context::InNode(Node::IfElseBranch, start, Box::new(context)), + Context::InNode(Node::IfElseBranch, start), expr, pos, ), @@ -1824,7 +1818,6 @@ fn to_when_report<'a>( alloc: &'a RocDocAllocator<'a>, lines: &LineInfo, filename: PathBuf, - context: Context, parse_problem: &roc_parse::parser::EWhen<'a>, start: Position, ) -> Report<'a> { @@ -1861,7 +1854,7 @@ fn to_when_report<'a>( alloc, lines, filename, - Context::InNode(Node::WhenIfGuard, start, Box::new(context)), + Context::InNode(Node::WhenIfGuard, start), nested, pos, ), @@ -1896,7 +1889,7 @@ fn to_when_report<'a>( alloc, lines, filename, - Context::InNode(Node::WhenBranch, start, Box::new(context)), + Context::InNode(Node::WhenBranch, start), expr, pos, ), @@ -1905,7 +1898,7 @@ fn to_when_report<'a>( alloc, lines, filename, - Context::InNode(Node::WhenCondition, start, Box::new(context)), + Context::InNode(Node::WhenCondition, start), expr, pos, ), @@ -2340,11 +2333,7 @@ fn to_precord_report<'a>( alloc, lines, filename, - Context::InNode( - Node::RecordConditionalDefault, - start, - Box::new(Context::InDef(pos)), - ), + Context::InNode(Node::RecordConditionalDefault, start), expr, pos, ), @@ -4491,6 +4480,7 @@ fn to_unfinished_ability_report<'a>( enum Next<'a> { Keyword(&'a str), // Operator(&'a str), + #[allow(dead_code)] Close(&'a str, char), Token(&'a str), Other(Option), diff --git a/crates/wasm_interp/src/instance.rs b/crates/wasm_interp/src/instance.rs index 0c094dcb9f..84fdcf844b 100644 --- a/crates/wasm_interp/src/instance.rs +++ b/crates/wasm_interp/src/instance.rs @@ -20,9 +20,11 @@ pub enum Action { #[derive(Debug, Clone, Copy)] enum BlockType { - Loop(usize), // Loop block, with start address to loop back to - Normal, // Block created by `block` instruction - Locals(usize), // Special "block" for locals. Holds function index for debug + Loop(usize), // Loop block, with start address to loop back to + Normal, // Block created by `block` instruction + #[allow(dead_code)] + Locals(usize), // Special "block" for locals. Holds function index for debug + #[allow(dead_code)] FunctionBody(usize), // Special block surrounding the function body. Holds function index for debug } diff --git a/examples/glue/rust-platform/rust-toolchain.toml b/examples/glue/rust-platform/rust-toolchain.toml index d564cb7f7d..0abb9617ed 100644 --- a/examples/glue/rust-platform/rust-toolchain.toml +++ b/examples/glue/rust-platform/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.76.0" +channel = "1.77.2" profile = "default" diff --git a/examples/platform-switching/rust-platform/rust-toolchain.toml b/examples/platform-switching/rust-platform/rust-toolchain.toml index d564cb7f7d..0abb9617ed 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.76.0" +channel = "1.77.2" profile = "default" diff --git a/flake.lock b/flake.lock index 9557dd4607..511c9adf18 100644 --- a/flake.lock +++ b/flake.lock @@ -92,11 +92,11 @@ ] }, "locked": { - "lastModified": 1712369449, - "narHash": "sha256-tbWug3uXPlSm1j0xD80Y3xbP+otT6gLnQo1e/vQat48=", + "lastModified": 1713150335, + "narHash": "sha256-Ic7zCPfiSYc9nFFp+E44WFk3TBJ99J/uPZ4QXX+uPPw=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "41b3b080cc3e4b3a48e933b87fc15a05f1870779", + "rev": "b186d85e747e2b7bee220ec95839fb66c868dc47", "type": "github" }, "original": { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 376202c7e0..ffc963e20c 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -5,16 +5,16 @@ # - update `channel = "RUST_VERSION"` in examples/glue/rust-platform/rust-toolchain.toml # - update FROM rust:RUST_VERSION-slim-buster in Earthfile # - 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/2023 +# - Find the latest nightly release that matches RUST_VERSION here: https://github.com/oxalica/rust-overlay/tree/master/manifests/nightly/2024 # - update `channel = "nightly-OLD_DATE"` below # - update nightly-OLD_DATE in .github/workflows/ubuntu_x86_64.yml # - update nightly-OLD_DATE in .github/workflows/windows_tests.yml # - update nightly-OLD_DATE in .github/workflows/windows_release_build.yml # - update nightly-OLD_DATE in crates/compiler/build/src/link.rs -channel = "1.76.0" # check ^^^ when changing this +channel = "1.77.2" # check ^^^ when changing this # -# channel = "nightly-2023-12-21" # 1.76.0 nightly to be able to use unstable features +# channel = "nightly-2024-02-03" # 1.77.0 nightly to be able to use unstable features profile = "default" components = [ # for usages of rust-analyzer or similar tools inside `nix develop`