File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,16 +94,15 @@ impl ConversionFlag {
9494}
9595
9696#[ cfg( feature = "constant-optimization" ) ]
97+ #[ non_exhaustive]
9798#[ derive( Default ) ]
98- pub struct ConstantOptimizer {
99- _priv : ( ) ,
100- }
99+ pub struct ConstantOptimizer { }
101100
102101#[ cfg( feature = "constant-optimization" ) ]
103102impl ConstantOptimizer {
104103 #[ inline]
105104 pub fn new ( ) -> Self {
106- Self { _priv : ( ) }
105+ Self { }
107106 }
108107}
109108
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ use instructions::FunctionCompiler;
1313use std:: mem:: ManuallyDrop ;
1414
1515#[ derive( Debug , thiserror:: Error ) ]
16+ #[ non_exhaustive]
1617pub enum JitCompileError {
1718 #[ error( "function can't be jitted" ) ]
1819 NotSupported ,
@@ -23,6 +24,7 @@ pub enum JitCompileError {
2324}
2425
2526#[ derive( Debug , thiserror:: Error , Eq , PartialEq ) ]
27+ #[ non_exhaustive]
2628pub enum JitArgumentError {
2729 #[ error( "argument is of wrong type" ) ]
2830 ArgumentTypeMismatch ,
@@ -167,6 +169,7 @@ impl JitSig {
167169}
168170
169171#[ derive( Debug , Clone , PartialEq ) ]
172+ #[ non_exhaustive]
170173pub enum JitType {
171174 Int ,
172175 Float ,
@@ -192,6 +195,7 @@ impl JitType {
192195}
193196
194197#[ derive( Debug , Clone , PartialEq ) ]
198+ #[ non_exhaustive]
195199pub enum AbiValue {
196200 Float ( f64 ) ,
197201 Int ( i64 ) ,
Original file line number Diff line number Diff line change @@ -310,16 +310,15 @@ fn add_stdlib(vm: &mut VirtualMachine) {
310310/// Create settings by examining command line arguments and environment
311311/// variables.
312312fn create_settings ( matches : & ArgMatches ) -> PySettings {
313- let mut settings = PySettings {
314- isolated : matches. is_present ( "isolate" ) ,
315- ignore_environment : matches. is_present ( "ignore-environment" ) ,
316- interactive : !matches. is_present ( "c" )
317- && !matches. is_present ( "m" )
318- && ( !matches. is_present ( "script" ) || matches. is_present ( "inspect" ) ) ,
319- bytes_warning : matches. occurrences_of ( "bytes-warning" ) ,
320- no_site : matches. is_present ( "no-site" ) ,
321- ..Default :: default ( )
322- } ;
313+ let mut settings = PySettings :: default ( ) ;
314+ settings. isolated = matches. is_present ( "isolate" ) ;
315+ settings. ignore_environment = matches. is_present ( "ignore-environment" ) ;
316+ settings. interactive = !matches. is_present ( "c" )
317+ && !matches. is_present ( "m" )
318+ && ( !matches. is_present ( "script" ) || matches. is_present ( "inspect" ) ) ;
319+ settings. bytes_warning = matches. occurrences_of ( "bytes-warning" ) ;
320+ settings. no_site = matches. is_present ( "no-site" ) ;
321+
323322 let ignore_environment = settings. ignore_environment || settings. isolated ;
324323
325324 // when rustpython-vm/pylib is enabled, PySettings::default().path_list has pylib::LIB_PATH
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ impl IntoPyObject for AbiValue {
3131 AbiValue :: Int ( i) => i. into_pyobject ( vm) ,
3232 AbiValue :: Float ( f) => f. into_pyobject ( vm) ,
3333 AbiValue :: Bool ( b) => b. into_pyobject ( vm) ,
34+ _ => unimplemented ! ( ) ,
3435 }
3536 }
3637}
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ pub mod module {
160160
161161 // Flags for os_access
162162 bitflags ! {
163- pub struct AccessFlags : u8 {
163+ pub struct AccessFlags : u8 {
164164 const F_OK = _os:: F_OK ;
165165 const R_OK = _os:: R_OK ;
166166 const W_OK = _os:: W_OK ;
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ use std::cmp::Ordering;
1414// The corresponding field in CPython is `tp_` prefixed.
1515// e.g. name -> tp_name
1616#[ derive( Default ) ]
17+ #[ non_exhaustive]
1718pub struct PyTypeSlots {
1819 pub name : PyRwLock < Option < String > > , // tp_name, not class name
1920 // tp_basicsize, tp_itemsize
@@ -84,6 +85,7 @@ impl std::fmt::Debug for PyTypeSlots {
8485}
8586
8687bitflags ! {
88+ #[ non_exhaustive]
8789 pub struct PyTypeFlags : u64 {
8890 const HEAPTYPE = 1 << 9 ;
8991 const BASETYPE = 1 << 10 ;
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ use crate::{PyContext, StaticType};
99
1010/// Holder of references to builtin types.
1111#[ derive( Debug , Clone ) ]
12+ #[ non_exhaustive]
1213pub struct TypeZoo {
1314 pub async_generator : PyTypeRef ,
1415 pub async_generator_asend : PyTypeRef ,
Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ pub enum InitParameter {
133133}
134134
135135/// Struct containing all kind of settings for the python vm.
136+ #[ non_exhaustive]
136137pub struct PySettings {
137138 /// -d command line switch
138139 pub debug : bool ,
You can’t perform that action at this time.
0 commit comments