-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Debug asserts aren't enabled by default in optimized build #17124
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
Conversation
#[macro_export] | ||
macro_rules! debug_assert( | ||
($(a:tt)*) => ({ | ||
if cfg!(not(ndebug)) { | ||
if (cfg!(not(optimize)) && cfg!(not(ndebug))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, where does the optimize
configuration get defined?
fn main() {
println!("{}", cfg!(optimize));
}
prints false with or without -O
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was defined in https://github.com/rust-lang/rust/blob/master/src/librustc/driver/config.rs#L781 but it seems that I was wrong.
I'll look into it, sorry if my pr was flawed :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry if my pr was flawed :/
Don't worry. 😄
Fixes #14972
- Ensures the propagated negation sign is properly utilized during type checking. - Removed redundant type checking, specifically regarding the out of bounds checking on a bounded type. - Closes #16684
This code used to produce an ICE on the definition of trait Bar with the following message: Type parameter out of range when substituting in region 'a (root type=fn(Self) -> 'astr) (space=FnSpace, index=0) Closes #16218.
This test verifies that casting from the same lifetime on a value to the same lifetime on a trait succeeds. Closes #10766.
Everyone agreed. Fix #17065
Everyone agreed. fix #17073
Breaks `iterate(f, seed)`, use `iterate(seed, f)` instead. The convention is to have the closure last. Closes #17066. [breaking-change]
The performance hit from these checks is significant, but unoptimized builds are already incredibly slow. Enabling these checks results in better test coverage since there are bots doing unoptimized builds, and the cost is relatively small in the context of an unoptimized build. This also allows using `JEMALLOC_FLAGS` to override the default configure flags.
Other languages may not want to have a leading #-line get stripped.
Win32/WinSock APIs never call WSASetLastError() with WSAEINTR unless a programmer specifically cancels the ongoing blocking call by a deprecated WinSock1 API WSACancelBlockingCall(). So the errno check was simply removed and retry() became an id function on Windows. Note: Windows' equivalent of SIGINT is always handled in a separate thread: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682541%28v=vs.85%29.aspx "CTRL+C and CTRL+BREAK Signals" Also, incidentally rename a type parameter and clean up some module imports.
This code used to produce the following ICE: error: internal compiler error: get_unique_type_id_of_type() - unexpected type: closure, ty_unboxed_closure(syntax::ast::DefId{krate: 0u32, node: 66u32}, ReScope(63u32)) This is a regression test for issue #17021.
Everyone agreed. fix #17076
This uses a bitwise mask to ensure that there's no bounds checking for the array accesses when generating the next random number. This isn't costless, but the single instruction is nothing compared to the branch. A `debug_assert` for "bounds check" is preserved to ensure that refactoring doesn't accidentally break it (i.e. create values of `cnt` that are out of bounds with the masking causing it to silently wrap- around). Before: test test::rand_isaac ... bench: 990 ns/iter (+/- 24) = 808 MB/s test test::rand_isaac64 ... bench: 614 ns/iter (+/- 25) = 1302 MB/s After: test test::rand_isaac ... bench: 877 ns/iter (+/- 134) = 912 MB/s test test::rand_isaac64 ... bench: 470 ns/iter (+/- 30) = 1702 MB/s (It also removes the unsafe code in Isaac64Rng.next_u64, with a *gain* in performance; today is a good day.)
itself. This breaks code like: for &x in my_vector.iter() { my_vector[2] = "wibble"; ... } Change this code to not invalidate iterators. For example: for i in range(0, my_vector.len()) { my_vector[2] = "wibble"; ... } The `for-loop-does-not-borrow-iterators` test for #8372 was incorrect and has been removed. Closes #16820. [breaking-change]
There isn't a good way to fit this in, so let's just not mention it. Fixes #16792.
This allows code to access the fields of tuples and tuple structs: let x = (1i, 2i); assert_eq!(x.1, 2); struct Point(int, int); let origin = Point(0, 0); assert_eq!(origin.0, 0); assert_eq!(origin.1, 0);
…detecting them in resolve. This simplifies logic elsewhere in the compiler. cc #5527
I missed some annotations, and some were in a different style.
Instead of `extern crate foo = bar`, write `extern crate bar as foo`. Instead of `extern crate baz = "quux"`, write `extern crate "quux" as baz`. Closes #16461. [breaking-change]
whoops Fixes #16827 (comment)
…bin/) to PATH during linking, so that rustc can invoke them.
gcc, ld, ar, dlltool, windres go into $(RUST)/bin/rustlib/<triple>/bin/ platform libraries and startup objects got into $(RUST)/bin/rustlib/<triple>/lib/
The Guide isn't 100% perfect, but it's basically complete. It's certainly better than the tutorial is. Time to start pointing more people its way. I also just made it consistent to call all things 'guides' rather than tutorials. Fixes #9874. This is the big one. And two bugs that just go away. Fixes #14503. Fixes #15009.
Closing to see if this unsticks bors |
fixes #17081