diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>
\ No newline at end of file
diff --git a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
index f4dc2df..c3af2db 100644
--- a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
@@ -538,6 +538,25 @@ public function testGenerateWithAlterHook() {
   }
 
   /**
+   * Tests whether rendering the same link twice works.
+   *
+   * This is a regression test for https://www.drupal.org/node/2842399.
+   */
+  public function testGenerateTwice() {
+    $this->urlGenerator->expects($this->any())
+      ->method('generateFromRoute')
+      ->will($this->returnValue((new GeneratedUrl())->setGeneratedUrl('/')));
+
+    $url = Url::fromRoute('<front>', [], ['attributes' => ['class' => ['foo', 'bar']]]);
+    $url->setUrlGenerator($this->urlGenerator);
+
+    $link = Link::fromTextAndUrl('text', $url);
+    $link->setLinkGenerator($this->linkGenerator);
+    $output = $link->toString() . $link->toString();
+    $this->assertEquals('<a href="/" class="foo bar">text</a><a href="/" class="foo bar">text</a>', $output);
+  }
+
+  /**
    * Checks that a link with certain properties exists in a given HTML snippet.
    *
    * @param array $properties
