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

Commit 410dcc9

Browse files
committed
Fully stabilize NLL
1 parent 7e9b92c commit 410dcc9

File tree

985 files changed

+1815
-12128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

985 files changed

+1815
-12128
lines changed

compiler/rustc_apfloat/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
3434
#![no_std]
3535
#![forbid(unsafe_code)]
36-
#![feature(nll)]
3736

3837
#[macro_use]
3938
extern crate alloc;

compiler/rustc_ast/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#![feature(let_chains)]
1818
#![feature(min_specialization)]
1919
#![feature(negative_impls)]
20-
#![feature(nll)]
2120
#![feature(slice_internals)]
2221
#![feature(stmt_expr_attributes)]
2322
#![recursion_limit = "256"]

compiler/rustc_builtin_macros/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#![feature(is_sorted)]
1010
#![feature(let_chains)]
1111
#![feature(let_else)]
12-
#![feature(nll)]
1312
#![feature(proc_macro_internals)]
1413
#![feature(proc_macro_quote)]
1514
#![recursion_limit = "256"]

compiler/rustc_codegen_llvm/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#![feature(let_else)]
1010
#![feature(extern_types)]
1111
#![feature(once_cell)]
12-
#![feature(nll)]
1312
#![feature(iter_intersperse)]
1413
#![recursion_limit = "256"]
1514
#![allow(rustc::potential_query_instability)]

compiler/rustc_codegen_ssa/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![feature(try_blocks)]
44
#![feature(let_else)]
55
#![feature(once_cell)]
6-
#![feature(nll)]
76
#![feature(associated_type_bounds)]
87
#![feature(strict_provenance)]
98
#![feature(int_roundings)]

compiler/rustc_driver/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
//! This API is completely unstable and subject to change.
66
77
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
8-
#![feature(nll)]
98
#![feature(let_else)]
109
#![feature(once_cell)]
1110
#![recursion_limit = "256"]

compiler/rustc_error_codes/src/error_codes/E0312.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
Reference's lifetime of borrowed content doesn't match the expected lifetime.
24

35
Erroneous code example:
46

5-
```compile_fail,E0312
7+
```compile_fail
68
pub fn opt_str<'a>(maybestr: &'a Option<String>) -> &'static str {
79
if maybestr.is_none() {
810
"(none)"

compiler/rustc_error_codes/src/error_codes/E0477.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
The type does not fulfill the required lifetime.
24

35
Erroneous code example:
46

5-
```compile_fail,E0477
7+
```compile_fail
68
use std::sync::Mutex;
79
810
struct MyString<'a> {

compiler/rustc_error_codes/src/error_codes/E0495.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
A lifetime cannot be determined in the given situation.
24

35
Erroneous code example:
46

5-
```compile_fail,E0495
7+
```compile_fail
68
fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
79
match (&t,) { // error!
810
((u,),) => u,

compiler/rustc_error_codes/src/error_codes/E0623.md

Lines changed: 48 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,70 @@ A lifetime didn't match what was expected.
33
Erroneous code example:
44

55
```compile_fail,E0623
6-
struct Foo<'a> {
7-
x: &'a isize,
8-
}
6+
struct Foo<'a, 'b, T>(std::marker::PhantomData<(&'a (), &'b (), T)>)
7+
where
8+
T: Convert<'a, 'b>;
99
10-
fn bar<'short, 'long>(c: Foo<'short>, l: &'long isize) {
11-
let _: Foo<'long> = c; // error!
10+
trait Convert<'a, 'b>: Sized {
11+
fn cast(&'a self) -> &'b Self;
12+
}
13+
impl<'long: 'short, 'short, T> Convert<'long, 'short> for T {
14+
fn cast(&'long self) -> &'short T {
15+
self
16+
}
17+
}
18+
// error
19+
fn badboi<'in_, 'out, T>(
20+
x: Foo<'in_, 'out, T>,
21+
sadness: &'in_ T
22+
) -> &'out T {
23+
sadness.cast()
1224
}
1325
```
1426

1527
In this example, we tried to set a value with an incompatible lifetime to
16-
another one (`'long` is unrelated to `'short`). We can solve this issue in
28+
another one (`'in_` is unrelated to `'out`). We can solve this issue in
1729
two different ways:
1830

19-
Either we make `'short` live at least as long as `'long`:
31+
Either we make `'in_` live at least as long as `'out`:
2032

2133
```
22-
struct Foo<'a> {
23-
x: &'a isize,
24-
}
34+
struct Foo<'a, 'b, T>(std::marker::PhantomData<(&'a (), &'b (), T)>)
35+
where
36+
T: Convert<'a, 'b>;
2537
26-
// we set 'short to live at least as long as 'long
27-
fn bar<'short: 'long, 'long>(c: Foo<'short>, l: &'long isize) {
28-
let _: Foo<'long> = c; // ok!
38+
trait Convert<'a, 'b>: Sized {
39+
fn cast(&'a self) -> &'b Self;
40+
}
41+
impl<'long: 'short, 'short, T> Convert<'long, 'short> for T {
42+
fn cast(&'long self) -> &'short T {
43+
self
44+
}
45+
}
46+
fn badboi<'in_: 'out, 'out, T>(
47+
x: Foo<'in_, 'out, T>,
48+
sadness: &'in_ T
49+
) -> &'out T {
50+
sadness.cast()
2951
}
3052
```
3153

3254
Or we use only one lifetime:
3355

3456
```
35-
struct Foo<'a> {
36-
x: &'a isize,
57+
struct Foo<'a, 'b, T>(std::marker::PhantomData<(&'a (), &'b (), T)>)
58+
where
59+
T: Convert<'a, 'b>;
60+
61+
trait Convert<'a, 'b>: Sized {
62+
fn cast(&'a self) -> &'b Self;
63+
}
64+
impl<'long: 'short, 'short, T> Convert<'long, 'short> for T {
65+
fn cast(&'long self) -> &'short T {
66+
self
67+
}
3768
}
38-
fn bar<'short>(c: Foo<'short>, l: &'short isize) {
39-
let _: Foo<'short> = c; // ok!
69+
fn badboi<'out, T>(x: Foo<'out, 'out, T>, sadness: &'out T) -> &'out T {
70+
sadness.cast()
4071
}
4172
```

0 commit comments

Comments
 (0)