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

Allow NativeEndian instead of NativeEndian {} #220

Closed
fitzgen opened this issue Jul 13, 2017 · 3 comments
Closed

Allow NativeEndian instead of NativeEndian {} #220

fitzgen opened this issue Jul 13, 2017 · 3 comments

Comments

@fitzgen
Copy link
Member

fitzgen commented Jul 13, 2017

As noted in #219, this should do the trick:

#[cfg(target_endian = "little")]
pub use self::LittleEndian as NativeEndian;

#[cfg(target_endian = "big")]
pub use self::BigEndian as NativeEndian;

However, when I try this I start getting errors in tests/parse_self.rs (?!?!??!)

failures:

---- test_parse_self_debug_aranges stdout ----
	Reading section "debug_aranges" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_aranges"
thread 'test_parse_self_debug_aranges' panicked at 'Should parse arange OK: UnexpectedEof', src/libcore/result.rs:860
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: <core::result::Result<T, E>>::expect
  10: parse_self::test_parse_self_debug_aranges
  11: <F as test::FnBox<T>>::call_box
  12: __rust_maybe_catch_panic

---- test_parse_self_debug_pubtypes stdout ----
	Reading section "debug_info" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_info"
Reading section "debug_abbrev" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_abbrev"
Reading section "debug_pubtypes" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_pubtypes"
thread 'test_parse_self_debug_pubtypes' panicked at 'Should parse pubtype OK: UnexpectedEof', src/libcore/result.rs:860
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: <core::result::Result<T, E>>::expect
  10: parse_self::test_parse_self_debug_pubtypes
  11: <F as test::FnBox<T>>::call_box
  12: __rust_maybe_catch_panic

---- test_parse_self_debug_pubnames stdout ----
	Reading section "debug_info" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_info"
Reading section "debug_abbrev" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_abbrev"
Reading section "debug_pubnames" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_pubnames"
thread 'test_parse_self_debug_pubnames' panicked at 'Should parse pubname OK: UnexpectedEof', src/libcore/result.rs:860
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: <core::result::Result<T, E>>::expect
  10: parse_self::test_parse_self_debug_pubnames
  11: <F as test::FnBox<T>>::call_box
  12: __rust_maybe_catch_panic

---- test_parse_self_eh_frame stdout ----
	Reading section "eh_frame" at path "/Users/fitzgen/src/gimli/fixtures/self/eh_frame"
thread 'test_parse_self_eh_frame' panicked at 'Should parse CFI entry OK: UnexpectedEof', src/libcore/result.rs:860
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: <core::result::Result<T, E>>::expect
  10: parse_self::test_parse_self_eh_frame
  11: <F as test::FnBox<T>>::call_box
  12: __rust_maybe_catch_panic

---- test_parse_self_debug_line stdout ----
	Reading section "debug_info" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_info"
Reading section "debug_abbrev" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_abbrev"
Reading section "debug_line" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_line"
Reading section "debug_str" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_str"
thread 'test_parse_self_debug_line' panicked at 'Should parse compilation unit: UnexpectedEof', src/libcore/result.rs:860
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: <core::result::Result<T, E>>::expect
  10: parse_self::test_parse_self_debug_line
  11: <F as test::FnBox<T>>::call_box
  12: __rust_maybe_catch_panic

---- test_parse_self_debug_info stdout ----
	Reading section "debug_info" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_info"
Reading section "debug_abbrev" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_abbrev"
thread 'test_parse_self_debug_info' panicked at 'Should parse compilation unit: UnexpectedEof', src/libcore/result.rs:860
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: <core::result::Result<T, E>>::expect
  10: parse_self::test_parse_self_debug_info
  11: <F as test::FnBox<T>>::call_box
  12: __rust_maybe_catch_panic

---- test_parse_self_debug_ranges stdout ----
	Reading section "debug_info" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_info"
Reading section "debug_abbrev" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_abbrev"
Reading section "debug_ranges" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_ranges"
thread 'test_parse_self_debug_ranges' panicked at 'Should parse compilation unit: UnexpectedEof', src/libcore/result.rs:860
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: <core::result::Result<T, E>>::expect
  10: parse_self::test_parse_self_debug_ranges
  11: <F as test::FnBox<T>>::call_box
  12: __rust_maybe_catch_panic

---- test_parse_self_debug_loc stdout ----
	Reading section "debug_info" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_info"
Reading section "debug_abbrev" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_abbrev"
Reading section "debug_loc" at path "/Users/fitzgen/src/gimli/fixtures/self/debug_loc"
thread 'test_parse_self_debug_loc' panicked at 'Should parse compilation unit: UnexpectedEof', src/libcore/result.rs:860
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: <core::result::Result<T, E>>::expect
  10: parse_self::test_parse_self_debug_loc
  11: <F as test::FnBox<T>>::call_box
  12: __rust_maybe_catch_panic


failures:
    test_parse_self_debug_aranges
    test_parse_self_debug_info
    test_parse_self_debug_line
    test_parse_self_debug_loc
    test_parse_self_debug_pubnames
    test_parse_self_debug_pubtypes
    test_parse_self_debug_ranges
    test_parse_self_eh_frame
@philipc
Copy link
Collaborator

philipc commented Jul 13, 2017

That does work for me. Maybe something isn't being rebuilt properly, does a cargo clean fix it?

@philipc
Copy link
Collaborator

philipc commented Jul 13, 2017

An issue with use is that it ignore the docs for NativeEndian.

I've filed rust-lang/rust#43209

@philipc
Copy link
Collaborator

philipc commented Jul 13, 2017

This should work, will test tomorrow:

pub type NativeEndian = LittleEndian;
pub const NativeEndian: LittleEndian = LittleEndian;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants