@@ -4,7 +4,6 @@ use std::ffi::CString;
44use std:: io:: Result as IoResult ;
55use std:: panic:: Location ;
66use std:: path:: { Path , PathBuf } ;
7- use std:: string:: String as StdString ;
87
98use crate :: error:: { Error , Result } ;
109use crate :: function:: Function ;
@@ -20,7 +19,7 @@ pub trait AsChunk {
2019 /// Returns optional chunk name
2120 ///
2221 /// See [`Chunk::set_name`] for possible name prefixes.
23- fn name ( & self ) -> Option < StdString > {
22+ fn name ( & self ) -> Option < String > {
2423 None
2524 }
2625
@@ -52,13 +51,13 @@ impl AsChunk for &str {
5251 }
5352}
5453
55- impl AsChunk for StdString {
54+ impl AsChunk for String {
5655 fn source < ' a > ( & self ) -> IoResult < Cow < ' a , [ u8 ] > > {
5756 Ok ( Cow :: Owned ( self . clone ( ) . into_bytes ( ) ) )
5857 }
5958}
6059
61- impl AsChunk for & StdString {
60+ impl AsChunk for & String {
6261 fn source < ' a > ( & self ) -> IoResult < Cow < ' a , [ u8 ] > >
6362 where
6463 Self : ' a ,
@@ -92,7 +91,7 @@ impl AsChunk for &Vec<u8> {
9291}
9392
9493impl AsChunk for & Path {
95- fn name ( & self ) -> Option < StdString > {
94+ fn name ( & self ) -> Option < String > {
9695 Some ( format ! ( "@{}" , self . display( ) ) )
9796 }
9897
@@ -102,7 +101,7 @@ impl AsChunk for &Path {
102101}
103102
104103impl AsChunk for PathBuf {
105- fn name ( & self ) -> Option < StdString > {
104+ fn name ( & self ) -> Option < String > {
106105 Some ( format ! ( "@{}" , self . display( ) ) )
107106 }
108107
@@ -112,7 +111,7 @@ impl AsChunk for PathBuf {
112111}
113112
114113impl < C : AsChunk + ?Sized > AsChunk for Box < C > {
115- fn name ( & self ) -> Option < StdString > {
114+ fn name ( & self ) -> Option < String > {
116115 ( * * self ) . name ( )
117116 }
118117
@@ -136,7 +135,7 @@ impl<C: AsChunk + ?Sized> AsChunk for Box<C> {
136135#[ must_use = "`Chunk`s do nothing unless one of `exec`, `eval`, `call`, or `into_function` are called on them" ]
137136pub struct Chunk < ' a > {
138137 pub ( crate ) lua : WeakLua ,
139- pub ( crate ) name : StdString ,
138+ pub ( crate ) name : String ,
140139 pub ( crate ) env : Result < Option < Table > > ,
141140 pub ( crate ) mode : Option < ChunkMode > ,
142141 pub ( crate ) source : IoResult < Cow < ' a , [ u8 ] > > ,
@@ -160,7 +159,7 @@ pub enum CompileConstant {
160159 Boolean ( bool ) ,
161160 Number ( crate :: Number ) ,
162161 Vector ( crate :: Vector ) ,
163- String ( StdString ) ,
162+ String ( String ) ,
164163}
165164
166165#[ cfg( any( feature = "luau" , doc) ) ]
@@ -192,7 +191,7 @@ impl From<&str> for CompileConstant {
192191}
193192
194193#[ cfg( any( feature = "luau" , doc) ) ]
195- type LibraryMemberConstantMap = HashMap < ( StdString , StdString ) , CompileConstant > ;
194+ type LibraryMemberConstantMap = HashMap < ( String , String ) , CompileConstant > ;
196195
197196/// Luau compiler
198197#[ cfg( any( feature = "luau" , doc) ) ]
@@ -203,14 +202,14 @@ pub struct Compiler {
203202 debug_level : u8 ,
204203 type_info_level : u8 ,
205204 coverage_level : u8 ,
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 > ,
205+ vector_lib : Option < String > ,
206+ vector_ctor : Option < String > ,
207+ vector_type : Option < String > ,
208+ mutable_globals : Vec < String > ,
209+ userdata_types : Vec < String > ,
210+ libraries_with_known_members : Vec < String > ,
212211 library_constants : Option < LibraryMemberConstantMap > ,
213- disabled_builtins : Vec < StdString > ,
212+ disabled_builtins : Vec < String > ,
214213}
215214
216215#[ cfg( any( feature = "luau" , doc) ) ]
@@ -294,7 +293,7 @@ impl Compiler {
294293 /// To set the library and method name, use the `lib.ctor` format.
295294 #[ doc( hidden) ]
296295 #[ must_use]
297- pub fn set_vector_ctor ( mut self , ctor : impl Into < StdString > ) -> Self {
296+ pub fn set_vector_ctor ( mut self , ctor : impl Into < String > ) -> Self {
298297 let ctor = ctor. into ( ) ;
299298 let lib_ctor = ctor. split_once ( '.' ) ;
300299 self . vector_lib = lib_ctor. as_ref ( ) . map ( |& ( lib, _) | lib. to_owned ( ) ) ;
@@ -307,7 +306,7 @@ impl Compiler {
307306 /// Sets alternative vector type name for type tables, in addition to default type `vector`.
308307 #[ doc( hidden) ]
309308 #[ must_use]
310- pub fn set_vector_type ( mut self , r#type : impl Into < StdString > ) -> Self {
309+ pub fn set_vector_type ( mut self , r#type : impl Into < String > ) -> Self {
311310 self . vector_type = Some ( r#type. into ( ) ) ;
312311 self
313312 }
@@ -316,7 +315,7 @@ impl Compiler {
316315 ///
317316 /// It disables the import optimization for fields accessed through it.
318317 #[ must_use]
319- pub fn add_mutable_global ( mut self , global : impl Into < StdString > ) -> Self {
318+ pub fn add_mutable_global ( mut self , global : impl Into < String > ) -> Self {
320319 self . mutable_globals . push ( global. into ( ) ) ;
321320 self
322321 }
@@ -325,21 +324,21 @@ impl Compiler {
325324 ///
326325 /// It disables the import optimization for fields accessed through these.
327326 #[ must_use]
328- pub fn set_mutable_globals < S : Into < StdString > > ( mut self , globals : impl IntoIterator < Item = S > ) -> Self {
327+ pub fn set_mutable_globals < S : Into < String > > ( mut self , globals : impl IntoIterator < Item = S > ) -> Self {
329328 self . mutable_globals = globals. into_iter ( ) . map ( |s| s. into ( ) ) . collect ( ) ;
330329 self
331330 }
332331
333332 /// Adds a userdata type to the list that will be included in the type information.
334333 #[ must_use]
335- pub fn add_userdata_type ( mut self , r#type : impl Into < StdString > ) -> Self {
334+ pub fn add_userdata_type ( mut self , r#type : impl Into < String > ) -> Self {
336335 self . userdata_types . push ( r#type. into ( ) ) ;
337336 self
338337 }
339338
340339 /// Sets a list of userdata types that will be included in the type information.
341340 #[ must_use]
342- pub fn set_userdata_types < S : Into < StdString > > ( mut self , types : impl IntoIterator < Item = S > ) -> Self {
341+ pub fn set_userdata_types < S : Into < String > > ( mut self , types : impl IntoIterator < Item = S > ) -> Self {
343342 self . userdata_types = types. into_iter ( ) . map ( |s| s. into ( ) ) . collect ( ) ;
344343 self
345344 }
@@ -373,14 +372,14 @@ impl Compiler {
373372
374373 /// Adds a builtin that should be disabled.
375374 #[ must_use]
376- pub fn add_disabled_builtin ( mut self , builtin : impl Into < StdString > ) -> Self {
375+ pub fn add_disabled_builtin ( mut self , builtin : impl Into < String > ) -> Self {
377376 self . disabled_builtins . push ( builtin. into ( ) ) ;
378377 self
379378 }
380379
381380 /// Sets a list of builtins that should be disabled.
382381 #[ must_use]
383- pub fn set_disabled_builtins < S : Into < StdString > > (
382+ pub fn set_disabled_builtins < S : Into < String > > (
384383 mut self ,
385384 builtins : impl IntoIterator < Item = S > ,
386385 ) -> Self {
@@ -490,7 +489,7 @@ impl Compiler {
490489 if bytecode. first ( ) == Some ( & 0 ) {
491490 // The rest of the bytecode is the error message starting with `:`
492491 // See https://github.com/luau-lang/luau/blob/0.640/Compiler/src/Compiler.cpp#L4336
493- let message = StdString :: from_utf8_lossy ( & bytecode[ 2 ..] ) . into_owned ( ) ;
492+ let message = String :: from_utf8_lossy ( & bytecode[ 2 ..] ) . into_owned ( ) ;
494493 return Err ( Error :: SyntaxError {
495494 incomplete_input : message. ends_with ( "<eof>" ) ,
496495 message,
@@ -513,7 +512,7 @@ impl Chunk<'_> {
513512 /// - `@` - file path (when truncation is needed, the end of the file path is kept, as this is
514513 /// more useful for identifying the file)
515514 /// - `=` - custom chunk name (when truncation is needed, the beginning of the name is kept)
516- pub fn set_name ( mut self , name : impl Into < StdString > ) -> Self {
515+ pub fn set_name ( mut self , name : impl Into < String > ) -> Self {
517516 self . name = name. into ( ) ;
518517 self
519518 }
@@ -761,7 +760,7 @@ impl Chunk<'_> {
761760 ChunkMode :: Text
762761 }
763762
764- fn convert_name ( name : StdString ) -> Result < CString > {
763+ fn convert_name ( name : String ) -> Result < CString > {
765764 CString :: new ( name) . map_err ( |err| Error :: runtime ( format ! ( "invalid name: {err}" ) ) )
766765 }
767766
0 commit comments