You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: active/0000-statically-sized-literals.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -62,26 +62,26 @@ In the future, after gaining the ability to parameterize on integers, strings of
62
62
```
63
63
struct __StrImpl<Sized? T>(T); // private
64
64
65
-
pub type str = StrImpl<[u8]>; // unsized referent of string slice `&str`, public
65
+
pub type str = __StrImpl<[u8]>; // unsized referent of string slice `&str`, public
66
66
pub type FixedString<const N: uint> = __StrImpl<[u8, ..N]>; // string of fixed size, public
67
67
68
68
// &FixedString<N> -> &str : OK, including &'static FixedString<N> -> &'static str for string literals
69
69
```
70
-
So, we don't propose to make these changes today and sugget to wait until parameterizing on integers is added to the language.
70
+
So, we don't propose to make these changes today and suggest to wait until generic parameterization on integers is added to the language.
71
71
72
72
### Precedents
73
73
74
-
C and C++ string literals are lvalue `char` arrays of fixed size with static duration.
74
+
C and C++ string literals are lvalue `char` arrays of fixed size with static duration.
75
75
C++ library proposal for strings of fixed size ([link][1]), the paper also contains some discussion and motivation.
76
76
77
77
# Rejected alternatives and discussion
78
78
79
79
## Array literals
80
80
81
-
The types of array literals potentially can be changed from `[T, ..N]` to `&'a [T, ..N]` for consistency with the other literals and ergonomics.
81
+
The types of array literals potentially can be changed from `[T, ..N]` to `&'a [T, ..N]` for consistency with the other literals and ergonomics.
82
82
The major blocker for this change is the inability to move out from a dereferenced array literal if `T` is not `Copy`.
83
83
```
84
-
let mut a = *[box 1i, box 2, box 3]; // Wouldn't work without special-casing of string literal with regard to moving out from dereferenced borrowed pointer
84
+
let mut a = *[box 1i, box 2, box 3]; // Wouldn't work without special-casing of array literals with regard to moving out from dereferenced borrowed pointer
85
85
```
86
86
Despite that array literals as references have better usability, possible `static`ness and consistency with other literals.
0 commit comments