Closed Bug 1603127 Opened 6 years ago Closed 4 years ago

Replace mozilla::Tie with structured bindings where appropriate in mozilla::Encoding/Decoder/Encoder usage

Categories

(Core :: Internationalization, task, P3)

task

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: hsivonen, Assigned: ssummar)

References

Details

(Keywords: good-first-bug)

Attachments

(1 file)

Various things in mozilla/Encoding.h return mozilla::Tuple. Now that we're on C++17, review the callers to see which call sites would become more readable if migrated to structured bindings.

Priority: -- → P3

Hi :hsivonen, do you mean to change all std::tie usages to structured bindings in all files where a function defined in Encoding.h is used? Or am I misunderstanding? Can you kindly elaborate this. Thank you.

I mean using structured bindings on all call sites that now call methods from mozilla/Encoding.h that now return mozilla::Tuple.

Shazib is working on this as a good-first-bug, and discovered that mozilla::Tuple doesn't support structured bindings (previously reported as bug 1633345). I then wrote a patch for that, and I could submit it there but I also found the (much older) bug 1276351 that suggests we should just migrate APIs away from mozilla:Tuple and instead use std::tuple. I'm thinking that using std::tuple might be the better approach for this bug. Your thoughts/preferences?

Flags: needinfo?(hsivonen)

Botond, is there a reason to stay with mozilla::Tuple or should we migrate to std::tuple?

Flags: needinfo?(hsivonen) → needinfo?(botond)

(In reply to Henri Sivonen (:hsivonen) from comment #4)

Botond, is there a reason to stay with mozilla::Tuple or should we migrate to std::tuple?

I'm supportive of migrating to std::tuple.

I tried it a few years ago, and at the time a major sticking point was that nsAutoPtr could not be stored in std::tuple (and there was a lot of code passing nsAutoPtr to runnable wrappers, whose implementation involved storing the arguments in a tuple). Since then, I see that nsAutoPtr has been removed in bug 1610067, so hopefully a migration should be much smoother now.

Flags: needinfo?(botond)

Thanks :botond. I'll be working on migrating to std::tuple then. You can expect a patch in a few days.

Assignee: nobody → ssummar.bee16seecs
Status: NEW → ASSIGNED
Blocks: 1739367
Pushed by hsivonen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7e8e3747c3f8 Replaced mozilla::Tuple with std::tuple and applied structured bindings in mozilla/Encoding.h. r=hsivonen

Thanks :)

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
Regressions: 1739589

Backed out for causing toolchains build bustages (Bug 1739589)

Flags: needinfo?(ssummar.bee16seecs)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: 96 Branch → ---

(In reply to Cristian Tuns from comment #11)

Backed out for causing toolchains build bustages (Bug 1739589)

Sorry about this. I didnt know non-debug and debug builds are different. I only tested on debug builds. I'm working on fixing this.

Flags: needinfo?(ssummar.bee16seecs)

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/b2e956b4671e
use std::tie instead of mozilla::Tie in comm-central. rs=bustage-fix DONTBUILD

Status: REOPENED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → FIXED
Backout by csabou@mozilla.com: https://hg.mozilla.org/mozilla-central/rev/eb905e7bd8d2 Backed out changeset 7e8e3747c3f8 for causing toolchains build bustages (Bug 1739589). CLOSED TREE
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Backout by mkmelin@iki.fi: https://hg.mozilla.org/comm-central/rev/636157cf21e4 Backed out comm-central changeset b2e956b4671e since m-c fix was backed out. rs=bustage-fix DONTBUILD

Fixed in latest revision. Hopefully won't need anymore revs.

Pushed by hsivonen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f861c1ac64f0 Replaced mozilla::Tuple with std::tuple and applied structured bindings in mozilla/Encoding.h. r=hsivonen
Status: REOPENED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
Pushed by mkmelin@iki.fi: https://hg.mozilla.org/comm-central/rev/9a070c9b7ccd use std::tie instead of mozilla::Tie in comm-central. rs=bustage-fix DONTBUILD
Regressions: 1740109
No longer regressions: 1740109
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: