Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

note: cat_expr Errd during dtor check #22265

Closed
oli-obk opened this issue Feb 13, 2015 · 4 comments · Fixed by #22767
Closed

note: cat_expr Errd during dtor check #22265

oli-obk opened this issue Feb 13, 2015 · 4 comments · Fixed by #22767
Assignees
Labels
A-destructors Area: Destructors (`Drop`, …) A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Feb 13, 2015

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.

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Feb 13, 2015
@pnkfelix pnkfelix added the A-destructors Area: Destructors (`Drop`, …) label Feb 18, 2015
@pnkfelix
Copy link
Member

this is pretty much my fault. :)

In all the cases that I have seen where it arises, it is due to a type error (or a type inference failure at at least) somewhere in the code.

Of course the notes are incredibly annoying. I will try to fix.

@pnkfelix pnkfelix self-assigned this Feb 18, 2015
@pnkfelix
Copy link
Member

And of course the concrete example given here is one where there is no type error. At least, not one exposed by compiling this code. (I have not yet managed to show Combiner being instantiated concretely without causing some other type error to arise.)

@pnkfelix
Copy link
Member

(but there may be a mix of bugs causing the original input here to pass. In particular, the code in the description is doing <Self as IndexMut>::Output, but that associated type does not exist. One needs <Self as Index>::Output. See also: #21259 )

@pnkfelix
Copy link
Member

cc #22321

bors added a commit that referenced this issue Feb 25, 2015
Avoid `cat_expr Erred` notes when already in error state.

Also, to ensure we do not let the dropck get skipped, ICE if `cat_expr` errors when *not* in error state.

This is not known to be a breaking change (i.e. I do not know of a current case that causes the new ICE to be exercised).

Fix #22265
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-destructors Area: Destructors (`Drop`, …) A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants