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

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#82126

use std::sync::Mutex;

struct MarketMultiplier {}

impl MarketMultiplier {
    fn buy(&mut self) -> &mut usize {
        todo!()
    }
}

async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
    LockedMarket(generator.lock().unwrap().buy())
}

struct LockedMarket<T>(T);

fn main() {}
=== stdout ===
=== stderr ===
error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
  --> /home/runner/work/glacier/glacier/ices/82126.rs:11:59
   |
11 | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
   |                                                           ^^^^^^^^^^^^---- help: remove these generics
   |                                                           |
   |                                                           expected 0 lifetime arguments
   |
note: struct defined here, with 0 lifetime parameters
  --> /home/runner/work/glacier/glacier/ices/82126.rs:15:8
   |
15 | struct LockedMarket<T>(T);
   |        ^^^^^^^^^^^^

error[E0107]: this struct takes 1 type argument but 0 type arguments were supplied
  --> /home/runner/work/glacier/glacier/ices/82126.rs:11:59
   |
11 | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
   |                                                           ^^^^^^^^^^^^ expected 1 type argument
   |
note: struct defined here, with 1 type parameter: `T`
  --> /home/runner/work/glacier/glacier/ices/82126.rs:15:8
   |
15 | struct LockedMarket<T>(T);
   |        ^^^^^^^^^^^^ -
help: add missing type argument
   |
11 | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_, T> {
   |                                                                          ^^^

error[E0515]: cannot return value referencing temporary value
  --> /home/runner/work/glacier/glacier/ices/82126.rs:12:5
   |
12 |     LockedMarket(generator.lock().unwrap().buy())
   |     ^^^^^^^^^^^^^-------------------------^^^^^^^
   |     |            |
   |     |            temporary value created here
   |     returns a value referencing data owned by the current function

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0107, E0515.
For more information about an error, try `rustc --explain E0107`.
==============

=== stdout ===
=== stderr ===
error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
  --> /home/runner/work/glacier/glacier/ices/82126.rs:11:59
   |
11 | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
   |                                                           ^^^^^^^^^^^^---- help: remove these generics
   |                                                           |
   |                                                           expected 0 lifetime arguments
   |
note: struct defined here, with 0 lifetime parameters
  --> /home/runner/work/glacier/glacier/ices/82126.rs:15:8
   |
15 | struct LockedMarket<T>(T);
   |        ^^^^^^^^^^^^

error[E0107]: this struct takes 1 type argument but 0 type arguments were supplied
  --> /home/runner/work/glacier/glacier/ices/82126.rs:11:59
   |
11 | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
   |                                                           ^^^^^^^^^^^^ expected 1 type argument
   |
note: struct defined here, with 1 type parameter: `T`
  --> /home/runner/work/glacier/glacier/ices/82126.rs:15:8
   |
15 | struct LockedMarket<T>(T);
   |        ^^^^^^^^^^^^ -
help: add missing type argument
   |
11 | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_, T> {
   |                                                                          ^^^

error[E0515]: cannot return value referencing temporary value
  --> /home/runner/work/glacier/glacier/ices/82126.rs:12:5
   |
12 |     LockedMarket(generator.lock().unwrap().buy())
   |     ^^^^^^^^^^^^^-------------------------^^^^^^^
   |     |            |
   |     |            temporary value created here
   |     returns a value referencing data owned by the current function

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0107, E0515.
For more information about an error, try `rustc --explain E0107`.
==============
@JohnTitor JohnTitor merged commit 0b1dbe8 into master Feb 18, 2021
@JohnTitor JohnTitor deleted the autofix/ices/82126.rs branch February 18, 2021 12:57
# 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