Skip to content

Commit 1bcf303

Browse files
authored
Merge pull request #6819 from roc-lang/rust-1-77-2-upgrade
Rust 1.77.2 upgrade
2 parents 3abc276 + 81d18cc commit 1bcf303

File tree

22 files changed

+74
-77
lines changed

22 files changed

+74
-77
lines changed

.github/workflows/ubuntu_x86_64.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
run: cargo run --locked --release format --check crates/compiler/builtins/roc
3131

3232
- name: ensure there are no unused dependencies
33-
run: cargo +nightly-2023-12-21 udeps --all-targets
33+
run: cargo +nightly-2024-02-03 udeps --all-targets
3434

3535
- name: zig wasm tests
3636
run: cd crates/compiler/builtins/bitcode && ./run-wasm-tests.sh

.github/workflows/windows_release_build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
- name: zig version
3030
run: zig version
3131

32-
- name: install rust nightly 1.76.0
33-
run: rustup install nightly-2023-12-21
32+
- name: install rust nightly 1.77.0
33+
run: rustup install nightly-2024-02-03
3434

3535
- name: set up llvm 16
3636
run: |

.github/workflows/windows_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
cd crates\compiler\builtins\bitcode\
3838
zig build test
3939
40-
- name: install rust nightly 1.76.0
41-
run: rustup install nightly-2023-12-21
40+
- name: install rust nightly 1.77.0
41+
run: rustup install nightly-2024-02-03
4242

4343
- name: set up llvm 16
4444
run: |

Earthfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
VERSION 0.6
3-
FROM rust:1.76.0-slim-buster # make sure to update rust-toolchain.toml too so that everything uses the same rust version
3+
FROM rust:1.77.2-slim-buster # make sure to update rust-toolchain.toml too so that everything uses the same rust version
44
WORKDIR /earthbuild
55

66
prep-debian:

