Merge remote-tracking branch 'origin/trunk' into rust61

This commit is contained in:
Folkert 2022-07-06 01:42:50 +02:00
commit a1de31d99e
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
131 changed files with 10929 additions and 10139 deletions

View file

@ -106,7 +106,7 @@ impl<'a> From<&'a str> for ModuleName {
}
}
impl<'a> From<IdentStr> for ModuleName {
impl From<IdentStr> for ModuleName {
fn from(string: IdentStr) -> Self {
Self(string.as_str().into())
}
@ -152,7 +152,7 @@ impl<'a> From<&'a str> for ForeignSymbol {
}
}
impl<'a> From<String> for ForeignSymbol {
impl From<String> for ForeignSymbol {
fn from(string: String) -> Self {
Self(string.into())
}
@ -174,7 +174,7 @@ impl<'a> From<&'a str> for Uppercase {
}
}
impl<'a> From<String> for Uppercase {
impl From<String> for Uppercase {
fn from(string: String) -> Self {
Self(string.into())
}
@ -198,7 +198,7 @@ impl<'a> From<&'a Lowercase> for &'a str {
}
}
impl<'a> From<String> for Lowercase {
impl From<String> for Lowercase {
fn from(string: String) -> Self {
Self(string.into())
}

View file

@ -13,6 +13,7 @@ pub enum LowLevel {
StrEndsWith,
StrSplit,
StrCountGraphemes,
StrCountUtf8Bytes,
StrFromInt,
StrFromUtf8,
StrFromUtf8Range,
@ -24,6 +25,11 @@ pub enum LowLevel {
StrTrimRight,
StrToNum,
StrToScalars,
StrGetUnsafe,
StrSubstringUnsafe,
StrReserve,
StrAppendScalar,
StrGetScalarUnsafe,
ListLen,
ListWithCapacity,
ListGetUnsafe,
@ -35,7 +41,6 @@ pub enum LowLevel {
ListMap2,
ListMap3,
ListMap4,
ListMapWithIndex,
ListSortWith,
ListSublist,
ListDropAt,
@ -120,7 +125,7 @@ pub enum LowLevel {
macro_rules! higher_order {
() => {
ListMap | ListMap2 | ListMap3 | ListMap4 | ListMapWithIndex | ListSortWith | DictWalk
ListMap | ListMap2 | ListMap3 | ListMap4 | ListSortWith | DictWalk
};
}
@ -141,7 +146,6 @@ impl LowLevel {
ListMap2 => 2,
ListMap3 => 3,
ListMap4 => 4,
ListMapWithIndex => 1,
ListSortWith => 1,
DictWalk => 2,
_ => unreachable!(),
@ -167,6 +171,7 @@ impl LowLevelWrapperType {
match symbol {
Symbol::STR_CONCAT => CanBeReplacedBy(StrConcat),
Symbol::STR_GET_UNSAFE => CanBeReplacedBy(StrGetUnsafe),
Symbol::STR_TO_SCALARS => CanBeReplacedBy(StrToScalars),
Symbol::STR_JOIN_WITH => CanBeReplacedBy(StrJoinWith),
Symbol::STR_IS_EMPTY => CanBeReplacedBy(StrIsEmpty),
@ -175,10 +180,13 @@ impl LowLevelWrapperType {
Symbol::STR_ENDS_WITH => CanBeReplacedBy(StrEndsWith),
Symbol::STR_SPLIT => CanBeReplacedBy(StrSplit),
Symbol::STR_COUNT_GRAPHEMES => CanBeReplacedBy(StrCountGraphemes),
Symbol::STR_COUNT_UTF8_BYTES => CanBeReplacedBy(StrCountUtf8Bytes),
Symbol::STR_FROM_UTF8 => WrapperIsRequired,
Symbol::STR_FROM_UTF8_RANGE => WrapperIsRequired,
Symbol::STR_TO_UTF8 => CanBeReplacedBy(StrToUtf8),
Symbol::STR_REPEAT => CanBeReplacedBy(StrRepeat),
Symbol::STR_RESERVE => CanBeReplacedBy(StrReserve),
Symbol::STR_APPEND_SCALAR_UNSAFE => CanBeReplacedBy(StrAppendScalar),
Symbol::STR_TRIM => CanBeReplacedBy(StrTrim),
Symbol::STR_TRIM_LEFT => CanBeReplacedBy(StrTrimLeft),
Symbol::STR_TRIM_RIGHT => CanBeReplacedBy(StrTrimRight),
@ -206,7 +214,6 @@ impl LowLevelWrapperType {
Symbol::LIST_MAP2 => WrapperIsRequired,
Symbol::LIST_MAP3 => WrapperIsRequired,
Symbol::LIST_MAP4 => WrapperIsRequired,
Symbol::LIST_MAP_WITH_INDEX => WrapperIsRequired,
Symbol::LIST_SORT_WITH => WrapperIsRequired,
Symbol::LIST_SUBLIST => WrapperIsRequired,
Symbol::LIST_DROP_AT => CanBeReplacedBy(ListDropAt),

View file

@ -182,7 +182,10 @@ impl fmt::Debug for Symbol {
// might be used in a panic error message, and if we panick
// while we're already panicking it'll kill the process
// without printing any of the errors!
eprintln!("DEBUG INFO: Failed to acquire lock for Debug reading from DEBUG_IDENT_IDS_BY_MODULE_ID, presumably because a thread panicked: {:?}", err);
use std::io::Write;
let mut stderr = std::io::stderr();
writeln!(stderr, "DEBUG INFO: Failed to acquire lock for Debug reading from DEBUG_IDENT_IDS_BY_MODULE_ID, presumably because a thread panicked: {:?}", err).unwrap();
fallback_debug_fmt(*self, f)
}
@ -1191,6 +1194,18 @@ define_builtins! {
32 STR_TO_U8: "toU8"
33 STR_TO_I8: "toI8"
34 STR_TO_SCALARS: "toScalars"
35 STR_GET_UNSAFE: "getUnsafe"
36 STR_COUNT_UTF8_BYTES: "countUtf8Bytes"
37 STR_SUBSTRING_UNSAFE: "substringUnsafe"
38 STR_SPLIT_FIRST: "splitFirst"
39 STR_SPLIT_LAST: "splitLast"
40 STR_WALK_UTF8_WITH_INDEX: "walkUtf8WithIndex"
41 STR_RESERVE: "reserve"
42 STR_APPEND_SCALAR_UNSAFE: "appendScalarUnsafe"
43 STR_APPEND_SCALAR: "appendScalar"
44 STR_GET_SCALAR_UNSAFE: "getScalarUnsafe"
45 STR_WALK_SCALARS: "walkScalars"
46 STR_WALK_SCALARS_UNTIL: "walkScalarsUntil"
}
5 LIST: "List" => {
0 LIST_LIST: "List" imported // the List.List type alias