Skip to content

Commit

Permalink
Merge pull request #6819 from roc-lang/rust-1-77-2-upgrade
Browse files Browse the repository at this point in the history
Rust 1.77.2 upgrade
  • Loading branch information
Anton-4 authored Jul 6, 2024
2 parents 3abc276 + 81d18cc commit 1bcf303
Show file tree
Hide file tree
Showing 22 changed files with 74 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows_release_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion Earthfile
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
6 changes: 6 additions & 0 deletions crates/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down Expand Up @@ -1322,6 +1327,7 @@ fn roc_run_executable_file_path(binary_bytes: &[u8]) -> std::io::Result<Executab
let mut file = OpenOptions::new()
.create(true)
.write(true)
.truncate(true)
.mode(0o777) // create the file as executable
.open(&app_path_buf)?;

Expand Down
1 change: 1 addition & 0 deletions crates/cli_utils/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ struct ValgrindOutput {

#[derive(Deserialize, Debug)]
#[serde(rename_all = "lowercase")]
#[allow(dead_code)] // Some fields are unused but this allows for easy deserialization of the xml.
enum ValgrindField {
ProtocolVersion(isize),
ProtocolTool(String),
Expand Down
2 changes: 1 addition & 1 deletion crates/compiler/build/src/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,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-2023-12-21", "cargo"]);
cmd.args(["run", "nightly-2024-02-03", "cargo"]);

cmd
} else {
Expand Down
12 changes: 3 additions & 9 deletions crates/compiler/build/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use std::ffi::OsStr;
use std::ops::Deref;
use std::{
path::{Path, PathBuf},
thread::JoinHandle,
time::{Duration, Instant},
};

Expand Down Expand Up @@ -915,11 +914,6 @@ fn build_loaded_file<'a>(
let problems = report_problems_monomorphized(&mut loaded);
let loaded = loaded;

enum HostRebuildTiming {
BeforeApp(u128),
ConcurrentWithApp(JoinHandle<u128>),
}

let opt_rebuild_timing = if let Some(rebuild_thread) = rebuild_thread {
if linking_strategy == LinkingStrategy::Additive {
let rebuild_duration = rebuild_thread
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
11 changes: 3 additions & 8 deletions crates/compiler/can/src/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,7 @@ impl ExpectsOrDbgs {
#[derive(Debug, Clone)]
enum PendingValueDef<'a> {
/// A standalone annotation with no body
AnnotationOnly(
&'a Loc<ast::Pattern<'a>>,
Loc<Pattern>,
&'a Loc<ast::TypeAnnotation<'a>>,
),
AnnotationOnly(Loc<Pattern>, &'a Loc<ast::TypeAnnotation<'a>>),
/// A body with no type annotation
Body(Loc<Pattern>, &'a Loc<ast::Expr<'a>>),
/// A body with a type annotation
Expand All @@ -175,7 +171,7 @@ enum PendingValueDef<'a> {
impl PendingValueDef<'_> {
fn loc_pattern(&self) -> &Loc<Pattern> {
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,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -2950,7 +2946,6 @@ fn to_pending_value_def<'a>(
);

PendingValue::Def(PendingValueDef::AnnotationOnly(
loc_pattern,
loc_can_pattern,
loc_ann,
))
Expand Down
2 changes: 1 addition & 1 deletion crates/compiler/can/src/suffixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize> = Cell::new(0);
static SUFFIXED_ANSWER_COUNTER: Cell<usize> = const { Cell::new(0) };
}

/// Provide an intermediate answer expression and pattern when unwrapping a
Expand Down
2 changes: 2 additions & 0 deletions crates/compiler/mono/src/ir/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>),
}

Expand Down
16 changes: 8 additions & 8 deletions crates/compiler/types/src/pretty_print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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),
}
Expand All @@ -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 ']'
//
Expand Down Expand Up @@ -1050,7 +1050,7 @@ fn write_sorted_tags<'a>(
tags: &MutMap<TagName, Vec<Variable>>,
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());

Expand Down
2 changes: 2 additions & 0 deletions crates/compiler/unify/src/unify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}

Expand Down
2 changes: 1 addition & 1 deletion crates/glue/tests/test_glue_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand Down
1 change: 1 addition & 0 deletions crates/linker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions crates/reporting/src/error/canonicalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<char>),
Expand Down
Loading

0 comments on commit 1bcf303

Please sign in to comment.