diff --git a/tests/spec/features/tools_spec.rb b/tests/spec/features/tools_spec.rb index 090dd420c..5325e2c00 100644 --- a/tests/spec/features/tools_spec.rb +++ b/tests/spec/features/tools_spec.rb @@ -64,7 +64,7 @@ def code_with_undefined_behavior expect(page).to have_content('core::fmt::Arguments::new_v1') # Third-party procedural macro - expect(page).to have_content('block_on(async') + expect(page).to have_content('block_on(body)') # User-specified declarative macro expect(page).to have_content('fn created_by_macro() -> i32 { 42 }') diff --git a/tests/spec/features/url_parameters_spec.rb b/tests/spec/features/url_parameters_spec.rb index e3f18cc66..4f7d30215 100644 --- a/tests/spec/features/url_parameters_spec.rb +++ b/tests/spec/features/url_parameters_spec.rb @@ -104,7 +104,7 @@ scenario "loading without code or an edition" do visit '/' - expect(page).to have_edition('2018') + expect(page).to have_edition('2021') end def editor diff --git a/ui/frontend/AdvancedOptionsMenu.tsx b/ui/frontend/AdvancedOptionsMenu.tsx index 0c83cdd20..c364c870d 100644 --- a/ui/frontend/AdvancedOptionsMenu.tsx +++ b/ui/frontend/AdvancedOptionsMenu.tsx @@ -4,7 +4,6 @@ import { useSelector, useDispatch } from 'react-redux'; import * as actions from './actions'; import { Either as EitherConfig, Select as SelectConfig } from './ConfigElement'; import MenuGroup from './MenuGroup'; -import MenuAside from './MenuAside'; import { State } from './reducers'; import * as selectors from './selectors'; import { Backtrace, Edition } from './types'; @@ -12,7 +11,6 @@ import { Backtrace, Edition } from './types'; const AdvancedOptionsMenu: React.SFC = () => { const isEditionDefault = useSelector(selectors.isEditionDefault); const edition = useSelector((state: State) => state.configuration.edition); - const isRust2021Available = useSelector(selectors.isRust2021Available); const isBacktraceSet = useSelector(selectors.getBacktraceSet); const backtrace = useSelector((state: State) => state.configuration.backtrace); @@ -21,8 +19,6 @@ const AdvancedOptionsMenu: React.SFC = () => { const changeEdition = useCallback((e) => dispatch(actions.changeEdition(e)), [dispatch]); const changeBacktrace = useCallback((b) => dispatch(actions.changeBacktrace(b)), [dispatch]); - const Aside = !isRust2021Available && <Rust2021Aside />; - return ( <MenuGroup title="Advanced options"> <SelectConfig @@ -30,7 +26,6 @@ const AdvancedOptionsMenu: React.SFC = () => { value={edition} isNotDefault={!isEditionDefault} onChange={changeEdition} - aside={Aside} > <option value={Edition.Rust2015}>2015</option> <option value={Edition.Rust2018}>2018</option> @@ -49,11 +44,4 @@ const AdvancedOptionsMenu: React.SFC = () => { ); }; -const Rust2021Aside: React.SFC = () => ( - <MenuAside> - Note: Rust 2021 currently requires using the Nightly channel, selecting this - option will switch to Nightly. - </MenuAside> -); - export default AdvancedOptionsMenu; diff --git a/ui/frontend/Notifications.tsx b/ui/frontend/Notifications.tsx index a55f74bab..9d857df4e 100644 --- a/ui/frontend/Notifications.tsx +++ b/ui/frontend/Notifications.tsx @@ -9,30 +9,29 @@ import * as selectors from './selectors'; import styles from './Notifications.module.css'; -const SURVEY_URL = 'https://blog.rust-lang.org/2020/09/10/survey-launch.html'; +const EDITION_URL = 'https://doc.rust-lang.org/edition-guide/'; const Notifications: React.SFC = () => { return ( <Portal> <div className={styles.container}> - <Rust2020SurveyNotification /> + <Rust2021IsDefaultNotification /> </div> </Portal> ); }; -const Rust2020SurveyNotification: React.SFC = () => { - const showRust2020Survey = useSelector(selectors.showRustSurvey2020Selector); +const Rust2021IsDefaultNotification: React.SFC = () => { + const showRust2021IsDefault = useSelector(selectors.showRust2021IsDefaultSelector); const dispatch = useDispatch(); - const seenRustSurvey2020 = useCallback(() => dispatch(actions.seenRustSurvey2020()), [dispatch]); - - return showRust2020Survey && ( - <Notification onClose={seenRustSurvey2020}> - We want to know your opinions! Your responses to - the <a href={SURVEY_URL}>2020 State of Rust Survey</a> will - help the project understand its strengths and weaknesses - and establish development priorities for the future! + const seenRust2021IsDefault = useCallback(() => dispatch(actions.seenRust2021IsDefault()), [dispatch]); + + return showRust2021IsDefault && ( + <Notification onClose={seenRust2021IsDefault}> + As of Rust 1.56, the default edition of Rust is now Rust + 2021. Learn more about editions in the <a href={EDITION_URL}>Edition Guide</a>. + To specify which edition to use, use the advanced compilation options menu. </Notification> ); }; diff --git a/ui/frontend/actions.ts b/ui/frontend/actions.ts index b04581c56..9f47ea68d 100644 --- a/ui/frontend/actions.ts +++ b/ui/frontend/actions.ts @@ -708,7 +708,7 @@ export function performVersionsLoad(): ThunkAction { const notificationSeen = (notification: Notification) => createAction(ActionType.NotificationSeen, { notification }); -export const seenRustSurvey2020 = () => notificationSeen(Notification.RustSurvey2020); +export const seenRust2021IsDefault = () => notificationSeen(Notification.Rust2021IsDefault); export const browserWidthChanged = (isSmall: boolean) => createAction(ActionType.BrowserWidthChanged, { isSmall }); diff --git a/ui/frontend/reducers/configuration.ts b/ui/frontend/reducers/configuration.ts index bd5a6b231..f7739adb7 100644 --- a/ui/frontend/reducers/configuration.ts +++ b/ui/frontend/reducers/configuration.ts @@ -42,7 +42,7 @@ const DEFAULT: State = { primaryAction: PrimaryActionAuto.Auto, channel: Channel.Stable, mode: Mode.Debug, - edition: Edition.Rust2018, + edition: Edition.Rust2021, backtrace: Backtrace.Disabled, }; diff --git a/ui/frontend/reducers/notifications.ts b/ui/frontend/reducers/notifications.ts index 572248ae0..c3b8bb326 100644 --- a/ui/frontend/reducers/notifications.ts +++ b/ui/frontend/reducers/notifications.ts @@ -4,21 +4,23 @@ import { Notification } from '../types'; interface State { seenRustSurvey2018: boolean; // expired seenRust2018IsDefault: boolean; // expired - seenRustSurvey2020: boolean; + seenRustSurvey2020: boolean; // expired + seenRust2021IsDefault: boolean; } const DEFAULT: State = { seenRustSurvey2018: true, seenRust2018IsDefault: true, - seenRustSurvey2020: false, + seenRustSurvey2020: true, + seenRust2021IsDefault: false, }; export default function notifications(state = DEFAULT, action: Action): State { switch (action.type) { case ActionType.NotificationSeen: { switch (action.notification) { - case Notification.RustSurvey2020: { - return { ...state, seenRustSurvey2020: true }; + case Notification.Rust2021IsDefault: { + return { ...state, seenRust2021IsDefault: true }; } } } diff --git a/ui/frontend/selectors/index.ts b/ui/frontend/selectors/index.ts index 80e5811be..90a258c95 100644 --- a/ui/frontend/selectors/index.ts +++ b/ui/frontend/selectors/index.ts @@ -108,7 +108,6 @@ export const isNightlyChannel = (state: State) => ( ); export const isWasmAvailable = isNightlyChannel; export const isHirAvailable = isNightlyChannel; -export const isRust2021Available = isNightlyChannel; export const getModeLabel = (state: State) => { const { configuration: { mode } } = state; @@ -122,7 +121,7 @@ export const getChannelLabel = (state: State) => { export const isEditionDefault = createSelector( editionSelector, - edition => edition == Edition.Rust2018, + edition => edition == Edition.Rust2021, ); export const getBacktraceSet = (state: State) => ( @@ -250,15 +249,15 @@ export const codeUrlSelector = createSelector( const notificationsSelector = (state: State) => state.notifications; const NOW = new Date(); -const RUST_SURVEY_2020_END = new Date('2020-09-24T23:59:59Z'); -const RUST_SURVEY_2020_OPEN = NOW <= RUST_SURVEY_2020_END; -export const showRustSurvey2020Selector = createSelector( +const RUST_2021_DEFAULT_END = new Date('2022-01-01T00:00:00Z'); +const RUST_2021_DEFAULT_OPEN = NOW <= RUST_2021_DEFAULT_END; +export const showRust2021IsDefaultSelector = createSelector( notificationsSelector, - notifications => RUST_SURVEY_2020_OPEN && !notifications.seenRustSurvey2020, + notifications => RUST_2021_DEFAULT_OPEN && !notifications.seenRust2021IsDefault, ); export const anyNotificationsToShowSelector = createSelector( - showRustSurvey2020Selector, + showRust2021IsDefaultSelector, allNotifications => allNotifications, ); diff --git a/ui/frontend/types.ts b/ui/frontend/types.ts index e321b9105..4842f3424 100644 --- a/ui/frontend/types.ts +++ b/ui/frontend/types.ts @@ -119,7 +119,7 @@ export enum Focus { } export enum Notification { - RustSurvey2020 = 'rust-survey-2020', + Rust2021IsDefault = 'rust-2021-is-default', } export type AceResizeKey = [Focus, number];