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() {}
104104
105105struct D;
106106
107+ /* FIXME(effects)
107108impl const Drop for D {
108109 fn drop(&mut self) {
109110 todo!();
110111 }
111112}
113+ */
112114
113115// Lint this, since it can be dropped in const contexts
114116// FIXME(effects)
115- fn d(this: D) {}
117+ const fn d(this: D) {}
118+ //~^ ERROR: this could be a `const fn`
116119
117120mod msrv {
118121 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`
161161 |
162162LL | fn d(this: D) {}
163163 | ^^^^^^^^^^^^^^^^
164+ |
165+ help: make the function `const`
166+ |
167+ LL | const fn d(this: D) {}
168+ | +++++
164169
165170error: this could be a `const fn`
166171 --> tests/ui/missing_const_for_fn/could_be_const.rs:125:9
You can’t perform that action at this time.
0 commit comments