Skip to main content

Violation

Enum Violation 

Source
#[non_exhaustive]
pub enum Violation {
Show 31 variants MissingBase { name: Token, }, CyclicInheritance { chain: String, }, MultipleBases { count: usize, }, AppliedApiNotRooted { base: Token, }, NonAppliedApiNotRooted { base: Token, }, InheritsWithinFamily { base: Token, }, UnknownApiSchemaType { spelling: String, }, KindMismatch { key: &'static str, kind: &'static str, }, ConcreteNotTyped, ApiSchemaTypeOnTyped, DisallowedIdentifier { identifier: Token, }, TypeNameMismatch { authored: Token, }, ApiSchemasNotPrepended, DuplicateSchematicsName { name: Token, first: Token, second: Token, }, UnknownPropertyType { property: Token, type_name: Token, }, MultipleApplyPrefix, DisallowedField { field: String, }, OverridesADeclaration { property: Token, class: Token, }, IncompatibleRedeclaration { property: Token, class: Token, theirs: Box<Shape>, ours: Box<Shape>, }, TokenValueCollision { id: String, first: String, second: String, }, RustNameCollision { name: String, first: String, second: String, }, MethodCollision { method: String, first: Token, second: Token, }, NotAnIdentifier { name: String, }, Ungenerated { class: Token, }, UnknownReflectedSchema { schema: Token, }, ReflectedNotApplied { schema: Token, }, UnknownLibrary { library: String, class: Token, }, UnreadableLibraryPath { library: String, path: String, }, UnknownApiGetImplementation { spelling: String, }, CustomGetWithoutAccessor { property: Token, }, UnnameableType { property: Token, type_name: Token, },
}
Expand description

A rule a schema broke.

One variant per rule enforced, not one per upstream check: two upstream checks that mean one thing here share a variant, and a check not kept has none. Tests match variants rather than message text.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

MissingBase

A base no layer in the stack declares.

Fields

§name: Token

The name that could not be found.

§

CyclicInheritance

An inheritance chain that returns to where it started, which has no order to generate in.

Fields

§chain: String

The cycle, in the order it was walked.

§

MultipleBases

More than one base. A schema is a single chain, and the registry resolves is_a along one.

Fields

§count: usize

How many were authored.

§

AppliedApiNotRooted

An applied API schema that does not inherit directly from APISchemaBase.

Applying a schema brings its own properties and the API schemas it lists, not its bases’ — an API schema’s inheritance is not walked the way a typed schema’s is — so a chain here would promise properties that applying never delivers.

Fields

§base: Token

The base it inherits instead.

§

NonAppliedApiNotRooted

A non-applied API schema on a base that is neither APISchemaBase nor another non-applied API schema, whose properties it would appear to offer and could never carry.

Fields

§base: Token

The base it inherits instead.

§

InheritsWithinFamily

A schema inheriting inside its own family, which the registry reads as one schema at two versions rather than two schemas.

Fields

§base: Token

The base sharing this schema’s family.

§

UnknownApiSchemaType

An apiSchemaType that is none of the three kinds.

Fields

§spelling: String

What the schema wrote.

§

KindMismatch

Metadata that contradicts the kind of schema it sits on.

Fields

§key: &'static str

The key that does not belong, whether the schema wrote it as prim metadata or under customData.

§kind: &'static str

The kind it was found on.

§

ConcreteNotTyped

A concrete schema that is not typed, so a stage could never instantiate it.

§

ApiSchemaTypeOnTyped

A schema that is typed, or carries a type name, and also declares itself an API schema.

The two cannot both hold: apiSchemaType is what makes a schema an API schema, and an API schema is never a prim type. Left alone the API reading wins and the type name never reaches the schematics, so a stage could no longer instantiate the prim type the schema meant to declare.

§

DisallowedIdentifier

An identifier the registry would refuse to register, and so could never look up.

Fields

§identifier: Token

The identifier as declared.

§

TypeNameMismatch

A typeName that is not the class’s own identifier. It reaches the schematics, so a stage would compose the wrong type.

Fields

§authored: Token

The authored type name.

§

ApiSchemasNotPrepended

An apiSchemas opinion that is not a prepend. Only a prepend composes as the class’s built-in applied API schemas.

Which kinds may declare built-ins at all is deliberately not a rule here: the upstream corpus’s own PublicMultipleApplyAPI declares them on a multiple-apply schema, so the shape is legal however it reads.

