about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-02-24 17:25:58 +0000
committerbors <bors@rust-lang.org>2019-02-24 17:25:58 +0000
commite99611bc39207946be13f6b5b9645baae81ef5ab (patch)
treede83748a14204cdba34ed2fb25ab0c9f35f23de5
parent5833e4d26e25f4f9a78a7fb7d5a7782973b4ece2 (diff)
parent8bcd546648d9ed16659d571380f41f3fbf7e0a47 (diff)
downloadrust-e99611bc39207946be13f6b5b9645baae81ef5ab.tar.gz
rust-e99611bc39207946be13f6b5b9645baae81ef5ab.zip
Auto merge of #3811 - rust-lang:test-for-2526, r=mcarton
Add a test for #2526

Closes #2526, which seems to have been fixed at some point, but I couldn't find a test for it.
-rwxr-xr-xtests/ui/proc_macro.rs8
-rw-r--r--tests/ui/proc_macro.stderr10
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/proc_macro.rs b/tests/ui/proc_macro.rs
new file mode 100755
index 00000000000..dd8bd58c015
--- /dev/null
+++ b/tests/ui/proc_macro.rs
@@ -0,0 +1,8 @@
+//! Check that we correctly lint procedural macros.
+
+#![crate_type = "proc-macro"]
+
+#[allow(dead_code)]
+fn f() {
+    let _x = 3.14;
+}
diff --git a/tests/ui/proc_macro.stderr b/tests/ui/proc_macro.stderr
new file mode 100644
index 00000000000..ec19cd8fc5f
--- /dev/null
+++ b/tests/ui/proc_macro.stderr
@@ -0,0 +1,10 @@
+error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly
+  --> $DIR/proc_macro.rs:7:14
+   |
+LL |     let _x = 3.14;
+   |              ^^^^
+   |
+   = note: #[deny(clippy::approx_constant)] on by default
+
+error: aborting due to previous error
+