Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
Merge branch 'move-language:main' into llvm-sys
Browse files Browse the repository at this point in the history
  • Loading branch information
ksolana authored Feb 2, 2024
2 parents 7c49a43 + ea70797 commit 5acd116
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ struct Bar { x: Foo<u8> }
// ^ 错误!u8 没有 'key'
struct Baz<T> { x: Foo<T> }
// ^ 错误! t 没有 'key'
// ^ 错误! T 没有 'key'
```

```move
Expand All @@ -287,7 +287,7 @@ fun consume<T: drop>(x: T) {
fun foo() {
let r = R {};
consume<R>(r);
// ^ 错误!r 没有 'drop'
// ^ 错误!R 没有 'drop'
}
```

Expand All @@ -306,7 +306,7 @@ fun double<T: copy>(x: T) {
fun foo(): (R, R) {
let r = R {};
double<R>(r)
// ^ 错误!R 没有 'error'
// ^ 错误!R 没有 'copy'
}
```

Expand Down
2 changes: 1 addition & 1 deletion language/move-binary-format/src/file_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ pub enum Bytecode {
///
/// Stack transition:
///
/// ```..., integer_value -> ..., u8_value```
/// ```..., integer_value -> ..., u64_value```
CastU64,
/// Convert the value at the top of the stack into u128.
///
Expand Down
6 changes: 3 additions & 3 deletions language/move-stdlib/docs/string.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Creates a new string from a sequence of bytes. Aborts if the bytes do not repres

<pre><code><b>public</b> <b>fun</b> <a href="string.md#0x1_string_utf8">utf8</a>(bytes: <a href="vector.md#0x1_vector">vector</a>&lt;u8&gt;): <a href="string.md#0x1_string_String">String</a> {
<b>assert</b>!(<a href="string.md#0x1_string_internal_check_utf8">internal_check_utf8</a>(&bytes), <a href="string.md#0x1_string_EINVALID_UTF8">EINVALID_UTF8</a>);
<a href="string.md#0x1_string_String">String</a>{bytes}
<a href="string.md#0x1_string_String">String</a> { bytes }
}
</code></pre>

Expand All @@ -127,7 +127,7 @@ Tries to create a new string from a sequence of bytes.

<pre><code><b>public</b> <b>fun</b> <a href="string.md#0x1_string_try_utf8">try_utf8</a>(bytes: <a href="vector.md#0x1_vector">vector</a>&lt;u8&gt;): Option&lt;<a href="string.md#0x1_string_String">String</a>&gt; {
<b>if</b> (<a href="string.md#0x1_string_internal_check_utf8">internal_check_utf8</a>(&bytes)) {
<a href="option.md#0x1_option_some">option::some</a>(<a href="string.md#0x1_string_String">String</a>{bytes})
<a href="option.md#0x1_option_some">option::some</a>(<a href="string.md#0x1_string_String">String</a> { bytes })
} <b>else</b> {
<a href="option.md#0x1_option_none">option::none</a>()
}
Expand Down Expand Up @@ -321,7 +321,7 @@ guaranteeing that the result is valid utf8.
j &lt;= l && i &lt;= j && <a href="string.md#0x1_string_internal_is_char_boundary">internal_is_char_boundary</a>(bytes, i) && <a href="string.md#0x1_string_internal_is_char_boundary">internal_is_char_boundary</a>(bytes, j),
<a href="string.md#0x1_string_EINVALID_INDEX">EINVALID_INDEX</a>
);
<a href="string.md#0x1_string_String">String</a>{bytes: <a href="string.md#0x1_string_internal_sub_string">internal_sub_string</a>(bytes, i, j)}
<a href="string.md#0x1_string_String">String</a> { bytes: <a href="string.md#0x1_string_internal_sub_string">internal_sub_string</a>(bytes, i, j) }
}
</code></pre>

Expand Down
6 changes: 3 additions & 3 deletions language/move-stdlib/sources/string.move
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ module std::string {
/// Creates a new string from a sequence of bytes. Aborts if the bytes do not represent valid utf8.
public fun utf8(bytes: vector<u8>): String {
assert!(internal_check_utf8(&bytes), EINVALID_UTF8);
String{bytes}
String { bytes }
}

/// Tries to create a new string from a sequence of bytes.
public fun try_utf8(bytes: vector<u8>): Option<String> {
if (internal_check_utf8(&bytes)) {
option::some(String{bytes})
option::some(String { bytes })
} else {
option::none()
}
Expand Down Expand Up @@ -77,7 +77,7 @@ module std::string {
j <= l && i <= j && internal_is_char_boundary(bytes, i) && internal_is_char_boundary(bytes, j),
EINVALID_INDEX
);
String{bytes: internal_sub_string(bytes, i, j)}
String { bytes: internal_sub_string(bytes, i, j) }
}

/// Computes the index of the first occurrence of a string. Returns `length(s)` if no occurrence found.
Expand Down

0 comments on commit 5acd116

Please sign in to comment.