§

DuplicateSchematicsName

Two properties that reach one name in the schematics, where one spec cannot hold both.

The check is on the resolved name: a multiple-apply schema’s property picks up its namespace prefix and the instance-name template on the way there, so two names distinct at the source can arrive as one.

Fields

§name: Token

The name they collided on.

§first: Token

The first property to reach it.

§second: Token

The second.

§

UnknownPropertyType

An attribute whose type no registered value type names, leaving its accessor nothing to read.

Fields

§property: Token

The property.

§type_name: Token

The type as declared.

§

MultipleApplyPrefix

A multiple-apply schema with properties but no namespace prefix, or a prefix and no properties. The prefix is what keeps one instance’s properties apart from another’s.

§

DisallowedField

A field the registry would refuse to carry, so it would be silently dropped rather than mean anything.

Fields

§field: String

The field name.

§

OverridesADeclaration

A property this class records as an API schema override that an ancestor declares outright.

An override reaches a prim definition only where a built-in API schema supplies the property, so this would delete the ancestor’s property from the class wherever none does. The other direction is allowed: a class may make an inherited override a declaration of its own.

Fields

§property: Token

The property.

§class: Token

The ancestor declaring it outright.

§

IncompatibleRedeclaration

A redeclaration that changes what a property is, rather than what it falls back to.

An accessor is generated where a property is introduced and every class below reaches that one, so its creator authors the type, variability and custom composed there. A redeclaration changing any of them would have that creator author a property the redeclaring class’s own definition contradicts. A fallback is not on the list: changing one is what a redeclaration is for.

Fields

§property: Token

The property.

§class: Token

The ancestor it disagrees with.

§theirs: Box<Shape>

What the property is at the ancestor. Boxed with ours, so the error a build stops on stays as small as every other.

§ours: Box<Shape>

What this class made it.

§

TokenValueCollision

Two token sources reaching one identifier with different values, where one constant would have to hold both strings.

Fields

§id: String

The identifier they collided on.

§first: String

The string the first source gave it.

§second: String

The string the second gave it.

§

RustNameCollision

Two classes of one library reaching one Rust name, where one module cannot hold both.

The scope is the module: two libraries may each declare a Sphere, and nothing stops them.

Fields

§name: String

The name they collided on.

§first: String

The first schema to reach it.

§second: String

The second.

§

MethodCollision

Two properties reaching one method name, where two methods of one name — or two traits offering one — make every call ambiguous.

Fields

§method: String

The method they collided on.

§first: Token

The first property to reach it.

§second: Token

The second.

§

NotAnIdentifier

A name a schema chose — through className or apiName — that is not a Rust identifier, so nothing could be called it.

Fields

§name: String

The name as the schema wrote it.

§

Ungenerated

A class this run does not generate and that belongs to no other library, so no view of it exists for a descendant to derive from or for a class to reflect.

Fields

§class: Token

The class that has no views.

§

UnknownReflectedSchema

A reflected API schema no layer in the stack declares.

Fields

§schema: Token

The name that could not be found.

§

ReflectedNotApplied

A reflected API schema the class does not apply.

Reflecting says every prim of this type carries the schema’s properties, which only applying the schema makes true; a reflected accessor would otherwise reach a property the prim’s definition does not have. A multiple-apply class records its applied schemas as instance-name templates, which no reflected name matches, so it cannot reflect.

Fields

§schema: Token

The schema reflected without being applied.

§

UnknownLibrary

A class in a library this run does not generate and was not told where to find, so its views cannot be named: a base to derive from, or a schema to reflect.

Fields

§library: String

The library declaring the class.

§class: Token

The class that could not be reached.

§

UnreadableLibraryPath

A library was told where its views live, but not in a spelling Rust can read, so nothing can be named through it.

Fields

§library: String

The library the path was given for.

§path: String

What was given.

§

UnknownApiGetImplementation

An apiGetImplementation that is neither spelling.

Fields

§spelling: String

What the schema wrote.

§

CustomGetWithoutAccessor

A custom read accessor asked for on a property that has no accessor, which cannot both be true.

Fields

§property: Token

The property.

§

UnnameableType

An attribute whose type the core reads but gives no constant to declare it with, so nothing could author the property.

Fields

§property: Token

The property.

§type_name: Token

The type it was declared as.

Trait Implementations§

Source§

impl Debug for Violation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Violation

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Violation

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.