File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
tests/ui/missing_const_for_fn Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -104,15 +104,18 @@ fn main() {}
104
104
105
105
struct D;
106
106
107
+ /* FIXME(effects)
107
108
impl const Drop for D {
108
109
fn drop(&mut self) {
109
110
todo!();
110
111
}
111
112
}
113
+ */
112
114
113
115
// Lint this, since it can be dropped in const contexts
114
116
// FIXME(effects)
115
- fn d(this: D) {}
117
+ const fn d(this: D) {}
118
+ //~^ ERROR: this could be a `const fn`
116
119
117
120
mod msrv {
118
121
struct Foo(*const u8, &'static u8);
Original file line number Diff line number Diff line change @@ -161,6 +161,11 @@ error: this could be a `const fn`
161
161
|
162
162
LL | fn d(this: D) {}
163
163
| ^^^^^^^^^^^^^^^^
164
+ |
165
+ help: make the function `const`
166
+ |
167
+ LL | const fn d(this: D) {}
168
+ | +++++
164
169
165
170
error: this could be a `const fn`
166
171
--> tests/ui/missing_const_for_fn/could_be_const.rs:125:9
You can’t perform that action at this time.
0 commit comments