Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into linux64
Browse files Browse the repository at this point in the history
  • Loading branch information
rtfeldman committed Jul 11, 2023
2 parents bdb93fd + 19fc777 commit 1d5c5b2
Show file tree
Hide file tree
Showing 328 changed files with 11,823 additions and 9,222 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/windows_release_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
- name: zig version
run: zig version

- name: install rust nightly 1.66
run: rustup install nightly-2022-10-30
- name: install rust nightly 1.67
run: rustup install nightly-2022-12-09

- name: set up llvm 13
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 @@ -36,8 +36,8 @@ jobs:
- name: zig version
run: zig version

- name: install rust nightly 1.66
run: rustup install nightly-2022-10-30
- name: install rust nightly 1.67
run: rustup install nightly-2022-12-09

- name: set up llvm 13
run: |
Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ Roc is not ready for a 0.1 release yet, but we do have:

- [**installation** guide](https://github.com/roc-lang/roc/tree/main/getting_started)
- [**tutorial**](https://roc-lang.org/tutorial)
- [**docs** for the standard library](https://www.roc-lang.org/builtins/Str)
- [**docs** for the standard library](https://www.roc-lang.org/builtins)
- [**examples**](https://github.com/roc-lang/examples/tree/main/examples)
- [frequently asked questions](https://github.com/roc-lang/roc/blob/main/FAQ.md)
- [Group chat](https://roc.zulipchat.com) for help, questions and discussions
- [**faq**: frequently asked questions](https://github.com/roc-lang/roc/blob/main/FAQ.md)
- [**group chat**](https://roc.zulipchat.com) for help, questions and discussions

If you'd like to contribute, check out [good first issues](https://github.com/roc-lang/roc/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22). Don't hesitate to ask for help on our [group chat](https://roc.zulipchat.com), we're friendly!

## Sponsors

We are very grateful for our corporate sponsors [Vendr](https://www.vendr.com/), [RWX](https://www.rwx.com), and [Tweede golf](https://tweedegolf.nl/en).
You can 💜 **sponsor** 💜 Roc on:
- [GitHub](https://github.com/sponsors/roc-lang)
- [Liberapay](https://liberapay.com/roc_lang)

We are very grateful for our corporate sponsors [Vendr](https://www.vendr.com/), [RWX](https://www.rwx.com), and [Tweede golf](https://tweedegolf.nl/en):

[<img src="https://user-images.githubusercontent.com/1094080/223597445-81755626-a080-4299-a38c-3c92e7548489.png" height="60" alt="Vendr logo"/>](https://www.vendr.com)
&nbsp;&nbsp;&nbsp;&nbsp;
Expand Down
4 changes: 2 additions & 2 deletions crates/ast/src/ast_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ impl From<ModuleError> for ASTError {
impl From<(Region, Loc<Ident>)> for ASTError {
fn from(ident_exists_err: (Region, Loc<Ident>)) -> Self {
Self::IdentExistsError {
msg: format!("{:?}", ident_exists_err),
msg: format!("{ident_exists_err:?}"),
}
}
}

impl<'a> From<SyntaxError<'a>> for ASTError {
fn from(syntax_err: SyntaxError) -> Self {
Self::SyntaxErrorNoBacktrace {
msg: format!("{:?}", syntax_err),
msg: format!("{syntax_err:?}"),
}
}
}
3 changes: 1 addition & 2 deletions crates/ast/src/builtin_aliases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ pub fn aliases() -> MutMap<Symbol, BuiltinAlias> {
let mut add_alias = |symbol, alias| {
debug_assert!(
!aliases.contains_key(&symbol),
"Duplicate alias definition for {:?}",
symbol
"Duplicate alias definition for {symbol:?}"
);

// TODO instead of using Region::zero for all of these,
Expand Down
2 changes: 1 addition & 1 deletion crates/ast/src/constrain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2065,7 +2065,7 @@ pub mod test_constrain {

assert_eq!(actual_str, expected_str);
}
Err(e) => panic!("syntax error {:?}", e),
Err(e) => panic!("syntax error {e:?}"),
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/ast/src/lang/core/expr/expr2_to_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ fn expr2_to_string_helper(
);
}
Expr2::Call { .. } => {
let _ = write!(out_string, "Call({:?})", expr2);
let _ = write!(out_string, "Call({expr2:?})");
}
Expr2::Closure { args, .. } => {
out_string.push_str("Closure:\n");
Expand All @@ -148,7 +148,7 @@ fn expr2_to_string_helper(
}
}
&Expr2::Var { .. } => {
let _ = write!(out_string, "{:?}", expr2);
let _ = write!(out_string, "{expr2:?}");
}
Expr2::RuntimeError { .. } => {
out_string.push_str("RuntimeError\n");
Expand Down
24 changes: 6 additions & 18 deletions crates/ast/src/lang/core/expr/expr_to_expr2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,37 +665,25 @@ pub fn expr_to_expr2<'a>(
ident,
} => canonicalize_lookup(env, scope, module_name, ident, region),

ParensAround(sub_expr) => expr_to_expr2(env, scope, sub_expr, region),

// Below this point, we shouln't see any of these nodes anymore because
// operator desugaring should have removed them!
bad_expr @ ParensAround(_) => {
panic!(
"A ParensAround did not get removed during operator desugaring somehow: {:#?}",
bad_expr
);
}
bad_expr @ SpaceBefore(_, _) => {
panic!(
"A SpaceBefore did not get removed during operator desugaring somehow: {:#?}",
bad_expr
"A SpaceBefore did not get removed during operator desugaring somehow: {bad_expr:#?}"
);
}
bad_expr @ SpaceAfter(_, _) => {
panic!(
"A SpaceAfter did not get removed during operator desugaring somehow: {:#?}",
bad_expr
"A SpaceAfter did not get removed during operator desugaring somehow: {bad_expr:#?}"
);
}
bad_expr @ BinOps { .. } => {
panic!(
"A binary operator chain did not get desugared somehow: {:#?}",
bad_expr
);
panic!("A binary operator chain did not get desugared somehow: {bad_expr:#?}");
}
bad_expr @ UnaryOp(_, _) => {
panic!(
"A unary operator did not get desugared somehow: {:#?}",
bad_expr
);
panic!("A unary operator did not get desugared somehow: {bad_expr:#?}");
}

rest => todo!("not yet implemented {:?}", rest),
Expand Down
2 changes: 1 addition & 1 deletion crates/ast/src/lang/core/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ pub fn update_str_expr(
Expr2::Str(old_pool_str) => Either::OldPoolStr(*old_pool_str),
other => UnexpectedASTNodeSnafu {
required_node_type: "SmallStr or Str",
encountered_node_type: format!("{:?}", other),
encountered_node_type: format!("{other:?}"),
}
.fail()?,
};
Expand Down
3 changes: 1 addition & 2 deletions crates/ast/src/lang/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ impl<'a> Env<'a> {
) -> Result<Symbol, RuntimeError> {
debug_assert!(
!module_name.is_empty(),
"Called env.qualified_lookup with an unqualified ident: {:?}",
ident
"Called env.qualified_lookup with an unqualified ident: {ident:?}"
);

let module_name: ModuleName = module_name.into();
Expand Down
10 changes: 2 additions & 8 deletions crates/ast/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,8 @@ pub fn load_module(
match loaded {
Ok(x) => x,
Err(roc_load::LoadingProblem::FormattedReport(report)) => {
panic!(
"Failed to load module from src_file: {:?}. Report: {}",
src_file, report
);
panic!("Failed to load module from src_file: {src_file:?}. Report: {report}");
}
Err(e) => panic!(
"Failed to load module from src_file {:?}: {:?}",
src_file, e
),
Err(e) => panic!("Failed to load module from src_file {src_file:?}: {e:?}"),
}
}
5 changes: 4 additions & 1 deletion crates/ast/src/solve_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,10 @@ fn solve<'a>(
let result = offenders.len();

if result > 0 {
dbg!(&subs, &offenders, &let_con.def_types);
eprintln!(
"subs: {:?}\n\noffenders: {:?}\n\nlet_con.def_types: {:?}\n",
&subs, &offenders, &let_con.def_types
);
}

result
Expand Down
6 changes: 3 additions & 3 deletions crates/cli/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,18 @@ pub fn format(files: std::vec::Vec<PathBuf>, mode: FormatMode) -> Result<(), Str
// the PartialEq implementation is returning `false` even when the Debug-formatted impl is exactly the same.
// I don't have the patience to debug this right now, so let's leave it for another day...
// TODO: fix PartialEq impl on ast types
if format!("{:?}", ast_normalized) != format!("{:?}", reparsed_ast_normalized) {
if format!("{ast_normalized:?}") != format!("{reparsed_ast_normalized:?}") {
let mut fail_file = file.clone();
fail_file.set_extension("roc-format-failed");
std::fs::write(&fail_file, buf.as_str()).unwrap();

let mut before_file = file.clone();
before_file.set_extension("roc-format-failed-ast-before");
std::fs::write(&before_file, format!("{:#?}\n", ast_normalized)).unwrap();
std::fs::write(&before_file, format!("{ast_normalized:#?}\n")).unwrap();

let mut after_file = file.clone();
after_file.set_extension("roc-format-failed-ast-after");
std::fs::write(&after_file, format!("{:#?}\n", reparsed_ast_normalized)).unwrap();
std::fs::write(&after_file, format!("{reparsed_ast_normalized:#?}\n")).unwrap();

internal_error!(
"Formatting bug; formatting didn't reparse as the same tree\n\n\
Expand Down
18 changes: 6 additions & 12 deletions crates/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,10 @@ pub fn test(matches: &ArgMatches, triple: Triple) -> io::Result<i32> {
match matches.value_source(ROC_FILE) {
Some(ValueSource::DefaultValue) => {
eprintln!(
"\nThe current directory ({}) does not contain a {} file to use as a default.\n\nYou can run `roc help` for more information on how to provide a .roc file.\n",
current_dir_string,
DEFAULT_ROC_FILENAME
"\nThe current directory ({current_dir_string}) does not contain a {DEFAULT_ROC_FILENAME} file to use as a default.\n\nYou can run `roc help` for more information on how to provide a .roc file.\n"
)
}
_ => eprintln!("\nThis file was not found: {}\n\nYou can run `roc help` for more information on how to provide a .roc file.\n", expected_file_path_string),
_ => eprintln!("\nThis file was not found: {expected_file_path_string}\n\nYou can run `roc help` for more information on how to provide a .roc file.\n"),
}

process::exit(1);
Expand Down Expand Up @@ -563,16 +561,13 @@ pub fn build(
match matches.value_source(ROC_FILE) {
Some(ValueSource::DefaultValue) => {
eprintln!(
"\nThe current directory ({}) does not contain a {} file to use as a default.\n\nYou can run `roc help` for more information on how to provide a .roc file.\n",
current_dir_string,
DEFAULT_ROC_FILENAME
"\nThe current directory ({current_dir_string}) does not contain a {DEFAULT_ROC_FILENAME} file to use as a default.\n\nYou can run `roc help` for more information on how to provide a .roc file.\n"
)
}
_ => {
let mut error_lines = Vec::new();
error_lines.push(format!(
"This file was not found: {}",
expected_file_path_string
"This file was not found: {expected_file_path_string}"
));
// Add some additional hints if run as `roc [FILENAME]`.
if matches.subcommand().is_none() {
Expand All @@ -582,8 +577,7 @@ pub fn build(
nearest_match(possible_typo, subcommands)
{
error_lines.push(format!(
"Did you mean to use the {} subcommand?",
nearest_command
"Did you mean to use the {nearest_command} subcommand?"
));
}
}
Expand Down Expand Up @@ -1142,7 +1136,7 @@ fn roc_run_executable_file_path(binary_bytes: &[u8]) -> std::io::Result<Executab
);
}

let path = PathBuf::from(format!("/proc/self/fd/{}", fd));
let path = PathBuf::from(format!("/proc/self/fd/{fd}"));

std::fs::write(&path, binary_bytes)?;

Expand Down
6 changes: 3 additions & 3 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ fn main() -> io::Result<()> {
}

Err(LoadingProblem::FormattedReport(report)) => {
print!("{}", report);
print!("{report}");

Ok(1)
}
Err(other) => {
panic!("build_file failed with error:\n{:?}", other);
panic!("build_file failed with error:\n{other:?}");
}
}
}
Expand Down Expand Up @@ -273,7 +273,7 @@ fn main() -> io::Result<()> {
let format_exit_code = match format(roc_files, format_mode) {
Ok(_) => 0,
Err(message) => {
eprintln!("{}", message);
eprintln!("{message}");
1
}
};
Expand Down
22 changes: 9 additions & 13 deletions crates/cli/tests/cli_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ mod cli_run {

// e.g. "1 error and 0 warnings found in 123 ms."
let (before_first_digit, _) = err.split_at(err.rfind("found in ").unwrap());
let err = format!("{}found in <ignored for test> ms.", before_first_digit);
let err = format!("{before_first_digit}found in <ignored for test> ms.");

// make paths consistent
let err = err.replace('\\', "/");
Expand Down Expand Up @@ -230,22 +230,22 @@ mod cli_run {
what: _,
xwhat,
} = error;
println!("Valgrind Error: {}\n", kind);
println!("Valgrind Error: {kind}\n");

if let Some(ValgrindErrorXWhat {
text,
leakedbytes: _,
leakedblocks: _,
}) = xwhat
{
println!(" {}", text);
println!(" {text}");
}
}
panic!("Valgrind reported memory errors");
}
} else {
let exit_code = match valgrind_out.status.code() {
Some(code) => format!("exit code {}", code),
Some(code) => format!("exit code {code}"),
None => "no exit code".to_string(),
};

Expand Down Expand Up @@ -301,7 +301,7 @@ mod cli_run {
// e.g. "1 failed and 0 passed in 123 ms."
if let Some(split) = actual.rfind("passed in ") {
let (before_first_digit, _) = actual.split_at(split);
actual = format!("{}passed in <ignored for test> ms.", before_first_digit);
actual = format!("{before_first_digit}passed in <ignored for test> ms.");
}

let self_path = file.display().to_string();
Expand Down Expand Up @@ -397,8 +397,7 @@ mod cli_run {
"swiftui" | "rocLovesSwift" => {
if cfg!(not(target_os = "macos")) {
eprintln!(
"WARNING: skipping testing example {} because it only works on MacOS.",
roc_filename
"WARNING: skipping testing example {roc_filename} because it only works on MacOS."
);
return;
} else {
Expand All @@ -409,8 +408,7 @@ mod cli_run {
"rocLovesWebAssembly" => {
// this is a web assembly example, but we don't test with JS at the moment
eprintln!(
"WARNING: skipping testing example {} because it only works in a browser!",
roc_filename
"WARNING: skipping testing example {roc_filename} because it only works in a browser!"
);
return;
}
Expand Down Expand Up @@ -965,16 +963,14 @@ mod cli_run {
match roc_filename {
"QuicksortApp.roc" => {
eprintln!(
"WARNING: skipping testing benchmark {} because the test is broken right now!",
roc_filename
"WARNING: skipping testing benchmark {roc_filename} because the test is broken right now!"
);
return;
}
"TestAStar.roc" => {
if cfg!(feature = "wasm32-cli-run") {
eprintln!(
"WARNING: skipping testing benchmark {} because it currently does not work on wasm32 due to dictionaries.",
roc_filename
"WARNING: skipping testing benchmark {roc_filename} because it currently does not work on wasm32 due to dictionaries."
);
return;
}
Expand Down
Loading

0 comments on commit 1d5c5b2

Please sign in to comment.