This website requires JavaScript.
Explore
Help
Sign In
nordic-dev.net
/
rust
Watch
2
Star
0
Fork
0
You've already forked rust
mirror of
https://github.com/rust-lang/rust.git
synced
2024-11-28 01:34:21 +00:00
Code
Issues
Packages
Projects
Releases
Wiki
Activity
f36a9b5e18
rust
/
tests
/
ui
/
static
/
static-lifetime-bound.rs
7 lines
109 B
Rust
Raw
Normal View
History
Unescape
Escape
Convert a hard-warning about named static lifetimes into lint "unused_lifetimes" Define the `named_static_lifetimes` lint This lint will replace the existing hard-warning. Replace the named static lifetime hard-warning with the new lint Update the UI tests for the `named_static_lifetimes` lint Remove the direct dependency on `rustc_lint_defs` fix build Signed-off-by: Zhi Qi <qizhi@pingcap.com> use "UNUSED_LIFETIMES" instead Signed-off-by: Zhi Qi <qizhi@pingcap.com> update 1 test and fix typo Signed-off-by: Zhi Qi <qizhi@pingcap.com> update tests Signed-off-by: Zhi Qi <qizhi@pingcap.com> fix tests: add extra blank line Signed-off-by: Zhi Qi <qizhi@pingcap.com>
2023-02-22 01:41:48 +00:00
fn
f
<
'
a
:
'static
>
(
_
:
&
'
a
i32
)
{
}
Warn when using a `'static` lifetime bound Previously a `'static` lifetime bound would result in an `undeclared lifetime` error when compiling, even though it could be considered valid. However, it is unnecessary to use it as a lifetime bound so we present the user with a warning instead and suggest using the `'static` lifetime directly, in place of the lifetime parameter.
2017-03-21 12:38:32 +00:00
fn
main
(
)
{
let
x
=
0
;
f
(
&
x
)
;
//~ERROR does not live long enough
}
Reference in New Issue
Copy Permalink