pub enum SpecialiseError {
Unbounded {
declaration: Name,
types: Vec<Type>,
span: NodeSpan,
used_in: Name,
},
NoInstance {
class: Name,
tpe: Type,
within: Name,
used_in: Name,
span: NodeSpan,
},
NotGround {
class: Name,
tpe: Type,
within: Name,
used_in: Name,
span: NodeSpan,
},
NoDeclaration {
name: Name,
within: Name,
used_in: Name,
span: NodeSpan,
},
}Expand description
Why the specialisations of a build could not be found.
Unbounded is a mistake in a program the type checker cannot see.
NotGround is a program it accepted whose use asks for a constrained
function at a type that is still a variable, one that has no copy to make. The other two
are what is left if a module reaches this pass that the type checker did not accept, which
nothing does today: a build with an error never gets here. They are errors and not panics
so that a caller holding one is told which declaration it was reading.
Variants§
Unbounded
A constrained declaration whose specialisations never end: it needs itself, directly or through other declarations, at a type larger each time.
Fields
declaration: NameThe declaration, as the source names it: a function, or the member an instance binds.
span: NodeSpanWhere the declaration was written.
NoInstance
A use that asks for an instance of class at tpe and no instance of it is part of
the build.
Fields
span: NodeSpanNotGround
A use of a constrained name whose constrained variable was still a type variable once
the declaration it is in was specialised, so there is no key to copy at; or a use of a
class member at a bare variable, which has no name to look an instance up by. A use at
Phantom b is neither, whatever b is.
NoDeclaration
A use of a constrained name whose declaration, or whose instance’s member, has no IR to copy: the type checker could not check it.