about summary refs log tree commit diff
path: root/src/test/ui/internal
diff options
context:
space:
mode:
authorDanuel <public.danuel@gmail.com>2021-02-01 23:35:53 +0900
committerDanuel <public.danuel@gmail.com>2021-02-01 23:36:19 +0900
commit8bbb2d057d1084368412f5236dfad8990ef98e49 (patch)
tree38f39c0380ddc2c01fb32703592c31918621d7c2 /src/test/ui/internal
parente0d9f793990d20f8f640097e28556886ba5362f0 (diff)
Fixed #[inline] to be warned in fields, arms, macro defs
Add visitors for checking #[inline]

Add visitors for checking #[inline] with struct field

Fix test for #[inline]

Add visitors for checking #[inline] with #[macro_export] macro

Add visitors for checking #[inline] without #[macro_export] macro

Add use alias with Visitor

Fix lint error

Reduce unnecessary variable

Co-authored-by: LingMan <LingMan@users.noreply.github.com>

Change error to warning

Add warning for checking field, arm with #[allow_internal_unstable]

Add name resolver

Formatting

Formatting

Fix error fixture

Add checking field, arm, macro def
Diffstat (limited to 'src/test/ui/internal')
-rw-r--r--src/test/ui/internal/internal-unstable.rs13
-rw-r--r--src/test/ui/internal/internal-unstable.stderr10
2 files changed, 18 insertions, 5 deletions
diff --git a/src/test/ui/internal/internal-unstable.rs b/src/test/ui/internal/internal-unstable.rs
index 94bd6aab23b..b8987d3e13c 100644
--- a/src/test/ui/internal/internal-unstable.rs
+++ b/src/test/ui/internal/internal-unstable.rs
@@ -1,10 +1,17 @@
 // aux-build:internal_unstable.rs
 
 #![feature(allow_internal_unstable)]
+#[allow(dead_code)]
 
 #[macro_use]
 extern crate internal_unstable;
 
+struct Baz {
+    #[allow_internal_unstable]
+    //^ WARN `#[allow_internal_unstable]` is ignored on struct fields and match arms
+    baz: u8,
+}
+
 macro_rules! foo {
     ($e: expr, $f: expr) => {{
         $e;
@@ -40,4 +47,10 @@ fn main() {
     println!("{:?}", internal_unstable::unstable()); //~ ERROR use of unstable
 
     bar!(internal_unstable::unstable()); //~ ERROR use of unstable
+
+    match true {
+        #[allow_internal_unstable]
+        //^ WARN `#[allow_internal_unstable]` is ignored on struct fields and match arms
+        _ => {}
+    }
 }
diff --git a/src/test/ui/internal/internal-unstable.stderr b/src/test/ui/internal/internal-unstable.stderr
index 2e6360c75c4..a92ca4957b5 100644
--- a/src/test/ui/internal/internal-unstable.stderr
+++ b/src/test/ui/internal/internal-unstable.stderr
@@ -1,5 +1,5 @@
 error[E0658]: use of unstable library feature 'function'
-  --> $DIR/internal-unstable.rs:34:25
+  --> $DIR/internal-unstable.rs:41:25
    |
 LL |     pass_through_allow!(internal_unstable::unstable());
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -7,7 +7,7 @@ LL |     pass_through_allow!(internal_unstable::unstable());
    = help: add `#![feature(function)]` to the crate attributes to enable
 
 error[E0658]: use of unstable library feature 'function'
-  --> $DIR/internal-unstable.rs:36:27
+  --> $DIR/internal-unstable.rs:43:27
    |
 LL |     pass_through_noallow!(internal_unstable::unstable());
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -15,7 +15,7 @@ LL |     pass_through_noallow!(internal_unstable::unstable());
    = help: add `#![feature(function)]` to the crate attributes to enable
 
 error[E0658]: use of unstable library feature 'function'
-  --> $DIR/internal-unstable.rs:40:22
+  --> $DIR/internal-unstable.rs:47:22
    |
 LL |     println!("{:?}", internal_unstable::unstable());
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -23,7 +23,7 @@ LL |     println!("{:?}", internal_unstable::unstable());
    = help: add `#![feature(function)]` to the crate attributes to enable
 
 error[E0658]: use of unstable library feature 'function'
-  --> $DIR/internal-unstable.rs:42:10
+  --> $DIR/internal-unstable.rs:49:10
    |
 LL |     bar!(internal_unstable::unstable());
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -31,7 +31,7 @@ LL |     bar!(internal_unstable::unstable());
    = help: add `#![feature(function)]` to the crate attributes to enable
 
 error[E0658]: use of unstable library feature 'function'
-  --> $DIR/internal-unstable.rs:12:9
+  --> $DIR/internal-unstable.rs:19:9
    |
 LL |         internal_unstable::unstable();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^