Add updated NLL tests · rust-lang/rust@8ca4406 (original) (raw)

`@@ -4,197 +4,257 @@ error[E0493]: destructors cannot be evaluated at compile-time

`

4

4

`LL | const fn into_inner(self) -> T { self.0 } //~ destructors cannot be evaluated

`

5

5

` | ^^^^ constant functions cannot evaluate destructors

`

6

6

``

7

``

`-

error: mutable references in const fn are unstable

`

``

7

`+

error[E0723]: mutable references in const fn are unstable (see issue #57563)

`

8

8

` --> $DIR/min_const_fn.rs:39:36

`

9

9

` |

`

10

10

`LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 }

`

11

11

` | ^^^^^^

`

``

12

`+

|

`

``

13

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

12

14

``

13

15

`error[E0493]: destructors cannot be evaluated at compile-time

`

14

16

` --> $DIR/min_const_fn.rs:44:28

`

15

17

` |

`

16

18

`LL | const fn into_inner_lt(self) -> T { self.0 } //~ destructors cannot be evaluated

`

17

19

` | ^^^^ constant functions cannot evaluate destructors

`

18

20

``

19

``

`-

error: mutable references in const fn are unstable

`

``

21

`+

error[E0723]: mutable references in const fn are unstable (see issue #57563)

`

20

22

` --> $DIR/min_const_fn.rs:46:42

`

21

23

` |

`

22

24

`LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }

`

23

25

` | ^^^^^^

`

``

26

`+

|

`

``

27

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

24

28

``

25

29

`error[E0493]: destructors cannot be evaluated at compile-time

`

26

30

` --> $DIR/min_const_fn.rs:51:27

`

27

31

` |

`

28

32

`LL | const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructors

`

29

33

` | ^^^^ constant functions cannot evaluate destructors

`

30

34

``

31

``

`-

error: mutable references in const fn are unstable

`

``

35

`+

error[E0723]: mutable references in const fn are unstable (see issue #57563)

`

32

36

` --> $DIR/min_const_fn.rs:53:38

`

33

37

` |

`

34

38

`LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }

`

35

39

` | ^^^^^^

`

``

40

`+

|

`

``

41

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

36

42

``

37

``

`-

error: mutable references in const fn are unstable

`

``

43

`+

error[E0723]: mutable references in const fn are unstable (see issue #57563)

`

38

44

` --> $DIR/min_const_fn.rs:58:39

`

39

45

` |

`

40

46

`LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }

`

41

47

` | ^^^^^^

`

``

48

`+

|

`

``

49

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

42

50

``

43

``

`` -

error: trait bounds other than Sized on const fn parameters are unstable

``

``

51

`` +

