-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compiletest ice tracking #122997
compiletest ice tracking #122997
Changes from 12 commits
65ca718
7b05360
d6e70df
e09244f
7048ce7
dde3178
dd1e35f
a5932b1
98dd566
7d826ae
6d9175f
37df490
2ce487c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,7 +4,7 @@ use crate::common::{ | |||||
expected_output_path, UI_EXTENSIONS, UI_FIXED, UI_STDERR, UI_STDOUT, UI_SVG, UI_WINDOWS_SVG, | ||||||
}; | ||||||
use crate::common::{incremental_dir, output_base_dir, output_base_name, output_testname_unique}; | ||||||
use crate::common::{Assembly, Incremental, JsDocTest, MirOpt, RunMake, RustdocJson, Ui}; | ||||||
use crate::common::{Assembly, Crashes, Incremental, JsDocTest, MirOpt, RunMake, RustdocJson, Ui}; | ||||||
use crate::common::{Codegen, CodegenUnits, DebugInfo, Debugger, Rustdoc}; | ||||||
use crate::common::{CompareMode, FailMode, PassMode}; | ||||||
use crate::common::{Config, TestPaths}; | ||||||
|
@@ -244,7 +244,7 @@ impl<'test> TestCx<'test> { | |||||
/// Code executed for each revision in turn (or, if there are no | ||||||
/// revisions, exactly once, with revision == None). | ||||||
fn run_revision(&self) { | ||||||
if self.props.should_ice && self.config.mode != Incremental { | ||||||
if self.props.should_ice && self.config.mode != Incremental && self.config.mode != Crashes { | ||||||
self.fatal("cannot use should-ice in a test that is not cfail"); | ||||||
} | ||||||
match self.config.mode { | ||||||
|
@@ -263,6 +263,7 @@ impl<'test> TestCx<'test> { | |||||
JsDocTest => self.run_js_doc_test(), | ||||||
CoverageMap => self.run_coverage_map_test(), | ||||||
CoverageRun => self.run_coverage_run_test(), | ||||||
Crashes => self.run_crash_test(), | ||||||
} | ||||||
} | ||||||
|
||||||
|
@@ -295,6 +296,7 @@ impl<'test> TestCx<'test> { | |||||
match self.config.mode { | ||||||
JsDocTest => true, | ||||||
Ui => pm.is_some() || self.props.fail_mode > Some(FailMode::Build), | ||||||
Crashes => false, | ||||||
Incremental => { | ||||||
let revision = | ||||||
self.revision.expect("incremental tests require a list of revisions"); | ||||||
|
@@ -359,6 +361,27 @@ impl<'test> TestCx<'test> { | |||||
self.check_forbid_output(&output_to_check, &proc_res); | ||||||
} | ||||||
|
||||||
fn run_crash_test(&self) { | ||||||
let pm = self.pass_mode(); | ||||||
let proc_res = self.compile_test(WillExecute::No, self.should_emit_metadata(pm)); | ||||||
|
||||||
if std::env::var("COMPILETEST_VERBOSE_CRASHES").is_ok() { | ||||||
eprintln!("{}", proc_res.status); | ||||||
eprintln!("{}", proc_res.stdout); | ||||||
eprintln!("{}", proc_res.stderr); | ||||||
eprintln!("{}", proc_res.cmdline); | ||||||
} | ||||||
|
||||||
// if a test does not crash, consider it an error | ||||||
if proc_res.status.success() || matches!(proc_res.status.code(), Some(1 | 0)) { | ||||||
self.fatal(&format!( | ||||||
"test no longer crashes/triggers ICE! Please give it a mearningful name, \ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't mind me, I'm just passing by
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think oli already fixed this in a drive-by cleanup somewhere 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, did he? I just saw that in one of this PRs #126316 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember doing that, but it probably hasn't landed yet |
||||||
add a doc-comment to the start of the test explaining why it exists and \ | ||||||
move it to tests/ui or wherever you see fit." | ||||||
)); | ||||||
} | ||||||
} | ||||||
|
||||||
fn run_rfail_test(&self) { | ||||||
let pm = self.pass_mode(); | ||||||
let should_run = self.run_if_enabled(); | ||||||
|
@@ -2517,7 +2540,7 @@ impl<'test> TestCx<'test> { | |||||
rustc.arg("-Cdebug-assertions=no"); | ||||||
} | ||||||
RunPassValgrind | Pretty | DebugInfo | Rustdoc | RustdocJson | RunMake | ||||||
| CodegenUnits | JsDocTest => { | ||||||
| CodegenUnits | JsDocTest | Crashes => { | ||||||
// do not use JSON output | ||||||
} | ||||||
} | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//! Tidy check to ensure that tests inside 'tests/crashes' have a '@known-bug' directive. | ||
|
||
use crate::walk::*; | ||
use std::path::Path; | ||
|
||
pub fn check(filepath: &Path, bad: &mut bool) { | ||
walk(filepath, |path, _is_dir| filter_not_rust(path), &mut |entry, contents| { | ||
let file = entry.path(); | ||
if !contents.lines().any(|line| line.starts_with("//@ known-bug: ")) { | ||
tidy_error!( | ||
bad, | ||
"{} crash/ice test does not have a \"//@ known-bug: \" directive", | ||
file.display() | ||
); | ||
} | ||
}); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//@ known-bug: #100041 | ||
|
||
pub trait WellUnformed { | ||
type RequestNormalize; | ||
} | ||
|
||
impl<T: ?Sized> WellUnformed for T { | ||
type RequestNormalize = (); | ||
} | ||
|
||
pub fn latent(_: &[<[[()]] as WellUnformed>::RequestNormalize; 0]) {} | ||
|
||
pub fn bang() { | ||
latent(&[]); | ||
} | ||
|
||
fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//@ known-bug: #101036 | ||
#![feature(generic_const_exprs)] | ||
|
||
const fn t<const N: usize>() -> u8 { | ||
N as u8 | ||
} | ||
|
||
#[repr(u8)] | ||
enum T<const N: u8 = { T::<0>::A as u8 + T::<0>::B as u8 }> | ||
where | ||
[(); N as usize]: | ||
{ | ||
A = t::<N>() as u8, B | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//@ known-bug: #101557 | ||
//@ compile-flags: -Copt-level=0 | ||
#![feature(generic_const_exprs)] | ||
use std::marker::PhantomData; | ||
|
||
trait Trait { | ||
const CONST: usize; | ||
} | ||
|
||
struct A<T: Trait> { | ||
_marker: PhantomData<T>, | ||
} | ||
|
||
impl<const N: usize> Trait for [i8; N] { | ||
const CONST: usize = N; | ||
} | ||
|
||
impl<const N: usize> From<usize> for A<[i8; N]> { | ||
fn from(_: usize) -> Self { | ||
todo!() | ||
} | ||
} | ||
|
||
impl<T: Trait> From<A<[i8; T::CONST]>> for A<T> { | ||
fn from(_: A<[i8; T::CONST]>) -> Self { | ||
todo!() | ||
} | ||
} | ||
|
||
fn f<T: Trait>() -> A<T> | ||
where | ||
[(); T::CONST]:, | ||
{ | ||
// Usage of `0` is arbitrary | ||
let a = A::<[i8; T::CONST]>::from(0); | ||
A::<T>::from(a) | ||
} | ||
|
||
fn main() { | ||
// Usage of `1` is arbitrary | ||
f::<[i8; 1]>(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//@ known-bug: #101962 | ||
|
||
#![feature(core_intrinsics)] | ||
|
||
pub fn wrapping<T: Copy>(a: T, b: T) { | ||
let _z = core::intrinsics::wrapping_mul(a, b); | ||
} | ||
|
||
fn main() { | ||
wrapping(1,2); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//@ known-bug: #102047 | ||
|
||
struct Ty1; | ||
struct Ty2; | ||
|
||
pub trait Trait<T> {} | ||
|
||
pub trait WithAssoc1<'a> { | ||
type Assoc; | ||
} | ||
pub trait WithAssoc2<'a> { | ||
type Assoc; | ||
} | ||
|
||
impl<T, U> Trait<for<'a> fn(<T as WithAssoc1<'a>>::Assoc, <U as WithAssoc2<'a>>::Assoc)> for (T, U) | ||
where | ||
T: for<'a> WithAssoc1<'a> + for<'a> WithAssoc2<'a, Assoc = i32>, | ||
U: for<'a> WithAssoc2<'a>, | ||
{ | ||
} | ||
|
||
impl WithAssoc1<'_> for Ty1 { | ||
type Assoc = (); | ||
} | ||
impl WithAssoc2<'_> for Ty1 { | ||
type Assoc = i32; | ||
} | ||
impl WithAssoc1<'_> for Ty2 { | ||
type Assoc = (); | ||
} | ||
impl WithAssoc2<'_> for Ty2 { | ||
type Assoc = u32; | ||
} | ||
|
||
fn foo<T, U, V>() | ||
where | ||
T: for<'a> WithAssoc1<'a>, | ||
U: for<'a> WithAssoc2<'a>, | ||
(T, U): Trait<V>, | ||
{ | ||
} | ||
|
||
fn main() { | ||
foo::<Ty1, Ty2, _>(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//@ known-bug: #102252 | ||
|
||
#![feature(min_specialization, rustc_attrs)] | ||
|
||
#[rustc_specialization_trait] | ||
pub trait Trait {} | ||
|
||
struct Struct | ||
where | ||
Self: Iterator<Item = <Self as Iterator>::Item>, {} | ||
|
||
impl Trait for Struct {} | ||
|
||
fn main() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will unset any other possible envs and left only this two, can it be wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why I would have other env vars influencing test outcome 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it possible to set env vars via "rustc-env" directive, but looks like this will unset it?
https://github.com/rust-lang/rust/pull/122997/files#diff-bf53d26b9ca67283fc825e902a64780b463c153d1b1df0c8e782da0300f08956R452-R457