Auto merge of #137198 - tgross35:cfg-match-rename, r=Amanieu · rust-lang/rust@6eef33b (original) (raw)

`@@ -9,7 +9,7 @@ trait Trait {

`

9

9

`struct Struct;

`

10

10

``

11

11

`impl Trait for Struct {

`

12

``

`-

cfg_match! {

`

``

12

`+

cfg_select! {

`

13

13

` feature = "blah" => {

`

14

14

`fn blah(&self) {

`

15

15

` unimplemented!();

`

`@@ -45,22 +45,22 @@ fn matches_leading_pipe() {

`

45

45

`}

`

46

46

``

47

47

`#[test]

`

48

``

`-

fn cfg_match_basic() {

`

49

``

`-

cfg_match! {

`

``

48

`+

fn cfg_select_basic() {

`

``

49

`+

cfg_select! {

`

50

50

` target_pointer_width = "64" => { fn f0_() -> bool { true }}

`

51

51

`}

`

52

52

``

53

``

`-

cfg_match! {

`

``

53

`+

cfg_select! {

`

54

54

` unix => { fn f1_() -> bool { true } }

`

55

55

` any(target_os = "macos", target_os = "linux") => { fn f1_() -> bool { false }}

`

56

56

`}

`

57

57

``

58

``

`-

cfg_match! {

`

``

58

`+

cfg_select! {

`

59

59

` target_pointer_width = "32" => { fn f2_() -> bool { false } }

`

60

60

` target_pointer_width = "64" => { fn f2_() -> bool { true } }

`

61

61

`}

`

62

62

``

63

``

`-

cfg_match! {

`

``

63

`+

cfg_select! {

`

64

64

` target_pointer_width = "16" => { fn f3_() -> i32 { 1 } }

`

65

65

` _ => { fn f3_() -> i32 { 2 }}

`

66

66

`}

`

`@@ -81,8 +81,8 @@ fn cfg_match_basic() {

`

81

81

`}

`

82

82

``

83

83

`#[test]

`

84

``

`-

fn cfg_match_debug_assertions() {

`

85

``

`-

cfg_match! {

`

``

84

`+

fn cfg_select_debug_assertions() {

`

``

85

`+

cfg_select! {

`

86

86

` debug_assertions => {

`

87

87

` assert!(cfg!(debug_assertions));

`

88

88

` assert_eq!(4, 2+2);

`

`@@ -96,8 +96,8 @@ fn cfg_match_debug_assertions() {

`

96

96

``

97

97

`#[cfg(target_pointer_width = "64")]

`

98

98

`#[test]

`

99

``

`-

fn cfg_match_no_duplication_on_64() {

`

100

``

`-

cfg_match! {

`

``

99

`+

fn cfg_select_no_duplication_on_64() {

`

``

100

`+

cfg_select! {

`

101

101

` windows => {

`

102

102

`fn foo() {}

`

103

103

`}

`

`@@ -112,34 +112,34 @@ fn cfg_match_no_duplication_on_64() {

`

112

112

`}

`

113

113

``

114

114

`#[test]

`

115

``

`-

fn cfg_match_options() {

`

116

``

`-

cfg_match! {

`

``

115

`+

fn cfg_select_options() {

`

``

116

`+

cfg_select! {

`

117

117

` test => {

`

118

118

`use core::option::Option as Option2;

`

119

119

`fn works1() -> Option2 { Some(1) }

`

120

120

`}

`

121

121

` _ => { fn works1() -> Option { None } }

`

122

122

`}

`

123

123

``

124

``

`-

cfg_match! {

`

``

124

`+

cfg_select! {

`

125

125

` feature = "foo" => { fn works2() -> bool { false } }

`

126

126

` test => { fn works2() -> bool { true } }

`

127

127

` _ => { fn works2() -> bool { false } }

`

128

128

`}

`

129

129

``

130

``

`-

cfg_match! {

`

``

130

`+

cfg_select! {

`

131

131

` feature = "foo" => { fn works3() -> bool { false } }

`

132

132

` _ => { fn works3() -> bool { true } }

`

133

133

`}

`

134

134

``

135

``

`-

cfg_match! {

`

``

135

`+

cfg_select! {

`

136

136

` test => {

`

137

137

`use core::option::Option as Option3;

`

138

138

`fn works4() -> Option3 { Some(1) }

`

139

139

`}

`

140

140

`}

`

141

141

``

142

``

`-

cfg_match! {

`

``

142

`+

cfg_select! {

`

143

143

` feature = "foo" => { fn works5() -> bool { false } }

`

144

144

` test => { fn works5() -> bool { true } }

`

145

145

`}

`

`@@ -152,8 +152,8 @@ fn cfg_match_options() {

`

152

152

`}

`

153

153

``

154

154

`#[test]

`

155

``

`-

fn cfg_match_two_functions() {

`

156

``

`-

cfg_match! {

`

``

155

`+

fn cfg_select_two_functions() {

`

``

156

`+

cfg_select! {

`

157

157

` target_pointer_width = "64" => {

`

158

158

`fn foo1() {}

`

159

159

`fn bar1() {}

`

`@@ -177,7 +177,7 @@ fn cfg_match_two_functions() {

`

177

177

`}

`

178

178

``

179

179

`fn _accepts_expressions() -> i32 {

`

180

``

`-

cfg_match! {

`

``

180

`+

cfg_select! {

`

181

181

` unix => { 1 }

`

182

182

` _ => { 2 }

`

183

183

`}

`

`@@ -188,14 +188,14 @@ fn _accepts_expressions() -> i32 {

`

188

188

`fn _allows_stmt_expr_attributes() {

`

189

189

`let one = 1;

`

190

190

`let two = 2;

`

191

``

`-

cfg_match! {

`

``

191

`+

cfg_select! {

`

192

192

` unix => { one * two; }

`

193

193

` _ => { one + two; }

`

194

194

`}

`

195

195

`}

`

196

196

``

197

197

`fn _expression() {

`

198

``

`-

let _ = cfg_match!({

`

``

198

`+

let _ = cfg_select!({

`

199

199

` windows => {

`

200

200

`" XP"

`

201

201

`}

`