-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #1504 - RalfJung:ill-formed-const, r=RalfJung
add test for unused ill-formed constant Once rust-lang/rust#75339 lands, this test should pass. Fixes #1382.
- Loading branch information
Showing
3 changed files
with
21 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
c94ed5ca91f1363b66970ce2cbd6e2773e3cb1d3 | ||
814bc4fe9364865bfaa94d7825b8eabc11245c7c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//! Make sure we detect erroneous constants post-monomorphization even when they are unused. | ||
//! (https://github.com/rust-lang/miri/issues/1382) | ||
#![feature(const_panic)] | ||
#![feature(never_type)] | ||
#![warn(warnings, const_err)] | ||
|
||
struct PrintName<T>(T); | ||
impl<T> PrintName<T> { | ||
const VOID: ! = panic!(); //~WARN any use of this value will cause an error | ||
} | ||
|
||
fn no_codegen<T>() { | ||
if false { | ||
let _ = PrintName::<T>::VOID; //~ERROR referenced constant has errors | ||
} | ||
} | ||
fn main() { | ||
no_codegen::<i32>(); | ||
} |