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

Fix 0-sized getrandom and thread_rng() #692

Merged
merged 10 commits into from
Apr 17, 2019
Merged

Conversation

RalfJung
Copy link
Member

No description provided.

@RalfJung RalfJung changed the title Fix 0-sized getrandom Fix 0-sized getrandom and thread_rng() Apr 16, 2019
@RalfJung
Copy link
Member Author

Dang, something is wrong on Windows:

=> captured stdout <=
running 1 test
test test::rng ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
running 3 tests
test entropy_rng ... 
=> captured stderr <=
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `8`,
 right: `4`', src\librustc\mir\interpret\value.rs:288:17
stack backtrace:
   0: std::sys_common::alloc::realloc_fallback
   1: std::panicking::take_hook
   2: std::panicking::take_hook
   3: rustc::ty::structural_impls::<impl rustc::ty::context::Lift for rustc::ty::adjustment::AutoBorrow>::lift_to_tcx
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic_fmt
   6: std::panicking::begin_panic_fmt
   7: rustc::mir::interpret::value::Scalar<Tag>::to_u64
   8: rustc::mir::interpret::value::Scalar<Tag>::to_usize
   9: rustc_mir::interpret::validity::<impl rustc_mir::interpret::eval_context::InterpretCx<M>>::validate_operand
  10: <rustc_mir::interpret::eval_context::LocalValue<Tag,Id> as core::fmt::Debug>::fmt
  11: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpretCx<M>>::run
  12: miri::eval_main
  13: env_logger::init_from_env
  14: rustc_interface::interface::Compiler::output_file
  15: <miri::MiriCompilerCalls as rustc_driver::Callbacks>::after_analysis
  16: <env_logger::fmt::WriteStyle as core::default::Default>::default
  17: rustc_driver::set_sigpipe_handler
  18: <env_logger::filter::inner::Filter as core::fmt::Display>::fmt
  19: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
  20: rustc_driver::set_sigpipe_handler
  21: _rust_maybe_catch_panic
  22: rustc_driver::set_sigpipe_handler
  23: <std::error::<impl core::convert::From<alloc::string::String> for alloc::boxed::Box<dyn +std::error::Error+core::marker::Sync+core::marker::Send>>::from::StringError as core::fmt::Display>::fmt
  24: std::sys::windows::thread::Thread::new
  25: BaseThreadInitThunk
  26: RtlUserThreadStart
query stack during panic:
end of query stack

@RalfJung
Copy link
Member Author

Looks like the len argument is actually always 32bit on Windows... but how did the tests pass previously then? Almost as if this wasn't even exercised on Windows?

Cc @Aaron1011

@RalfJung
Copy link
Member Author

Oh, I get it... the test actually ICE'd but because of #685 we did not notice.

@RalfJung RalfJung merged commit ff88062 into rust-lang:master Apr 17, 2019
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

Successfully merging this pull request may close these issues.

2 participants