@@ -19,9 +19,8 @@ use derive_more::Display;
19
19
use thiserror:: Error ;
20
20
21
21
use crate :: hugr:: IdentList ;
22
- use crate :: ops:: constant:: { ValueName , ValueNameRef } ;
23
22
use crate :: ops:: custom:: { ExtensionOp , OpaqueOp } ;
24
- use crate :: ops:: { self , OpName , OpNameRef } ;
23
+ use crate :: ops:: { OpName , OpNameRef } ;
25
24
use crate :: types:: type_param:: { TypeArg , TypeArgError , TypeParam } ;
26
25
use crate :: types:: RowVariable ;
27
26
use crate :: types:: { check_typevar_decl, CustomType , Substitution , TypeBound , TypeName } ;
@@ -378,6 +377,7 @@ pub static EMPTY_REG: ExtensionRegistry = ExtensionRegistry {
378
377
/// TODO: decide on failure modes
379
378
#[ derive( Debug , Clone , Error , PartialEq , Eq ) ]
380
379
#[ allow( missing_docs) ]
380
+ #[ non_exhaustive]
381
381
pub enum SignatureError {
382
382
/// Name mismatch
383
383
#[ error( "Definition name ({0}) and instantiation name ({1}) do not match." ) ]
@@ -496,37 +496,6 @@ impl CustomConcrete for CustomType {
496
496
}
497
497
}
498
498
499
- /// A constant value provided by a extension.
500
- /// Must be an instance of a type available to the extension.
501
- #[ derive( Clone , Debug , serde:: Serialize , serde:: Deserialize ) ]
502
- pub struct ExtensionValue {
503
- extension : ExtensionId ,
504
- name : ValueName ,
505
- typed_value : ops:: Value ,
506
- }
507
-
508
- impl ExtensionValue {
509
- /// Returns a reference to the typed value of this [`ExtensionValue`].
510
- pub fn typed_value ( & self ) -> & ops:: Value {
511
- & self . typed_value
512
- }
513
-
514
- /// Returns a mutable reference to the typed value of this [`ExtensionValue`].
515
- pub ( super ) fn typed_value_mut ( & mut self ) -> & mut ops:: Value {
516
- & mut self . typed_value
517
- }
518
-
519
- /// Returns a reference to the name of this [`ExtensionValue`].
520
- pub fn name ( & self ) -> & str {
521
- self . name . as_str ( )
522
- }
523
-
524
- /// Returns a reference to the extension this [`ExtensionValue`] belongs to.
525
- pub fn extension ( & self ) -> & ExtensionId {
526
- & self . extension
527
- }
528
- }
529
-
530
499
/// A unique identifier for a extension.
531
500
///
532
501
/// The actual [`Extension`] is stored externally.
@@ -582,8 +551,6 @@ pub struct Extension {
582
551
pub runtime_reqs : ExtensionSet ,
583
552
/// Types defined by this extension.
584
553
types : BTreeMap < TypeName , TypeDef > ,
585
- /// Static values defined by this extension.
586
- values : BTreeMap < ValueName , ExtensionValue > ,
587
554
/// Operation declarations with serializable definitions.
588
555
// Note: serde will serialize this because we configure with `features=["rc"]`.
589
556
// That will clone anything that has multiple references, but each
@@ -607,7 +574,6 @@ impl Extension {
607
574
version,
608
575
runtime_reqs : Default :: default ( ) ,
609
576
types : Default :: default ( ) ,
610
- values : Default :: default ( ) ,
611
577
operations : Default :: default ( ) ,
612
578
}
613
579
}
@@ -679,11 +645,6 @@ impl Extension {
679
645
self . types . get ( type_name)
680
646
}
681
647
682
- /// Allows read-only access to the values in this Extension
683
- pub fn get_value ( & self , value_name : & ValueNameRef ) -> Option < & ExtensionValue > {
684
- self . values . get ( value_name)
685
- }
686
-
687
648
/// Returns the name of the extension.
688
649
pub fn name ( & self ) -> & ExtensionId {
689
650
& self . name
@@ -704,25 +665,6 @@ impl Extension {
704
665
self . types . iter ( )
705
666
}
706
667
707
- /// Add a named static value to the extension.
708
- pub fn add_value (
709
- & mut self ,
710
- name : impl Into < ValueName > ,
711
- typed_value : ops:: Value ,
712
- ) -> Result < & mut ExtensionValue , ExtensionBuildError > {
713
- let extension_value = ExtensionValue {
714
- extension : self . name . clone ( ) ,
715
- name : name. into ( ) ,
716
- typed_value,
717
- } ;
718
- match self . values . entry ( extension_value. name . clone ( ) ) {
719
- btree_map:: Entry :: Occupied ( _) => {
720
- Err ( ExtensionBuildError :: ValueExists ( extension_value. name ) )
721
- }
722
- btree_map:: Entry :: Vacant ( ve) => Ok ( ve. insert ( extension_value) ) ,
723
- }
724
- }
725
-
726
668
/// Instantiate an [`ExtensionOp`] which references an [`OpDef`] in this extension.
727
669
pub fn instantiate_extension_op (
728
670
& self ,
@@ -783,9 +725,6 @@ pub enum ExtensionBuildError {
783
725
/// Existing [`TypeDef`]
784
726
#[ error( "Extension already has an type called {0}." ) ]
785
727
TypeDefExists ( TypeName ) ,
786
- /// Existing [`ExtensionValue`]
787
- #[ error( "Extension already has an extension value called {0}." ) ]
788
- ValueExists ( ValueName ) ,
789
728
}
790
729
791
730
/// A set of extensions identified by their unique [`ExtensionId`].
0 commit comments