diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php
index 859cf07..bb1fcd7 100644
--- a/core/lib/Drupal/Core/Url.php
+++ b/core/lib/Drupal/Core/Url.php
@@ -640,13 +640,6 @@ public function toString() {
   }
 
   /**
-   * {@inheritdoc}
-   */
-  public function __toString() {
-    return $this->toString();
-  }
-
-  /**
    * Returns the route information for a render array.
    *
    * @return array
diff --git a/core/modules/system/src/Tests/Theme/EngineTwigTest.php b/core/modules/system/src/Tests/Theme/EngineTwigTest.php
index d564a8f..02139ab 100644
--- a/core/modules/system/src/Tests/Theme/EngineTwigTest.php
+++ b/core/modules/system/src/Tests/Theme/EngineTwigTest.php
@@ -84,6 +84,25 @@ public function testTwigLinkGenerator() {
   }
 
   /**
+   * Tests the magic url to string Twig functions.
+   *
+   * @see \Drupal\Core\Url
+   */
+  public function testTwigUrlToString() {
+    $this->drupalGet('twig-theme-test/url-to-string');
+
+    $expected = [
+      'rendered url: ' . Url::fromRoute('user.register')->toString(),
+    ];
+
+    $content = $this->getRawContent();
+    $this->assertFalse(empty($content), 'Page content is not empty');
+    foreach ($expected as $string) {
+      $this->assertRaw('<div>' . $string . '</div>');
+    }
+  }
+
+  /**
    * Tests the file_url Twig functions.
    */
   public function testTwigFileUrls() {
diff --git a/core/modules/system/tests/modules/twig_theme_test/src/TwigThemeTestController.php b/core/modules/system/tests/modules/twig_theme_test/src/TwigThemeTestController.php
index 2bf5394..ff49bd6 100644
--- a/core/modules/system/tests/modules/twig_theme_test/src/TwigThemeTestController.php
+++ b/core/modules/system/tests/modules/twig_theme_test/src/TwigThemeTestController.php
@@ -50,6 +50,16 @@ public function linkGeneratorRender() {
   }
 
   /**
+   * Renders a URL to a string.
+   */
+  public function urlToStringRender() {
+    return [
+      '#theme' => 'twig_theme_test_url_to_string',
+      '#test_url' => Url::fromRoute('user.register'),
+    ];
+  }
+
+  /**
    * Renders for testing file_url functions in a Twig template.
    */
   public function fileUrlRender() {
diff --git a/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.url_to_string.html.twig b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.url_to_string.html.twig
new file mode 100644
index 0000000..e337a6f
--- /dev/null
+++ b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.url_to_string.html.twig
@@ -0,0 +1 @@
+<div>rendered url: {{ test_url }}</div>
diff --git a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module
index e42b020..7f6fe35 100644
--- a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module
+++ b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module
@@ -42,6 +42,10 @@ function twig_theme_test_theme($existing, $type, $theme, $path) {
     'variables' => array('test_url' => NULL),
     'template' => 'twig_theme_test.link_generator',
   );
+  $items['twig_theme_test_url_to_string'] = array(
+    'variables' => array('test_url' => NULL),
+    'template' => 'twig_theme_test.url_to_string',
+  );
   $items['twig_theme_test_file_url'] = array(
     'variables' => array(),
     'template' => 'twig_theme_test.file_url',
diff --git a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml
index 4d30bb9..1001b47 100644
--- a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml
+++ b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml
@@ -26,6 +26,13 @@ twig_theme_test_link_generator:
   requirements:
     _access: 'TRUE'
 
+twig_theme_test_url_to_string:
+  path: '/twig-theme-test/url-to-string'
+  defaults:
+    _controller: '\Drupal\twig_theme_test\TwigThemeTestController::urlToStringRender'
+  requirements:
+    _access: 'TRUE'
+
 twig_theme_test_file_url:
   path: '/twig-theme-test/file-url'
   defaults:
diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php
index 3f0ec3e..59489c9 100644
--- a/core/tests/Drupal/Tests/Core/UrlTest.php
+++ b/core/tests/Drupal/Tests/Core/UrlTest.php
@@ -332,24 +332,6 @@ public function testToString($urls) {
   }
 
   /**
-   * Tests the __toString() method.
-   *
-   * @param \Drupal\Core\Url[] $urls
-   *   An array of Url objects.
-   *
-   * @depends testUrlFromRequest
-   *
-   * @covers ::__toString
-   */
-  public function testMagicToString($urls) {
-    foreach ($urls as $index => $url) {
-      $url->setUrlGenerator(\Drupal::urlGenerator());
-      $path = array_pop($this->map[$index]);
-      $this->assertSame($path, (string) $url);
-    }
-  }
-
-  /**
    * Tests the getRouteName() method.
    *
    * @param \Drupal\Core\Url[] $urls
diff --git a/core/themes/engines/twig/twig.engine b/core/themes/engines/twig/twig.engine
index 5ef2f10..0fc600e 100644
--- a/core/themes/engines/twig/twig.engine
+++ b/core/themes/engines/twig/twig.engine
@@ -150,6 +150,9 @@ function twig_render_var($arg) {
     if (method_exists($arg, '__toString')) {
       return (string) $arg;
     }
+    elseif (method_exists($arg, 'toString')) {
+      return $arg->toString();
+    }
     else {
       throw new Exception(t('Object of type "@class" cannot be printed.', array('@class' => get_class($arg))));
     }
@@ -237,6 +240,9 @@ function twig_drupal_escape_filter(\Twig_Environment $env, $string, $strategy =
     if (method_exists($string, '__toString')) {
       $return = (string) $string;
     }
+    elseif (method_exists($string, 'toString')) {
+      $return = $string->toString();
+    }
     else {
       throw new \Exception(t('Object of type "@class" cannot be printed.', array('@class' => get_class($string))));
     }
