diff options
| author | bors <bors@rust-lang.org> | 2021-08-28 02:28:31 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-28 02:28:31 +0000 |
| commit | 27e88d367c140907655bae9c7975fac411a5c344 (patch) | |
| tree | 4f3afa767878bbc86c5a28c3bd80f039791eac39 /src/test | |
| parent | 2296b16654165ebe0849a8bba67ea46e3c6f0c7c (diff) | |
| parent | 88e4efd321c3c13b7b0d9ca13388f363a7b91363 (diff) | |
Auto merge of #88400 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] backports
This PR rolls up a number of beta backports:
* Split critical edge targeting the start block #88124
* Make BuildHasher object safe #88031
* Fix Windows Command::env("PATH") #87863
* Do not ICE on HIR based WF check when involving lifetimes #87811
* Update compiler_builtins to fix i128 shift/mul on thumbv6m #87633
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs | 35 | ||||
| -rw-r--r-- | src/test/ui/wf/hir-wf-check-erase-regions.rs | 14 | ||||
| -rw-r--r-- | src/test/ui/wf/hir-wf-check-erase-regions.stderr | 31 |
3 files changed, 80 insertions, 0 deletions
diff --git a/src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs b/src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs new file mode 100644 index 00000000000..38dfca347c8 --- /dev/null +++ b/src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs @@ -0,0 +1,35 @@ +// build-pass +// compile-flags: -Copt-level=0 + +// Regression test for #88043: LLVM crash when the RemoveZsts mir-opt pass is enabled. +// We should not see the error: +// `Basic Block in function '_ZN4main10take_until17h0067b8a660429bc9E' does not have terminator!` + +fn bump() -> Option<usize> { + unreachable!() +} + +fn take_until(terminate: impl Fn() -> bool) { + loop { + if terminate() { + return; + } else { + bump(); + } + } +} + +// CHECK-LABEL: @main +fn main() { + take_until(|| true); + f(None); +} + +fn f(_a: Option<String>) -> Option<u32> { + loop { + g(); + () + } +} + +fn g() -> Option<u32> { None } diff --git a/src/test/ui/wf/hir-wf-check-erase-regions.rs b/src/test/ui/wf/hir-wf-check-erase-regions.rs new file mode 100644 index 00000000000..bb398e5698a --- /dev/null +++ b/src/test/ui/wf/hir-wf-check-erase-regions.rs @@ -0,0 +1,14 @@ +// Regression test for #87549. +// compile-flags: -C incremental=tmp/wf/hir-wf-check-erase-regions + +pub struct Table<T, const N: usize>([Option<T>; N]); + +impl<'a, T, const N: usize> IntoIterator for &'a Table<T, N> { + type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; //~ ERROR `&T` is not an iterator + type Item = &'a T; + + fn into_iter(self) -> Self::IntoIter { //~ ERROR `&T` is not an iterator + unimplemented!() + } +} +fn main() {} diff --git a/src/test/ui/wf/hir-wf-check-erase-regions.stderr b/src/test/ui/wf/hir-wf-check-erase-regions.stderr new file mode 100644 index 00000000000..203f09994e6 --- /dev/null +++ b/src/test/ui/wf/hir-wf-check-erase-regions.stderr @@ -0,0 +1,31 @@ +error[E0277]: `&T` is not an iterator + --> $DIR/hir-wf-check-erase-regions.rs:7:5 + | +LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&T` is not an iterator + | + ::: $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL + | +LL | pub struct Flatten<I: Iterator<Item: IntoIterator>> { + | ------------ required by this bound in `Flatten` + | + = help: the trait `Iterator` is not implemented for `&T` + = note: required because of the requirements on the impl of `IntoIterator` for `&T` + +error[E0277]: `&T` is not an iterator + --> $DIR/hir-wf-check-erase-regions.rs:10:27 + | +LL | fn into_iter(self) -> Self::IntoIter { + | ^^^^^^^^^^^^^^ `&T` is not an iterator + | + ::: $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL + | +LL | pub struct Flatten<I: Iterator<Item: IntoIterator>> { + | ------------ required by this bound in `Flatten` + | + = help: the trait `Iterator` is not implemented for `&T` + = note: required because of the requirements on the impl of `IntoIterator` for `&T` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. |
