about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-08-19 09:40:36 +0000
committerbors <bors@rust-lang.org>2018-08-19 09:40:36 +0000
commit8928de74394f320d1109da6731b12638a2167945 (patch)
tree61910bae0095a09ecba3eee2331e8abbe7bae010 /src/test/codegen
parenta9fe312b98d5a6b194c4ad1a17dcf258ba9941ea (diff)
parent1001b2beee595db76ae9d612134271e4a971fed8 (diff)
downloadrust-8928de74394f320d1109da6731b12638a2167945.tar.gz
rust-8928de74394f320d1109da6731b12638a2167945.zip
Auto merge of #52972 - RalfJung:from_raw_parts_align, r=alexcrichton
debug_assert to ensure that from_raw_parts is only used properly aligned

This does not help nearly as much as I would hope because everybody uses the distributed libstd which is compiled without debug assertions. For this reason, I am not sure if this is even worth it. OTOH, this would have caught the misalignment fixed by https://github.com/rust-lang/rust/issues/42789 *if* there had been any tests actually using ZSTs with alignment >1 (we have a CI runner which has debug assertions in libstd enabled), and it seems to currently [fail in the rg testsuite](https://ci.appveyor.com/project/rust-lang/rust/build/1.0.8403/job/v7dfdcgn8ay5j6sb). So maybe it is worth it, after all.

I have seen the attribute `#[rustc_inherit_overflow_checks]` in some places, does that make it so that the *caller's* debug status is relevant? Is there a similar attribute for `debug_assert!`? That could even subsume `rustc_inherit_overflow_checks`: Something like `rustc_inherit_debug_flag` could affect *all* places that change the generated code depending on whether we are in debug or release mode. In fact, given that we have to keep around the MIR for generic functions anyway, is there ever a reason *not* to handle the debug flag that way? I guess currently we apply debug flags like `cfg` so this is dropped early during the MIR pipeline?

EDIT: I learned from @eddyb that because of how `debug_assert!` works, this is not realistic. Well, we could still have it for the rustc CI runs and then maybe, eventually, when libstd gets compiled client-side and there is both a debug and a release build... then this will also benefit users.^^
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/vec-clear.rs1
-rw-r--r--src/test/codegen/vec-iter-collect-len.rs1
-rw-r--r--src/test/codegen/vec-optimizes-away.rs1
3 files changed, 3 insertions, 0 deletions
diff --git a/src/test/codegen/vec-clear.rs b/src/test/codegen/vec-clear.rs
index a73dd077cea..c44637376d7 100644
--- a/src/test/codegen/vec-clear.rs
+++ b/src/test/codegen/vec-clear.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-debug: the debug assertions get in the way
 // compile-flags: -O
 
 #![crate_type = "lib"]
diff --git a/src/test/codegen/vec-iter-collect-len.rs b/src/test/codegen/vec-iter-collect-len.rs
index efb384d0afb..05cbf053444 100644
--- a/src/test/codegen/vec-iter-collect-len.rs
+++ b/src/test/codegen/vec-iter-collect-len.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-debug: the debug assertions get in the way
 // no-system-llvm
 // compile-flags: -O
 #![crate_type="lib"]
diff --git a/src/test/codegen/vec-optimizes-away.rs b/src/test/codegen/vec-optimizes-away.rs
index 261564ed51a..6bef01fd4ea 100644
--- a/src/test/codegen/vec-optimizes-away.rs
+++ b/src/test/codegen/vec-optimizes-away.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 //
+// ignore-debug: the debug assertions get in the way
 // no-system-llvm
 // compile-flags: -O
 #![crate_type="lib"]