Skip to content

Cannot generically implement Function traits #17779

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

Closed
Ericson2314 opened this issue Oct 4, 2014 · 1 comment
Closed

Cannot generically implement Function traits #17779

Ericson2314 opened this issue Oct 4, 2014 · 1 comment
Labels
A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@Ericson2314
Copy link
Contributor

My code:

pub struct LockedClosure<F>  {
    closure: Mutex<F>
}

impl<F, Args, Result> Fn<Args, Result> for LockedClosure<F>
    where F: FnMut<Args, Result>, F:Send
{
    #[rust_call_abi_hack]
    fn call(&self, args: Args) -> Result {
        self.closure.lock().deref_mut().call_mut(args)
    }
}

I get an ICE 'argument to function with "rust-call" ABI is neither a tuple nor unit', which is perfectly reasonable. This seems like a useful thing to do however, and due to the where clause, args will in fact be a tuple or unit.

@kmcallister kmcallister added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-type-system Area: Type system labels Oct 4, 2014
@Ericson2314
Copy link
Contributor Author

Hmm, so another unboxed-closure thing might of triggered the ICE, closing until I can reconfirm issue.

lnicola pushed a commit to lnicola/rust that referenced this issue Sep 25, 2024
feat: Implement object safety and its hovering hint

Resolves rust-lang#17779

- [x] Fill missing implementations
- [x] Hover rendering
- [x] Implement object safety's own test suite, like layout
- [x] Add test cases (from rustc maybe)
- [x] Clean up ugly codes
- [x] Add doc string
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 I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants