@@ -160,7 +160,7 @@ pub enum CompileConstant {
160
160
Boolean ( bool ) ,
161
161
Number ( crate :: Number ) ,
162
162
Vector ( crate :: Vector ) ,
163
- String ( String ) ,
163
+ String ( StdString ) ,
164
164
}
165
165
166
166
#[ cfg( any( feature = "luau" , doc) ) ]
@@ -192,7 +192,7 @@ impl From<&str> for CompileConstant {
192
192
}
193
193
194
194
#[ cfg( any( feature = "luau" , doc) ) ]
195
- type LibraryMemberConstantMap = HashMap < ( String , String ) , CompileConstant > ;
195
+ type LibraryMemberConstantMap = HashMap < ( StdString , StdString ) , CompileConstant > ;
196
196
197
197
/// Luau compiler
198
198
#[ cfg( any( feature = "luau" , doc) ) ]
@@ -203,14 +203,14 @@ pub struct Compiler {
203
203
debug_level : u8 ,
204
204
type_info_level : u8 ,
205
205
coverage_level : u8 ,
206
- vector_lib : Option < String > ,
207
- vector_ctor : Option < String > ,
208
- vector_type : Option < String > ,
209
- mutable_globals : Vec < String > ,
210
- userdata_types : Vec < String > ,
211
- libraries_with_known_members : Vec < String > ,
206
+ vector_lib : Option < StdString > ,
207
+ vector_ctor : Option < StdString > ,
208
+ vector_type : Option < StdString > ,
209
+ mutable_globals : Vec < StdString > ,
210
+ userdata_types : Vec < StdString > ,
211
+ libraries_with_known_members : Vec < StdString > ,
212
212
library_constants : Option < LibraryMemberConstantMap > ,
213
- disabled_builtins : Vec < String > ,
213
+ disabled_builtins : Vec < StdString > ,
214
214
}
215
215
216
216
#[ cfg( any( feature = "luau" , doc) ) ]
@@ -290,21 +290,21 @@ impl Compiler {
290
290
291
291
#[ doc( hidden) ]
292
292
#[ must_use]
293
- pub fn set_vector_lib ( mut self , lib : impl Into < String > ) -> Self {
293
+ pub fn set_vector_lib ( mut self , lib : impl Into < StdString > ) -> Self {
294
294
self . vector_lib = Some ( lib. into ( ) ) ;
295
295
self
296
296
}
297
297
298
298
#[ doc( hidden) ]
299
299
#[ must_use]
300
- pub fn set_vector_ctor ( mut self , ctor : impl Into < String > ) -> Self {
300
+ pub fn set_vector_ctor ( mut self , ctor : impl Into < StdString > ) -> Self {
301
301
self . vector_ctor = Some ( ctor. into ( ) ) ;
302
302
self
303
303
}
304
304
305
305
#[ doc( hidden) ]
306
306
#[ must_use]
307
- pub fn set_vector_type ( mut self , r#type : impl Into < String > ) -> Self {
307
+ pub fn set_vector_type ( mut self , r#type : impl Into < StdString > ) -> Self {
308
308
self . vector_type = Some ( r#type. into ( ) ) ;
309
309
self
310
310
}
@@ -484,7 +484,7 @@ impl Compiler {
484
484
if bytecode. first ( ) == Some ( & 0 ) {
485
485
// The rest of the bytecode is the error message starting with `:`
486
486
// See https://github.com/luau-lang/luau/blob/0.640/Compiler/src/Compiler.cpp#L4336
487
- let message = String :: from_utf8_lossy ( & bytecode[ 2 ..] ) . to_string ( ) ;
487
+ let message = StdString :: from_utf8_lossy ( & bytecode[ 2 ..] ) . into_owned ( ) ;
488
488
return Err ( Error :: SyntaxError {
489
489
incomplete_input : message. ends_with ( "<eof>" ) ,
490
490
message,
@@ -507,7 +507,7 @@ impl Chunk<'_> {
507
507
/// - `@` - file path (when truncation is needed, the end of the file path is kept, as this is
508
508
/// more useful for identifying the file)
509
509
/// - `=` - custom chunk name (when truncation is needed, the beginning of the name is kept)
510
- pub fn set_name ( mut self , name : impl Into < String > ) -> Self {
510
+ pub fn set_name ( mut self , name : impl Into < StdString > ) -> Self {
511
511
self . name = name. into ( ) ;
512
512
self
513
513
}
@@ -755,7 +755,7 @@ impl Chunk<'_> {
755
755
ChunkMode :: Text
756
756
}
757
757
758
- fn convert_name ( name : String ) -> Result < CString > {
758
+ fn convert_name ( name : StdString ) -> Result < CString > {
759
759
CString :: new ( name) . map_err ( |err| Error :: runtime ( format ! ( "invalid name: {err}" ) ) )
760
760
}
761
761
0 commit comments