pub enum CharLitError {
Unterminated,
Empty,
TooLong,
}Expand description
Why a '…' run is not a character literal.
Three variants rather than one, because the lexer’s message is what makes the
difference between the three legible: '' names no character, 'ab' names
two, and 'a never closed. Collapsing them would report the length rule for
a literal whose real problem is a missing quote.
Variants§
Unterminated
No closing ' — the token ran to the end of its line or the file.
Empty
'': the body is empty, so there is no character to name.
TooLong
'ab': the body decodes to more than one Unicode scalar.
This is the variant the feature exists for. "ab"[0] is a well-typed
program that silently means a; 'ab' is a lexical error.
Trait Implementations§
Source§impl Clone for CharLitError
impl Clone for CharLitError
Source§fn clone(&self) -> CharLitError
fn clone(&self) -> CharLitError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for CharLitError
Source§impl Debug for CharLitError
impl Debug for CharLitError
impl Eq for CharLitError
Source§impl PartialEq for CharLitError
impl PartialEq for CharLitError
impl StructuralPartialEq for CharLitError
Auto Trait Implementations§
impl Freeze for CharLitError
impl RefUnwindSafe for CharLitError
impl Send for CharLitError
impl Sync for CharLitError
impl Unpin for CharLitError
impl UnsafeUnpin for CharLitError
impl UnwindSafe for CharLitError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more