crates/cli/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,11 @@ unsafe fn roc_run_native_fast(
11571157
enum ExecutableFile {
11581158
#[cfg(target_os = "linux")]
11591159
MemFd(libc::c_int, PathBuf),
1160+
// We store the TempDir in the onDisk variant alongside the path to the executable,
1161+
// so that the TempDir doesn't get dropped until after we're done with the path.
1162+
// If we didn't do that, then the tempdir would potentially get deleted by the
1163+
// TempDir's Drop impl before the file had been executed.
1164+
#[allow(dead_code)]
11601165
#[cfg(not(target_os = "linux"))]
11611166
OnDisk(TempDir, PathBuf),
11621167
}
@@ -1322,6 +1327,7 @@ fn roc_run_executable_file_path(binary_bytes: &[u8]) -> std::io::Result<Executab
13221327
let mut file = OpenOptions::new()
13231328
.create(true)
13241329
.write(true)
1330+
.truncate(true)
13251331
.mode(0o777) // create the file as executable
13261332
.open(&app_path_buf)?;
13271333

crates/cli_utils/src/helpers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ struct ValgrindOutput {
351351

352352
#[derive(Deserialize, Debug)]
353353
#[serde(rename_all = "lowercase")]
354+
#[allow(dead_code)] // Some fields are unused but this allows for easy deserialization of the xml.
354355
enum ValgrindField {
355356
ProtocolVersion(isize),
356357
ProtocolTool(String),

crates/compiler/build/src/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ pub fn rebuild_host(
540540
// on windows, we need the nightly toolchain so we can use `-Z export-executable-symbols`
541541
// using `+nightly` only works when running cargo through rustup
542542
let mut cmd = rustup();
543-
cmd.args(["run", "nightly-2023-12-21", "cargo"]);
543+
cmd.args(["run", "nightly-2024-02-03", "cargo"]);
544544

545545
cmd
546546
} else {

crates/compiler/build/src/program.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use std::ffi::OsStr;
2222
use std::ops::Deref;
2323
use std::{
2424
path::{Path, PathBuf},
25-
thread::JoinHandle,
2625
time::{Duration, Instant},
2726
};
2827

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

918-
enum HostRebuildTiming {
919-
BeforeApp(u128),
920-
ConcurrentWithApp(JoinHandle<u128>),
921-
}
922-
923917
let opt_rebuild_timing = if let Some(rebuild_thread) = rebuild_thread {
924918
if linking_strategy == LinkingStrategy::Additive {
925919
let rebuild_duration = rebuild_thread
@@ -930,9 +924,9 @@ fn build_loaded_file<'a>(
930924
println!("Finished rebuilding the platform in {rebuild_duration} ms\n");
931925
}
932926

933-
Some(HostRebuildTiming::BeforeApp(rebuild_duration))
927+
None
934928
} else {
935-
Some(HostRebuildTiming::ConcurrentWithApp(rebuild_thread))
929+
Some(rebuild_thread)
936930
}
937931
} else {
938932
None
@@ -977,7 +971,7 @@ fn build_loaded_file<'a>(
977971
);
978972
}
979973

980-
if let Some(HostRebuildTiming::ConcurrentWithApp(thread)) = opt_rebuild_timing {
974+
if let Some(thread) = opt_rebuild_timing {
981975
let rebuild_duration = thread.join().expect("Failed to (re)build platform.");
982976

983977
if emit_timings && !is_platform_prebuilt {

crates/compiler/can/src/def.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,7 @@ impl ExpectsOrDbgs {
150150
#[derive(Debug, Clone)]
151151
enum PendingValueDef<'a> {
152152
/// A standalone annotation with no body
153-
AnnotationOnly(
154-
&'a Loc<ast::Pattern<'a>>,
155-
Loc<Pattern>,
156-
&'a Loc<ast::TypeAnnotation<'a>>,
157-
),
153+
AnnotationOnly(Loc<Pattern>, &'a Loc<ast::TypeAnnotation<'a>>),
158154
/// A body with no type annotation
159155
Body(Loc<Pattern>, &'a Loc<ast::Expr<'a>>),
160156
/// A body with a type annotation
@@ -175,7 +171,7 @@ enum PendingValueDef<'a> {
175171
impl PendingValueDef<'_> {
176172
fn loc_pattern(&self) -> &Loc<Pattern> {
177173
match self {
178-
PendingValueDef::AnnotationOnly(_, loc_pattern, _) => loc_pattern,
174+
PendingValueDef::AnnotationOnly(loc_pattern, _) => loc_pattern,
179175
PendingValueDef::Body(loc_pattern, _) => loc_pattern,
180176
PendingValueDef::TypedBody(_, loc_pattern, _, _) => loc_pattern,
181177
PendingValueDef::IngestedFile(loc_pattern, _, _) => loc_pattern,
@@ -2208,7 +2204,7 @@ fn canonicalize_pending_value_def<'a>(
22082204
let pending_abilities_in_scope = &Default::default();
22092205

22102206
let output = match pending_def {
2211-
AnnotationOnly(_, loc_can_pattern, loc_ann) => {
2207+
AnnotationOnly(loc_can_pattern, loc_ann) => {
22122208
// Make types for the body expr, even if we won't end up having a body.
22132209
let expr_var = var_store.fresh();
22142210
let mut vars_by_symbol = SendMap::default();
@@ -2950,7 +2946,6 @@ fn to_pending_value_def<'a>(
29502946
);
29512947

29522948
PendingValue::Def(PendingValueDef::AnnotationOnly(
2953-
loc_pattern,
29542949
loc_can_pattern,
29552950
loc_ann,
29562951
))

crates/compiler/can/src/suffixed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::cell::Cell;
1212

1313
thread_local! {
1414
// we use a thread_local here so that tests consistently give the same pattern
15-
static SUFFIXED_ANSWER_COUNTER: Cell<usize> = Cell::new(0);
15+
static SUFFIXED_ANSWER_COUNTER: Cell<usize> = const { Cell::new(0) };
1616
}
1717

1818
/// Provide an intermediate answer expression and pattern when unwrapping a

crates/compiler/mono/src/ir/pattern.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ enum PatternBindingIter<'r, 'a> {
131131

132132
enum PatternBindingWork<'r, 'a> {
133133
Pat(&'r Pattern<'a>),
134+
#[allow(dead_code)]
135+
// Field will be used once todo is immplemented in next in impl<'r, 'a> Iterator for PatternBindingIter
134136
RecordDestruct(&'r DestructType<'a>),
135137
}
136138

crates/compiler/types/src/pretty_print.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -960,13 +960,13 @@ fn write_integer<'a>(
960960
}
961961
}
962962

963-
enum ExtContent<'a> {
963+
enum ExtContent {
964964
Empty,
965-
Content(Variable, &'a Content),
965+
Content(Variable),
966966
}
967967

968-
impl<'a> ExtContent<'a> {
969-
fn for_tag(subs: &'a Subs, ext: Variable, pol: Polarity, debug_flags: &DebugPrint) -> Self {
968+
impl ExtContent {
969+
fn for_tag(subs: &Subs, ext: Variable, pol: Polarity, debug_flags: &DebugPrint) -> Self {
970970
let content = subs.get_content_without_compacting(ext);
971971
match content {
972972
Content::Structure(FlatType::EmptyTagUnion) => ExtContent::Empty,
@@ -983,7 +983,7 @@ impl<'a> ExtContent<'a> {
983983
Content::FlexVar(_)
984984
| Content::FlexAbleVar(..)
985985
| Content::RigidVar(_)
986-
| Content::RigidAbleVar(..) => ExtContent::Content(ext, content),
986+
| Content::RigidAbleVar(..) => ExtContent::Content(ext),
987987

988988
other => unreachable!("something weird ended up in an ext var: {:?}", other),
989989
}
@@ -995,11 +995,11 @@ fn write_ext_content<'a>(
995995
ctx: &mut Context<'a>,
996996
subs: &'a Subs,
997997
buf: &mut String,
998-
ext_content: ExtContent<'a>,
998+
ext_content: ExtContent,
999999
parens: Parens,
10001000
pol: Polarity,
10011001
) {
1002-
if let ExtContent::Content(var, _) = ext_content {
1002+
if let ExtContent::Content(var) = ext_content {
10031003
// This is an open record or tag union, so print the variable
10041004
// right after the '}' or ']'
10051005
//
@@ -1050,7 +1050,7 @@ fn write_sorted_tags<'a>(
10501050
tags: &MutMap<TagName, Vec<Variable>>,
10511051
ext_var: Variable,
10521052
pol: Polarity,
1053-
) -> ExtContent<'a> {
1053+
) -> ExtContent {
10541054
// Sort the fields so they always end up in the same order.
10551055
let mut sorted_fields = Vec::with_capacity(tags.len());
10561056

crates/compiler/unify/src/unify.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,6 +2533,8 @@ enum Rec {
25332533
None,
25342534
Left(Variable),
25352535
Right(Variable),
2536+
#[allow(dead_code)]
2537+
// dead_code because of https://github.com/roc-lang/roc/pull/6819/files#r1655317562
25362538
Both(Variable, Variable),
25372539
}
25382540

crates/glue/tests/test_glue_cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ mod glue_cli_run {
6767
let test_name_str = stringify!($test_name);
6868

6969
// TODO after #5924 is fixed; remove this
70-
let skip_on_linux_surgical_linker = ["closures", "option", "nullable_wrapped", "enumeration", "nested_record"];
70+
let skip_on_linux_surgical_linker = ["closures", "option", "nullable_wrapped", "enumeration", "nested_record", "advanced_recursive_union"];
7171

7272
// Validate linux with the default linker.
7373
if !(cfg!(target_os = "linux") && (skip_on_linux_surgical_linker.contains(&test_name_str))) {

crates/linker/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ pub(crate) fn open_mmap_mut(path: &Path, length: usize) -> MmapMut {
559559
.read(true)
560560
.write(true)
561561
.create(true)
562+
.truncate(false)
562563
.open(path)
563564
.unwrap_or_else(|e| internal_error!("failed to create or open file {path:?}: {e}"));
564565
out_file

crates/reporting/src/error/canonicalize.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,7 +1698,11 @@ fn to_bad_ident_pattern_report<'b>(
16981698
enum BadIdentNext<'a> {
16991699
LowercaseAccess(u32),
17001700
UppercaseAccess(u32),
1701+
#[allow(dead_code)]
1702+
// The field u32 will be used once todo is implemented in to_bad_ident_expr_report
17011703
NumberAccess(u32),
1704+
#[allow(dead_code)]
1705+
// The field str will be used once todo is implemented in to_bad_ident_expr_report
17021706
Keyword(&'a str),
17031707
DanglingDot,
17041708
Other(Option<char>),

0 commit comments

Comments
 (0)