diff options
| author | bors <bors@rust-lang.org> | 2018-07-20 22:52:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-07-20 22:52:11 +0000 |
| commit | ee8d23d54445f8d3e62a5e2bd6fde9ac3ff2cf24 (patch) | |
| tree | 5b1993b8da7f303046ad60ce690ca657cb34bced /src/libsyntax | |
| parent | 878dd0b5e19e086e608351f33bf12e3625425f20 (diff) | |
| parent | 7bf3578a39e71d61a22beaa121ebd25de2b25738 (diff) | |
| download | rust-ee8d23d54445f8d3e62a5e2bd6fde9ac3ff2cf24.tar.gz rust-ee8d23d54445f8d3e62a5e2bd6fde9ac3ff2cf24.zip | |
Auto merge of #52574 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests Successful merges: - #52502 (fix unsafety: don't call ptr_rotate for ZST) - #52505 (rustc: Remove a workaround in ThinLTO fixed upstream) - #52526 (Enable run-pass/sepcomp-lib-lto.rs on Android) - #52527 (Remove duplicate E0396 tests) - #52539 (rustc: Fix two custom attributes with custom derive) - #52540 (Fix docker/run.sh script when run locally) - #52573 (Cleanups) Failed merges: r? @ghost
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 1241e230b26..d64f3de8daa 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -240,6 +240,13 @@ impl Invocation { InvocationKind::Derive { ref path, .. } => path.span, } } + + pub fn attr_id(&self) -> Option<ast::AttrId> { + match self.kind { + InvocationKind::Attr { attr: Some(ref attr), .. } => Some(attr.id), + _ => None, + } + } } pub struct MacroExpander<'a, 'b:'a> { @@ -331,10 +338,20 @@ impl<'a, 'b> MacroExpander<'a, 'b> { let scope = if self.monotonic { invoc.expansion_data.mark } else { orig_expansion_data.mark }; + let attr_id_before = invoc.attr_id(); let ext = match self.cx.resolver.resolve_invoc(&mut invoc, scope, force) { Ok(ext) => Some(ext), Err(Determinacy::Determined) => None, Err(Determinacy::Undetermined) => { + // Sometimes attributes which we thought were invocations + // end up being custom attributes for custom derives. If + // that's the case our `invoc` will have changed out from + // under us. If this is the case we're making progress so we + // want to flag it as such, and we test this by looking if + // the `attr_id()` method has been changing over time. + if invoc.attr_id() != attr_id_before { + progress = true; + } undetermined_invocations.push(invoc); continue } |
