diff --git a/core/modules/media/src/Form/MediaDeleteMultipleConfirmForm.php b/core/modules/media/src/Form/MediaDeleteMultipleConfirmForm.php
index 616a567e3c..85b472a6ed 100644
--- a/core/modules/media/src/Form/MediaDeleteMultipleConfirmForm.php
+++ b/core/modules/media/src/Form/MediaDeleteMultipleConfirmForm.php
@@ -195,7 +195,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
       }
 
       if ($total_count) {
-        drupal_set_message($this->formatPlural($total_count, 'Deleted 1 media item.', 'Deleted @count media items.'));
+        $this->messenger()->addStatus($this->formatPlural($total_count, 'Deleted 1 media item.', 'Deleted @count media items.'));
       }
 
       $this->tempStoreFactory->get('media_multiple_delete_confirm')->delete(\Drupal::currentUser()->id());
diff --git a/core/modules/media/src/MediaForm.php b/core/modules/media/src/MediaForm.php
index dd6b3fd2ad..6f860e23cd 100644
--- a/core/modules/media/src/MediaForm.php
+++ b/core/modules/media/src/MediaForm.php
@@ -65,11 +65,11 @@ public function save(array $form, FormStateInterface $form_state) {
 
     if ($saved === SAVED_NEW) {
       $logger->notice('@type: added %label.', $context);
-      drupal_set_message($this->t('@type %label has been created.', $t_args));
+      $this->messenger()->addStatus($this->t('@type %label has been created.', $t_args));
     }
     else {
       $logger->notice('@type: updated %label.', $context);
-      drupal_set_message($this->t('@type %label has been updated.', $t_args));
+      $this->messenger()->addStatus($this->t('@type %label has been updated.', $t_args));
     }
 
     $form_state->setRedirectUrl($this->entity->toUrl('canonical'));
diff --git a/core/modules/media/src/MediaTypeForm.php b/core/modules/media/src/MediaTypeForm.php
index 7766af2e56..17fd3c8d47 100644
--- a/core/modules/media/src/MediaTypeForm.php
+++ b/core/modules/media/src/MediaTypeForm.php
@@ -373,10 +373,10 @@ public function save(array $form, FormStateInterface $form_state) {
 
     $t_args = ['%name' => $media_type->label()];
     if ($status === SAVED_UPDATED) {
-      drupal_set_message($this->t('The media type %name has been updated.', $t_args));
+      $this->messenger()->addStatus($this->t('The media type %name has been updated.', $t_args));
     }
     elseif ($status === SAVED_NEW) {
-      drupal_set_message($this->t('The media type %name has been added.', $t_args));
+      $this->messenger()->addStatus($this->t('The media type %name has been added.', $t_args));
       $this->logger('media')->notice('Added media type %name.', $t_args);
     }
 
diff --git a/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php b/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php
index 7175c1bb25..60e086b133 100644
--- a/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php
+++ b/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php
@@ -130,14 +130,14 @@ public function save(array $form, FormStateInterface $form_state) {
     $saved = $menu_link->save();
 
     if ($saved) {
-      drupal_set_message($this->t('The menu link has been saved.'));
+      $this->messenger()->addStatus($this->t('The menu link has been saved.'));
       $form_state->setRedirect(
         'entity.menu_link_content.canonical',
         ['menu_link_content' => $menu_link->id()]
       );
     }
     else {
-      drupal_set_message($this->t('There was an error saving the menu link.'), 'error');
+      $this->messenger()->addError($this->t('There was an error saving the menu link.'));
       $form_state->setRebuild();
     }
   }
diff --git a/core/modules/menu_ui/src/Form/MenuLinkEditForm.php b/core/modules/menu_ui/src/Form/MenuLinkEditForm.php
index 6cb50da1c4..1afafd6444 100644
--- a/core/modules/menu_ui/src/Form/MenuLinkEditForm.php
+++ b/core/modules/menu_ui/src/Form/MenuLinkEditForm.php
@@ -91,7 +91,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
   public function submitForm(array &$form, FormStateInterface $form_state) {
     $link = $form['#plugin_form']->submitConfigurationForm($form, $form_state);
 
-    drupal_set_message($this->t('The menu link has been saved.'));
+    $this->messenger()->addStatus($this->t('The menu link has been saved.'));
     $form_state->setRedirect(
       'entity.menu.edit_form',
       ['menu' => $link->getMenuName()]
diff --git a/core/modules/menu_ui/src/Form/MenuLinkResetForm.php b/core/modules/menu_ui/src/Form/MenuLinkResetForm.php
index de9dccb9ed..ae307bcd72 100644
--- a/core/modules/menu_ui/src/Form/MenuLinkResetForm.php
+++ b/core/modules/menu_ui/src/Form/MenuLinkResetForm.php
@@ -102,7 +102,7 @@ public function buildForm(array $form, FormStateInterface $form_state, MenuLinkI
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
     $this->link = $this->menuLinkManager->resetLink($this->link->getPluginId());
-    drupal_set_message($this->t('The menu link was reset to its default settings.'));
+    $this->messenger()->addStatus($this->t('The menu link was reset to its default settings.'));
     $form_state->setRedirectUrl($this->getCancelUrl());
   }
 
diff --git a/core/modules/menu_ui/src/MenuForm.php b/core/modules/menu_ui/src/MenuForm.php
index aec2c49eb0..9291fda0bf 100644
--- a/core/modules/menu_ui/src/MenuForm.php
+++ b/core/modules/menu_ui/src/MenuForm.php
@@ -166,11 +166,11 @@ public function save(array $form, FormStateInterface $form_state) {
     $status = $menu->save();
     $edit_link = $this->entity->link($this->t('Edit'));
     if ($status == SAVED_UPDATED) {
-      drupal_set_message($this->t('Menu %label has been updated.', ['%label' => $menu->label()]));
+      $this->messenger()->addStatus($this->t('Menu %label has been updated.', ['%label' => $menu->label()]));
       $this->logger('menu')->notice('Menu %label has been updated.', ['%label' => $menu->label(), 'link' => $edit_link]);
     }
     else {
-      drupal_set_message($this->t('Menu %label has been added.', ['%label' => $menu->label()]));
+      $this->messenger()->addStatus($this->t('Menu %label has been added.', ['%label' => $menu->label()]));
       $this->logger('menu')->notice('Menu %label has been added.', ['%label' => $menu->label(), 'link' => $edit_link]);
     }
 
diff --git a/core/modules/migrate_drupal_ui/migrate_drupal_ui.install b/core/modules/migrate_drupal_ui/migrate_drupal_ui.install
index c6925b9b8d..5962ee1f87 100644
--- a/core/modules/migrate_drupal_ui/migrate_drupal_ui.install
+++ b/core/modules/migrate_drupal_ui/migrate_drupal_ui.install
@@ -12,5 +12,5 @@
  */
 function migrate_drupal_ui_install() {
   $url = Url::fromRoute('migrate_drupal_ui.upgrade')->toString();
-  drupal_set_message(t('The Migrate Drupal UI module has been enabled. Proceed to the <a href=":url">upgrade form</a>.', [':url' => $url]));
+  \Drupal::messenger()->addStatus(t('The Migrate Drupal UI module has been enabled. Proceed to the <a href=":url">upgrade form</a>.', [':url' => $url]));
 }
diff --git a/core/modules/migrate_drupal_ui/src/Batch/MigrateUpgradeImportBatch.php b/core/modules/migrate_drupal_ui/src/Batch/MigrateUpgradeImportBatch.php
index 12dc5c1c89..abe48f220a 100644
--- a/core/modules/migrate_drupal_ui/src/Batch/MigrateUpgradeImportBatch.php
+++ b/core/modules/migrate_drupal_ui/src/Batch/MigrateUpgradeImportBatch.php
@@ -228,24 +228,24 @@ public static function finished($success, $results, $operations, $elapsed) {
 
     // If we had any successes log that for the user.
     if ($successes > 0) {
-      drupal_set_message(\Drupal::translation()
+      \Drupal::messenger()->addStatus(\Drupal::translation()
         ->formatPlural($successes, 'Completed 1 upgrade task successfully', 'Completed @count upgrade tasks successfully'));
     }
     // If we had failures, log them and show the migration failed.
     if ($failures > 0) {
-      drupal_set_message(\Drupal::translation()
+      \Drupal::messenger()->addStatus(\Drupal::translation()
         ->formatPlural($failures, '1 upgrade failed', '@count upgrades failed'));
-      drupal_set_message(t('Upgrade process not completed'), 'error');
+      \Drupal::messenger()->addError(t('Upgrade process not completed'));
     }
     else {
       // Everything went off without a hitch. We may not have had successes
       // but we didn't have failures so this is fine.
-      drupal_set_message(t('Congratulations, you upgraded Drupal!'));
+      \Drupal::messenger()->addStatus(t('Congratulations, you upgraded Drupal!'));
     }
 
     if (\Drupal::moduleHandler()->moduleExists('dblog')) {
       $url = Url::fromRoute('migrate_drupal_ui.log');
-      drupal_set_message(Link::fromTextAndUrl(new TranslatableMarkup('Review the detailed upgrade log'), $url), $failures ? 'error' : 'status');
+      \Drupal::messenger()->addMessage(Link::fromTextAndUrl(new TranslatableMarkup('Review the detailed upgrade log'), $url), $failures ? 'error' : 'status');
     }
   }
 
diff --git a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php
index 898a8a5568..42984c715c 100644
--- a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php
+++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php
@@ -133,7 +133,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
         return $this->buildConfirmForm($form, $form_state);
 
       default:
-        drupal_set_message($this->t('Unrecognized form step @step', ['@step' => $step]), 'error');
+        $this->messenger()->addError($this->t('Unrecognized form step @step', ['@step' => $step]));
         return [];
     }
   }
@@ -505,7 +505,7 @@ public function buildIdConflictForm(array &$form, FormStateInterface $form_state
       return $this->buildForm($form, $form_state);
     }
 
-    drupal_set_message($this->t('WARNING: Content may be overwritten on your new site.'), 'warning');
+    $this->messenger()->addWarning($this->t('WARNING: Content may be overwritten on your new site.'));
 
     $form = parent::buildForm($form, $form_state);
     $form['actions']['submit']['#submit'] = ['::submitConfirmIdConflictForm'];
@@ -646,11 +646,11 @@ public function buildConfirmForm(array $form, FormStateInterface $form_state) {
       $migration_id = $migration->getPluginId();
       $source_module = $migration->getSourcePlugin()->getSourceModule();
       if (!$source_module) {
-        drupal_set_message($this->t('Source module not found for @migration_id.', ['@migration_id' => $migration_id]), 'error');
+        $this->messenger()->addError($this->t('Source module not found for @migration_id.', ['@migration_id' => $migration_id]));
       }
       $destination_module = $migration->getDestinationPlugin()->getDestinationModule();
       if (!$destination_module) {
-        drupal_set_message($this->t('Destination module not found for @migration_id.', ['@migration_id' => $migration_id]), 'error');
+        $this->messenger()->addError($this->t('Destination module not found for @migration_id.', ['@migration_id' => $migration_id]));
       }
 
       if ($source_module && $destination_module) {
diff --git a/core/modules/node/node.admin.inc b/core/modules/node/node.admin.inc
index b96ee5aff6..fe48692a84 100644
--- a/core/modules/node/node.admin.inc
+++ b/core/modules/node/node.admin.inc
@@ -60,7 +60,7 @@ function node_mass_update(array $nodes, array $updates, $langcode = NULL, $load
       }
       _node_mass_update_helper($node, $updates, $langcode);
     }
-    drupal_set_message(t('The update has been performed.'));
+    \Drupal::messenger()->addStatus(t('The update has been performed.'));
   }
 }
 
@@ -164,16 +164,16 @@ function _node_mass_update_batch_process(array $nodes, array $updates, $langcode
  */
 function _node_mass_update_batch_finished($success, $results, $operations) {
   if ($success) {
-    drupal_set_message(t('The update has been performed.'));
+    \Drupal::messenger()->addStatus(t('The update has been performed.'));
   }
   else {
-    drupal_set_message(t('An error occurred and processing did not complete.'), 'error');
+    \Drupal::messenger()->addError(t('An error occurred and processing did not complete.'));
     $message = \Drupal::translation()->formatPlural(count($results), '1 item successfully processed:', '@count items successfully processed:');
     $item_list = [
       '#theme' => 'item_list',
       '#items' => $results,
     ];
     $message .= \Drupal::service('renderer')->render($item_list);
-    drupal_set_message($message);
+    \Drupal::messenger()->addStatus($message);
   }
 }
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 208deb5786..9930fa89aa 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -104,7 +104,7 @@ function node_help($route_name, RouteMatchInterface $route_match) {
     else {
       $message = t('The content access permissions need to be rebuilt. <a href=":node_access_rebuild">Rebuild permissions</a>.', [':node_access_rebuild' => \Drupal::url('node.configure_rebuild_confirm')]);
     }
-    drupal_set_message($message, 'error');
+    \Drupal::messenger()->addError($message);
   }
 
   switch ($route_name) {
@@ -1221,7 +1221,7 @@ function node_access_rebuild($batch_mode = FALSE) {
   }
 
   if (!isset($batch)) {
-    drupal_set_message(t('Content permissions have been rebuilt.'));
+    \Drupal::messenger()->addStatus(t('Content permissions have been rebuilt.'));
     node_access_needs_rebuild(FALSE);
   }
 }
@@ -1294,11 +1294,11 @@ function _node_access_rebuild_batch_operation(&$context) {
  */
 function _node_access_rebuild_batch_finished($success, $results, $operations) {
   if ($success) {
-    drupal_set_message(t('The content access permissions have been rebuilt.'));
+    \Drupal::messenger()->addStatus(t('The content access permissions have been rebuilt.'));
     node_access_needs_rebuild(FALSE);
   }
   else {
-    drupal_set_message(t('The content access permissions have not been properly rebuilt.'), 'error');
+    \Drupal::messenger()->addError(t('The content access permissions have not been properly rebuilt.'));
   }
 }
 
diff --git a/core/modules/node/src/Entity/NodeType.php b/core/modules/node/src/Entity/NodeType.php
index e4a4c3b6c1..cfd53aedc4 100644
--- a/core/modules/node/src/Entity/NodeType.php
+++ b/core/modules/node/src/Entity/NodeType.php
@@ -179,7 +179,7 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) {
     if ($update && $this->getOriginalId() != $this->id()) {
       $update_count = node_type_update_nodes($this->getOriginalId(), $this->id());
       if ($update_count) {
-        drupal_set_message(\Drupal::translation()->formatPlural($update_count,
+        \Drupal::messenger()->addStatus(\Drupal::translation()->formatPlural($update_count,
           'Changed the content type of 1 post from %old-type to %type.',
           'Changed the content type of @count posts from %old-type to %type.',
           [
diff --git a/core/modules/node/src/Form/DeleteMultiple.php b/core/modules/node/src/Form/DeleteMultiple.php
index 8bc8f0685d..ae67d534ed 100644
--- a/core/modules/node/src/Form/DeleteMultiple.php
+++ b/core/modules/node/src/Form/DeleteMultiple.php
@@ -189,7 +189,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
       }
 
       if ($total_count) {
-        drupal_set_message($this->formatPlural($total_count, 'Deleted 1 post.', 'Deleted @count posts.'));
+        $this->messenger()->addStatus($this->formatPlural($total_count, 'Deleted 1 post.', 'Deleted @count posts.'));
       }
 
       $this->tempStoreFactory->get('node_multiple_delete_confirm')->delete(\Drupal::currentUser()->id());
diff --git a/core/modules/node/src/Form/NodeRevisionDeleteForm.php b/core/modules/node/src/Form/NodeRevisionDeleteForm.php
index 47e77990cc..d2145a55fb 100644
--- a/core/modules/node/src/Form/NodeRevisionDeleteForm.php
+++ b/core/modules/node/src/Form/NodeRevisionDeleteForm.php
@@ -118,7 +118,12 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
 
     $this->logger('content')->notice('@type: deleted %title revision %revision.', ['@type' => $this->revision->bundle(), '%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]);
     $node_type = $this->nodeTypeStorage->load($this->revision->bundle())->label();
-    drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '@type' => $node_type, '%title' => $this->revision->label()]));
+    $this->messenger()
+      ->addStatus($this->t('Revision from %revision-date of @type %title has been deleted.', [
+        '%revision-date' => format_date($this->revision->getRevisionCreationTime()),
+        '@type' => $node_type,
+        '%title' => $this->revision->label(),
+      ]));
     $form_state->setRedirect(
       'entity.node.canonical',
       ['node' => $this->revision->id()]
diff --git a/core/modules/node/src/Form/NodeRevisionRevertForm.php b/core/modules/node/src/Form/NodeRevisionRevertForm.php
index fc6fe023f5..cc9cac0178 100644
--- a/core/modules/node/src/Form/NodeRevisionRevertForm.php
+++ b/core/modules/node/src/Form/NodeRevisionRevertForm.php
@@ -133,7 +133,12 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
     $this->revision->save();
 
     $this->logger('content')->notice('@type: reverted %title revision %revision.', ['@type' => $this->revision->bundle(), '%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]);
-    drupal_set_message(t('@type %title has been reverted to the revision from %revision-date.', ['@type' => node_get_type_label($this->revision), '%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)]));
+    $this->messenger()
+      ->addStatus($this->t('@type %title has been reverted to the revision from %revision-date.', [
+        '@type' => node_get_type_label($this->revision),
+        '%title' => $this->revision->label(),
+        '%revision-date' => $this->dateFormatter->format($original_revision_timestamp),
+      ]));
     $form_state->setRedirect(
       'entity.node.version_history',
       ['node' => $this->revision->id()]
diff --git a/core/modules/node/src/NodeForm.php b/core/modules/node/src/NodeForm.php
index 0513d1f758..3a6b45fded 100644
--- a/core/modules/node/src/NodeForm.php
+++ b/core/modules/node/src/NodeForm.php
@@ -285,11 +285,11 @@ public function save(array $form, FormStateInterface $form_state) {
 
     if ($insert) {
       $this->logger('content')->notice('@type: added %title.', $context);
-      drupal_set_message(t('@type %title has been created.', $t_args));
+      $this->messenger()->addStatus($this->t('@type %title has been created.', $t_args));
     }
     else {
       $this->logger('content')->notice('@type: updated %title.', $context);
-      drupal_set_message(t('@type %title has been updated.', $t_args));
+      $this->messenger()->addStatus($this->t('@type %title has been updated.', $t_args));
     }
 
     if ($node->id()) {
@@ -312,7 +312,7 @@ public function save(array $form, FormStateInterface $form_state) {
     else {
       // In the unlikely case something went wrong on save, the node will be
       // rebuilt and node form redisplayed the same way as in preview.
-      drupal_set_message(t('The post could not be saved.'), 'error');
+      $this->messenger()->addError($this->t('The post could not be saved.'));
       $form_state->setRebuild();
     }
   }
diff --git a/core/modules/node/src/NodeTypeForm.php b/core/modules/node/src/NodeTypeForm.php
index 9eec40c700..148c1ff683 100644
--- a/core/modules/node/src/NodeTypeForm.php
+++ b/core/modules/node/src/NodeTypeForm.php
@@ -225,11 +225,11 @@ public function save(array $form, FormStateInterface $form_state) {
     $t_args = ['%name' => $type->label()];
 
     if ($status == SAVED_UPDATED) {
-      drupal_set_message(t('The content type %name has been updated.', $t_args));
+      $this->messenger()->addStatus($this->t('The content type %name has been updated.', $t_args));
     }
     elseif ($status == SAVED_NEW) {
       node_add_body_field($type);
-      drupal_set_message(t('The content type %name has been added.', $t_args));
+      $this->messenger()->addStatus($this->t('The content type %name has been added.', $t_args));
       $context = array_merge($t_args, ['link' => $type->link($this->t('View'), 'collection')]);
       $this->logger('node')->notice('Added content type %name.', $context);
     }
diff --git a/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php
index c200f34b61..97215a781f 100644
--- a/core/modules/node/src/Plugin/Search/NodeSearch.php
+++ b/core/modules/node/src/Plugin/Search/NodeSearch.php
@@ -289,15 +289,15 @@ protected function findResults() {
     $status = $query->getStatus();
 
     if ($status & SearchQuery::EXPRESSIONS_IGNORED) {
-      drupal_set_message($this->t('Your search used too many AND/OR expressions. Only the first @count terms were included in this search.', ['@count' => $this->searchSettings->get('and_or_limit')]), 'warning');
+      $this->messenger()->addWarning($this->t('Your search used too many AND/OR expressions. Only the first @count terms were included in this search.', ['@count' => $this->searchSettings->get('and_or_limit')]));
     }
 
     if ($status & SearchQuery::LOWER_CASE_OR) {
-      drupal_set_message($this->t('Search for either of the two terms with uppercase <strong>OR</strong>. For example, <strong>cats OR dogs</strong>.'), 'warning');
+      $this->messenger()->addWarning($this->t('Search for either of the two terms with uppercase <strong>OR</strong>. For example, <strong>cats OR dogs</strong>.'));
     }
 
     if ($status & SearchQuery::NO_POSITIVE_KEYWORDS) {
-      drupal_set_message($this->formatPlural($this->searchSettings->get('index.minimum_word_size'), 'You must include at least one keyword to match in the content, and punctuation is ignored.', 'You must include at least one keyword to match in the content. Keywords must be at least @count characters, and punctuation is ignored.'), 'warning');
+      $this->messenger()->addWarning($this->formatPlural($this->searchSettings->get('index.minimum_word_size'), 'You must include at least one keyword to match in the content, and punctuation is ignored.', 'You must include at least one keyword to match in the content. Keywords must be at least @count characters, and punctuation is ignored.'));
     }
 
     return $find;
diff --git a/core/modules/node/tests/modules/node_test/node_test.module b/core/modules/node/tests/modules/node_test/node_test.module
index a2f06decce..56aef63c61 100644
--- a/core/modules/node/tests/modules/node_test/node_test.module
+++ b/core/modules/node/tests/modules/node_test/node_test.module
@@ -182,10 +182,10 @@ function node_test_node_insert(NodeInterface $node) {
  */
 function node_test_form_alter(&$form, FormStateInterface $form_state, $form_id) {
   if (!$form_state->get('node_test_form_alter')) {
-    drupal_set_message('Storage is not set');
+    \Drupal::messenger()->addStatus('Storage is not set');
     $form_state->set('node_test_form_alter', TRUE);
   }
   else {
-    drupal_set_message('Storage is set');
+    \Drupal::messenger()->addStatus('Storage is set');
   }
 }
diff --git a/core/modules/path/src/Form/PathFormBase.php b/core/modules/path/src/Form/PathFormBase.php
index 5a54c08b48..2aa785cd73 100644
--- a/core/modules/path/src/Form/PathFormBase.php
+++ b/core/modules/path/src/Form/PathFormBase.php
@@ -212,7 +212,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
 
     $this->aliasStorage->save($source, $alias, $langcode, $pid);
 
-    drupal_set_message($this->t('The alias has been saved.'));
+    $this->messenger()->addStatus($this->t('The alias has been saved.'));
     $form_state->setRedirect('path.admin_overview');
   }
 
diff --git a/core/modules/responsive_image/src/ResponsiveImageStyleForm.php b/core/modules/responsive_image/src/ResponsiveImageStyleForm.php
index 4240473900..3a709519d0 100644
--- a/core/modules/responsive_image/src/ResponsiveImageStyleForm.php
+++ b/core/modules/responsive_image/src/ResponsiveImageStyleForm.php
@@ -276,7 +276,7 @@ public function save(array $form, FormStateInterface $form_state) {
     $responsive_image_style->save();
 
     $this->logger('responsive_image')->notice('Responsive image style @label saved.', ['@label' => $responsive_image_style->label()]);
-    drupal_set_message($this->t('Responsive image style %label saved.', ['%label' => $responsive_image_style->label()]));
+    $this->messenger()->addStatus($this->t('Responsive image style %label saved.', ['%label' => $responsive_image_style->label()]));
 
     // Redirect to edit form after creating a new responsive image style or
     // after selecting another breakpoint group.
