Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add derive macro for specifying diagnostics using attributes. #75138

Merged
merged 3 commits into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4086,6 +4086,7 @@ dependencies = [
"rustc_hir_pretty",
"rustc_index",
"rustc_infer",
"rustc_macros",
"rustc_middle",
"rustc_session",
"rustc_span",
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_error_codes/src/error_codes/E0224.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
A trait object was declaired with no traits.
A trait object was declared with no traits.

Erroneous code example:

Expand All @@ -8,7 +8,7 @@ type Foo = dyn 'static +;

Rust does not currently support this.

To solve ensure the the trait object has at least one trait:
To solve, ensure that the trait object has at least one trait:

```
type Foo = dyn 'static + Copy;
Expand Down
13 changes: 13 additions & 0 deletions compiler/rustc_macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![feature(proc_macro_diagnostic)]
#![allow(rustc::default_hash_types)]
#![recursion_limit = "128"]

Expand All @@ -9,6 +10,7 @@ mod hash_stable;
mod lift;
mod query;
mod serialize;
mod session_diagnostic;
mod symbols;
mod type_foldable;

Expand Down Expand Up @@ -36,3 +38,14 @@ decl_derive!([MetadataDecodable] => serialize::meta_decodable_derive);
decl_derive!([MetadataEncodable] => serialize::meta_encodable_derive);
decl_derive!([TypeFoldable, attributes(type_foldable)] => type_foldable::type_foldable_derive);
decl_derive!([Lift, attributes(lift)] => lift::lift_derive);
decl_derive!(
[SessionDiagnostic, attributes(
message,
lint,
error,
label,
suggestion,
suggestion_short,
suggestion_hidden,
suggestion_verbose)] => session_diagnostic::session_diagnostic_derive
);
Loading