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

ICE when passing self as the value to a nonexistent struct field #5439

Closed
doy opened this issue Mar 19, 2013 · 5 comments
Closed

ICE when passing self as the value to a nonexistent struct field #5439

doy opened this issue Mar 19, 2013 · 5 comments
Labels
A-type-system Area: Type system E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@doy
Copy link
Contributor

doy commented Mar 19, 2013

struct Foo {
    foo: int,
}

struct Bar {
    bar: int,
}

impl Bar {
    fn make_foo (&self, i: int) -> ~Foo {
        return ~Foo { nonexistent: self, foo: i };
    }
}

fn main () {
    let bar = Bar { bar: 1 };
    let foo = bar.make_foo(2);
    io::println(fmt!("%d", foo.foo));
}

produces

test2.rs:11:22: 11:39 error: structure has no field named `nonexistent`
test2.rs:11         return ~Foo { nonexistent: self, foo: i };
                                  ^~~~~~~~~~~~~~~~~
error: internal compiler error: no type for node 23: expr self (id=23) in fcx 7f5d0c438ce0
@pcwalton
Copy link
Contributor

pcwalton commented May 9, 2013

Nominated for production ready

@graydon
Copy link
Contributor

graydon commented May 16, 2013

accepted for production-ready milestone

@emberian
Copy link
Member

No longer ICEs, needs testcase

@fhahn
Copy link
Contributor

fhahn commented Aug 28, 2013

@alexcrichton
Copy link
Member

hurrah!

oli-obk pushed a commit to oli-obk/rust that referenced this issue May 2, 2020
Lint for holding locks across await points

Fixes rust-lang#4226

This introduces the lint await_holding_lock. For async functions, we iterate
over all types in generator_interior_types and look for types named MutexGuard,
RwLockReadGuard, or RwLockWriteGuard. If we find one then we emit a lint.

changelog: introduce the await_holding_lock lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

6 participants