about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-11-28 11:17:45 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2022-11-29 12:54:45 +1100
commita709f87be7d66e8a91c5ee2818cac6f077caac08 (patch)
tree49ff2e0daaff47dd3c7b9295ea6479859d7e89ab /src/test
parentfc2a8a0c675bf7d111846b19fd3d5d7a13915425 (diff)
downloadrust-a709f87be7d66e8a91c5ee2818cac6f077caac08.tar.gz
rust-a709f87be7d66e8a91c5ee2818cac6f077caac08.zip
Avoid more unnecessary `MetaItem`/`Attribute` conversions.
In `Expander::expand` the code currently uses `mk_attr_outer` to convert
a `MetaItem` to an `Attribute`, and then follows that with
`meta_item_list` which converts back. This commit avoids the unnecessary
conversions.

There was one wrinkle: the existing conversions caused the bogus `<>` on
`Default<>` to be removed. With the conversion gone, we get a second
error message about the `<>`. This is a rare case, so I think it
probably doesn't matter much.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/span/macro-ty-params.rs4
-rw-r--r--src/test/ui/span/macro-ty-params.stderr8
2 files changed, 10 insertions, 2 deletions
diff --git a/src/test/ui/span/macro-ty-params.rs b/src/test/ui/span/macro-ty-params.rs
index 0a93105b664..cf28b0255d1 100644
--- a/src/test/ui/span/macro-ty-params.rs
+++ b/src/test/ui/span/macro-ty-params.rs
@@ -9,5 +9,7 @@ macro_rules! foo { () => () }
 fn main() {
     foo::<T>!(); //~ ERROR generic arguments in macro path
     foo::<>!(); //~ ERROR generic arguments in macro path
-    m!(Default<>); //~ ERROR unexpected generic arguments in path
+    m!(Default<>);
+    //~^ ERROR unexpected generic arguments in path
+    //~^^ ERROR generic arguments in macro path
 }
diff --git a/src/test/ui/span/macro-ty-params.stderr b/src/test/ui/span/macro-ty-params.stderr
index 138cd2598a1..7023ef8cd1c 100644
--- a/src/test/ui/span/macro-ty-params.stderr
+++ b/src/test/ui/span/macro-ty-params.stderr
@@ -16,5 +16,11 @@ error: unexpected generic arguments in path
 LL |     m!(Default<>);
    |               ^^
 
-error: aborting due to 3 previous errors
+error: generic arguments in macro path
+  --> $DIR/macro-ty-params.rs:12:15
+   |
+LL |     m!(Default<>);
+   |               ^^
+
+error: aborting due to 4 previous errors