Don't run const propagation on items with inconsistent bounds

Using `#![feature(trivial_bounds)]`, it's possible to write functions
with unsatisfiable 'where' clauses, making them uncallable. However, the
user can act as if these 'where' clauses are true inside the body of the
function, leading to code that would normally be impossible to write.

Since const propgation can run even without any user-written calls to a
function, we need to explcitly check for these uncallable functions.
This commit is contained in:
Aaron Hill 2020-01-05 22:32:53 -05:00
parent e82febc78e
commit 5896998e76
No known key found for this signature in database
GPG key ID: B4087E510E98B164
3 changed files with 31 additions and 0 deletions

View file

@ -1,4 +1,8 @@
// run-pass
// Force mir to be emitted, to ensure that const
// propagation doesn't ICE on a function
// with an 'impossible' body. See issue #67696
// compile-flags: --emit=mir,link
// Inconsistent bounds with trait implementations
#![feature(trivial_bounds)]

View file

@ -0,0 +1,2 @@
warning: due to multiple output types requested, the explicitly specified output file name will be adapted for each output type