Skip to content

librustc: Make references to functions not have static lifetime. #15961

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jul 25, 2014

Conversation

pcwalton
Copy link
Contributor

This breaks code like:

struct A<'a> {
    func: &'a fn() -> Option<int>
}

fn foo() -> Option<int> { ... }

fn create() -> A<'static> {
    A {
        func: &foo
    }
}

Change this code to not take functions by reference. For example:

struct A {
    func: extern "Rust" fn() -> Option<int>
}

fn foo() -> Option<int> { ... }

fn create() -> A {
    A {
        func: foo
    }
}

Closes #13595.

[breaking-change]

r? @huonw

This breaks code like:

    struct A<'a> {
        func: &'a fn() -> Option<int>
    }

    fn foo() -> Option<int> { ... }

    fn create() -> A<'static> {
        A {
            func: &foo
        }
    }

Change this code to not take functions by reference. For example:

    struct A {
        func: extern "Rust" fn() -> Option<int>
    }

    fn foo() -> Option<int> { ... }

    fn create() -> A {
        A {
            func: foo
        }
    }

Closes rust-lang#13595.

[breaking-change]
bors added a commit that referenced this pull request Jul 25, 2014
This breaks code like:

    struct A<'a> {
        func: &'a fn() -> Option<int>
    }

    fn foo() -> Option<int> { ... }

    fn create() -> A<'static> {
        A {
            func: &foo
        }
    }

Change this code to not take functions by reference. For example:

    struct A {
        func: extern "Rust" fn() -> Option<int>
    }

    fn foo() -> Option<int> { ... }

    fn create() -> A {
        A {
            func: foo
        }
    }

Closes #13595.

[breaking-change]

r? @huonw
@bors bors closed this Jul 25, 2014
@bors bors merged commit d1dcd19 into rust-lang:master Jul 25, 2014
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 4, 2023
Improve error handling for top-level `let` statements

This commit addresses the issue of excessive and unrelated errors generated by top-level `let` statements. Now, only a single error is produced, indicating that `let` statements are invalid at the top level.

---

Fixes rust-lang/rust-analyzer#14963.

While I'm not really sure if handling a particular case in a special manner is appropriate, it would be good to suppress the excessive number of annoying and unrelated errors.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

core dump: fn pointer in iterator
3 participants