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

Fragment debug_id u16 only exists in debug, prod will format mem address #11442

Merged
merged 1 commit into from Jun 4, 2016

Conversation

@mitchhentges
Copy link
Contributor

mitchhentges commented May 26, 2016

Each fragment has a u16 debug_id in debug mode, but no debug_id in production to save memory. To format a debug id in production, the address of the empty debug_id is displayed.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #87 (github issue number if applicable).
  • These changes do not require tests because it looks like it's not possible to mock out cfg options in #[test]s

This change is Reviewable

@highfive
Copy link

highfive commented May 26, 2016

warning Warning warning

  • These commits modify layout code, but no tests are modified. Please consider adding a test!
@mitchhentges
Copy link
Contributor Author

mitchhentges commented May 26, 2016

CI is mad right out-of-the-gate :(

@mitchhentges mitchhentges force-pushed the mitchhentges:87-debug-id branch from dce044b to 9e224f6 May 27, 2016
@highfive
Copy link

highfive commented May 27, 2016

New code was committed to pull request.

@mitchhentges
Copy link
Contributor Author

mitchhentges commented May 27, 2016

Merged master to make CI go again (Appveyor had failed immediately for the first commit)

@jdm
Copy link
Member

jdm commented May 27, 2016

If appveyor shows a build error unrelated to your changes, it's not a big deal.


#[cfg(debug_assertions)]
#[derive(Clone)]
struct DebugId {

This comment has been minimized.

Copy link
@KiChjang

KiChjang May 31, 2016

Member

This could just be struct DebugId(u16).

@mitchhentges mitchhentges force-pushed the mitchhentges:87-debug-id branch from 9e224f6 to 14a90d0 May 31, 2016
@highfive
Copy link

highfive commented May 31, 2016

New code was committed to pull request.

@mitchhentges
Copy link
Contributor Author

mitchhentges commented May 31, 2016

I also made the not(debug_assertions) one a "unit-like" struct

@KiChjang
Copy link
Member

KiChjang commented May 31, 2016

@bors-servo r+

Thanks!

@bors-servo
Copy link
Contributor

bors-servo commented May 31, 2016

📌 Commit 14a90d0 has been approved by KiChjang

@bors-servo
Copy link
Contributor

bors-servo commented Jun 1, 2016

Testing commit 14a90d0 with merge 170a21e...

bors-servo added a commit that referenced this pull request Jun 1, 2016
Fragment debug_id u16 only exists in debug, prod will format mem address

<!-- Please describe your changes on the following line: -->
Each fragment has a `u16` `debug_id` in debug mode, but no `debug_id` in production to save memory. To format a debug id in production, the address of the empty `debug_id` is displayed.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #87 (github issue number if applicable).

<!-- Either: -->
- [X] These changes do not require tests because it looks like it's not possible to mock out `cfg` options in `#[test]`s

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11442)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jun 1, 2016

💔 Test failed - linux-rel

@KiChjang
Copy link
Member

KiChjang commented Jun 1, 2016

Fails compiling release:

/home/servo/buildbot/slave/linux-rel/build/components/layout/fragment.rs:2819:31: 2819:37 error: invalid reference to argument `0` (no arguments given)
/home/servo/buildbot/slave/linux-rel/build/components/layout/fragment.rs:2819         e.emit_string(format!("{:p}"), &self)
                                                                                                            ^~~~~~
<std macros>:2:28: 2:59 note: in this expansion of format_args!
/home/servo/buildbot/slave/linux-rel/build/components/layout/fragment.rs:2819:23: 2819:38 note: in this expansion of format! (defined in <std macros>)
error: aborting due to previous error
error: Could not compile `layout`.
@mitchhentges mitchhentges force-pushed the mitchhentges:87-debug-id branch from 14a90d0 to 971743d Jun 1, 2016
@highfive
Copy link

highfive commented Jun 1, 2016

New code was committed to pull request.

@mitchhentges
Copy link
Contributor Author

mitchhentges commented Jun 1, 2016

Ah, you do ./mach build --release to build without debug_assertions to test the other compile path, cool.
Fixed, and I also added some #[cfg(not(debug_assertions))] to try and not create DEBUG_ID_COUNTER, generate_unique_debug_id() and the import for layout_debug, but I'm still getting warnings in the console. Maybe I should ignore the "dead code" warning?

/home/mitch/dev/servo/components/layout/layout_debug.rs:23:1: 23:58 warning: static item is never used: `DEBUG_ID_COUNTER`, #[warn(dead_code)] on by default
/home/mitch/dev/servo/components/layout/layout_debug.rs:23 static DEBUG_ID_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mitch/dev/servo/components/layout/layout_debug.rs:101:1: 103:2 warning: function is never used: `generate_unique_debug_id`, #[warn(dead_code)] on by default
/home/mitch/dev/servo/components/layout/layout_debug.rs:101 pub fn generate_unique_debug_id() -> u16 {
                                                            ^
/home/mitch/dev/servo/components/layout/fragment.rs:53:5: 53:17 warning: unused import, #[warn(unused_imports)] on by default
/home/mitch/dev/servo/components/layout/fragment.rs:53 use layout_debug;
@mitchhentges mitchhentges force-pushed the mitchhentges:87-debug-id branch from a864cad to b65643c Jun 4, 2016
@highfive
Copy link

highfive commented Jun 4, 2016

New code was committed to pull request.

@mitchhentges
Copy link
Contributor Author

mitchhentges commented Jun 4, 2016

Okay. I think I've got this covered. I've:

  • Run ./mach test-tidy
  • Run ./mach build -d
  • Run ./mach build --release

I don't know what else I can do other than run all tests locally, which will take a little too long. So, I'm pretty confident that it should pass CI now 😄

@KiChjang
Copy link
Member

KiChjang commented Jun 4, 2016

Fails tidy:

./components/layout/fragment.rs:52: encountered whitespace following a use statement

./components/layout/layout_debug.rs:19: encountered whitespace following a use statement
@mitchhentges
Copy link
Contributor Author

mitchhentges commented Jun 4, 2016

I must've made a mistake on my git add, agh. Handling this outside my ide (for amends) is throwing me off

@mitchhentges mitchhentges force-pushed the mitchhentges:87-debug-id branch from b65643c to 43396c0 Jun 4, 2016
@highfive
Copy link

highfive commented Jun 4, 2016

New code was committed to pull request.

@KiChjang
Copy link
Member

KiChjang commented Jun 4, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Jun 4, 2016

📌 Commit 43396c0 has been approved by KiChjang

@bors-servo
Copy link
Contributor

bors-servo commented Jun 4, 2016

Testing commit 43396c0 with merge a149d75...

bors-servo added a commit that referenced this pull request Jun 4, 2016
Fragment debug_id u16 only exists in debug, prod will format mem address

<!-- Please describe your changes on the following line: -->
Each fragment has a `u16` `debug_id` in debug mode, but no `debug_id` in production to save memory. To format a debug id in production, the address of the empty `debug_id` is displayed.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #87 (github issue number if applicable).

<!-- Either: -->
- [X] These changes do not require tests because it looks like it's not possible to mock out `cfg` options in `#[test]`s

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11442)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jun 4, 2016

💔 Test failed - mac-rel-css

@mitchhentges
Copy link
Contributor Author

mitchhentges commented Jun 4, 2016

I don't think that the failing build is due to my changes:


command timed out: 1200 seconds without output running ['git', 'clean', '-f', '-f', '-d', '-x'], attempting to kill
@KiChjang
Copy link
Member

KiChjang commented Jun 4, 2016

@bors-servo retry

  • The annoying git
@KiChjang KiChjang removed the S-fails-tidy label Jun 4, 2016
bors-servo added a commit that referenced this pull request Jun 4, 2016
Fragment debug_id u16 only exists in debug, prod will format mem address

<!-- Please describe your changes on the following line: -->
Each fragment has a `u16` `debug_id` in debug mode, but no `debug_id` in production to save memory. To format a debug id in production, the address of the empty `debug_id` is displayed.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #87 (github issue number if applicable).

<!-- Either: -->
- [X] These changes do not require tests because it looks like it's not possible to mock out `cfg` options in `#[test]`s

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11442)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jun 4, 2016

Testing commit 43396c0 with merge 5002dff...

@bors-servo
Copy link
Contributor

bors-servo commented Jun 4, 2016

@bors-servo bors-servo merged commit 43396c0 into servo:master Jun 4, 2016
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@mitchhentges mitchhentges deleted the mitchhentges:87-debug-id branch Jun 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.