Skip to content

Commit 89f15bf

Browse files
committed
Add test.
1 parent 96321ed commit 89f15bf

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pub fn foo() {}
2+
3+
#[macro_export]
4+
macro_rules! gimme_a {
5+
($($mac:tt)*) => { $($mac)* { 'a } }
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// edition:2018
2+
// aux-build:edition-lint-infer-outlives-macro.rs
3+
4+
// Test that the lint does not fire if the where predicate
5+
// is from the local crate, but all the bounds are from an
6+
// external macro.
7+
8+
#![deny(explicit_outlives_requirements)]
9+
10+
#[macro_use]
11+
extern crate edition_lint_infer_outlives_macro;
12+
13+
macro_rules! make_foo {
14+
($a:tt) => {
15+
struct Foo<$a, 'b> where 'b: $a {
16+
foo: &$a &'b (),
17+
}
18+
}
19+
}
20+
21+
gimme_a! {make_foo!}
22+
23+
struct Bar<'a, 'b: 'a> {
24+
//~^ ERROR: outlives requirements can be inferred
25+
bar: &'a &'b (),
26+
}
27+
28+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: outlives requirements can be inferred
2+
--> $DIR/edition-lint-infer-outlives-macro.rs:23:18
3+
|
4+
LL | struct Bar<'a, 'b: 'a> {
5+
| ^^^^ help: remove this bound
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/edition-lint-infer-outlives-macro.rs:8:9
9+
|
10+
LL | #![deny(explicit_outlives_requirements)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+

0 commit comments

Comments
 (0)