-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved error messages for possible function callees that have polym…
…orphic arguments with constraints
- Loading branch information
1 parent
6d89442
commit ebeafdb
Showing
3 changed files
with
15 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
use crate::resolved::TraitRef; | ||
use crate::resolved::{HumanName, TraitRef}; | ||
use derivative::Derivative; | ||
use derive_more::IsVariant; | ||
use std::fmt::Display; | ||
|
||
#[derive(Clone, Debug, PartialEq, Eq, Hash)] | ||
#[derive(Clone, Debug, IsVariant, Derivative)] | ||
#[derivative(PartialEq, Eq, Hash)] | ||
pub enum Constraint { | ||
PrimitiveAdd, | ||
Trait(TraitRef), | ||
Trait( | ||
#[derivative(PartialEq = "ignore")] | ||
#[derivative(Hash = "ignore")] | ||
HumanName, | ||
TraitRef, | ||
), | ||
} | ||
|
||
impl Display for Constraint { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
Constraint::PrimitiveAdd => write!(f, "PrimitiveAdd"), | ||
Constraint::Trait(_) => write!(f, "<user-defined trait>"), | ||
Constraint::Trait(name, _) => write!(f, "{}", name), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters