diff options
| author | Vishnunarayan K I <appukuttancr@gmail.com> | 2020-11-04 22:23:43 +0530 |
|---|---|---|
| committer | Vishnunarayan K I <appukuttancr@gmail.com> | 2020-11-04 23:22:14 +0530 |
| commit | bd7229daf06b954b93d553825e8c7673cb1019c9 (patch) | |
| tree | 84b23f192d7692859fbf4f89a2f8b5568ba12e75 /src/test | |
| parent | 8e8939b8045b7af6076fb718e2e298844aaf4650 (diff) | |
| download | rust-bd7229daf06b954b93d553825e8c7673cb1019c9.tar.gz rust-bd7229daf06b954b93d553825e8c7673cb1019c9.zip | |
make intern_const_alloc_recursive return error fix #78655
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/consts/issue-78655.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/consts/issue-78655.stderr | 30 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/test/ui/consts/issue-78655.rs b/src/test/ui/consts/issue-78655.rs new file mode 100644 index 00000000000..066764bc46f --- /dev/null +++ b/src/test/ui/consts/issue-78655.rs @@ -0,0 +1,10 @@ +const FOO: *const u32 = { //~ ERROR encountered dangling pointer in final constant + let x; + &x //~ ERROR borrow of possibly-uninitialized variable: `x` +}; + +fn main() { + let FOO = FOO; + //~^ ERROR could not evaluate constant pattern + //~| ERROR could not evaluate constant pattern +} diff --git a/src/test/ui/consts/issue-78655.stderr b/src/test/ui/consts/issue-78655.stderr new file mode 100644 index 00000000000..cf3fe18f802 --- /dev/null +++ b/src/test/ui/consts/issue-78655.stderr @@ -0,0 +1,30 @@ +error[E0381]: borrow of possibly-uninitialized variable: `x` + --> $DIR/issue-78655.rs:3:5 + | +LL | &x + | ^^ use of possibly-uninitialized `x` + +error: encountered dangling pointer in final constant + --> $DIR/issue-78655.rs:1:1 + | +LL | / const FOO: *const u32 = { +LL | | let x; +LL | | &x +LL | | }; + | |__^ + +error: could not evaluate constant pattern + --> $DIR/issue-78655.rs:7:9 + | +LL | let FOO = FOO; + | ^^^ + +error: could not evaluate constant pattern + --> $DIR/issue-78655.rs:7:9 + | +LL | let FOO = FOO; + | ^^^ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0381`. |
