@@ -279,12 +279,19 @@ pub struct MinifyOpts {
279
279
/// Represents a compiled contract ID as a pub const in a contract.
280
280
type ContractIdConst = String ;
281
281
282
+ #[ derive( Serialize , Deserialize , Clone , Debug , Default , PartialEq , Eq ) ]
283
+ pub struct DumpOpts {
284
+ /// Dump all trait implementations for the given type name.
285
+ pub dump_impls : Option < String > ,
286
+ }
287
+
282
288
/// The set of options provided to the `build` functions.
283
289
#[ derive( Default , Clone ) ]
284
290
pub struct BuildOpts {
285
291
pub pkg : PkgOpts ,
286
292
pub print : PrintOpts ,
287
293
pub minify : MinifyOpts ,
294
+ pub dump : DumpOpts ,
288
295
/// If set, generates a JSON file containing the hex-encoded script binary.
289
296
pub hex_outfile : Option < String > ,
290
297
/// If set, outputs a binary file representing the script bytes.
@@ -1724,7 +1731,7 @@ pub fn compile(
1724
1731
& handler,
1725
1732
engines,
1726
1733
source,
1727
- namespace,
1734
+ namespace. clone ( ) ,
1728
1735
Some ( & sway_build_config) ,
1729
1736
& pkg. name,
1730
1737
None ,
@@ -1754,6 +1761,10 @@ pub fn compile(
1754
1761
return fail ( handler) ;
1755
1762
}
1756
1763
1764
+ if let Some ( typename) = & profile. dump . dump_impls {
1765
+ sway_core:: check_dump_impls ( engines, & namespace, typename) ;
1766
+ }
1767
+
1757
1768
let asm_res = time_expr ! (
1758
1769
pkg. name,
1759
1770
"compile ast to asm" ,
@@ -2108,6 +2119,7 @@ fn build_profile_from_opts(
2108
2119
metrics_outfile,
2109
2120
tests,
2110
2121
error_on_warnings,
2122
+ dump,
2111
2123
..
2112
2124
} = build_options;
2113
2125
@@ -2128,6 +2140,7 @@ fn build_profile_from_opts(
2128
2140
BuildProfile :: default ( )
2129
2141
} ) ;
2130
2142
profile. name = selected_profile_name. into ( ) ;
2143
+ profile. dump = dump. clone ( ) ;
2131
2144
profile. print_ast |= print. ast ;
2132
2145
if profile. print_dca_graph . is_none ( ) {
2133
2146
profile. print_dca_graph . clone_from ( & print. dca_graph ) ;
0 commit comments