Closed
Bug 1631952
Opened 4 years ago
Closed 4 years ago
Fail loudly when trying to `xpimplement` multiple interfaces with the same method name in Rust
Categories
(Core :: XPCOM, task)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla77
Tracking | Status | |
---|---|---|
firefox77 | --- | fixed |
People
(Reporter: lina, Assigned: lina)
Details
Attachments
(1 file)
I declared two methods with the same name (but different callback parameter types) in two different interfaces. That won't work in Rust, since it doesn't have function overloading like C++—but the compiler error only pointed to the derive[xpcom]
line, saying something like expected type *const nsICallbackType, found type *const nsIOtherCallbackType
, making it hard to figure out what the actual issue was.
We can't really do anything about this except use binaryname
in XPIDL to rename one or both of those methods to something that doesn't conflict. So let's suggest that in the error that we return.
Assignee | ||
Comment 1•4 years ago
|
||
Assignee | ||
Comment 2•4 years ago
|
||
2:06.29 = help: message: #[derive(xpcom)] failed: "The method `Finalize` is declared on both `mozIExtensionStorageArea` and `mozIBridgedSyncEngine`, but a Rust type cannot implement two methods with the same name. You can add the `[binaryname(RenamedFinalize)]` XPIDL attribute to one of the declarations to rename it."
Much better! 😊
Pushed by kcambridge@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9371029b5814 Ensure that all XPCOM interface methods have unique names when implementing them in Rust. r=nika
Comment 4•4 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
status-firefox77:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in
before you can comment on or make changes to this bug.
Description
•