Skip to content

Commit 4eec03d

Browse files
committed
Cherry-pick src/test changes with Centril's changes
1 parent 1489095 commit 4eec03d

30 files changed

+207
-227
lines changed

src/test/codegen/issue-45222.rs

-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

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

8-
//------------------------------------------------------------------------------
98
// Example from original issue #45222
109

1110
fn foo2(n: u64) -> u64 {
@@ -25,7 +24,6 @@ pub fn check_foo2() -> u64 {
2524
foo2(100000)
2625
}
2726

28-
//------------------------------------------------------------------------------
2927
// Simplified example of #45222
3028

3129
fn triangle_inc(n: u64) -> u64 {
@@ -43,7 +41,6 @@ pub fn check_triangle_inc() -> u64 {
4341
triangle_inc(100000)
4442
}
4543

46-
//------------------------------------------------------------------------------
4744
// Demo in #48012
4845

4946
fn foo3r(n: u64) -> u64 {

src/test/incremental/hashes/call_expressions.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn callee1(_x: u32, _y: i64) {}
1818
fn callee2(_x: u32, _y: i64) {}
1919

2020

21-
// Change Callee (Function) ----------------------------------------------------
21+
// Change Callee (Function)
2222
#[cfg(cfail1)]
2323
pub fn change_callee_function() {
2424
callee1(1, 2)
@@ -33,7 +33,7 @@ pub fn change_callee_function() {
3333

3434

3535

36-
// Change Argument (Function) --------------------------------------------------
36+
// Change Argument (Function)
3737
#[cfg(cfail1)]
3838
pub fn change_argument_function() {
3939
callee1(1, 2)
@@ -48,7 +48,7 @@ pub fn change_argument_function() {
4848

4949

5050

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

76-
// Change Callee (Method) ------------------------------------------------------
76+
// Change Callee (Method)
7777
#[cfg(cfail1)]
7878
pub fn change_callee_method() {
7979
let s = Struct;
@@ -90,7 +90,7 @@ pub fn change_callee_method() {
9090

9191

9292

93-
// Change Argument (Method) ----------------------------------------------------
93+
// Change Argument (Method)
9494
#[cfg(cfail1)]
9595
pub fn change_argument_method() {
9696
let s = Struct;
@@ -107,7 +107,7 @@ pub fn change_argument_method() {
107107

108108

109109

110-
// Change Callee (Method, UFCS) ------------------------------------------------
110+
// Change Callee (Method, UFCS)
111111
#[cfg(cfail1)]
112112
pub fn change_ufcs_callee_method() {
113113
let s = Struct;
@@ -124,7 +124,7 @@ pub fn change_ufcs_callee_method() {
124124

125125

126126

127-
// Change Argument (Method, UFCS) ----------------------------------------------
127+
// Change Argument (Method, UFCS)
128128
#[cfg(cfail1)]
129129
pub fn change_argument_method_ufcs() {
130130
let s = Struct;
@@ -141,7 +141,7 @@ pub fn change_argument_method_ufcs() {
141141

142142

143143

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

167-
// Change UFCS Callee Indirectly -----------------------------------------------
167+
// Change UFCS Callee Indirectly
168168
pub mod change_ufcs_callee_indirectly {
169169
#[cfg(cfail1)]
170170
use super::Struct as Struct;

src/test/incremental/hashes/closure_expressions.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#![crate_type="rlib"]
1515

1616

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

3030

3131

32-
// Add parameter ---------------------------------------------------------------
32+
// Add parameter
3333
#[cfg(cfail1)]
3434
pub fn add_parameter() {
3535
let x = 0u32;
@@ -46,7 +46,7 @@ pub fn add_parameter() {
4646

4747

4848

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

6262

6363

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

7777

7878

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

9494

9595

96-
// Change parameter type -------------------------------------------------------
96+
// Change parameter type
9797
#[cfg(cfail1)]
9898
pub fn change_parameter_type() {
9999
let closure = |x: u32| (x as u64) + 1;

src/test/incremental/hashes/consts.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#![crate_type="rlib"]
1515

1616

17-
// Change const visibility ---------------------------------------------------
17+
// Change const visibility
1818
#[cfg(cfail1)]
1919
const CONST_VISIBILITY: u8 = 0;
2020

@@ -24,7 +24,7 @@ const CONST_VISIBILITY: u8 = 0;
2424
pub const CONST_VISIBILITY: u8 = 0;
2525

2626

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

@@ -34,7 +34,7 @@ const CONST_CHANGE_TYPE_1: i32 = 0;
3434
const CONST_CHANGE_TYPE_1: u32 = 0;
3535

3636

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

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

4646

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

5858

59-
// Change value between expressions -------------------------------------------
59+
// Change value between expressions
6060
#[rustc_clean(cfg="cfail2", except="HirBody")]
6161
#[rustc_clean(cfg="cfail3")]
6262
const CONST_CHANGE_VALUE_2: i16 = {
@@ -88,7 +88,7 @@ const CONST_CHANGE_VALUE_4: i16 = {
8888
};
8989

9090

91-
// Change type indirectly -----------------------------------------------------
91+
// Change type indirectly
9292
struct ReferencedType1;
9393
struct ReferencedType2;
9494

src/test/incremental/hashes/if_expressions.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#![feature(rustc_attrs)]
1515
#![crate_type="rlib"]
1616

17-
// Change condition (if) -------------------------------------------------------
17+
// Change condition (if)
1818
#[cfg(cfail1)]
1919
pub fn change_condition(x: bool) -> u32 {
2020
if x {
@@ -35,7 +35,7 @@ pub fn change_condition(x: bool) -> u32 {
3535
return 0
3636
}
3737

38-
// Change then branch (if) -----------------------------------------------------
38+
// Change then branch (if)
3939
#[cfg(cfail1)]
4040
pub fn change_then_branch(x: bool) -> u32 {
4141
if x {
@@ -58,7 +58,7 @@ pub fn change_then_branch(x: bool) -> u32 {
5858

5959

6060

61-
// Change else branch (if) -----------------------------------------------------
61+
// Change else branch (if)
6262
#[cfg(cfail1)]
6363
pub fn change_else_branch(x: bool) -> u32 {
6464
if x {
@@ -81,7 +81,7 @@ pub fn change_else_branch(x: bool) -> u32 {
8181

8282

8383

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

110110

111111

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

133133

134134

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

156156

157157

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

179179

180180

181-
// Add else branch (if let) ----------------------------------------------------
181+
// Add else branch (if let)
182182
#[cfg(cfail1)]
183183
pub fn add_else_branch_if_let(x: Option<u32>) -> u32 {
184184
let mut ret = 1;

src/test/incremental/hashes/indexing_expressions.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#![feature(rustc_attrs)]
1414
#![crate_type="rlib"]
1515

16-
// Change simple index ---------------------------------------------------------
16+
// Change simple index
1717
#[cfg(cfail1)]
1818
fn change_simple_index(slice: &[u32]) -> u32 {
1919
slice[3]
@@ -30,7 +30,7 @@ fn change_simple_index(slice: &[u32]) -> u32 {
3030

3131

3232

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

4848

4949

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

6565

6666

67-
// Add lower bound -------------------------------------------------------------
67+
// Add lower bound
6868
#[cfg(cfail1)]
6969
fn add_lower_bound(slice: &[u32]) -> &[u32] {
7070
&slice[..4]
@@ -81,7 +81,7 @@ fn add_lower_bound(slice: &[u32]) -> &[u32] {
8181

8282

8383

84-
// Add upper bound -------------------------------------------------------------
84+
// Add upper bound
8585
#[cfg(cfail1)]
8686
fn add_upper_bound(slice: &[u32]) -> &[u32] {
8787
&slice[3..]
@@ -98,7 +98,7 @@ fn add_upper_bound(slice: &[u32]) -> &[u32] {
9898

9999

100100

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

116116

117117

118-
// Exclusive to inclusive range ------------------------------------------------
118+
// Exclusive to inclusive range
119119
#[cfg(cfail1)]
120120
fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] {
121121
&slice[3..7]

0 commit comments

Comments
 (0)