Add test.

This commit is contained in:
Camille GILLOT 2022-05-07 13:08:04 +02:00
parent 96321ed756
commit 89f15bfd90
3 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,6 @@
pub fn foo() {}
#[macro_export]
macro_rules! gimme_a {
($($mac:tt)*) => { $($mac)* { 'a } }
}

View File

@ -0,0 +1,28 @@
// edition:2018
// aux-build:edition-lint-infer-outlives-macro.rs
// Test that the lint does not fire if the where predicate
// is from the local crate, but all the bounds are from an
// external macro.
#![deny(explicit_outlives_requirements)]
#[macro_use]
extern crate edition_lint_infer_outlives_macro;
macro_rules! make_foo {
($a:tt) => {
struct Foo<$a, 'b> where 'b: $a {
foo: &$a &'b (),
}
}
}
gimme_a! {make_foo!}
struct Bar<'a, 'b: 'a> {
//~^ ERROR: outlives requirements can be inferred
bar: &'a &'b (),
}
fn main() {}

View File

@ -0,0 +1,14 @@
error: outlives requirements can be inferred
--> $DIR/edition-lint-infer-outlives-macro.rs:23:18
|
LL | struct Bar<'a, 'b: 'a> {
| ^^^^ help: remove this bound
|
note: the lint level is defined here
--> $DIR/edition-lint-infer-outlives-macro.rs:8:9
|
LL | #![deny(explicit_outlives_requirements)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error