Skip to content

Commit

Permalink
Cherry-pick src/test changes with Centril's changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sd234678 committed Aug 19, 2019
1 parent 1489095 commit 4eec03d
Show file tree
Hide file tree
Showing 30 changed files with 207 additions and 227 deletions.
3 changes: 0 additions & 3 deletions src/test/codegen/issue-45222.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

// verify that LLVM recognizes a loop involving 0..=n and will const-fold it.

//------------------------------------------------------------------------------
// Example from original issue #45222

fn foo2(n: u64) -> u64 {
Expand All @@ -25,7 +24,6 @@ pub fn check_foo2() -> u64 {
foo2(100000)
}

//------------------------------------------------------------------------------
// Simplified example of #45222

fn triangle_inc(n: u64) -> u64 {
Expand All @@ -43,7 +41,6 @@ pub fn check_triangle_inc() -> u64 {
triangle_inc(100000)
}

//------------------------------------------------------------------------------
// Demo in #48012

fn foo3r(n: u64) -> u64 {
Expand Down
18 changes: 9 additions & 9 deletions src/test/incremental/hashes/call_expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn callee1(_x: u32, _y: i64) {}
fn callee2(_x: u32, _y: i64) {}


// Change Callee (Function) ----------------------------------------------------
// Change Callee (Function)
#[cfg(cfail1)]
pub fn change_callee_function() {
callee1(1, 2)
Expand All @@ -33,7 +33,7 @@ pub fn change_callee_function() {



// Change Argument (Function) --------------------------------------------------
// Change Argument (Function)
#[cfg(cfail1)]
pub fn change_argument_function() {
callee1(1, 2)
Expand All @@ -48,7 +48,7 @@ pub fn change_argument_function() {



// Change Callee Indirectly (Function) -----------------------------------------
// Change Callee Indirectly (Function)
mod change_callee_indirectly_function {
#[cfg(cfail1)]
use super::callee1 as callee;
Expand All @@ -73,7 +73,7 @@ impl Struct {
fn method2(&self, _x: char, _y: bool) {}
}

// Change Callee (Method) ------------------------------------------------------
// Change Callee (Method)
#[cfg(cfail1)]
pub fn change_callee_method() {
let s = Struct;
Expand All @@ -90,7 +90,7 @@ pub fn change_callee_method() {



// Change Argument (Method) ----------------------------------------------------
// Change Argument (Method)
#[cfg(cfail1)]
pub fn change_argument_method() {
let s = Struct;
Expand All @@ -107,7 +107,7 @@ pub fn change_argument_method() {



// Change Callee (Method, UFCS) ------------------------------------------------
// Change Callee (Method, UFCS)
#[cfg(cfail1)]
pub fn change_ufcs_callee_method() {
let s = Struct;
Expand All @@ -124,7 +124,7 @@ pub fn change_ufcs_callee_method() {



// Change Argument (Method, UFCS) ----------------------------------------------
// Change Argument (Method, UFCS)
#[cfg(cfail1)]
pub fn change_argument_method_ufcs() {
let s = Struct;
Expand All @@ -141,7 +141,7 @@ pub fn change_argument_method_ufcs() {



// Change To UFCS --------------------------------------------------------------
// Change To UFCS
#[cfg(cfail1)]
pub fn change_to_ufcs() {
let s = Struct;
Expand All @@ -164,7 +164,7 @@ impl Struct2 {
fn method1(&self, _x: char, _y: bool) {}
}

// Change UFCS Callee Indirectly -----------------------------------------------
// Change UFCS Callee Indirectly
pub mod change_ufcs_callee_indirectly {
#[cfg(cfail1)]
use super::Struct as Struct;
Expand Down
12 changes: 6 additions & 6 deletions src/test/incremental/hashes/closure_expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#![crate_type="rlib"]


// Change closure body ---------------------------------------------------------
// Change closure body
#[cfg(cfail1)]
pub fn change_closure_body() {
let _ = || 1u32;
Expand All @@ -29,7 +29,7 @@ pub fn change_closure_body() {



// Add parameter ---------------------------------------------------------------
// Add parameter
#[cfg(cfail1)]
pub fn add_parameter() {
let x = 0u32;
Expand All @@ -46,7 +46,7 @@ pub fn add_parameter() {



// Change parameter pattern ----------------------------------------------------
// Change parameter pattern
#[cfg(cfail1)]
pub fn change_parameter_pattern() {
let _ = |x: (u32,)| x;
Expand All @@ -61,7 +61,7 @@ pub fn change_parameter_pattern() {



// Add `move` to closure -------------------------------------------------------
// Add `move` to closure
#[cfg(cfail1)]
pub fn add_move() {
let _ = || 1;
Expand All @@ -76,7 +76,7 @@ pub fn add_move() {



// Add type ascription to parameter --------------------------------------------
// Add type ascription to parameter
#[cfg(cfail1)]
pub fn add_type_ascription_to_parameter() {
let closure = |x| x + 1u32;
Expand All @@ -93,7 +93,7 @@ pub fn add_type_ascription_to_parameter() {



// Change parameter type -------------------------------------------------------
// Change parameter type
#[cfg(cfail1)]
pub fn change_parameter_type() {
let closure = |x: u32| (x as u64) + 1;
Expand Down
12 changes: 6 additions & 6 deletions src/test/incremental/hashes/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#![crate_type="rlib"]


// Change const visibility ---------------------------------------------------
// Change const visibility
#[cfg(cfail1)]
const CONST_VISIBILITY: u8 = 0;

Expand All @@ -24,7 +24,7 @@ const CONST_VISIBILITY: u8 = 0;
pub const CONST_VISIBILITY: u8 = 0;


// Change type from i32 to u32 ------------------------------------------------
// Change type from i32 to u32
#[cfg(cfail1)]
const CONST_CHANGE_TYPE_1: i32 = 0;

Expand All @@ -34,7 +34,7 @@ const CONST_CHANGE_TYPE_1: i32 = 0;
const CONST_CHANGE_TYPE_1: u32 = 0;


// Change type from Option<u32> to Option<u64> --------------------------------
// Change type from Option<u32> to Option<u64>
#[cfg(cfail1)]
const CONST_CHANGE_TYPE_2: Option<u32> = None;

Expand All @@ -44,7 +44,7 @@ const CONST_CHANGE_TYPE_2: Option<u32> = None;
const CONST_CHANGE_TYPE_2: Option<u64> = None;


// Change value between simple literals ---------------------------------------
// Change value between simple literals
#[rustc_clean(cfg="cfail2", except="HirBody")]
#[rustc_clean(cfg="cfail3")]
const CONST_CHANGE_VALUE_1: i16 = {
Expand All @@ -56,7 +56,7 @@ const CONST_CHANGE_VALUE_1: i16 = {
};


// Change value between expressions -------------------------------------------
// Change value between expressions
#[rustc_clean(cfg="cfail2", except="HirBody")]
#[rustc_clean(cfg="cfail3")]
const CONST_CHANGE_VALUE_2: i16 = {
Expand Down Expand Up @@ -88,7 +88,7 @@ const CONST_CHANGE_VALUE_4: i16 = {
};


// Change type indirectly -----------------------------------------------------
// Change type indirectly
struct ReferencedType1;
struct ReferencedType2;

Expand Down
16 changes: 8 additions & 8 deletions src/test/incremental/hashes/if_expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#![feature(rustc_attrs)]
#![crate_type="rlib"]

// Change condition (if) -------------------------------------------------------
// Change condition (if)
#[cfg(cfail1)]
pub fn change_condition(x: bool) -> u32 {
if x {
Expand All @@ -35,7 +35,7 @@ pub fn change_condition(x: bool) -> u32 {
return 0
}

// Change then branch (if) -----------------------------------------------------
// Change then branch (if)
#[cfg(cfail1)]
pub fn change_then_branch(x: bool) -> u32 {
if x {
Expand All @@ -58,7 +58,7 @@ pub fn change_then_branch(x: bool) -> u32 {



// Change else branch (if) -----------------------------------------------------
// Change else branch (if)
#[cfg(cfail1)]
pub fn change_else_branch(x: bool) -> u32 {
if x {
Expand All @@ -81,7 +81,7 @@ pub fn change_else_branch(x: bool) -> u32 {



// Add else branch (if) --------------------------------------------------------
// Add else branch (if)
#[cfg(cfail1)]
pub fn add_else_branch(x: bool) -> u32 {
let mut ret = 1;
Expand Down Expand Up @@ -109,7 +109,7 @@ pub fn add_else_branch(x: bool) -> u32 {



// Change condition (if let) ---------------------------------------------------
// Change condition (if let)
#[cfg(cfail1)]
pub fn change_condition_if_let(x: Option<u32>) -> u32 {
if let Some(_x) = x {
Expand All @@ -132,7 +132,7 @@ pub fn change_condition_if_let(x: Option<u32>) -> u32 {



// Change then branch (if let) -------------------------------------------------
// Change then branch (if let)
#[cfg(cfail1)]
pub fn change_then_branch_if_let(x: Option<u32>) -> u32 {
if let Some(x) = x {
Expand All @@ -155,7 +155,7 @@ pub fn change_then_branch_if_let(x: Option<u32>) -> u32 {



// Change else branch (if let) -------------------------------------------------
// Change else branch (if let)
#[cfg(cfail1)]
pub fn change_else_branch_if_let(x: Option<u32>) -> u32 {
if let Some(x) = x {
Expand All @@ -178,7 +178,7 @@ pub fn change_else_branch_if_let(x: Option<u32>) -> u32 {



// Add else branch (if let) ----------------------------------------------------
// Add else branch (if let)
#[cfg(cfail1)]
pub fn add_else_branch_if_let(x: Option<u32>) -> u32 {
let mut ret = 1;
Expand Down
14 changes: 7 additions & 7 deletions src/test/incremental/hashes/indexing_expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#![feature(rustc_attrs)]
#![crate_type="rlib"]

// Change simple index ---------------------------------------------------------
// Change simple index
#[cfg(cfail1)]
fn change_simple_index(slice: &[u32]) -> u32 {
slice[3]
Expand All @@ -30,7 +30,7 @@ fn change_simple_index(slice: &[u32]) -> u32 {



// Change lower bound ----------------------------------------------------------
// Change lower bound
#[cfg(cfail1)]
fn change_lower_bound(slice: &[u32]) -> &[u32] {
&slice[3..5]
Expand All @@ -47,7 +47,7 @@ fn change_lower_bound(slice: &[u32]) -> &[u32] {



// Change upper bound ----------------------------------------------------------
// Change upper bound
#[cfg(cfail1)]
fn change_upper_bound(slice: &[u32]) -> &[u32] {
&slice[3..5]
Expand All @@ -64,7 +64,7 @@ fn change_upper_bound(slice: &[u32]) -> &[u32] {



// Add lower bound -------------------------------------------------------------
// Add lower bound
#[cfg(cfail1)]
fn add_lower_bound(slice: &[u32]) -> &[u32] {
&slice[..4]
Expand All @@ -81,7 +81,7 @@ fn add_lower_bound(slice: &[u32]) -> &[u32] {



// Add upper bound -------------------------------------------------------------
// Add upper bound
#[cfg(cfail1)]
fn add_upper_bound(slice: &[u32]) -> &[u32] {
&slice[3..]
Expand All @@ -98,7 +98,7 @@ fn add_upper_bound(slice: &[u32]) -> &[u32] {



// Change mutability -----------------------------------------------------------
// Change mutability
#[cfg(cfail1)]
fn change_mutability(slice: &mut [u32]) -> u32 {
(&mut slice[3..5])[0]
Expand All @@ -115,7 +115,7 @@ fn change_mutability(slice: &mut [u32]) -> u32 {



// Exclusive to inclusive range ------------------------------------------------
// Exclusive to inclusive range
#[cfg(cfail1)]
fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] {
&slice[3..7]
Expand Down
Loading

0 comments on commit 4eec03d

Please sign in to comment.