question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Detect Rust errors

See original GitHub issue

Here’s the list of the Rust compiler errors that the compiler can emit according to https://doc.rust-lang.org/error-index.html. All old errors (i.e. marked with Note: this error code is no longer emitted by the compiler. note) are excluded from this list. Since some errors can become outdated during compiler evolution, any corrections and additions are very welcome.

Some of these errors could only be detected in a limited number of cases so far, but it’s still enough for them to be helpful.

I think this list could be treated as a meta issue from which anyone could grab tasks to accomplish. I will surely do that.

I would also suggest that the error annotations should provide the very same highlight range and error text (with the error code at the end) as rustc produces.

  • E0004: Not all possible patterns are covered in match expression

    Quick fixes:

    • Add remaining patterns
    • Add _ pattern
  • E0005: Patterns used to bind names must be irrefutable, that is, they must guarantee that a name will be extracted in all cases.

  • E0010: The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time.

  • E0013: Static and const variables can refer to other const variables. But a const variable cannot refer to a static variable. #6353

  • E0015: A constant item was initialized with something that is not a constant expression.

    Implemented for simple cases

  • E0023: A pattern attempted to extract an incorrect number of fields from a tuple enum variant.

    Quick fixes:

    • Add missing fields
    • Add ..
  • E0025: Each field of a struct can only be bound once in a pattern. #5871

  • E0026: A struct pattern attempted to extract a non-existent field from a struct.

  • E0027: A pattern for a struct fails to specify a sub-pattern for every one of the struct’s fields.

    Quick fixes:

    • Add missing fields
    • Add ..
  • E0029: Something other than numbers and characters has been used for a range.

  • E0030: When matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range.

  • E0033: A trait type has been dereferenced.

  • E0034: The compiler doesn’t know what method to call because more than one method has the same prototype.

  • E0038: Trait objects like Box<Trait> can only be constructed when certain requirements are satisfied by the trait in question.

  • E0040: It is not allowed to manually call destructors in Rust.

    Quick fixes:

    • Replace with std::mem::drop
  • E0044: You cannot use type or const parameters on foreign items. https://github.com/intellij-rust/intellij-rust/pull/9816

  • E0045: Variadic parameters have been used on a non-C ABI function.

  • E0046: Items are missing in a trait implementation.

    Has a false positive when specialization is used.

    Quick fixes:

    • Implement members
  • E0049: An attempted implementation of a trait method has the wrong number of type or const parameters. https://github.com/intellij-rust/intellij-rust/issues/8312

  • E0050: An attempted implementation of a trait method has the wrong number of function parameters.

  • E0053: The parameters of any trait method must match between a trait implementation and the trait definition.

  • E0054: It is not allowed to cast to a bool. #6318

    Quick fixes:

    • Compare with zero (for numeric types) #6330
  • E0055: During a method call, a value is automatically dereferenced as many times as needed to make the value’s type match the method’s receiver. The catch is that the compiler will only attempt to dereference a number of times up to the recursion limit (which can be set via the recursion_limit attribute).

  • E0057: An invalid number of arguments was given when calling a closure. #6319

  • E0059: The built-in function traits are generic over a tuple of the function arguments. If one uses angle-bracket notation (Fn<(T,), Output=U>) instead of parentheses (Fn(T) -> U) to denote the function trait, the type parameter should be a tuple. Otherwise function call notation cannot be used and the trait will not be implemented by closures.

  • E0060: An invalid number of arguments was passed when calling a variadic function.

  • E0061: An invalid number of arguments was passed when calling a function.

  • E0062: A struct’s or struct-like enum variant’s field was specified more than once.

  • E0063: A struct’s or struct-like enum variant’s field was not provided.

  • E0067: An invalid left-hand side expression was used on an assignment operation.

  • E0069: The compiler found a function whose body contains a return; statement but whose return type is not ().

  • E0070: An assignment operator was used on a non-place expression.

  • E0071: A structure-literal syntax was used to create an item that is not a structure or enum variant.

  • E0072: A recursive type has infinite size because it doesn’t have an indirection.

  • E0075: A #[simd] attribute was applied to an empty tuple struct.

  • E0076: All types in a tuple struct aren’t the same when using the #[simd] attribute.

  • E0077: A tuple struct’s element isn’t a machine type when using the #[simd] attribute.

  • E0080: A constant value failed to get evaluated.

  • E0081: A discriminant value is present more than once.

  • E0084: An unsupported representation was attempted on a zero-variant enum.

    Quick fixes:

    • Removed repr attr
  • E0091: An unnecessary type or const parameter was given in a type alias.

  • E0092: An undefined atomic operation function was declared.

  • E0093: An unknown intrinsic function was declared.

  • E0094: An invalid number of type parameters was given to an intrinsic function.

  • E0106: This error indicates that a lifetime is missing from a type.

    Implemented for structs / enums / type aliases and base types. Lifetimes in function signatures are a subject of lifetime elision and not covered yet.

  • E0107: An incorrect number of generic arguments were provided.

  • E0109: You tried to provide a generic argument to a type which doesn’t need it.

  • E0116: An inherent implementation was defined for a type outside the current crate.

  • E0117: Only traits defined in the current crate can be implemented for arbitrary types.

  • E0118: An inherent implementation was defined for something which isn’t a struct nor an enum.

  • E0119: There are conflicting trait implementations for the same type.

  • E0120: Drop was implemented on a trait, which is not allowed: only structs and enums can implement Drop.

  • E0121: The type placeholder _ was used within a type on an item’s signature.

    • function
    • static, const
    • struct, enum variant #7682
  • E0124: A struct was declared with two fields having the same name.

  • E0128: A type parameter with default value is using forward declared identifier.

  • E0130: A pattern was declared as an argument in a foreign function declaration.

  • E0131: The main function was defined with generic parameters.

  • E0132: A function with the start attribute was declared with type parameters.

  • E0133: Unsafe code was used outside of an unsafe function or block.

    Quick fixes:

    • Surround with unsafe block
    • Add unsafe to
  • E0138: More than one function was declared with the #[start] attribute.

  • E0152: A lang item was redefined.

  • E0158: An associated const has been referenced in a pattern.

  • E0161: A value was moved whose size was not known at compile time.

  • E0164: Something which is neither a tuple struct nor a tuple variant was used as a pattern.

  • E0170: A pattern binding is using the same name as one of the variants of a type.

  • E0178: The + type operator was used in an ambiguous context.

  • E0183: Manual implementation of a Fn* trait.

  • E0184: The Copy trait was implemented on a type with a Drop implementation.

  • E0185: An associated function for a trait was defined to be static, but an implementation of the trait declared the same function to be a method (i.e., to take a self parameter).

  • E0186: An associated function for a trait was defined to be a method (i.e., to take a self parameter), but an implementation of the trait declared the same function to be static.

  • E0191: An associated type wasn’t specified for a trait object. #5866

  • E0195: The lifetime parameters of the method do not match the trait declaration.

  • E0197: An inherent implementation was marked unsafe.

  • E0198: A negative implementation was marked as unsafe.

  • E0199: A trait implementation was marked as unsafe while the trait is safe.

  • E0200: An unsafe trait was implemented without an unsafe implementation.

  • E0201: Two associated items (like methods, associated types, associated functions, etc.) were defined with the same identifier.

  • E0203: Having multiple relaxed default bounds is unsupported.

  • E0204: The Copy trait was implemented on a type which contains a field that doesn’t implement the Copy trait.

  • E0206: The Copy trait was implemented on a type which is neither a struct nor an enum.

  • E0207: A type parameter that is specified for impl is not constrained.

  • E0210: This error indicates a violation of one of Rust’s orphan rules for trait implementations. The rule concerns the use of type parameters in an implementation of a foreign trait (a trait defined in another crate), and states that type parameters must be “covered” by a local type.

  • E0212: Cannot use the associated type of a trait with uninferred generic parameters.

  • E0214: A generic type was described using parentheses rather than angle brackets.

  • E0220: The associated type used was not defined in the trait. #5866

  • E0221: An attempt was made to retrieve an associated type, but the type was ambiguous.

  • E0222: An attempt was made to constrain an associated type.

  • E0223: An attempt was made to retrieve an associated type, but the type was ambiguous.

  • E0224: A trait object was declaired with no traits.

  • E0225: Multiple types were used as bounds for a closure or trait object.

  • E0226: More than one explicit lifetime bound was used on a trait object.

  • E0227: This error indicates that the compiler is unable to determine whether there is exactly one unique region in the set of derived region bounds.

  • E0228: The lifetime bound for this object type cannot be deduced from context and must be specified.

  • E0229: An associated type binding was done outside of the type parameter declaration and where clause.

  • E0230/E0231/E0232: The #[rustc_on_unimplemented] attribute lets you specify a custom error message for when a particular trait isn’t implemented on a type placed in a position that needs that trait.

  • E0252: Two items of the same name cannot be imported without rebinding one of the items under a new local name.

    Quick fixes:

    • Introduce alias
  • E0253: Attempt was made to import an unimportable value. This can happen when trying to import a method from a trait.

  • E0254: Attempt was made to import an item whereas an extern crate with this name has already been imported.

  • E0255: You can’t import a value whose name is the same as another value defined in the module.

  • E0259: The name chosen for an external crate conflicts with another external crate that has been imported into the current module.

  • E0260: The name for an item declaration conflicts with an external crate’s name.

  • E0261: An undeclared lifetime was used.

    Quick fixes:

    • Create lifetime parameter
  • E0262: An invalid name was used for a lifetime parameter.

  • E0263: A lifetime was declared more than once in the same scope.

  • E0264: An unknown external lang item was used.

  • E0267: A loop keyword (break or continue) was used inside a closure but outside of any loop.

  • E0268: A loop keyword (break or continue) was used outside of a loop.

  • E0271: A type mismatched an associated type of a trait.

  • E0275: An evaluation of a trait requirement overflowed.

  • E0276: A trait implementation has stricter requirements than the trait definition.

  • E0277: You tried to use a type which doesn’t implement some trait in a place which expected that trait.

    Quick fixes:

    • Convert to reference (specific for Sized trait)
    • Convert to Box (specific for Sized trait)

    Supported cases:

    • in impl Trait for Type, when Trait inherits another Trait, which is not implemented for Type
    • when type is not Sized, despite of expected Sized

    Known issues:

  • E0282: The compiler could not infer a type and asked for a type annotation.

  • E0283: An implementation cannot be chosen unambiguously because of lack of information.

  • E0284: This error occurs when the compiler is unable to unambiguously infer the return type of a function or method which is generic on return type, such as the collect method for Iterators.

  • E0307: The self parameter in a method has an invalid “receiver type”.

  • E0308

    • Expected type did not match the received type. Is not shown in some cases to avoid false-piositives
    • Unable to infer the concrete type of a variable.

    Quick fixes:

    • Change return type
    • Convert type of local variable
    • Change reference to mutable
    • Add safe cast
    • Convert to %type% using dereference
    • Convert to %type% using From trait
    • Convert to %type% using TryFrom trait
    • Convert to %type% using FromStr trait
    • Convert to %type% using ToOwned trait
    • Convert to %type% using ToString trait
    • Convert to %type% using Borrow trait
    • Convert to %type% using BorrowMut trait
    • Convert to %type% using AsRef trait
    • Convert to %type% using AsMut trait
    • Convert to %type% using AsMut trait
    • Convert to &str
    • Convert to &mut str
  • E0309: A parameter type is missing an explicit lifetime bound and may not live long enough.

  • E0310: A parameter type is missing a lifetime constraint or has a lifetime that does not live long enough.

  • E0316: A where clause contains a nested quantification over lifetimes.

  • E0317: An if expression is missing an else block.

  • E0321: A cross-crate opt-out trait was implemented on something which wasn’t a struct or enum type.

  • E0322: The Sized trait was implemented explicitly.

  • E0323: An associated const was implemented when another trait item was expected.

  • E0324: A method was implemented when another trait item was expected.

  • E0325: An associated type was implemented when another trait item was expected.

  • E0326: An implementation of a trait doesn’t match the type constraint.

  • E0328: The Unsize trait should not be implemented directly. All implementations of Unsize are provided automatically by the compiler.

  • E0364: Private items cannot be publicly re-exported. This error indicates that you attempted to pub use a type or value that was not itself public. #5759

    Quick fixes:

    • Make public
  • E0365: Private modules cannot be publicly re-exported. This error indicates that you attempted to pub use a module that was not itself public. #5759

    Quick fixes:

    • Make public
  • E0366: An attempt was made to implement Drop on a concrete specialization of a generic type. An example is shown below:

  • E0367: An attempt was made to implement Drop on a specialization of a generic type.

  • E0368: A binary assignment operator like += or ^= was applied to a type that doesn’t support it. #5651

  • E0369: A binary operation was attempted on a type which doesn’t support it. #5651

  • E0370: The maximum value of an enum was reached, so it cannot be automatically set in the next enum value.

  • E0371: A trait was implemented on another which already automatically implemented it.

  • E0373: A captured variable in a closure may not live long enough.

  • E0374: CoerceUnsized was implemented on a struct which does not contain a field with an unsized type.

  • E0375: CoerceUnsized was implemented on a struct which contains more than one field with an unsized type.

  • E0376: CoerceUnsized was implemented on something that isn’t a struct.

  • E0378: The DispatchFromDyn trait was implemented on something which is not a pointer or a newtype wrapper around a pointer.

  • E0379: A trait method was declared const.

  • E0380: An auto trait was declared with a method or an associated item.

  • E0381: It is not allowed to use or capture an uninitialized variable.

    Implemented as a part of RsBorrowCheckerInspection. Doesn’t use RsDiagnostic for some reason.

  • E0382: A variable was used after its contents have been moved elsewhere.

  • E0384: An immutable variable was reassigned.

    Quick fixes:

    • Make mutable
  • E0390: A method was implemented on a primitive type.

  • E0391: A type dependency cycle has been encountered.

  • E0392: A type or lifetime parameter has been declared but is not actually used.

    Quick fixes:

    • Remove unused item
  • E0393: A type parameter which references Self in its default value was not specified.

  • E0401: Inner items do not inherit type or const parameters from the functions they are embedded in.

  • E0403: Some type parameters have the same name.

  • E0404: A type that is not a trait was used in a trait position, such as a bound or impl.

  • E0405: The code refers to a trait that is not in scope.

  • E0407: A definition of a method not in the implemented trait was given in a trait implementation.

    Quick fixes:

    • Remove method
    • Add method to trait
    • Extract method to inherent impl
  • E0408: An “or” pattern was used where the variable bindings are not consistently bound across patterns.

  • E0409: An “or” pattern was used where the variable bindings are not consistently bound across patterns.

  • E0411: The Self keyword was used outside an impl, trait, or type definition.

  • E0412: A used type name is not in scope.

  • E0415: More than one function parameter have the same name.

  • E0416: An identifier is bound more than once in a pattern. #6259

  • E0422: An identifier that is neither defined nor a struct was used.

  • E0423: An identifier was used like a function name or a value was expected and the identifier exists but it belongs to a different namespace.

  • E0424: The self keyword was used inside of an associated function without a “self receiver” parameter.

    Quick fixes:

    • Add self to function
  • E0425: An unresolved name was used.

  • E0426: An undeclared label was used.

  • E0428: A type or module has been defined more than once.

  • E0429: The self keyword cannot appear alone as the last segment in a use declaration. #8972

  • E0430: The self import appears more than once in the list. #9020

  • E0431: An invalid self import was made. #8972

  • E0432: An import was unresolved.

  • E0433: An undeclared type or module was used.

    Implemented in some specific cases.

  • E0434: A variable used inside an inner function comes from a dynamic environment. #9272

    Quick fixes:

  • E0435: A non-constant value was used in a constant expression. #5427

    Implemented in some specific cases.

  • E0436: The functional record update syntax was used on something other than a struct.

  • E0437: An associated type whose name does not match any of the associated types in the trait was used when implementing the trait.

  • E0438: An associated constant whose name does not match any of the associated constants in the trait was used when implementing the trait.

  • E0445: A private trait was used on a public type parameter bound.

  • E0446: A private type was used in a public type signature.

  • E0449: A visibility qualifier was used when it was unnecessary.

    Quick fixes:

    • Remove visibility qualifier #6304
  • E0451: A struct constructor with private fields was invoked.

    Quick fixes:

    • Make public
  • E0452: An invalid lint attribute has been given.

  • E0453: A lint check attribute was overruled by a forbid directive set as an attribute on an enclosing scope, or on the command line with the -F option.

  • E0454: A link name was given with an empty name.

  • E0455: Linking with kind=framework is only supported when targeting macOS, as frameworks are specific to that operating system.

  • E0458: An unknown “kind” was specified for a link attribute.

  • E0459: A link was used without a name parameter.

  • E0463: A plugin/crate was declared but cannot be found.

  • E0464: The compiler found multiple library files with the requested crate name.

  • E0466: Macro import declaration was malformed.

  • E0468: A non-root module tried to import macros from another crate.

  • E0469: A macro listed for import was not found.

  • E0478: A lifetime bound was not satisfied.

  • E0491: A reference has a longer lifetime than the data it references.

  • E0492: A borrow of a constant containing interior mutability was attempted.

  • E0493: A value with a custom Drop implementation may be dropped during const-eval.

  • E0496: A lifetime name is shadowing another lifetime name.

  • E0498: The plugin attribute was malformed.

  • E0499: A variable was borrowed as mutable more than once.

  • E0500: A borrowed variable was used by a closure.

  • E0501: A mutable variable is used but it is already captured by a closure.

  • E0502: A variable already borrowed as immutable was borrowed as mutable.

  • E0503: A value was used after it was mutably borrowed.

  • E0505: A value was moved out while it was still borrowed.

  • E0506: An attempt was made to assign to a borrowed value.

  • E0507: A borrowed value was moved out.

  • E0508: A value was moved out of a non-copy fixed-size array.

  • E0509: This error occurs when an attempt is made to move out of a value whose type implements the Drop trait.

  • E0510: The matched value was assigned in a match guard.

  • E0511: Invalid monomorphization of an intrinsic function was used.

  • E0512: Transmute with two differently sized types was attempted.

  • E0515: A reference to a local variable was returned.

  • E0516: The typeof keyword is currently reserved but unimplemented.

  • E0517: A #[repr(…)] attribute was placed on an unsupported item.

    Quick fixes:

    • Remove %element%
  • E0518: An #[inline(…)] attribute was incorrectly placed on something other than a function or method.

    Quick fixes:

    • Remove inline attribute
  • E0520: A non-default implementation was already made on this type so it cannot be specialized further.

  • E0521: Borrowed data escapes outside of closure.

  • E0522: The lang attribute was used in an invalid context.

  • E0524: A variable which requires unique access is being used in more than one closure at the same time.

  • E0525: A closure was used but didn’t implement the expected trait.

  • E0527: The number of elements in an array or slice pattern differed from the number of elements in the array being matched.

  • E0528: An array or slice pattern required more elements than were present in the matched array.

  • E0529: An array or slice pattern was matched against some other type.

  • E0530: A binding shadowed something it shouldn’t.

  • E0531: An unknown tuple struct/variant has been used.

  • E0532: Pattern arm did not match expected kind.

  • E0533: An item which isn’t a unit struct, a variant, nor a constant has been used as a match pattern.

  • E0534: The inline attribute was malformed.

  • E0535: An unknown argument was given to the inline attribute.

  • E0536: The not cfg-predicate was malformed.

  • E0537: An unknown predicate was used inside the cfg attribute. #7102

    Quick fixes:

  • E0538: Attribute contains same meta item more than once.

  • E0539: An invalid meta-item was used inside an attribute.

  • E0541: An unknown meta item was used.

  • E0542: The since value is missing in a stability attribute.

  • E0543: The note value is missing in a stability attribute.

  • E0544: Multiple stability attributes were declared on the same item.

  • E0545: The issue value is incorrect in a stability attribute.

  • E0546: The feature value is missing in a stability attribute.

  • E0547: The issue value is missing in a stability attribute.

  • E0549: A deprecated attribute wasn’t paired with a stable/unstable attribute with #![feature(staged_api)] enabled.

  • E0551: An invalid meta-item was used inside an attribute.

  • E0552: A unrecognized representation attribute was used.

    Quick fixes:

    • Remove %element%
  • E0554: Feature attributes are only allowed on the nightly release channel. Stable or beta compilers will not comply. #8616 #8867

  • E0556: The feature attribute was badly formed.

  • E0557: A feature attribute named a feature that has been removed.

  • E0559: An unknown field was specified into an enum’s structure variant.

  • E0560: An unknown field was specified into a structure.

  • E0561: A non-ident or non-wildcard pattern has been used as a parameter of a function pointer type.

  • E0562: Abstract return types (written impl Trait for some trait Trait) are only allowed as function and inherent impl return types.

  • E0565: A literal was used in a built-in attribute that doesn’t support literals.

  • E0566: Conflicting representation hints have been used on a same item.

  • E0567: Generics have been used on an auto trait.

  • E0568: A super trait has been added to an auto trait.

  • E0569: If an impl has a generic parameter with the #[may_dangle] attribute, then that impl must be declared as an unsafe impl.

    Quick fixes:

    • Add unsafe
  • E0570: The requested ABI is unsupported by the current target.

  • E0571: A break statement with an argument appeared in a non-loop loop.

  • E0572: A return statement was found outside of a function body.

  • E0573: Something other than a type has been used when one was expected.

  • E0574: Something other than a struct, variant or union has been used when one was expected.

  • E0575: Something other than a type or an associated type was given.

  • E0576: An associated item wasn’t found in the given type.

  • E0577: Something other than a module was found in visibility scope.

  • E0578: A module cannot be found and therefore, the visibility cannot be determined.

  • E0579: A lower range wasn’t less than the upper range.

  • E0580: The main function was incorrectly declared.

  • E0581: In a fn type, a lifetime appears only in the return type and not in the arguments types.

  • E0582: A lifetime is only present in an associated-type binding, and not in the input types to the trait.

  • E0583: A file wasn’t found for an out-of-line module.

    Quick fixes:

    • Create module file
  • E0584: A doc comment that is not attached to anything has been encountered.

  • E0585: A documentation comment that doesn’t document anything was found.

  • E0586: An inclusive range was used with no end.

  • E0587: A type has both packed and align representation hints.

  • E0588: A type with packed representation hint has a field with align representation hint.

  • E0589: The value of N that was specified for repr(align(N)) was not a power of two, or was greater than 2^29.

  • E0590: break or continue keywords were used in a condition of a while loop without a label.

  • E0591: Per RFC 401, if you have a function declaration foo:

  • E0592: This error occurs when you defined methods or associated functions with same name.

  • E0593: You tried to supply an Fn-based type with an incorrect number of arguments than what was expected.

  • E0594: A non-mutable value was assigned a value.

    Quick fixes:

    • Make mutable
  • E0596: This error occurs because you tried to mutably borrow a non-mutable variable.

  • E0597: This error occurs because a value was dropped while it was still borrowed

  • E0599: This error occurs when a method is used on a type which doesn’t implement it:

  • E0600: An unary operator was used on a type which doesn’t implement it.

  • E0601: No main function was found in a binary crate. #5477

    Quick fixes:

    • Add main function
  • E0602: An unknown lint was used on the command line.

  • E0603: A private item was used outside its scope.

    Quick fixes:

    • Make public
  • E0604: A cast to char was attempted on a type other than u8.

  • E0605: An invalid cast was attempted.

  • E0606: An incompatible cast was attempted.

  • E0607: A cast between a thin and a fat pointer was attempted.

  • E0608: An attempt to use index on a type which doesn’t implement the std::ops::Index trait was performed.

  • E0609: Attempted to access a non-existent field in a struct. https://github.com/intellij-rust/intellij-rust/issues/8325

  • E0610: Attempted to access a field on a primitive type.

  • E0614: Attempted to dereference a variable which cannot be dereferenced.

  • E0615: Attempted to access a method like a field.

  • E0616: Attempted to access a private field on a struct.

    Quick fixes:

    • Make public
  • E0617: Attempted to pass an invalid type of variable into a variadic function.

  • E0618: Attempted to call something which isn’t a function nor a method.

  • E0620: A cast to an unsized type was attempted.

  • E0621: This error code indicates a mismatch between the lifetimes appearing in the function signature (i.e., the parameter types and the return type) and the data-flow found in the function body.

  • E0622: An intrinsic was declared without being a function.

  • E0623: A lifetime didn’t match what was expected.

  • E0624: A private item was used outside of its scope.

    Quick fixes:

    • Make public
  • E0625: A compile-time const variable is referring to a thread-local static variable.

  • E0626: This error occurs because a borrow in a generator persists across a yield point.

  • E0627: A yield expression was used outside of the generator literal.

  • E0628: More than one parameter was used for a generator.

  • E0631: This error indicates a type mismatch in closure arguments.

  • E0634: A type has conflicting packed representation hints.

  • E0635: The #![feature] attribute specified an unknown feature.

  • E0636: A #![feature] attribute was declared multiple times.

  • E0637: An underscore _ character has been used as the identifier for a lifetime.

  • E0638: This error indicates that the struct, enum or enum variant must be matched non-exhaustively as it has been marked as non_exhaustive.

  • E0639: This error indicates that the struct, enum or enum variant cannot be instantiated from outside of the defining crate as it has been marked as non_exhaustive and as such more fields/variants may be added in future that could cause adverse side effects for this code.

  • E0641: Attempted to cast to/from a pointer with an unknown kind.

  • E0642: Trait methods currently cannot take patterns as arguments.

  • E0643: This error indicates that there is a mismatch between generic parameters and impl Trait parameters in a trait declaration versus its impl.

  • E0644: A closure or generator was constructed that references its own type.

  • E0646: It is not possible to define main with a where clause.

  • E0647: The start function was defined with a where clause.

  • E0648: An export_name attribute contains null characters (\0).

  • E0657: A lifetime bound on a trait implementation was captured at an incorrect place.

  • E0658: An unstable feature was used.

    Supported only for some compiler features

    Quick fixes:

    • Add feature attribute (available only with nightly compiler)
  • E0659: An item usage is ambiguous.

  • E0666: impl Trait types cannot appear nested in the generic arguments of other impl Trait types.

  • E0667: impl Trait is not allowed in path parameters

  • E0670: Rust 2015 does not permit the use of async fn.

  • E0688: In-band lifetimes were mixed with explicit lifetime binders.

    Quick fixes:

    • Create lifetime parameter
  • E0689: A method was called on an ambiguous numeric type.

  • E0690: A struct with the representation hint repr(transparent) had zero or more than one fields that were not guaranteed to be zero-sized.

  • E0691: A struct, enum, or union with the repr(transparent) representation hint contains a zero-sized field that requires non-trivial alignment.

  • E0692: A repr(transparent) type was also annotated with other, incompatible representation hints.

  • E0693: align representation hint was incorrectly declared.

  • E0695: A break statement without a label appeared inside a labeled block.

  • E0696: A function is using continue keyword incorrectly.

  • E0697: A closure has been used as static.

  • E0698: When using generators (or async) all type variables must be bound so a generator can be constructed.

  • E0699: A method was called on a raw pointer whose inner type wasn’t completely known.

  • E0700: The impl Trait return type captures lifetime parameters that do not appear within the impl Trait itself.

  • E0701: This error indicates that a #[non_exhaustive] attribute was incorrectly placed on something other than a struct or enum.

  • E0703: Invalid ABI (Application Binary Interface) used in the code. #7640

    Quick fixes:

    • Change to %valid_abi_name%
  • E0704: An incorrect visibility restriction was specified.

    Quick fixes:

    • Fix visibility restriction
  • E0705: A #![feature] attribute was declared for a feature that is stable in the current edition, but not in all editions.

  • E0706: async fns are not yet supported in traits in Rust.

  • E0708: async non-move closures with parameters are currently not supported.

  • E0710: An unknown tool name was found in a scoped lint.

  • E0712: A borrow of a thread-local variable was made inside a function which outlived the lifetime of the function.

  • E0713: This error occurs when an attempt is made to borrow state past the end of the lifetime of a type that implements the Drop trait.

  • E0714: A #[marker] trait contained an associated item.

  • E0715: An impl for a #[marker] trait tried to override an associated item.

  • E0716: A temporary value is being dropped while a borrow is still in active use.

  • E0718: A #[lang = “…”] attribute was placed on the wrong item type.

  • E0719: An associated type value was specified more than once.

  • E0720: An impl Trait type expands to a recursive type.

  • E0722: The optimize attribute was malformed.

  • E0724: #[ffi_returns_twice] was used on something other than a foreign function declaration.

  • E0725: A feature attribute named a feature that was disallowed in the compiler command line flags.

  • E0726: An argument lifetime was elided in an async function.

  • E0727: A yield clause was used in an async context.

  • E0728: await has been used outside async function or async block. #9251

    Quick fixes:

    • Make function/lambda async #9251
    • Surround with async block / Add async to block
  • E0730: An array without a fixed length was pattern-matched.

  • E0731: An enum with the representation hint repr(transparent) had zero or more than one variants.

  • E0732: An enum with a discriminant must specify a #[repr(inttype)].

    Quick fixes:

    • Add repr attribute
  • E0733: An async function used recursion without boxing. #9256

    Quick fixes:

  • E0734: A stability attribute has been used outside of the standard library.

  • E0735: Type parameter defaults cannot use Self on structs, enums, or unions.

  • E0736: #[track_caller] and #[naked] cannot both be applied to the same function.

  • E0737: #[track_caller] requires functions to have the “Rust” ABI for implicitly receiving caller location. See RFC 2091 for details on this and other restrictions.

  • E0739: #[track_caller] can not be applied on struct.

  • E0740: A union was declared with fields with destructors.

  • E0741: A non-structural-match type was used as the type of a const generic parameter.

  • E0742: Visibility is restricted to a module which isn’t an ancestor of the current item. #9000

  • E0743: The C-variadic type has been nested inside another type.

  • E0744: A control-flow expression was used inside a const context.

  • E0745: The address of temporary value was taken.

  • E0746: An unboxed trait object was used as a return value.

  • E0747: Generic arguments were not provided in the same order as the corresponding generic parameters are declared. #8144

  • E0748: A raw string isn’t correctly terminated because the trailing # count doesn’t match its leading # count.

  • E0749: An item was added on a negative impl.

  • E0750: A negative impl was made default impl.

  • E0751: There are both a positive and negative trait implementation for the same type.

  • E0752: The entry point of the program was marked as async.

  • E0753: An inner doc comment was used in an invalid context.

  • E0754: An non-ascii identifier was used in an invalid context.

  • E0755: The ffi_pure attribute was used on a non-foreign function.

  • E0756: The ffi_const attribute was used on something other than a foreign function declaration.

  • E0757: A function was given both the ffi_const and ffi_pure attributes.

  • E0758: A multi-line (doc-)comment is unterminated.

  • E0760: async fn/impl trait return type cannot contain a projection or Self that references lifetimes from a parent scope.

  • E0761: Multiple candidate files were found for an out-of-line module.

  • E0762: A character literal wasn’t ended with a quote.

  • E0763: A byte constant wasn’t correctly ended.

  • E0764: Mutable references (&mut) can only be used in constant functions, not statics or constants.

  • E0765: A double quote string (") was not terminated.

  • E0766: A double quote byte string (b") was not terminated.

  • E0767: An unreachable label was used.

  • E0768: A number in a non-decimal base has no digits.

  • E0769: A tuple struct or tuple variant was used in a pattern as if it were a struct or struct variant.

  • E0770: The type of a const parameter references other generic parameters.

  • E0771: A non-'static lifetime was used in a const generic. This is currently not allowed.

  • E0773: A builtin-macro was defined more than once.

  • E0774: derive was applied on something which is not a struct, a union or an enum.

  • E0775: #[cmse_nonsecure_entry] is only valid for targets with the TrustZone-M extension.

  • E0776: #[cmse_nonsecure_entry] functions require a C ABI

  • E0777: A literal value was used inside #[derive].

  • E0778: The instruction_set attribute was malformed.

  • E0779: An unknown argument was given to the instruction_set attribute.

  • E0780: Cannot use doc(inline) with anonymous imports

  • E0781: The C-cmse-nonsecure-call ABI can only be used with function pointers.

  • E0782: Trait objects must include the dyn keyword.

  • E0783: The range pattern is no longer allowed.

  • E0784: A union expression does not have exactly one field.

  • E0785: An inherent impl was written on a dyn auto trait.

  • E0786: A metadata file was invalid.

  • E0787: An unsupported naked function definition.

  • E0788: A #[no_coverage] attribute was applied to something which does not show up in code coverage, or is too granular to be excluded from the coverage report.

  • E0790: You need to specify a specific implementation of the trait in order to call the method.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:24
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
Undincommented, Oct 26, 2020

Note, I’ve updated this issue. Now it contains all compiler errors that the compiler can emit according to https://doc.rust-lang.org/error-index.html. I’ve updated the statuses of them in the plugin and also added the corresponding quick fixes. Don’t hesitate to fix any inaccuracy or point maintainers to update something in the issue

1reaction
Undincommented, Apr 18, 2022

@WindSoilder Actually, it’s already implemented (at least partially), but in most cases it’s disabled by default not to produce false positive errors. To try it, disable Ignore unresolved references without quick fix option for Rust / Unresolved reference inspection in Preferences | Editor | Inspections settings image Note, this inspection detects not only unresolved method references but also other unresolved references and it may produce false positives. In most cases, false positives are caused by one of the following reasons:

  • procedural macros. See #6908 how to turn on the experimental procedural macro support
  • various bugs in type inference engine
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Handling - The Rust Programming Language
Rust groups errors into two major categories: recoverable and unrecoverable errors. For a recoverable error, such as a file not found error, we...
Read more >
Error Handling - The Rust Programming Language
Like most programming languages, Rust encourages the programmer to handle errors in a particular way. Generally speaking, error handling is divided into two ......
Read more >
Testing Errors in Rust | Yury Zhauniarovich
In Rust, these errors are represented by a structure ... Both these unit tests check if the function under the test generates an...
Read more >
Handle Error Variants - Rust Cookbook
Handles error that occur when trying to open a file that does not exist. It is achieved by using error-chain, a library that...
Read more >
Beginner's guide to Error Handling in Rust - Shesh's blog
Ignore the error · Terminate the program · Use a fallback value · Bubble up the error · Bubble up multiple errors ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found