diff options
| author | David Wood <david@davidtw.co> | 2020-08-07 17:07:25 +0100 |
|---|---|---|
| committer | David Wood <david@davidtw.co> | 2020-08-07 17:07:25 +0100 |
| commit | d97f89b1a6add41b6ac3c0d69cbe82d15483a0d6 (patch) | |
| tree | 141b21c22eabd64947652cb22ff5fd4f6f9d824b /src/test/ui/polymorphization | |
| parent | 659d44a3b4928b5b9b81927dec74242d3bdb7120 (diff) | |
| download | rust-d97f89b1a6add41b6ac3c0d69cbe82d15483a0d6.tar.gz rust-d97f89b1a6add41b6ac3c0d69cbe82d15483a0d6.zip | |
polymorphize: non-promoted unevaluated constants
This commit makes polymorphization visit non-promoted unevaluated constants rather than visit their substs directly. Signed-off-by: David Wood <david@davidtw.co>
Diffstat (limited to 'src/test/ui/polymorphization')
| -rw-r--r-- | src/test/ui/polymorphization/promoted-function-2.rs | 16 | ||||
| -rw-r--r-- | src/test/ui/polymorphization/promoted-function-2.stderr | 17 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/test/ui/polymorphization/promoted-function-2.rs b/src/test/ui/polymorphization/promoted-function-2.rs new file mode 100644 index 00000000000..2831f861f55 --- /dev/null +++ b/src/test/ui/polymorphization/promoted-function-2.rs @@ -0,0 +1,16 @@ +// build-fail +// compile-flags:-Zpolymorphize=on +#![crate_type = "lib"] +#![feature(lazy_normalization_consts, rustc_attrs)] +//~^ WARN the feature `lazy_normalization_consts` is incomplete + +#[rustc_polymorphize_error] +fn test<T>() { + //~^ ERROR item has unused generic parameters + let x = [0; 3 + 4]; +} + +pub fn caller() { + test::<String>(); + test::<Vec<String>>(); +} diff --git a/src/test/ui/polymorphization/promoted-function-2.stderr b/src/test/ui/polymorphization/promoted-function-2.stderr new file mode 100644 index 00000000000..38d4808c48c --- /dev/null +++ b/src/test/ui/polymorphization/promoted-function-2.stderr @@ -0,0 +1,17 @@ +warning: the feature `lazy_normalization_consts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/promoted-function-2.rs:4:12 + | +LL | #![feature(lazy_normalization_consts, rustc_attrs)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #72219 <https://github.com/rust-lang/rust/issues/72219> for more information + +error: item has unused generic parameters + --> $DIR/promoted-function-2.rs:8:4 + | +LL | fn test<T>() { + | ^^^^ - generic parameter `T` is unused + +error: aborting due to previous error; 1 warning emitted + |
