Skip to content

Commit 09fe391

Browse files
committed
Make edition 2024 the default
1 parent 952e95e commit 09fe391

File tree

8 files changed

+14
-41
lines changed

8 files changed

+14
-41
lines changed

compiler/base/orchestrator/src/coordinator.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3074,11 +3074,7 @@ mod tests {
30743074
r#"fn x() { u16::try_from(1u8); }"#,
30753075
[false, false, true, true],
30763076
),
3077-
(
3078-
r#"#![feature(gen_blocks)]
3079-
fn x() { gen { yield 1u8 }; }"#,
3080-
[false, false, false, true],
3081-
),
3077+
(r#"fn x() { let gen = true; }"#, [true, true, true, false]),
30823078
];
30833079

30843080
let tests = params.into_iter().flat_map(|(code, works_in)| {
@@ -3090,7 +3086,6 @@ mod tests {
30903086
code: code.into(),
30913087
edition,
30923088
crate_type: CrateType::Library(LibraryType::Lib),
3093-
channel: Channel::Nightly, // To allow 2024 while it is unstable
30943089
..ARBITRARY_EXECUTE_REQUEST
30953090
};
30963091
let response = coordinator.execute(request).await.unwrap();
@@ -3524,7 +3519,6 @@ mod tests {
35243519
let req = CompileRequest {
35253520
edition,
35263521
code: SUBTRACT_CODE.into(),
3527-
channel: Channel::Nightly, // To allow 2024 while it is unstable
35283522
..ARBITRARY_HIR_REQUEST
35293523
};
35303524

@@ -3855,7 +3849,6 @@ mod tests {
38553849
let req = FormatRequest {
38563850
edition,
38573851
code: code.into(),
3858-
channel: Channel::Nightly, // To allow 2024 while it is unstable
38593852
..ARBITRARY_FORMAT_REQUEST
38603853
};
38613854

tests/spec/features/compilation_targets_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119

120120
scenario "compiling a library to WebAssembly" do
121121
editor.set <<~EOF
122-
#[no_mangle]
122+
#[unsafe(no_mangle)]
123123
pub fn calculator(a: u8) -> u8 { a + 42 }
124124
EOF
125125

tests/spec/features/editions_spec.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,16 @@
3939

4040
scenario "using the 2024 edition" do
4141
editor.set <<-EOF
42-
#![feature(gen_blocks)]
43-
4442
fn main() {
45-
let mut x = gen { yield 1 };
46-
47-
eprintln!("{:?}", x.next());
48-
eprintln!("{:?}", x.next());
43+
let gen = 1;
4944
}
5045
EOF
5146

5247
in_advanced_options_menu { select '2024' }
5348
click_on("Run")
5449

5550
within(:output, :stderr) do
56-
expect(page).to have_content 'Some(1)'
57-
expect(page).to have_content 'None'
51+
expect(page).to have_content 'found reserved keyword `gen`'
5852
end
5953
end
6054

tests/spec/features/url_parameters_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104

105105
scenario "loading without code or an edition" do
106106
visit '/'
107-
expect(page).to have_edition('2021')
107+
expect(page).to have_edition('2024')
108108
end
109109

110110
def editor

ui/frontend/AdvancedOptionsMenu.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as config from './reducers/configuration';
44
import { Either as EitherConfig, Select as SelectConfig } from './ConfigElement';
55
import MenuGroup from './MenuGroup';
66
import * as selectors from './selectors';
7-
import { Backtrace, Channel, Edition } from './types';
7+
import { Backtrace, Edition } from './types';
88
import { useAppDispatch, useAppSelector } from './hooks';
99

1010
const AdvancedOptionsMenu: React.FC = () => {
@@ -18,9 +18,6 @@ const AdvancedOptionsMenu: React.FC = () => {
1818
const changeEdition = useCallback((e: Edition) => dispatch(config.changeEdition(e)), [dispatch]);
1919
const changeBacktrace = useCallback((b: Backtrace) => dispatch(config.changeBacktrace(b)), [dispatch]);
2020

21-
const channel = useAppSelector((state) => state.configuration.channel);
22-
const switchText = (channel !== Channel.Nightly) ? ' (will select nightly Rust)' : '';
23-
2421
return (
2522
<MenuGroup title="Advanced options">
2623
<SelectConfig
@@ -32,7 +29,7 @@ const AdvancedOptionsMenu: React.FC = () => {
3229
<option value={Edition.Rust2015}>2015</option>
3330
<option value={Edition.Rust2018}>2018</option>
3431
<option value={Edition.Rust2021}>2021</option>
35-
<option value={Edition.Rust2024}>2024{switchText}</option>
32+
<option value={Edition.Rust2024}>2024</option>
3633
</SelectConfig>
3734

3835
<EitherConfig

ui/frontend/actions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { addCrateType, editCode } from './reducers/code';
55
import {
66
changeBacktrace,
77
changeChannel,
8-
changeEditionRaw,
8+
changeEdition,
99
changeMode,
1010
changePrimaryAction,
1111
} from './reducers/configuration';
@@ -153,7 +153,7 @@ export function indexPageLoad({
153153
}
154154
}
155155

156-
const edition = maybeEdition || Edition.Rust2021;
156+
const edition = maybeEdition || Edition.Rust2024;
157157

158158
if (code) {
159159
dispatch(editCode(code));
@@ -163,7 +163,7 @@ export function indexPageLoad({
163163

164164
dispatch(changeChannel(channel));
165165
dispatch(changeMode(mode));
166-
dispatch(changeEditionRaw(edition));
166+
dispatch(changeEdition(edition));
167167
};
168168
}
169169

ui/frontend/reducers/configuration.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { PayloadAction, createSlice } from '@reduxjs/toolkit';
22

3-
import { ThunkAction } from '../actions';
43
import {
54
AssemblyFlavor,
65
Backtrace,
@@ -57,7 +56,7 @@ const initialState: State = {
5756
primaryAction: PrimaryActionAuto.Auto,
5857
channel: Channel.Stable,
5958
mode: Mode.Debug,
60-
edition: Edition.Rust2021,
59+
edition: Edition.Rust2024,
6160
backtrace: Backtrace.Disabled,
6261
};
6362

@@ -85,7 +84,7 @@ const slice = createSlice({
8584
state.demangleAssembly = action.payload;
8685
},
8786

88-
changeEditionRaw: (state, action: PayloadAction<Edition>) => {
87+
changeEdition: (state, action: PayloadAction<Edition>) => {
8988
state.edition = action.payload;
9089
},
9190

@@ -149,7 +148,7 @@ export const {
149148
changeBacktrace,
150149
changeChannel,
151150
changeDemangleAssembly,
152-
changeEditionRaw,
151+
changeEdition,
153152
changeEditor,
154153
changeKeybinding,
155154
changeMode,
@@ -162,14 +161,4 @@ export const {
162161
swapTheme,
163162
} = slice.actions;
164163

165-
export const changeEdition =
166-
(edition: Edition): ThunkAction =>
167-
(dispatch) => {
168-
if (edition === Edition.Rust2024) {
169-
dispatch(changeChannel(Channel.Nightly));
170-
}
171-
172-
dispatch(changeEditionRaw(edition));
173-
};
174-
175164
export default slice.reducer;

ui/frontend/selectors/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export const getChannelLabel = createSelector(channelSelector, (channel) => `${c
172172

173173
export const isEditionDefault = createSelector(
174174
editionSelector,
175-
edition => edition == Edition.Rust2021,
175+
edition => edition == Edition.Rust2024,
176176
);
177177

178178
export const getBacktraceSet = (state: State) => (

0 commit comments

Comments
 (0)