summaryrefslogtreecommitdiffstats
path: root/src/test/ui/proc-macro
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/proc-macro')
-rw-r--r--src/test/ui/proc-macro/amputate-span.stderr4
-rw-r--r--src/test/ui/proc-macro/auxiliary/issue-104884.rs23
-rw-r--r--src/test/ui/proc-macro/expand-expr.rs15
-rw-r--r--src/test/ui/proc-macro/expand-expr.stderr14
-rw-r--r--src/test/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs20
-rw-r--r--src/test/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr48
6 files changed, 113 insertions, 11 deletions
diff --git a/src/test/ui/proc-macro/amputate-span.stderr b/src/test/ui/proc-macro/amputate-span.stderr
index 9553ba3da..ab4670411 100644
--- a/src/test/ui/proc-macro/amputate-span.stderr
+++ b/src/test/ui/proc-macro/amputate-span.stderr
@@ -2,7 +2,7 @@ error[E0433]: failed to resolve: use of undeclared type `Command`
--> $DIR/amputate-span.rs:49:5
|
LL | Command::new("git");
- | ^^^^^^^ not found in this scope
+ | ^^^^^^^ use of undeclared type `Command`
|
help: consider importing this struct
|
@@ -13,7 +13,7 @@ error[E0433]: failed to resolve: use of undeclared type `Command`
--> $DIR/amputate-span.rs:63:9
|
LL | Command::new("git");
- | ^^^^^^^ not found in this scope
+ | ^^^^^^^ use of undeclared type `Command`
|
help: consider importing this struct
|
diff --git a/src/test/ui/proc-macro/auxiliary/issue-104884.rs b/src/test/ui/proc-macro/auxiliary/issue-104884.rs
new file mode 100644
index 000000000..0de59d005
--- /dev/null
+++ b/src/test/ui/proc-macro/auxiliary/issue-104884.rs
@@ -0,0 +1,23 @@
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(AddImpl)]
+
+pub fn derive(input: TokenStream) -> TokenStream {
+ "use std::cmp::Ordering;
+
+ impl<T> Ord for PriorityQueue<T> {
+ fn cmp(&self, other: &Self) -> Ordering {
+ self.0.cmp(&self.height)
+ }
+ }
+ "
+ .parse()
+ .unwrap()
+}
diff --git a/src/test/ui/proc-macro/expand-expr.rs b/src/test/ui/proc-macro/expand-expr.rs
index d1146d970..901b3a951 100644
--- a/src/test/ui/proc-macro/expand-expr.rs
+++ b/src/test/ui/proc-macro/expand-expr.rs
@@ -1,5 +1,5 @@
// aux-build:expand-expr.rs
-
+#![feature(concat_bytes)]
extern crate expand_expr;
use expand_expr::{
@@ -23,6 +23,11 @@ expand_expr_is!(
concat!("contents: ", include_str!("auxiliary/included-file.txt"))
);
+expand_expr_is!(
+ b"contents: Included file contents\n",
+ concat_bytes!(b"contents: ", include_bytes!("auxiliary/included-file.txt"))
+);
+
// Correct value is checked for multiple sources.
check_expand_expr_file!(file!());
@@ -118,4 +123,10 @@ expand_expr_fail!(echo_pm!(arbitrary_expression() + "etc"));
const _: u32 = recursive_expand!(); //~ ERROR: recursion limit reached while expanding `recursive_expand!`
-fn main() {}
+fn main() {
+ // https://github.com/rust-lang/rust/issues/104414
+ match b"Included file contents\n" {
+ include_bytes!("auxiliary/included-file.txt") => (),
+ _ => panic!("include_bytes! in pattern"),
+ }
+}
diff --git a/src/test/ui/proc-macro/expand-expr.stderr b/src/test/ui/proc-macro/expand-expr.stderr
index 8dc2d0cfc..c6c4695fd 100644
--- a/src/test/ui/proc-macro/expand-expr.stderr
+++ b/src/test/ui/proc-macro/expand-expr.stderr
@@ -1,29 +1,29 @@
error: expected one of `.`, `?`, or an operator, found `;`
- --> $DIR/expand-expr.rs:101:27
+ --> $DIR/expand-expr.rs:106:27
|
LL | expand_expr_fail!("string"; hello);
| ^ expected one of `.`, `?`, or an operator
error: expected expression, found `$`
- --> $DIR/expand-expr.rs:104:19
+ --> $DIR/expand-expr.rs:109:19
|
LL | expand_expr_fail!($);
| ^ expected expression
error: expected expression, found `$`
- --> $DIR/expand-expr.rs:33:23
+ --> $DIR/expand-expr.rs:38:23
|
LL | ($($t:tt)*) => { $($t)* };
| ^^^^ expected expression
error: expected expression, found `$`
- --> $DIR/expand-expr.rs:106:28
+ --> $DIR/expand-expr.rs:111:28
|
LL | expand_expr_fail!(echo_pm!($));
| ^ expected expression
error: macro expansion ignores token `hello` and any following
- --> $DIR/expand-expr.rs:110:47
+ --> $DIR/expand-expr.rs:115:47
|
LL | expand_expr_is!("string", echo_tts!("string"; hello));
| --------------------^^^^^-- help: you might be missing a semicolon here: `;`
@@ -33,7 +33,7 @@ LL | expand_expr_is!("string", echo_tts!("string"; hello));
= note: the usage of `echo_tts!` is likely invalid in expression context
error: macro expansion ignores token `;` and any following
- --> $DIR/expand-expr.rs:111:44
+ --> $DIR/expand-expr.rs:116:44
|
LL | expand_expr_is!("string", echo_pm!("string"; hello));
| -----------------^-------- help: you might be missing a semicolon here: `;`
@@ -43,7 +43,7 @@ LL | expand_expr_is!("string", echo_pm!("string"; hello));
= note: the usage of `echo_pm!` is likely invalid in expression context
error: recursion limit reached while expanding `recursive_expand!`
- --> $DIR/expand-expr.rs:119:16
+ --> $DIR/expand-expr.rs:124:16
|
LL | const _: u32 = recursive_expand!();
| ^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs b/src/test/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs
new file mode 100644
index 000000000..a0d619c45
--- /dev/null
+++ b/src/test/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs
@@ -0,0 +1,20 @@
+// aux-build:issue-104884.rs
+
+use std::collections::BinaryHeap;
+
+#[macro_use]
+extern crate issue_104884;
+
+#[derive(PartialEq, Eq, PartialOrd, Ord)]
+struct PriorityQueueEntry<T> {
+ value: T,
+}
+
+#[derive(PartialOrd, AddImpl)]
+//~^ ERROR can't compare `PriorityQueue<T>` with `PriorityQueue<T>`
+//~| ERROR the trait bound `PriorityQueue<T>: Eq` is not satisfied
+//~| ERROR can't compare `T` with `T`
+
+struct PriorityQueue<T>(BinaryHeap<PriorityQueueEntry<T>>);
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr b/src/test/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr
new file mode 100644
index 000000000..ac49e04e3
--- /dev/null
+++ b/src/test/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr
@@ -0,0 +1,48 @@
+error[E0277]: can't compare `PriorityQueue<T>` with `PriorityQueue<T>`
+ --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:10
+ |
+LL | #[derive(PartialOrd, AddImpl)]
+ | ^^^^^^^^^^ no implementation for `PriorityQueue<T> == PriorityQueue<T>`
+ |
+ = help: the trait `PartialEq` is not implemented for `PriorityQueue<T>`
+note: required by a bound in `PartialOrd`
+ --> $SRC_DIR/core/src/cmp.rs:LL:COL
+ |
+LL | pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
+ | ^^^^^^^^^^^^^^ required by this bound in `PartialOrd`
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0277]: the trait bound `PriorityQueue<T>: Eq` is not satisfied
+ --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22
+ |
+LL | #[derive(PartialOrd, AddImpl)]
+ | ^^^^^^^ the trait `Eq` is not implemented for `PriorityQueue<T>`
+ |
+note: required by a bound in `Ord`
+ --> $SRC_DIR/core/src/cmp.rs:LL:COL
+ |
+LL | pub trait Ord: Eq + PartialOrd<Self> {
+ | ^^ required by this bound in `Ord`
+ = note: this error originates in the derive macro `AddImpl` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0277]: can't compare `T` with `T`
+ --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22
+ |
+LL | #[derive(PartialOrd, AddImpl)]
+ | ^^^^^^^ no implementation for `T < T` and `T > T`
+ |
+note: required for `PriorityQueue<T>` to implement `PartialOrd`
+ --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:10
+ |
+LL | #[derive(PartialOrd, AddImpl)]
+ | ^^^^^^^^^^
+note: required by a bound in `Ord`
+ --> $SRC_DIR/core/src/cmp.rs:LL:COL
+ |
+LL | pub trait Ord: Eq + PartialOrd<Self> {
+ | ^^^^^^^^^^^^^^^^ required by this bound in `Ord`
+ = note: this error originates in the derive macro `AddImpl` which comes from the expansion of the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.