Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

ices/95272.rs: fixed with errors #1210

Merged
merged 1 commit into from
Apr 6, 2022
Merged

ices/95272.rs: fixed with errors #1210

merged 1 commit into from
Apr 6, 2022

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Apr 6, 2022

Issue: rust-lang/rust#95272

#![feature(nll)]

use std::cell::Cell;

fn check<'a, 'b>(x: Cell<&'a ()>, y: Cell<&'b ()>)
where
    'a: 'b,
{
}

fn test<'a, 'b>(x: Cell<&'a ()>, y: Cell<&'b ()>) {
    let f = check;
    f(x, y);
}

fn main() {}
=== stdout ===
=== stderr ===
warning: unused variable: `x`
 --> /home/runner/work/glacier/glacier/ices/95272.rs:5:18
  |
5 | fn check<'a, 'b>(x: Cell<&'a ()>, y: Cell<&'b ()>)
  |                  ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `y`
 --> /home/runner/work/glacier/glacier/ices/95272.rs:5:35
  |
5 | fn check<'a, 'b>(x: Cell<&'a ()>, y: Cell<&'b ()>)
  |                                   ^ help: if this is intentional, prefix it with an underscore: `_y`

error: lifetime may not live long enough
  --> /home/runner/work/glacier/glacier/ices/95272.rs:12:13
   |
11 | fn test<'a, 'b>(x: Cell<&'a ()>, y: Cell<&'b ()>) {
   |         --  -- lifetime `'b` defined here
   |         |
   |         lifetime `'a` defined here
12 |     let f = check;
   |             ^^^^^ assignment requires that `'a` must outlive `'b`
   |
   = help: consider adding the following bound: `'a: 'b`
   = note: requirement occurs because of a function pointer to `check`
   = note: the function `check` is invariant over the parameter `'a`
   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance

error: aborting due to previous error; 2 warnings emitted

==============

=== stdout ===
=== stderr ===
warning: unused variable: `x`
 --> /home/runner/work/glacier/glacier/ices/95272.rs:5:18
  |
5 | fn check<'a, 'b>(x: Cell<&'a ()>, y: Cell<&'b ()>)
  |                  ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `y`
 --> /home/runner/work/glacier/glacier/ices/95272.rs:5:35
  |
5 | fn check<'a, 'b>(x: Cell<&'a ()>, y: Cell<&'b ()>)
  |                                   ^ help: if this is intentional, prefix it with an underscore: `_y`

error: lifetime may not live long enough
  --> /home/runner/work/glacier/glacier/ices/95272.rs:12:13
   |
11 | fn test<'a, 'b>(x: Cell<&'a ()>, y: Cell<&'b ()>) {
   |         --  -- lifetime `'b` defined here
   |         |
   |         lifetime `'a` defined here
12 |     let f = check;
   |             ^^^^^ assignment requires that `'a` must outlive `'b`
   |
   = help: consider adding the following bound: `'a: 'b`
   = note: requirement occurs because of a function pointer to `check`
   = note: the function `check` is invariant over the parameter `'a`
   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance

error: aborting due to previous error; 2 warnings emitted

==============
@Alexendoo Alexendoo merged commit ffbdd28 into master Apr 6, 2022
@Alexendoo Alexendoo deleted the autofix/ices/95272.rs branch April 6, 2022 16:05
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants