Rollup merge of #83015 - hyd-dev:test-79825-81555, r=Aaron1011

Add regression tests for #79825 and #81555

Closes #79825.
Closes #81555.

`@rustbot` label A-proc-macros T-compiler
This commit is contained in:
Dylan DPC 2021-04-01 02:41:44 +02:00 committed by GitHub
commit 9e30e57eeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,14 @@
// force-host
// no-prefer-dynamic
#![crate_type = "proc-macro"]
extern crate proc_macro;
use proc_macro::TokenStream;
#[proc_macro_attribute]
pub fn assert_input(args: TokenStream, input: TokenStream) -> TokenStream {
assert_eq!(input.to_string(), "trait Alias = Sized ;");
assert!(args.is_empty());
TokenStream::new()
}

View File

@ -0,0 +1,10 @@
// check-pass
// aux-build:issue-79825.rs
#![feature(trait_alias)]
extern crate issue_79825;
#[issue_79825::assert_input]
trait Alias = Sized;
fn main() {}

View File

@ -0,0 +1,15 @@
// check-pass
// aux-build:test-macros.rs
#![feature(stmt_expr_attributes, proc_macro_hygiene)]
extern crate test_macros;
use test_macros::identity_attr;
#[identity_attr]
fn main() {
let _x;
let y = ();
#[identity_attr]
_x = y;
}