mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
Merge branch 'trunk' into ir-cleanup
This commit is contained in:
commit
3f76c6314c
16 changed files with 117 additions and 109 deletions
|
@ -90,9 +90,9 @@ pub enum OptLevel {
|
|||
Optimize,
|
||||
}
|
||||
|
||||
impl Into<OptimizationLevel> for OptLevel {
|
||||
fn into(self) -> OptimizationLevel {
|
||||
match self {
|
||||
impl From<OptLevel> for OptimizationLevel {
|
||||
fn from(level: OptLevel) -> Self {
|
||||
match level {
|
||||
OptLevel::Normal => OptimizationLevel::None,
|
||||
OptLevel::Optimize => OptimizationLevel::Aggressive,
|
||||
}
|
||||
|
|
|
@ -8,9 +8,9 @@ pub enum RocCallResult<T> {
|
|||
Failure(*mut c_char),
|
||||
}
|
||||
|
||||
impl<T: Sized> Into<Result<T, String>> for RocCallResult<T> {
|
||||
fn into(self) -> Result<T, String> {
|
||||
match self {
|
||||
impl<T: Sized> From<RocCallResult<T>> for Result<T, String> {
|
||||
fn from(call_result: RocCallResult<T>) -> Self {
|
||||
match call_result {
|
||||
Success(value) => Ok(value),
|
||||
Failure(failure) => Err({
|
||||
let raw = unsafe { CString::from_raw(failure) };
|
||||
|
|
|
@ -12,8 +12,6 @@ mod helpers;
|
|||
|
||||
#[cfg(all(test, target_os = "linux", any(target_arch = "x86_64"/*, target_arch = "aarch64"*/)))]
|
||||
mod gen_num {
|
||||
//use roc_std::RocOrder;
|
||||
|
||||
#[test]
|
||||
fn i64_values() {
|
||||
assert_evals_to!("0", 0, i64);
|
||||
|
|
|
@ -5,6 +5,7 @@ use roc_can::builtins::builtin_defs_map;
|
|||
use roc_collections::all::MutMap;
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn promote_expr_to_module(src: &str) -> String {
|
||||
let mut buffer = String::from("app \"test\" provides [ main ] to \"./platform\"\n\nmain =\n");
|
||||
|
||||
|
@ -18,6 +19,7 @@ fn promote_expr_to_module(src: &str) -> String {
|
|||
buffer
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn helper<'a>(
|
||||
arena: &'a bumpalo::Bump,
|
||||
src: &str,
|
||||
|
|
|
@ -4143,7 +4143,7 @@ where
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn to_file_problem_report(filename: &PathBuf, error: io::ErrorKind) -> String {
|
||||
fn to_file_problem_report(filename: &Path, error: io::ErrorKind) -> String {
|
||||
use roc_reporting::report::{Report, RocDocAllocator, DEFAULT_PALETTE};
|
||||
use ven_pretty::DocAllocator;
|
||||
|
||||
|
|
|
@ -117,21 +117,21 @@ impl From<InlinableString> for ModuleName {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<InlinableString> for ModuleName {
|
||||
fn into(self) -> InlinableString {
|
||||
self.0
|
||||
impl From<ModuleName> for InlinableString {
|
||||
fn from(name: ModuleName) -> Self {
|
||||
name.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<&'a InlinableString> for &'a ModuleName {
|
||||
fn into(self) -> &'a InlinableString {
|
||||
&self.0
|
||||
impl<'a> From<&'a ModuleName> for &'a InlinableString {
|
||||
fn from(name: &'a ModuleName) -> Self {
|
||||
&name.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<Box<str>> for ModuleName {
|
||||
fn into(self) -> Box<str> {
|
||||
self.0.to_string().into()
|
||||
impl From<ModuleName> for Box<str> {
|
||||
fn from(name: ModuleName) -> Self {
|
||||
name.0.to_string().into()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,9 +197,9 @@ impl<'a> From<String> for Lowercase {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<InlinableString> for Lowercase {
|
||||
fn into(self) -> InlinableString {
|
||||
self.0
|
||||
impl From<Lowercase> for InlinableString {
|
||||
fn from(lowercase: Lowercase) -> Self {
|
||||
lowercase.0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,21 +234,21 @@ impl From<InlinableString> for Ident {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<InlinableString> for Ident {
|
||||
fn into(self) -> InlinableString {
|
||||
self.0
|
||||
impl From<Ident> for InlinableString {
|
||||
fn from(ident: Ident) -> Self {
|
||||
ident.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<&'a InlinableString> for &'a Ident {
|
||||
fn into(self) -> &'a InlinableString {
|
||||
&self.0
|
||||
impl<'a> From<&'a Ident> for &'a InlinableString {
|
||||
fn from(ident: &'a Ident) -> Self {
|
||||
&ident.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<Box<str>> for Ident {
|
||||
fn into(self) -> Box<str> {
|
||||
self.0.to_string().into()
|
||||
impl From<Ident> for Box<str> {
|
||||
fn from(ident: Ident) -> Self {
|
||||
ident.0.to_string().into()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![warn(clippy::all, clippy::dbg_macro)]
|
||||
// See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check.
|
||||
#![allow(clippy::large_enum_variant)]
|
||||
#![allow(clippy::large_enum_variant, clippy::upper_case_acronyms)]
|
||||
|
||||
pub mod ident;
|
||||
pub mod low_level;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![warn(clippy::all, clippy::dbg_macro)]
|
||||
// See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check.
|
||||
#![allow(clippy::large_enum_variant)]
|
||||
#![allow(clippy::large_enum_variant, clippy::upper_case_acronyms)]
|
||||
|
||||
pub mod borrow;
|
||||
pub mod expand_rc;
|
||||
|
|
|
@ -42,15 +42,15 @@ pub enum PackageOrPath<'a> {
|
|||
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
||||
pub struct ModuleName<'a>(&'a str);
|
||||
|
||||
impl<'a> Into<&'a str> for ModuleName<'a> {
|
||||
fn into(self) -> &'a str {
|
||||
self.0
|
||||
impl<'a> From<ModuleName<'a>> for &'a str {
|
||||
fn from(name: ModuleName<'a>) -> Self {
|
||||
name.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<InlinableString> for ModuleName<'a> {
|
||||
fn into(self) -> InlinableString {
|
||||
self.0.into()
|
||||
impl<'a> From<ModuleName<'a>> for InlinableString {
|
||||
fn from(name: ModuleName<'a>) -> InlinableString {
|
||||
name.0.into()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ pub enum SyntaxError<'a> {
|
|||
ReservedKeyword(Region),
|
||||
ArgumentsBeforeEquals(Region),
|
||||
NotYetImplemented(String),
|
||||
TODO,
|
||||
Todo,
|
||||
Type(Type<'a>),
|
||||
Pattern(EPattern<'a>),
|
||||
Expr(EExpr<'a>),
|
||||
|
|
|
@ -93,9 +93,9 @@ impl VarStore {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<Variable> for VarStore {
|
||||
fn into(self) -> Variable {
|
||||
Variable(self.next)
|
||||
impl From<VarStore> for Variable {
|
||||
fn from(store: VarStore) -> Self {
|
||||
Variable(store.next)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,9 +139,9 @@ impl fmt::Debug for OptVariable {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<Option<Variable>> for OptVariable {
|
||||
fn into(self) -> Option<Variable> {
|
||||
self.into_variable()
|
||||
impl From<OptVariable> for Option<Variable> {
|
||||
fn from(opt_var: OptVariable) -> Self {
|
||||
opt_var.into_variable()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,9 +180,9 @@ impl Variable {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<OptVariable> for Variable {
|
||||
fn into(self) -> OptVariable {
|
||||
OptVariable(self.0)
|
||||
impl From<Variable> for OptVariable {
|
||||
fn from(var: Variable) -> Self {
|
||||
OptVariable(var.0)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -483,9 +483,9 @@ impl fmt::Debug for Rank {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<usize> for Rank {
|
||||
fn into(self) -> usize {
|
||||
self.0
|
||||
impl From<Rank> for usize {
|
||||
fn from(rank: Rank) -> Self {
|
||||
rank.0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue