summary refs log tree commit diff
path: root/src/librustc_expand
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-03-09 22:09:51 +0000
committerbors <bors@rust-lang.org>2020-03-09 22:09:51 +0000
commitb8cedc00407a4c56a3bda1ed605c6fc166655447 (patch)
treec6dcbe9711ea6d5a31429a833a3d0c59cbbb2578 /src/librustc_expand
parentb08d07143d2b61777d341f8658281adc0f2ac809 (diff)
parent133f659766c60ff7a33288ae6f33b0c272792f57 (diff)
downloadrust-1.42.0.tar.gz
rust-1.42.0.zip
Auto merge of #69854 - pietroalbini:stable-next, r=Centril 1.42.0
[stable] Release 1.42.0

This PR prepares the release artifacts of Rust 1.42.0, and cherry-picks the following PRs:

* https://github.com/rust-lang/rust/pull/69754: Update deprecation version to 1.42 for Error::description
* https://github.com/rust-lang/rust/pull/69753: Do not ICE when matching an uninhabited enum's field
* https://github.com/rust-lang/rust/pull/69522 / https://github.com/rust-lang/rust/pull/69853: error_derive_forbidden_on_non_adt: be more graceful
* https://github.com/rust-lang/rust/pull/68598:  Fix null synthetic_implementors error

In addition, the release notes are updated to include the remaining compatibility notes.

r? @Centril
Diffstat (limited to 'src/librustc_expand')
-rw-r--r--src/librustc_expand/expand.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/librustc_expand/expand.rs b/src/librustc_expand/expand.rs
index f915f44c17a..a65ba8903be 100644
--- a/src/librustc_expand/expand.rs
+++ b/src/librustc_expand/expand.rs
@@ -435,14 +435,13 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
                         _ => unreachable!(),
                     };
                     if !item.derive_allowed() {
-                        let attr = attr::find_by_name(item.attrs(), sym::derive)
-                            .expect("`derive` attribute should exist");
-                        let span = attr.span;
+                        let attr = attr::find_by_name(item.attrs(), sym::derive);
+                        let span = attr.map_or(item.span(), |attr| attr.span);
                         let mut err = self.cx.struct_span_err(
                             span,
                             "`derive` may only be applied to structs, enums and unions",
                         );
-                        if let ast::AttrStyle::Inner = attr.style {
+                        if let Some(ast::Attribute { style: ast::AttrStyle::Inner, .. }) = attr {
                             let trait_list = derives
                                 .iter()
                                 .map(|t| pprust::path_to_string(t))