diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2024-06-26 16:36:42 +0000 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2024-06-28 15:44:20 +0000 |
| commit | 2fcef6e9f7bb3e94bf889fa3846afbfb25c991b8 (patch) | |
| tree | 5fb3d51cd3d1225e7227710066b815c954ec85d8 | |
| parent | 74bc964e60eee642297face703940c6c8c198cf5 (diff) | |
| download | rust-2fcef6e9f7bb3e94bf889fa3846afbfb25c991b8.tar.gz rust-2fcef6e9f7bb3e94bf889fa3846afbfb25c991b8.zip | |
address review comments
| -rw-r--r-- | tests/ui/missing_const_for_fn/could_be_const.fixed | 5 | ||||
| -rw-r--r-- | tests/ui/missing_const_for_fn/could_be_const.stderr | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/tests/ui/missing_const_for_fn/could_be_const.fixed b/tests/ui/missing_const_for_fn/could_be_const.fixed index 921dcf0b162..f8fc935f367 100644 --- a/tests/ui/missing_const_for_fn/could_be_const.fixed +++ b/tests/ui/missing_const_for_fn/could_be_const.fixed @@ -104,15 +104,18 @@ fn main() {} struct D; +/* FIXME(effects) impl const Drop for D { fn drop(&mut self) { todo!(); } } +*/ // Lint this, since it can be dropped in const contexts // FIXME(effects) -fn d(this: D) {} +const fn d(this: D) {} +//~^ ERROR: this could be a `const fn` mod msrv { struct Foo(*const u8, &'static u8); diff --git a/tests/ui/missing_const_for_fn/could_be_const.stderr b/tests/ui/missing_const_for_fn/could_be_const.stderr index 8ba42c0e5b6..8302b074127 100644 --- a/tests/ui/missing_const_for_fn/could_be_const.stderr +++ b/tests/ui/missing_const_for_fn/could_be_const.stderr @@ -161,6 +161,11 @@ error: this could be a `const fn` | LL | fn d(this: D) {} | ^^^^^^^^^^^^^^^^ + | +help: make the function `const` + | +LL | const fn d(this: D) {} + | +++++ error: this could be a `const fn` --> tests/ui/missing_const_for_fn/could_be_const.rs:125:9 |
