Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use check-pass in single-use-lifetime ui tests #78342

Merged
merged 1 commit into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/test/ui/single-use-lifetime/one-use-in-fn-return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
// (Normally, using `'static` would be preferred, but there are
// times when that is not what you want.)

// build-pass (FIXME(62277): could be check-pass?)
// check-pass

#![deny(single_use_lifetimes)]

fn b<'a>() -> &'a u32 { // OK: used only in return type
// OK: used only in return type
fn b<'a>() -> &'a u32 {
&22
}

Expand Down
11 changes: 5 additions & 6 deletions src/test/ui/single-use-lifetime/one-use-in-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,26 @@
// even when they are only used once (since to not use a named
// lifetime is illegal!)
//
// build-pass (FIXME(62277): could be check-pass?)
// check-pass

#![deny(single_use_lifetimes)]
#![allow(dead_code)]
#![allow(unused_variables)]

struct Foo<'f> {
data: &'f u32
data: &'f u32,
}

enum Bar<'f> {
Data(&'f u32)
Data(&'f u32),
}

trait Baz<'f> { }
trait Baz<'f> {}

// `Derive`d impls shouldn't trigger a warning, either (Issue #53738).

#[derive(Debug)]
struct Quux<'a> {
priors: &'a u32,
}

fn main() { }
fn main() {}
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// Test that we DO NOT warn when lifetime name is used in
// both the argument and return.
//
// build-pass (FIXME(62277): could be check-pass?)
// check-pass

#![deny(single_use_lifetimes)]
#![allow(dead_code)]
#![allow(unused_variables)]

fn c<'a>(x: &'a u32) -> &'a u32 { // OK: used twice
// OK: used twice
fn c<'a>(x: &'a u32) -> &'a u32 {
&22
}

fn main() { }
fn main() {}
12 changes: 6 additions & 6 deletions src/test/ui/single-use-lifetime/two-uses-in-fn-arguments.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Test that we DO NOT warn when lifetime name is used multiple
// arguments, or more than once in a single argument.
//
// build-pass (FIXME(62277): could be check-pass?)
// check-pass

#![deny(single_use_lifetimes)]
#![allow(dead_code)]
#![allow(unused_variables)]

fn c<'a>(x: &'a u32, y: &'a u32) { // OK: used twice
}
// OK: used twice
fn c<'a>(x: &'a u32, y: &'a u32) {}

fn d<'a>(x: (&'a u32, &'a u32)) { // OK: used twice
}
// OK: used twice
fn d<'a>(x: (&'a u32, &'a u32)) {}

fn main() { }
fn main() {}
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
// Test that we DO NOT warn for a lifetime used twice in an impl.
//
// build-pass (FIXME(62277): could be check-pass?)
// check-pass

#![deny(single_use_lifetimes)]
#![allow(dead_code)]
#![allow(unused_variables)]

struct Foo<'f> {
data: &'f u32
data: &'f u32,
}

impl<'f> Foo<'f> {
fn inherent_a(&self, data: &'f u32) {
}
fn inherent_a(&self, data: &'f u32) {}
}

fn main() { }
fn main() {}
6 changes: 3 additions & 3 deletions src/test/ui/single-use-lifetime/two-uses-in-trait-impl.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Test that we DO NOT warn for a lifetime on an impl used in both
// header and in an associated type.
//
// build-pass (FIXME(62277): could be check-pass?)
// check-pass

#![deny(single_use_lifetimes)]
#![allow(dead_code)]
#![allow(unused_variables)]

struct Foo<'f> {
data: &'f u32
data: &'f u32,
}

impl<'f> Iterator for Foo<'f> {
Expand All @@ -19,4 +19,4 @@ impl<'f> Iterator for Foo<'f> {
}
}

fn main() { }
fn main() {}