Make non-local-def lint Allow by default · rust-lang/rust@cfae8b2 (original) (raw)

1

1

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

2

``

`-

--> $DIR/exhaustive.rs:10:5

`

``

2

`+

--> $DIR/exhaustive.rs:12:5

`

3

3

` |

`

4

4

`LL | / impl Test {

`

5

5

`LL | |

`

`@@ -11,10 +11,14 @@ LL | | }

`

11

11

`` = note: an impl definition is non-local if it is nested inside an item and may impact type checking outside of that item. This can be the case if neither the trait or the self type are at the same nesting level as the impl

``

12

12

`` = note: one exception to the rule are anon-const (const _: () = { ... }) at top-level module and anon-const at the same nesting as the trait or type

``

13

13

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

14

``

`` -

= note: #[warn(non_local_definitions)] on by default

``

``

14

`+

note: the lint level is defined here

`

``

15

`+

--> $DIR/exhaustive.rs:4:9

`

``

16

`+

|

`

``

17

`+

LL | #![warn(non_local_definitions)]

`

``

18

`+

| ^^^^^^^^^^^^^^^^^^^^^

`

15

19

``

16

20

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

17

``

`-

--> $DIR/exhaustive.rs:15:5

`

``

21

`+

--> $DIR/exhaustive.rs:17:5

`

18

22

` |

`

19

23

`LL | / impl Display for Test {

`

20

24

`LL | |

`

`@@ -30,7 +34,7 @@ LL | | }

`

30

34

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

31

35

``

32

36

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

33

``

`-

--> $DIR/exhaustive.rs:22:5

`

``

37

`+

--> $DIR/exhaustive.rs:24:5

`

34

38

` |

`

35

39

`LL | impl dyn Trait {}

`

36

40

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

`

`@@ -41,7 +45,7 @@ LL | impl dyn Trait {}

`

41

45

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

42

46

``

43

47

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

44

``

`-

--> $DIR/exhaustive.rs:25:5

`

``

48

`+

--> $DIR/exhaustive.rs:27:5

`

45

49

` |

`

46

50

`LL | impl<T: Trait> Trait for Vec { }

`

47

51

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

`

`@@ -52,7 +56,7 @@ LL | impl<T: Trait> Trait for Vec { }

`

52

56

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

53

57

``

54

58

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

55

``

`-

--> $DIR/exhaustive.rs:28:5

`

``

59

`+

--> $DIR/exhaustive.rs:30:5

`

56

60

` |

`

57

61

`LL | impl Trait for &dyn Trait {}

`

58

62

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

`

`@@ -63,7 +67,7 @@ LL | impl Trait for &dyn Trait {}

`

63

67

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

64

68

``

65

69

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

66

``

`-

--> $DIR/exhaustive.rs:31:5

`

``

70

`+

--> $DIR/exhaustive.rs:33:5

`

67

71

` |

`

68

72

`LL | impl Trait for *mut Test {}

`

69

73

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

`

`@@ -74,7 +78,7 @@ LL | impl Trait for *mut Test {}

`

74

78

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

75

79

``

76

80

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

77

``

`-

--> $DIR/exhaustive.rs:34:5

`

``

81

`+

--> $DIR/exhaustive.rs:36:5

`

78

82

` |

`

79

83

`LL | impl Trait for *mut [Test] {}

`

80

84

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

`

`@@ -85,7 +89,7 @@ LL | impl Trait for *mut [Test] {}

`

85

89

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

86

90

``

87

91

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

88

``

`-

--> $DIR/exhaustive.rs:37:5

`

``

92

`+

--> $DIR/exhaustive.rs:39:5

`

89

93

` |

`

90

94

`LL | impl Trait for [Test; 8] {}

`

91

95

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

`

`@@ -96,7 +100,7 @@ LL | impl Trait for [Test; 8] {}

`

96

100

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

97

101

``

98

102

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

99

``

`-

--> $DIR/exhaustive.rs:40:5

`

``

103

`+

--> $DIR/exhaustive.rs:42:5

`

100

104

` |

`

101

105

`LL | impl Trait for (Test,) {}

`

102

106

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

`

`@@ -107,7 +111,7 @@ LL | impl Trait for (Test,) {}

`

107

111

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

108

112

``

109

113

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

110

``

`-

--> $DIR/exhaustive.rs:43:5

