Skip to content

Commit

Permalink
Replace with manual impl to preserve doc-comments in generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Nov 13, 2024
1 parent b9fd144 commit 93a3b18
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
12 changes: 0 additions & 12 deletions charon/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion charon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ clap = { version = "4.0", features = ["derive", "env"] }
colored = "2.0.4"
convert_case = "0.6.0"
crates_io_api = { version = "0.11.0", optional = true }
derive-where = "1.2.7"
derive-visitor = { version = "0.4.0", features = ["std-types-drive"] }
env_logger = { version = "0.11", features = ["color"] }
flate2 = { version = "1.0.34", optional = true }
Expand Down
11 changes: 7 additions & 4 deletions charon/src/ast/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::ids::Vector;
use crate::{ast::*, common::hash_consing::HashConsed};
use derive_visitor::{Drive, DriveMut, Event, Visitor, VisitorMut};
use derive_where::derive_where;
use macros::{EnumAsGetters, EnumIsA, EnumToGetters, VariantIndexArity, VariantName};
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -348,24 +347,28 @@ generate_index_type!(TraitImplId, "TraitImpl");

/// A predicate of the form `Type: Trait<Args>`.
#[derive(Debug, Clone, Serialize, Deserialize, Drive, DriveMut)]
#[derive_where(PartialEq)]
pub struct TraitClause {
/// We use this id when solving trait constraints, to be able to refer
/// to specific where clauses when the selected trait actually is linked
/// to a parameter.
pub clause_id: TraitClauseId,
#[derive_where(skip)]
// TODO: does not need to be an option.
pub span: Option<Span>,
/// Where the predicate was written, relative to the item that requires it.
#[derive_where(skip)]
#[charon::opaque]
pub origin: PredicateOrigin,
/// The trait that is implemented.
#[charon::rename("trait")]
pub trait_: PolyTraitDeclRef,
}

impl PartialEq for TraitClause {
fn eq(&self, other: &Self) -> bool {
// Skip `span` and `origin`
self.clause_id == other.clause_id && self.trait_ == other.trait_
}
}

impl Eq for TraitClause {}

/// Where a given predicate came from.
Expand Down

0 comments on commit 93a3b18

Please sign in to comment.