proc_macro::Diagnostic - Rust
Description: API documentation for the Rust `Diagnostic` struct in crate `proc_macro`.
Keywords: rust, rustlang, rust-lang, Diagnostic

# Struct proc_macro::Diagnostic [−] [src]

    pub struct Diagnostic { /* fields omitted */ }

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

A structure representing a diagnostic message and associated children messages.

## Methods

### `impl Diagnostic`
[src]

#### `pub fn new<T: Into<String>>(level: Level, message: T) -> Diagnostic`
[src]

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

Create a new diagnostic with the given `level` and `message`.

#### `pub fn spanned<T: Into<String>>(
span: Span,
level: Level,
message: T
) -> Diagnostic`
[src]

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

Create a new diagnostic with the given `level` and `message` pointing to the given `span`.

#### `pub fn span_error<T: Into<String>>(self, span: Span, message: T) -> Diagnostic`
[src]

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

Add a new child diagnostic message to `self` with the level identified by this methods name with the given `span` and `message`.

#### `pub fn error<T: Into<String>>(self, message: T) -> Diagnostic`
[src]

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

Add a new child diagnostic message to `self` with the level identified by this method's name with the given `message`.

#### `pub fn span_warning<T: Into<String>>(self, span: Span, message: T) -> Diagnostic`
[src]

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

Add a new child diagnostic message to `self` with the level identified by this methods name with the given `span` and `message`.

#### `pub fn warning<T: Into<String>>(self, message: T) -> Diagnostic`
[src]

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

Add a new child diagnostic message to `self` with the level identified by this method's name with the given `message`.

#### `pub fn span_note<T: Into<String>>(self, span: Span, message: T) -> Diagnostic`
[src]

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

Add a new child diagnostic message to `self` with the level identified by this methods name with the given `span` and `message`.

#### `pub fn note<T: Into<String>>(self, message: T) -> Diagnostic`
[src]

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

Add a new child diagnostic message to `self` with the level identified by this method's name with the given `message`.

#### `pub fn span_help<T: Into<String>>(self, span: Span, message: T) -> Diagnostic`
[src]

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

Add a new child diagnostic message to `self` with the level identified by this methods name with the given `span` and `message`.

#### `pub fn help<T: Into<String>>(self, message: T) -> Diagnostic`
[src]

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

Add a new child diagnostic message to `self` with the level identified by this method's name with the given `message`.

#### `pub fn level(&self) -> Level`
[src]

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

Returns the diagnostic `level` for `self`.

#### `pub fn emit(self)`
[src]

🔬 This is a nightly-only experimental API. (`proc_macro` #38356)

Emit the diagnostic.

## Trait Implementations

### `impl Clone for Diagnostic`
[src]

#### `fn clone(&self) -> Diagnostic`
[src]

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`
1.0.0
[src]

Performs copy-assignment from `source`. Read more

### `impl Debug for Diagnostic`
[src]

#### `fn fmt(&self, __arg_0: &mut Formatter) -> Result`
[src]

Formats the value using the given formatter.

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)