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

ices/97946.rs: fixed with errors #1323

Merged
merged 1 commit into from
Jun 29, 2022
Merged

ices/97946.rs: fixed with errors #1323

merged 1 commit into from
Jun 29, 2022

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#97946

struct A<T> {
    inner: T
}

impl <T> A<T>  {
    thread_local! {
        static MY_STATIC: Option<T>  = None;
    }
}

fn main() {}
=== stdout ===
=== stderr ===
error[E0401]: can't use generic parameters from outer function
 --> /home/runner/work/glacier/glacier/ices/97946.rs:7:34
  |
5 | impl <T> A<T>  {
  |       - type parameter from outer function
6 |     thread_local! {
7 |         static MY_STATIC: Option<T>  = None;
  |                                  ^ use of generic parameter from outer function
  |
  = help: try using a local generic parameter instead

error[E0310]: the parameter type `T` may not live long enough
 --> /home/runner/work/glacier/glacier/ices/97946.rs:6:5
  |
6 | /     thread_local! {
7 | |         static MY_STATIC: Option<T>  = None;
8 | |     }
  | |_____^ ...so that the type `Option<T>` will meet its required lifetime bounds...
  |
note: ...that is required by this bound
  = note: this error originates in the macro `$crate::__thread_local_inner` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider adding an explicit lifetime bound...
  |
5 | impl <T: 'static> A<T>  {
  |        +++++++++

error: aborting due to 2 previous errors

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

=== stdout ===
=== stderr ===
error[E0401]: can't use generic parameters from outer function
 --> /home/runner/work/glacier/glacier/ices/97946.rs:7:34
  |
5 | impl <T> A<T>  {
  |       - type parameter from outer function
6 |     thread_local! {
7 |         static MY_STATIC: Option<T>  = None;
  |                                  ^ use of generic parameter from outer function
  |
  = help: try using a local generic parameter instead

error[E0310]: the parameter type `T` may not live long enough
 --> /home/runner/work/glacier/glacier/ices/97946.rs:6:5
  |
6 | /     thread_local! {
7 | |         static MY_STATIC: Option<T>  = None;
8 | |     }
  | |_____^ ...so that the type `Option<T>` will meet its required lifetime bounds...
  |
note: ...that is required by this bound
  = note: this error originates in the macro `$crate::__thread_local_inner` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider adding an explicit lifetime bound...
  |
5 | impl <T: 'static> A<T>  {
  |        +++++++++

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0310, E0401.
For more information about an error, try `rustc --explain E0310`.
==============
@Alexendoo Alexendoo merged commit 95617ea into master Jun 29, 2022
@Alexendoo Alexendoo deleted the autofix/ices/97946.rs branch June 29, 2022 12:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants