Skip to content

Commit 2fcef6e

Browse files
committed
address review comments
1 parent 74bc964 commit 2fcef6e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

tests/ui/missing_const_for_fn/could_be_const.fixed

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,18 @@ fn main() {}
104104

105105
struct D;
106106

107+
/* FIXME(effects)
107108
impl 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

117120
mod msrv {
118121
struct Foo(*const u8, &'static u8);

tests/ui/missing_const_for_fn/could_be_const.stderr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ error: this could be a `const fn`
161161
|
162162
LL | fn d(this: D) {}
163163
| ^^^^^^^^^^^^^^^^
164+
|
165+
help: make the function `const`
166+
|
167+
LL | const fn d(this: D) {}
168+
| +++++
164169

165170
error: this could be a `const fn`
166171
--> tests/ui/missing_const_for_fn/could_be_const.rs:125:9

0 commit comments

Comments
 (0)