[][src]Struct rustc_errors::CodeSuggestion

pub struct CodeSuggestion {
    pub substitutions: Vec<Substitution>,
    pub msg: String,
    pub style: SuggestionStyle,
    pub applicability: Applicability,


substitutions: Vec<Substitution>

Each substitute can have multiple variants due to multiple applicable suggestions

foo.bar might be replaced with a.b or x.y by replacing foo and bar on their own:

    Substitution { parts: vec![(0..3, "a"), (4..7, "b")] },
    Substitution { parts: vec![(0..3, "x"), (4..7, "y")] },

or by replacing the entire span:

    Substitution { parts: vec![(0..7, "a.b")] },
    Substitution { parts: vec![(0..7, "x.y")] },
msg: Stringstyle: SuggestionStyle

Visual representation of this suggestion.

applicability: Applicability

Whether or not the suggestion is approximate

Sometimes we may show suggestions with placeholders, which are useful for users but not useful for tools like rustfix


impl CodeSuggestion[src]

pub fn splice_lines(
    sm: &SourceMap
) -> Vec<(String, Vec<SubstitutionPart>, bool)>

Returns the assembled code suggestions, whether they should be shown with an underline and whether the substitution only differs in capitalization.

Trait Implementations

impl Clone for CodeSuggestion[src]

impl Debug for CodeSuggestion[src]

impl<__D: Decoder> Decodable<__D> for CodeSuggestion[src]

impl<__E: Encoder> Encodable<__E> for CodeSuggestion[src]

impl Hash for CodeSuggestion[src]

impl PartialEq<CodeSuggestion> for CodeSuggestion[src]

impl StructuralPartialEq for CodeSuggestion[src]

Auto Trait Implementations

impl RefUnwindSafe for CodeSuggestion

impl !Send for CodeSuggestion

impl !Sync for CodeSuggestion

impl Unpin for CodeSuggestion

impl UnwindSafe for CodeSuggestion

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.