Skip to content

Commit

Permalink
Move missing_docs ignore to the error's variants
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Mar 13, 2024
1 parent 2f92518 commit ade4527
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions quantinuum-hugr/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ pub use circuit::{CircuitBuildError, CircuitBuilder};

#[derive(Debug, Clone, PartialEq, Error)]
#[non_exhaustive]
#[allow(missing_docs)]
/// Error while building the HUGR.
pub enum BuildError {
/// The constructed HUGR is invalid.
Expand All @@ -144,6 +143,7 @@ pub enum BuildError {
EntryBuiltError(Node),
/// Node was expected to have a certain type but was found to not.
#[error("Node with index {node:?} does not have type {op_desc:?} as expected.")]
#[allow(missing_docs)]
UnexpectedType {
/// Index of node where error occurred.
node: Node,
Expand All @@ -164,6 +164,7 @@ pub enum BuildError {

/// Invalid wires when setting outputs
#[error("Found an error while setting the outputs of a {} container, {container_node}. {error}", .container_op.name())]
#[allow(missing_docs)]
OutputWiring {
container_op: OpType,
container_node: Node,
Expand All @@ -175,6 +176,7 @@ pub enum BuildError {
///
/// The internal error message already contains the node index.
#[error("Got an input wire while adding a {} to the circuit. {error}", .op.name())]
#[allow(missing_docs)]
OperationWiring {
op: OpType,
#[source]
Expand All @@ -184,18 +186,19 @@ pub enum BuildError {

#[derive(Debug, Clone, PartialEq, Error)]
#[non_exhaustive]
#[allow(missing_docs)]
/// Error raised when wiring up a node during the build process.
pub enum BuilderWiringError {
/// Tried to copy a linear type.
#[error("Cannot copy linear type {typ} from output {src_offset} of node {src}")]
#[allow(missing_docs)]
NoCopyLinear {
typ: Type,
src: Node,
src_offset: Port,
},
/// The ancestors of an inter-graph edge are not related.
#[error("Cannot connect an inter-graph edge between unrelated nodes. Tried connecting {src} ({src_offset}) with {dst} ({dst_offset}).")]
#[allow(missing_docs)]
NoRelationIntergraph {
src: Node,
src_offset: Port,
Expand All @@ -204,6 +207,7 @@ pub enum BuilderWiringError {
},
/// Inter-Graph edges can only carry copyable data.
#[error("Inter-graph edges cannot carry non-copyable data {typ}. Tried connecting {src} ({src_offset}) with {dst} ({dst_offset}).")]
#[allow(missing_docs)]
NonCopyableIntergraph {
src: Node,
src_offset: Port,
Expand Down

0 comments on commit ade4527

Please sign in to comment.