Skip to content

note: cat_expr Errd during dtor check #22265

Closed
@oli-obk

Description

@oli-obk

I tried to get a minimal example, now i just ended up with completely senseless code, that still gives the error.

use std::ops::IndexMut;

trait Combiner : IndexMut<usize> {
    fn combine<P>(&mut self, mut predicate : P) where
        P: FnMut(&[<Self as IndexMut<usize>>::Output]) -> <Self as IndexMut<usize>>::Output;
}

impl<T> Combiner for Vec<T> {
    fn combine<P>(&mut self, mut predicate : P) where
        P: FnMut(&[<Self as IndexMut<usize>>::Output]) -> <Self as IndexMut<usize>>::Output {
        for _ in 0..self.len() {
            let elem = predicate(&self[0..]);
            *self = vec![elem];
        }
    }
}

fn main() {}

playpen says:

<anon>:11:13: 11:14 note: cat_expr Errd during dtor check
<anon>:11         for _ in 0..self.len() {
                      ^
<anon>:11:32: 14:10 note: cat_expr Errd during dtor check
<anon>:11         for _ in 0..self.len() {
<anon>:12             let elem = predicate(&self[0..]);
<anon>:13             *self = vec![elem];
<anon>:14         }
<anon>:12:24: 12:45 note: cat_expr Errd during dtor check
<anon>:12             let elem = predicate(&self[0..]);
                                 ^~~~~~~~~~~~~~~~~~~~~
<anon>:13:26: 13:30 note: cat_expr Errd during dtor check
<anon>:13             *self = vec![elem];
                                   ^~~~
<std macros>:1:1: 7:33 note: in expansion of vec!
<anon>:13:21: 13:32 note: expansion site

if you remove the for loop, only the last two cat_expr notes are left. adding more code just ends up with more of the notes.

Metadata

Metadata

Assignees

Labels

A-destructorsArea: Destructors (`Drop`, …)A-diagnosticsArea: Messages for errors, warnings, and lints

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions