Detect "bound more than once" error and suppress need-mut for it.

This commit is contained in:
hkalbasi 2023-06-04 12:39:36 +03:30
parent 08f89193b5
commit 71f3e4b08c
4 changed files with 84 additions and 8 deletions

View file

@ -486,6 +486,16 @@ impl BindingAnnotation {
}
}
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum BindingProblems {
/// https://doc.rust-lang.org/stable/error_codes/E0416.html
BoundMoreThanOnce,
/// https://doc.rust-lang.org/stable/error_codes/E0409.html
BoundInconsistently,
/// https://doc.rust-lang.org/stable/error_codes/E0408.html
NotBoundAcrossAll,
}
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Binding {
pub name: Name,
@ -494,6 +504,7 @@ pub struct Binding {
/// Id of the closure/generator that owns this binding. If it is owned by the
/// top level expression, this field would be `None`.
pub owner: Option<ExprId>,
pub problems: Option<BindingProblems>,
}
impl Binding {