`

``

114

`+

--> $DIR/exhaustive.rs:45:5

`

111

115

` |

`

112

116

`LL | impl Trait for fn(Test) -> () {}

`

113

117

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

`

`@@ -118,7 +122,7 @@ LL | impl Trait for fn(Test) -> () {}

`

118

122

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

119

123

``

120

124

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

121

``

`-

--> $DIR/exhaustive.rs:46:5

`

``

125

`+

--> $DIR/exhaustive.rs:48:5

`

122

126

` |

`

123

127

`LL | impl Trait for fn() -> Test {}

`

124

128

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

`

`@@ -129,7 +133,7 @@ LL | impl Trait for fn() -> Test {}

`

129

133

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

130

134

``

131

135

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

132

``

`-

--> $DIR/exhaustive.rs:50:9

`

``

136

`+

--> $DIR/exhaustive.rs:52:9

`

133

137

` |

`

134

138

`LL | impl Trait for Test {}

`

135

139

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

`

`@@ -140,7 +144,7 @@ LL | impl Trait for Test {}

`

140

144

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

141

145

``

142

146

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

143

``

`-

--> $DIR/exhaustive.rs:58:5

`

``

147

`+

--> $DIR/exhaustive.rs:60:5

`

144

148

` |

`

145

149

`LL | impl Trait for *mut InsideMain {}

`

146

150

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

`

`@@ -151,7 +155,7 @@ LL | impl Trait for *mut InsideMain {}

`

151

155

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

152

156

``

153

157

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

154

``

`-

--> $DIR/exhaustive.rs:60:5

`

``

158

`+

--> $DIR/exhaustive.rs:62:5

`

155

159

` |

`

156

160

`LL | impl Trait for *mut [InsideMain] {}

`

157

161

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

`

`@@ -162,7 +166,7 @@ LL | impl Trait for *mut [InsideMain] {}

`

162

166

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

163

167

``

164

168

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

165

``

`-

--> $DIR/exhaustive.rs:62:5

`

``

169

`+

--> $DIR/exhaustive.rs:64:5

`

166

170

` |

`

167

171

`LL | impl Trait for [InsideMain; 8] {}

`

168

172

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

`

`@@ -173,7 +177,7 @@ LL | impl Trait for [InsideMain; 8] {}

`

173

177

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

174

178

``

175

179

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

176

``

`-

--> $DIR/exhaustive.rs:64:5

`

``

180

`+

--> $DIR/exhaustive.rs:66:5

`

177

181

` |

`

178

182

`LL | impl Trait for (InsideMain,) {}

`

179

183

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

`

`@@ -184,7 +188,7 @@ LL | impl Trait for (InsideMain,) {}

`

184

188

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

185

189

``

186

190

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

187

``

`-

--> $DIR/exhaustive.rs:66:5

`

``

191

`+

--> $DIR/exhaustive.rs:68:5

`

188

192

` |

`

189

193

`LL | impl Trait for fn(InsideMain) -> () {}

`

190

194

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

`

`@@ -195,7 +199,7 @@ LL | impl Trait for fn(InsideMain) -> () {}

`

195

199

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

196

200

``

197

201

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

198

``

`-

--> $DIR/exhaustive.rs:68:5

`

``

202

`+

--> $DIR/exhaustive.rs:70:5

`

199

203

` |

`

200

204

`LL | impl Trait for fn() -> InsideMain {}

`

201

205

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

`

`@@ -206,7 +210,7 @@ LL | impl Trait for fn() -> InsideMain {}

`

206

210

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

207

211

``

208

212

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

209

``

`-

--> $DIR/exhaustive.rs:72:9

`

``

213

`+

--> $DIR/exhaustive.rs:74:9

`

210

214

` |

`

211

215

`LL | / impl Display for InsideMain {

`

212

216

`LL | |

`

`@@ -222,7 +226,7 @@ LL | | }

`

222

226

` = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue https://github.com/rust-lang/rust/issues/120363

`

223

227

``

224

228

`` warning: non-local impl definition, they should be avoided as they go against expectation

``

225

``

`-

--> $DIR/exhaustive.rs:79:9

`

``

229

`+

--> $DIR/exhaustive.rs:81:9

`

226

230

` |

`

227

231

`LL | / impl InsideMain {

`

228

232

`LL | |

`