error[E0723]: trait bounds other than Sized on const fn parameters are unstable (see issue #57563)

``

44

52

` --> $DIR/min_const_fn.rs:76:16

`

45

53

` |

`

46

54

`LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }

`

47

55

` | ^

`

``

56

`+

|

`

``

57

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

48

58

``

49

``

`` -

error: trait bounds other than Sized on const fn parameters are unstable

``

``

59

`` +

error[E0723]: trait bounds other than Sized on const fn parameters are unstable (see issue #57563)

``

50

60

` --> $DIR/min_const_fn.rs:78:18

`

51

61

` |

`

52

62

`LL | const fn foo11_2<T: Send>(t: T) -> T { t }

`

53

63

` | ^

`

``

64

`+

|

`

``

65

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

54

66

``

55

``

`` -

error: only int, bool and char operations are stable in const fn

``

``

67

`` +

error[E0723]: only int, bool and char operations are stable in const fn (see issue #57563)

``

56

68

` --> $DIR/min_const_fn.rs:80:33

`

57

69

` |

`

58

70

`LL | const fn foo19(f: f32) -> f32 { f * 2.0 }

`

59

71

` | ^^^^^^^

`

``

72

`+

|

`

``

73

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

60

74

``

61

``

`` -

error: only int, bool and char operations are stable in const fn

``

``

75

`` +

error[E0723]: only int, bool and char operations are stable in const fn (see issue #57563)

``

62

76

` --> $DIR/min_const_fn.rs:82:35

`

63

77

` |

`

64

78

`LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f }

`

65

79

` | ^^^^^^^

`

``

80

`+

|

`

``

81

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

66

82

``

67

``

`` -

error: only int and bool operations are stable in const fn

``

``

83

`` +

error[E0723]: only int and bool operations are stable in const fn (see issue #57563)

``

68

84

` --> $DIR/min_const_fn.rs:84:35

`

69

85

` |

`

70

86

`LL | const fn foo19_3(f: f32) -> f32 { -f }

`

71

87

` | ^^

`

``

88

`+

|

`

``

89

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

72

90

``

73

``

`` -

error: only int, bool and char operations are stable in const fn

``

``

91

`` +

error[E0723]: only int, bool and char operations are stable in const fn (see issue #57563)

``

74

92

` --> $DIR/min_const_fn.rs:86:43

`

75

93

` |

`

76

94

`LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g }

`

77

95

` | ^^^^^

`

``

96

`+

|

`

``

97

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

78

98

``

79

``

`` -

error: cannot access static items in const fn

``

``

99

`` +

error[E0723]: cannot access static items in const fn (see issue #57563)

``

80

100

` --> $DIR/min_const_fn.rs:90:27

`

81

101

` |

`

82

102

`` LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access static items in const fn

``

83

103

` | ^^^

`

``

104

`+

|

`

``

105

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

84

106

``

85

``

`` -

error: cannot access static items in const fn

``

``

107

`` +

error[E0723]: cannot access static items in const fn (see issue #57563)

``

86

108

` --> $DIR/min_const_fn.rs:91:36

`

87

109

` |

`

88

110

`` LL | const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access static items

``

89

111

` | ^^^^

`

``

112

`+

|

`

``

113

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

90

114

``

91

``

`-

error: casting pointers to ints is unstable in const fn

`

``

115

`+

error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)

`

92

116

` --> $DIR/min_const_fn.rs:92:42

`

93

117

` |

`

94

118

`LL | const fn foo30(x: *const u32) -> usize { x as usize }

`

95

119

` | ^^^^^^^^^^

`

``

120

`+

|

`

``

121

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

96

122

``

97

``

`-

error: casting pointers to ints is unstable in const fn

`

``

123

`+

error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)

`

98

124

` --> $DIR/min_const_fn.rs:94:63

`

99

125

` |

`

100

126

`LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } }

`

101

127

` | ^^^^^^^^^^

`

``

128

`+

|

`

``

129

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

102

130

``

103

``

`-

error: casting pointers to ints is unstable in const fn

`

``

131

`+

error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)

`

104

132

` --> $DIR/min_const_fn.rs:96:42

`

105

133

` |

`

106

134

`LL | const fn foo30_2(x: *mut u32) -> usize { x as usize }

`

107

135

` | ^^^^^^^^^^

`

``

136

`+

|

`

``

137

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

108

138

``

109

``

`-

error: casting pointers to ints is unstable in const fn

`

``

139

`+

error[E0723]: casting pointers to ints is unstable in const fn (see issue #57563)

`

110

140

` --> $DIR/min_const_fn.rs:98:63

`

111

141

` |

`

112

142

`LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } }

`

113

143

` | ^^^^^^^^^^

`

``

144

`+

|

`

``

145

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

114

146

``

115

``

`` -

error: if, match, && and || are not stable in const fn

``

``

147

`` +

error[E0723]: if, match, && and || are not stable in const fn (see issue #57563)

``

116

148

` --> $DIR/min_const_fn.rs💯38

`

117

149

` |

`

118

150

`LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } }

`

119

151

` | ^^^^^^^^^^^^^^^^^^^^^^

`

``

152

`+

|

`

``

153

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

120

154

``

121

``

`` -

error: if, match, && and || are not stable in const fn

``

``

155

`` +

error[E0723]: if, match, && and || are not stable in const fn (see issue #57563)

``

122

156

` --> $DIR/min_const_fn.rs:102:29

`

123

157

` |

`

124

158

`LL | const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn

`

125

159

` | ^^^^^^^^^^^

`

``

160

`+

|

`

``

161

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

126

162

``

127

``

`` -

error: if, match, && and || are not stable in const fn

``

``

163

`` +

error[E0723]: if, match, && and || are not stable in const fn (see issue #57563)

``

128

164

` --> $DIR/min_const_fn.rs:104:44

`

129

165

` |

`

130

166

`LL | const fn foo36(a: bool, b: bool) -> bool { a && b }

`

131

167

` | ^^^^^^

`

``

168

`+

|

`

``

169

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

132

170

``

133

``

`` -

error: if, match, && and || are not stable in const fn

``

``

171

`` +

error[E0723]: if, match, && and || are not stable in const fn (see issue #57563)

``

134

172

` --> $DIR/min_const_fn.rs:106:44

`

135

173

` |

`

136

174

`LL | const fn foo37(a: bool, b: bool) -> bool { a || b }

`

137

175

` | ^^^^^^

`

``

176

`+

|

`

``

177

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

138

178

``

139

``

`-

error: mutable references in const fn are unstable

`

``

179

`+

error[E0723]: mutable references in const fn are unstable (see issue #57563)

`

140

180

` --> $DIR/min_const_fn.rs:108:14

`

141

181

` |

`

142

182

`LL | const fn inc(x: &mut i32) { *x += 1 }

`

143

183

` | ^

`

``

184

`+

|

`

``

185

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

144

186

``

145

``

`` -

error: trait bounds other than Sized on const fn parameters are unstable

``

``

187

`` +

error[E0723]: trait bounds other than Sized on const fn parameters are unstable (see issue #57563)

``

146

188

` --> $DIR/min_const_fn.rs:113:6

`

147

189

` |

`

148

190

`LL | impl<T: std::fmt::Debug> Foo {

`

149

191

` | ^

`

``

192

`+

|

`

``

193

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

150

194

``

151

``

`` -

error: trait bounds other than Sized on const fn parameters are unstable

``

``

195

`` +

error[E0723]: trait bounds other than Sized on const fn parameters are unstable (see issue #57563)

``

152

196

` --> $DIR/min_const_fn.rs:118:6

`

153

197

` |

`

154

198

`LL | impl<T: std::fmt::Debug + Sized> Foo {

`

155

199

` | ^

`

``

200

`+

|

`

``

201

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

156

202

``

157

``

`` -

error: trait bounds other than Sized on const fn parameters are unstable

``

``

203

`` +

error[E0723]: trait bounds other than Sized on const fn parameters are unstable (see issue #57563)

``

158

204

` --> $DIR/min_const_fn.rs:123:6

`

159

205

` |

`

160

206

`LL | impl<T: Sync + Sized> Foo {

`

161

207

` | ^

`

``

208

`+

|

`

``

209

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

162

210

``

163

``

`` -

error: impl Trait in const fn is unstable

``

``

211

`` +

error[E0723]: impl Trait in const fn is unstable (see issue #57563)

``

164

212

` --> $DIR/min_const_fn.rs:129:24

`

165

213

` |

`

166

214

`LL | const fn no_rpit2() -> AlanTuring { AlanTuring(0) }

`

167

215

` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

`

``

216

`+

|

`

``

217

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

168

218

``

169

``

`` -

error: trait bounds other than Sized on const fn parameters are unstable

``

``

219

`` +

error[E0723]: trait bounds other than Sized on const fn parameters are unstable (see issue #57563)

``

170

220

` --> $DIR/min_const_fn.rs:131:34

`

171

221

` |

`

172

222

`LL | const fn no_apit2(_x: AlanTuring) {}

`

173

223

` | ^^^^^^^^^^^^^^^^^^^^

`

``

224

`+

|

`

``

225

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

174

226

``

175

``

`` -

error: trait bounds other than Sized on const fn parameters are unstable

``

``

227

`` +

error[E0723]: trait bounds other than Sized on const fn parameters are unstable (see issue #57563)

``

176

228

` --> $DIR/min_const_fn.rs:133:22

`

177

229

` |

`

178

230

`` LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than Sized

``

179

231

` | ^^^^^^^^^^^^^^^^^^^^

`

``

232

`+

|

`

``

233

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

180

234

``

181

``

`` -

error: impl Trait in const fn is unstable

``

``

235

`` +

error[E0723]: impl Trait in const fn is unstable (see issue #57563)

``

182

236

` --> $DIR/min_const_fn.rs:134:23

`

183

237

` |

`

184

238

`` LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR impl Trait in const fn is unstable

``

185

239

` | ^^^^^^^^^^^^^^^^^^^^

`

``

240

`+

|

`

``

241

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

186

242

``

187

``

`` -

error: trait bounds other than Sized on const fn parameters are unstable

``

``

243

`` +

error[E0723]: trait bounds other than Sized on const fn parameters are unstable (see issue #57563)

``

188

244

` --> $DIR/min_const_fn.rs:135:23

`

189

245

` |

`

190

246

`` LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than Sized

``

191

247

` | ^^

`

``

248

`+

|

`

``

249

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

192

250

``

193

``

`` -

error: trait bounds other than Sized on const fn parameters are unstable

``

``

251

`` +

error[E0723]: trait bounds other than Sized on const fn parameters are unstable (see issue #57563)

``

194

252

` --> $DIR/min_const_fn.rs:136:32

`

195

253

` |

`

196

254

`LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }

`

197

255

` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

`

``

256

`+

|

`

``

257

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

198

258

``

199

259

`warning[E0515]: cannot return reference to temporary value

`

200

260

` --> $DIR/min_const_fn.rs:136:63

`

`@@ -208,25 +268,31 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }

`

208

268

` = warning: this error has been downgraded to a warning for backwards compatibility with previous releases

`

209

269

` = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future

`

210

270

``

211

``

`` -

error: trait bounds other than Sized on const fn parameters are unstable

``

``

271

`` +

error[E0723]: trait bounds other than Sized on const fn parameters are unstable (see issue #57563)

``

212

272

` --> $DIR/min_const_fn.rs:141:41

`

213

273

` |

`

214

274

`LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 }

`

215

275

` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

`

``

276

`+

|

`

``

277

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

216

278

``

217

``

`-

error: function pointers in const fn are unstable

`

``

279

`+

error[E0723]: function pointers in const fn are unstable (see issue #57563)

`

218

280

` --> $DIR/min_const_fn.rs:144:21

`

219

281

` |

`

220

282

`LL | const fn no_fn_ptrs(_x: fn()) {}

`

221

283

` | ^^

`

``

284

`+

|

`

``

285

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

222

286

``

223

``

`-

error: function pointers in const fn are unstable

`

``

287

`+

error[E0723]: function pointers in const fn are unstable (see issue #57563)

`

224

288

` --> $DIR/min_const_fn.rs:146:27

`

225

289

` |

`

226

290

`LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }

`

227

291

` | ^^^^

`

``

292

`+

|

`

``

293

`+

= help: add #![feature(const_fn)] to the crate attributes to enable

`

228

294

``

229

295

`error: aborting due to 36 previous errors

`

230

296

``

231

``

`-

Some errors occurred: E0493, E0515.

`

``

297

`+

Some errors occurred: E0493, E0515, E0723.

`

232

298

`` For more information about an error, try rustc --explain E0493.

``