Fixme with link for re-enabling const mutation lint for Drop consts
This commit is contained in:
parent
75c2fdf34a
commit
804d159c62
1 changed files with 9 additions and 2 deletions
|
@ -39,14 +39,21 @@ impl<'a, 'tcx> ConstMutationChecker<'a, 'tcx> {
|
||||||
// We avoid linting mutation of a const item if the const's type has a
|
// We avoid linting mutation of a const item if the const's type has a
|
||||||
// Drop impl. The Drop logic observes the mutation which was performed.
|
// Drop impl. The Drop logic observes the mutation which was performed.
|
||||||
//
|
//
|
||||||
// struct Log { msg: &'static str }
|
// pub struct Log { msg: &'static str }
|
||||||
// const LOG: Log = Log { msg: "" };
|
// pub const LOG: Log = Log { msg: "" };
|
||||||
// impl Drop for Log {
|
// impl Drop for Log {
|
||||||
// fn drop(&mut self) { println!("{}", self.msg); }
|
// fn drop(&mut self) { println!("{}", self.msg); }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// LOG.msg = "wow"; // prints "wow"
|
// LOG.msg = "wow"; // prints "wow"
|
||||||
//
|
//
|
||||||
|
// FIXME(https://github.com/rust-lang/rust/issues/77425):
|
||||||
|
// Drop this exception once there is a stable attribute to suppress the
|
||||||
|
// const item mutation lint for a single specific const only. Something
|
||||||
|
// equivalent to:
|
||||||
|
//
|
||||||
|
// #[const_mutation_allowed]
|
||||||
|
// pub const LOG: Log = Log { msg: "" };
|
||||||
match self.tcx.calculate_dtor(def_id, &mut any_dtor) {
|
match self.tcx.calculate_dtor(def_id, &mut any_dtor) {
|
||||||
Some(_) => None,
|
Some(_) => None,
|
||||||
None => Some(def_id),
|
None => Some(def_id),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue