Skip to content

Commit 4f88ddf

Browse files
authored
Merge pull request #739 from lqd/editiooOOoOOnn
♪ EditiooOoOOnnN ! ♫
2 parents 8cfa7b2 + 4007080 commit 4f88ddf

File tree

9 files changed

+28
-40
lines changed

9 files changed

+28
-40
lines changed

tests/spec/features/tools_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def code_with_undefined_behavior
6464
expect(page).to have_content('core::fmt::Arguments::new_v1')
6565

6666
# Third-party procedural macro
67-
expect(page).to have_content('block_on(async')
67+
expect(page).to have_content('block_on(body)')
6868

6969
# User-specified declarative macro
7070
expect(page).to have_content('fn created_by_macro() -> i32 { 42 }')

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('2018')
107+
expect(page).to have_edition('2021')
108108
end
109109

110110
def editor

ui/frontend/AdvancedOptionsMenu.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ import { useSelector, useDispatch } from 'react-redux';
44
import * as actions from './actions';
55
import { Either as EitherConfig, Select as SelectConfig } from './ConfigElement';
66
import MenuGroup from './MenuGroup';
7-
import MenuAside from './MenuAside';
87
import { State } from './reducers';
98
import * as selectors from './selectors';
109
import { Backtrace, Edition } from './types';
1110

1211
const AdvancedOptionsMenu: React.SFC = () => {
1312
const isEditionDefault = useSelector(selectors.isEditionDefault);
1413
const edition = useSelector((state: State) => state.configuration.edition);
15-
const isRust2021Available = useSelector(selectors.isRust2021Available);
1614
const isBacktraceSet = useSelector(selectors.getBacktraceSet);
1715
const backtrace = useSelector((state: State) => state.configuration.backtrace);
1816

@@ -21,16 +19,13 @@ const AdvancedOptionsMenu: React.SFC = () => {
2119
const changeEdition = useCallback((e) => dispatch(actions.changeEdition(e)), [dispatch]);
2220
const changeBacktrace = useCallback((b) => dispatch(actions.changeBacktrace(b)), [dispatch]);
2321

24-
const Aside = !isRust2021Available && <Rust2021Aside />;
25-
2622
return (
2723
<MenuGroup title="Advanced options">
2824
<SelectConfig
2925
name="Edition"
3026
value={edition}
3127
isNotDefault={!isEditionDefault}
3228
onChange={changeEdition}
33-
aside={Aside}
3429
>
3530
<option value={Edition.Rust2015}>2015</option>
3631
<option value={Edition.Rust2018}>2018</option>
@@ -49,11 +44,4 @@ const AdvancedOptionsMenu: React.SFC = () => {
4944
);
5045
};
5146

52-
const Rust2021Aside: React.SFC = () => (
53-
<MenuAside>
54-
Note: Rust 2021 currently requires using the Nightly channel, selecting this
55-
option will switch to Nightly.
56-
</MenuAside>
57-
);
58-
5947
export default AdvancedOptionsMenu;

ui/frontend/Notifications.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,29 @@ import * as selectors from './selectors';
99

1010
import styles from './Notifications.module.css';
1111

12-
const SURVEY_URL = 'https://blog.rust-lang.org/2020/09/10/survey-launch.html';
12+
const EDITION_URL = 'https://doc.rust-lang.org/edition-guide/';
1313

1414
const Notifications: React.SFC = () => {
1515
return (
1616
<Portal>
1717
<div className={styles.container}>
18-
<Rust2020SurveyNotification />
18+
<Rust2021IsDefaultNotification />
1919
</div>
2020
</Portal>
2121
);
2222
};
2323

24-
const Rust2020SurveyNotification: React.SFC = () => {
25-
const showRust2020Survey = useSelector(selectors.showRustSurvey2020Selector);
24+
const Rust2021IsDefaultNotification: React.SFC = () => {
25+
const showRust2021IsDefault = useSelector(selectors.showRust2021IsDefaultSelector);
2626

2727
const dispatch = useDispatch();
28-
const seenRustSurvey2020 = useCallback(() => dispatch(actions.seenRustSurvey2020()), [dispatch]);
29-
30-
return showRust2020Survey && (
31-
<Notification onClose={seenRustSurvey2020}>
32-
We want to know your opinions! Your responses to
33-
the <a href={SURVEY_URL}>2020 State of Rust Survey</a> will
34-
help the project understand its strengths and weaknesses
35-
and establish development priorities for the future!
28+
const seenRust2021IsDefault = useCallback(() => dispatch(actions.seenRust2021IsDefault()), [dispatch]);
29+
30+
return showRust2021IsDefault && (
31+
<Notification onClose={seenRust2021IsDefault}>
32+
As of Rust 1.56, the default edition of Rust is now Rust
33+
2021. Learn more about editions in the <a href={EDITION_URL}>Edition Guide</a>.
34+
To specify which edition to use, use the advanced compilation options menu.
3635
</Notification>
3736
);
3837
};

ui/frontend/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ export function performVersionsLoad(): ThunkAction {
708708
const notificationSeen = (notification: Notification) =>
709709
createAction(ActionType.NotificationSeen, { notification });
710710

711-
export const seenRustSurvey2020 = () => notificationSeen(Notification.RustSurvey2020);
711+
export const seenRust2021IsDefault = () => notificationSeen(Notification.Rust2021IsDefault);
712712

713713
export const browserWidthChanged = (isSmall: boolean) =>
714714
createAction(ActionType.BrowserWidthChanged, { isSmall });

ui/frontend/reducers/configuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const DEFAULT: State = {
4242
primaryAction: PrimaryActionAuto.Auto,
4343
channel: Channel.Stable,
4444
mode: Mode.Debug,
45-
edition: Edition.Rust2018,
45+
edition: Edition.Rust2021,
4646
backtrace: Backtrace.Disabled,
4747
};
4848

ui/frontend/reducers/notifications.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,23 @@ import { Notification } from '../types';
44
interface State {
55
seenRustSurvey2018: boolean; // expired
66
seenRust2018IsDefault: boolean; // expired
7-
seenRustSurvey2020: boolean;
7+
seenRustSurvey2020: boolean; // expired
8+
seenRust2021IsDefault: boolean;
89
}
910

1011
const DEFAULT: State = {
1112
seenRustSurvey2018: true,
1213
seenRust2018IsDefault: true,
13-
seenRustSurvey2020: false,
14+
seenRustSurvey2020: true,
15+
seenRust2021IsDefault: false,
1416
};
1517

1618
export default function notifications(state = DEFAULT, action: Action): State {
1719
switch (action.type) {
1820
case ActionType.NotificationSeen: {
1921
switch (action.notification) {
20-
case Notification.RustSurvey2020: {
21-
return { ...state, seenRustSurvey2020: true };
22+
case Notification.Rust2021IsDefault: {
23+
return { ...state, seenRust2021IsDefault: true };
2224
}
2325
}
2426
}

ui/frontend/selectors/index.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ export const isNightlyChannel = (state: State) => (
108108
);
109109
export const isWasmAvailable = isNightlyChannel;
110110
export const isHirAvailable = isNightlyChannel;
111-
export const isRust2021Available = isNightlyChannel;
112111

113112
export const getModeLabel = (state: State) => {
114113
const { configuration: { mode } } = state;
@@ -122,7 +121,7 @@ export const getChannelLabel = (state: State) => {
122121

123122
export const isEditionDefault = createSelector(
124123
editionSelector,
125-
edition => edition == Edition.Rust2018,
124+
edition => edition == Edition.Rust2021,
126125
);
127126

128127
export const getBacktraceSet = (state: State) => (
@@ -250,15 +249,15 @@ export const codeUrlSelector = createSelector(
250249
const notificationsSelector = (state: State) => state.notifications;
251250

252251
const NOW = new Date();
253-
const RUST_SURVEY_2020_END = new Date('2020-09-24T23:59:59Z');
254-
const RUST_SURVEY_2020_OPEN = NOW <= RUST_SURVEY_2020_END;
255-
export const showRustSurvey2020Selector = createSelector(
252+
const RUST_2021_DEFAULT_END = new Date('2022-01-01T00:00:00Z');
253+
const RUST_2021_DEFAULT_OPEN = NOW <= RUST_2021_DEFAULT_END;
254+
export const showRust2021IsDefaultSelector = createSelector(
256255
notificationsSelector,
257-
notifications => RUST_SURVEY_2020_OPEN && !notifications.seenRustSurvey2020,
256+
notifications => RUST_2021_DEFAULT_OPEN && !notifications.seenRust2021IsDefault,
258257
);
259258

260259
export const anyNotificationsToShowSelector = createSelector(
261-
showRustSurvey2020Selector,
260+
showRust2021IsDefaultSelector,
262261
allNotifications => allNotifications,
263262
);
264263

ui/frontend/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export enum Focus {
119119
}
120120

121121
export enum Notification {
122-
RustSurvey2020 = 'rust-survey-2020',
122+
Rust2021IsDefault = 'rust-2021-is-default',
123123
}
124124

125125
export type AceResizeKey = [Focus, number];

0 commit comments

Comments
 (0)