diff --git a/core/includes/pager.inc b/core/includes/pager.inc
index 730be44..05be5c8 100644
--- a/core/includes/pager.inc
+++ b/core/includes/pager.inc
@@ -211,15 +211,13 @@ function template_preprocess_pager(&$variables) {
   }
   // End of generation loop preparation.
 
-  $current_path = current_path();
-
   // Create the "first" and "previous" links if we are not on the first page.
   if ($pager_page_array[$element] > 0) {
     $items['first'] = array();
     $options = array(
       'query' => pager_query_add_page($parameters, $element, 0),
     );
-    $items['first']['href'] = url($current_path, $options);
+    $items['first']['href'] = \Drupal::url('<current>', [], $options);
     if (isset($tags[0])) {
       $items['first']['text'] = $tags[0];
     }
@@ -228,7 +226,7 @@ function template_preprocess_pager(&$variables) {
     $options = array(
       'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] - 1),
     );
-    $items['previous']['href'] = url($current_path, $options);
+    $items['previous']['href'] = \Drupal::url('<current>', [], $options);
     if (isset($tags[1])) {
       $items['previous']['text'] = $tags[1];
     }
@@ -244,7 +242,7 @@ function template_preprocess_pager(&$variables) {
       $options = array(
         'query' => pager_query_add_page($parameters, $element, $i - 1),
       );
-      $items['pages'][$i]['href'] = url($current_path, $options);
+      $items['pages'][$i]['href'] = \Drupal::url('<current>', [], $options);
       if ($i == $pager_current) {
         $variables['current'] = $i;
       }
@@ -261,7 +259,7 @@ function template_preprocess_pager(&$variables) {
     $options = array(
       'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] + 1),
     );
-    $items['next']['href'] = url($current_path, $options);
+    $items['next']['href'] = \Drupal::url('<current>', [], $options);
     if (isset($tags[3])) {
       $items['next']['text'] = $tags[3];
     }
@@ -270,7 +268,7 @@ function template_preprocess_pager(&$variables) {
     $options = array(
       'query' => pager_query_add_page($parameters, $element, $pager_max - 1),
     );
-    $items['last']['href'] = url($current_path, $options);
+    $items['last']['href'] = \Drupal::url('<current>', [], $options);
     if (isset($tags[4])) {
       $items['last']['text'] = $tags[4];
     }
diff --git a/core/includes/tablesort.inc b/core/includes/tablesort.inc
index 0b3574f..d4b1576 100644
--- a/core/includes/tablesort.inc
+++ b/core/includes/tablesort.inc
@@ -61,14 +61,14 @@ function tablesort_header(&$cell_content, array &$cell_attributes, array $header
       $ts['sort'] = 'asc';
       $image = '';
     }
-    $cell_content = l($cell_content . $image, current_path(), array(
+    $cell_content = \Drupal::l($cell_content . $image, '<current>', [], [
       'attributes' => array('title' => $title),
       'query' => array_merge($ts['query'], array(
         'sort' => $ts['sort'],
         'order' => $cell_content,
       )),
       'html' => TRUE,
-    ));
+    ]);
 
     unset($cell_attributes['field'], $cell_attributes['sort']);
   }
diff --git a/core/modules/language/tests/language_test/src/Controller/LanguageTestController.php b/core/modules/language/tests/language_test/src/Controller/LanguageTestController.php
index 8095270..e9408aa 100644
--- a/core/modules/language/tests/language_test/src/Controller/LanguageTestController.php
+++ b/core/modules/language/tests/language_test/src/Controller/LanguageTestController.php
@@ -62,7 +62,7 @@ public function typeLinkActiveClass() {
       'no_language' => array(
         '#type' => 'link',
         '#title' => t('Link to the current path with no langcode provided.'),
-        '#href' => current_path(),
+        '#route_name' => '<current>',
         '#options' => array(
           'attributes' => array(
             'id' => 'no_lang_link',
@@ -73,7 +73,7 @@ public function typeLinkActiveClass() {
       'fr' => array(
         '#type' => 'link',
         '#title' => t('Link to a French version of the current path.'),
-        '#href' => current_path(),
+        '#route_name' => '<current>',
         '#options' => array(
           'language' => $languages['fr'],
           'attributes' => array(
@@ -85,7 +85,7 @@ public function typeLinkActiveClass() {
       'en' => array(
         '#type' => 'link',
         '#title' => t('Link to an English version of the current path.'),
-        '#href' => current_path(),
+        '#route_name' => '<current>',
         '#options' => array(
           'language' => $languages['en'],
           'attributes' => array(
diff --git a/core/modules/path/src/Form/PathFormBase.php b/core/modules/path/src/Form/PathFormBase.php
index 8564156..f4d9309 100644
--- a/core/modules/path/src/Form/PathFormBase.php
+++ b/core/modules/path/src/Form/PathFormBase.php
@@ -95,7 +95,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $pid = NU
       '#maxlength' => 255,
       '#size' => 45,
       '#description' => $this->t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1.'),
-      '#field_prefix' => url(NULL, array('absolute' => TRUE)),
+      '#field_prefix' => $this->url('<none>', [], ['absolute' => TRUE]),
       '#required' => TRUE,
     );
     $form['alias'] = array(
@@ -105,7 +105,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $pid = NU
       '#maxlength' => 255,
       '#size' => 45,
       '#description' => $this->t('Specify an alternative path by which this data can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
-      '#field_prefix' => url(NULL, array('absolute' => TRUE)),
+      '#field_prefix' => $this->url('<none>', [], ['absolute' => TRUE]),
       '#required' => TRUE,
     );
 
diff --git a/core/modules/system/src/Form/SiteInformationForm.php b/core/modules/system/src/Form/SiteInformationForm.php
index d8328df..f51bd98 100644
--- a/core/modules/system/src/Form/SiteInformationForm.php
+++ b/core/modules/system/src/Form/SiteInformationForm.php
@@ -114,7 +114,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
       '#default_value' => $front_page,
       '#size' => 40,
       '#description' => t('Optionally, specify a relative URL to display as the front page. Leave blank to display the default front page.'),
-      '#field_prefix' => url(NULL, array('absolute' => TRUE)),
+      '#field_prefix' => $this->url('<none>', [], ['absolute' => TRUE]),
     );
     $form['error_page'] = array(
       '#type' => 'details',
@@ -127,7 +127,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
       '#default_value' => $site_config->get('page.403'),
       '#size' => 40,
       '#description' => t('This page is displayed when the requested document is denied to the current user. Leave blank to display a generic "access denied" page.'),
-      '#field_prefix' => url(NULL, array('absolute' => TRUE)),
+      '#field_prefix' => $this->url('<none>', [], ['absolute' => TRUE]),
     );
     $form['error_page']['site_404'] = array(
       '#type' => 'textfield',
@@ -135,7 +135,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
       '#default_value' => $site_config->get('page.404'),
       '#size' => 40,
       '#description' => t('This page is displayed when no other content matches the requested document. Leave blank to display a generic "page not found" page.'),
-      '#field_prefix' => url(NULL, array('absolute' => TRUE)),
+      '#field_prefix' => $this->url('<none>', [], ['absolute' => TRUE]),
     );
 
     return parent::buildForm($form, $form_state);
diff --git a/core/modules/system/src/Tests/Common/UrlTest.php b/core/modules/system/src/Tests/Common/UrlTest.php
index 4edae14..74e0cc5 100644
--- a/core/modules/system/src/Tests/Common/UrlTest.php
+++ b/core/modules/system/src/Tests/Common/UrlTest.php
@@ -114,7 +114,7 @@ function testLinkAttributes() {
     // Test adding a custom class in links produced by l() and #type 'link'.
     // Test l().
     $class_l = $this->randomMachineName();
-    $link_l = l($this->randomMachineName(), current_path(), array('attributes' => array('class' => array($class_l))));
+    $link_l = \Drupal::l($this->randomMachineName(), '<current>', [], ['attributes' => array('class' => array($class_l))]);
     $this->assertTrue($this->hasAttribute('class', $link_l, $class_l), format_string('Custom class @class is present on link when requested by l()', array('@class' => $class_l)));
 
     // Test #type.
@@ -122,7 +122,7 @@ function testLinkAttributes() {
     $type_link = array(
       '#type' => 'link',
       '#title' => $this->randomMachineName(),
-      '#href' => current_path(),
+      '#route_name' => '<current>',
       '#options' => array(
         'attributes' => array(
           'class' => array($class_theme),
diff --git a/core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php b/core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php
index 32bc04f..ed85c14 100644
--- a/core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php
+++ b/core/modules/system/tests/modules/common_test/src/Controller/CommonTestController.php
@@ -25,7 +25,7 @@ public function typeLinkActiveClass() {
       'no_query' => array(
         '#type' => 'link',
         '#title' => t('Link with no query string'),
-        '#href' => current_path(),
+        '#route_name' => '<current>',
         '#options' => array(
           'set_active_class' => TRUE,
         ),
@@ -33,7 +33,7 @@ public function typeLinkActiveClass() {
       'with_query' => array(
         '#type' => 'link',
         '#title' => t('Link with a query string'),
-        '#href' => current_path(),
+        '#route_name' => '<current>',
         '#options' => array(
           'query' => array(
             'foo' => 'bar',
@@ -45,7 +45,7 @@ public function typeLinkActiveClass() {
       'with_query_reversed' => array(
         '#type' => 'link',
         '#title' => t('Link with the same query string in reverse order'),
-        '#href' => current_path(),
+        '#route_name' => '<current>',
         '#options' => array(
           'query' => array(
             'one' => 'two',
diff --git a/core/modules/user/src/Plugin/Block/UserLoginBlock.php b/core/modules/user/src/Plugin/Block/UserLoginBlock.php
index 7b3727d..0bb3406 100644
--- a/core/modules/user/src/Plugin/Block/UserLoginBlock.php
+++ b/core/modules/user/src/Plugin/Block/UserLoginBlock.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\user\Plugin\Block;
 
+use Drupal\Core\Routing\UrlGeneratorTrait;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Block\BlockBase;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
@@ -22,6 +23,8 @@
  */
 class UserLoginBlock extends BlockBase {
 
+  use UrlGeneratorTrait;
+
   /**
    * {@inheritdoc}
    */
@@ -40,7 +43,7 @@ public function build() {
     unset($form['pass']['#description']);
     $form['name']['#size'] = 15;
     $form['pass']['#size'] = 15;
-    $form['#action'] = url(current_path(), array('query' => drupal_get_destination(), 'external' => FALSE));
+    $form['#action'] = $this->url('<current>', [], ['query' => drupal_get_destination(), 'external' => FALSE]);
     // Build action links.
     $items = array();
     if (\Drupal::config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY) {
diff --git a/core/modules/views/src/Plugin/views/display/PathPluginBase.php b/core/modules/views/src/Plugin/views/display/PathPluginBase.php
index 1fe0a35..f3d90ce 100644
--- a/core/modules/views/src/Plugin/views/display/PathPluginBase.php
+++ b/core/modules/views/src/Plugin/views/display/PathPluginBase.php
@@ -9,6 +9,7 @@
 
 use Drupal\Core\Access\AccessManagerInterface;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Routing\UrlGeneratorTrait;
 use Drupal\Core\State\StateInterface;
 use Drupal\Core\Routing\RouteCompiler;
 use Drupal\Core\Routing\RouteProviderInterface;
@@ -27,6 +28,8 @@
  */
 abstract class PathPluginBase extends DisplayPluginBase implements DisplayRouterInterface {
 
+  use UrlGeneratorTrait;
+
   /**
    * The route provider.
    *
@@ -393,7 +396,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
           '#title' => $this->t('Path'),
           '#description' => $this->t('This view will be displayed by visiting this path on your site. You may use "%" in your URL to represent values that will be used for contextual filters: For example, "node/%/feed". If needed you can even specify named route parameters like taxonomy/term/%taxonomy_term'),
           '#default_value' => $this->getOption('path'),
-          '#field_prefix' => '<span dir="ltr">' . url(NULL, array('absolute' => TRUE)),
+          '#field_prefix' => '<span dir="ltr">' . $this->url('<none>', [], ['absolute' => TRUE]),
           '#field_suffix' => '</span>&lrm;',
           '#attributes' => array('dir' => 'ltr'),
           // Account for the leading backslash.
diff --git a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
index 1b13575..c8a127b 100644
--- a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
+++ b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
@@ -9,6 +9,7 @@
 
 use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Routing\UrlGeneratorTrait;
 use Drupal\views\Entity\View;
 use Drupal\views\Views;
 use Drupal\views_ui\ViewUI;
@@ -38,6 +39,8 @@
  */
 abstract class WizardPluginBase extends PluginBase implements WizardInterface {
 
+  use UrlGeneratorTrait;
+
   /**
    * The base table connected with the wizard.
    *
@@ -218,7 +221,7 @@ public function getSorts() {
   public function buildForm(array $form, FormStateInterface $form_state) {
     $style_options = Views::fetchPluginNames('style', 'normal', array($this->base_table));
     $feed_row_options = Views::fetchPluginNames('row', 'feed', array($this->base_table));
-    $path_prefix = url(NULL, array('absolute' => TRUE));
+    $path_prefix = $this->url('<none>', [], ['absolute' => TRUE]);
 
     // Add filters and sorts which apply to the view as a whole.
     $this->buildFilters($form, $form_state);
diff --git a/core/modules/views/src/Tests/ViewUnitTestBase.php b/core/modules/views/src/Tests/ViewUnitTestBase.php
index fa14ec9..ad5c392 100644
--- a/core/modules/views/src/Tests/ViewUnitTestBase.php
+++ b/core/modules/views/src/Tests/ViewUnitTestBase.php
@@ -55,6 +55,7 @@ protected function setUpFixtures() {
 
     // The router table is required for router rebuilds.
     $this->installSchema('system', array('router'));
+    \Drupal::service('router.builder')->rebuild();
 
     // Load the test dataset.
     $data_set = $this->dataSet();
diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc
index 81df6a1..749dc76 100644
--- a/core/modules/views/views.theme.inc
+++ b/core/modules/views/views.theme.inc
@@ -306,8 +306,10 @@ function template_preprocess_views_view_summary(&$variables) {
   }
 
   $active_urls = array(
-    url(current_path(), array('alias' => TRUE)), // force system path
-    url(current_path()), // could be an alias
+    // Force system path.
+    \Drupal::url('<current>', [], ['alias' => TRUE]),
+    // Could be an alias.
+    \Drupal::url('<current>'),
   );
   $active_urls = array_combine($active_urls, $active_urls);
 
@@ -366,9 +368,9 @@ function template_preprocess_views_view_summary_unformatted(&$variables) {
   $count = 0;
   $active_urls = array(
     // Force system path.
-    url(current_path(), array('alias' => TRUE)),
+    \Drupal::url('<current>', [], ['alias' => TRUE]),
     // Could be an alias.
-    url(current_path()),
+    \Drupal::url('<current>'),
   );
   $active_urls = array_combine($active_urls, $active_urls);
 
@@ -484,7 +486,7 @@ function template_preprocess_views_view_table(&$variables) {
           'attributes' => array('title' => $title),
           'query' => $query,
         );
-        $variables['header'][$field]['content'] = l($label, current_path(), $link_options);
+        $variables['header'][$field]['content'] = \Drupal::l($label, '<current>', [], $link_options);
       }
 
       // Set up the header label class.
@@ -1038,14 +1040,13 @@ function template_preprocess_views_mini_pager(&$variables) {
 
   // Current is the page we are currently paged to.
   $pager_current = $pager_page_array[$element] + 1;
-  $current_path = current_path();
 
   $li_previous = array();
   if ($pager_total[$element] > 1 && $pager_page_array[$element] > 0) {
     $li_previous = array(
       '#type' => 'link',
       '#title' => $tags[1],
-      '#href' => $current_path,
+      '#route_name' => '<current>',
       '#options' => array(
         'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] - 1),
         'attributes' => array(
@@ -1068,7 +1069,7 @@ function template_preprocess_views_mini_pager(&$variables) {
     $li_next = array(
       '#type' => 'link',
       '#title' => $tags[3],
-      '#href' => $current_path,
+      '#route_name' => '<current>',
       '#options' => array(
         'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] + 1),
         'attributes' => array(
