Index: src/wp-includes/link-template.php
===================================================================
--- src/wp-includes/link-template.php	(revision 40568)
+++ src/wp-includes/link-template.php	(working copy)
@@ -560,7 +560,7 @@
  * @param string $feed   Optional. Feed type. Default empty.
  */
 function the_feed_link( $anchor, $feed = '' ) {
-	$link = '<a href="' . esc_url( get_feed_link( $feed ) ) . '">' . $anchor . '</a>';
+	$link = '<a rel="alternate" type="' . esc_attr( feed_content_type( $feed ) ) . '" href="' . esc_url( get_feed_link( $feed ) ) . '">' . esc_html( $anchor ) . '</a>';
 
 	/**
 	 * Filters the feed link anchor tag.
@@ -699,7 +699,7 @@
 		$link_text = __('Comments Feed');
 	}
 
-	$link = '<a href="' . esc_url( $url ) . '">' . $link_text . '</a>';
+	$link = '<a rel="alternate" type="' . esc_attr( feed_content_type( $feed ) ) . '" href="' . esc_url( $url ) . '">' . esc_html( $link_text ) . '</a>';
 	/**
 	 * Filters the post comment feed link anchor tag.
 	 *
Index: tests/phpunit/tests/feed/template.php
===================================================================
--- tests/phpunit/tests/feed/template.php	(revision 0)
+++ tests/phpunit/tests/feed/template.php	(working copy)
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Tests for the Feeds template components
+ *
+ * @group feed
+ */
+class Tests_Feeds_Template extends WP_UnitTestCase {
+	static $post_id;
+
+	/**
+	 * Setup a new user and attribute some posts.
+	 */
+	public static function wpSetUpBeforeClass( $factory ) {
+		self::$post_id = $factory->post->create();
+	}
+
+	/**
+	 * Setup.
+	 */
+	public function setUp() {
+		parent::setUp();
+		$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+	}
+
+	/**
+	 * Tests the RSS feed link
+	 */
+	function test_the_feed_link_rss() {
+		$expected = '<a rel="alternate" type="application/rss+xml" href="' . get_feed_link( 'rss' ) . '">feed</a>';
+		ob_start();
+		the_feed_link( 'feed', 'rss' );
+		$actual = ob_get_clean();
+		$this->assertEquals( $expected, $actual );
+	}
+
+	/**
+	 * Tests Atom feed link
+	 */
+	function test_the_feed_link_atom() {
+		$expected = '<a rel="alternate" type="application/atom+xml" href="' . get_feed_link( 'atom' ) . '">feed</a>';
+		ob_start();
+		the_feed_link( 'feed', 'atom' );
+		$actual = ob_get_clean();
+		$this->assertEquals( $expected, $actual );
+	}
+
+	/**
+	 * Tests RSS comments feed link
+	 */
+	function test_post_comments_feed_link_rss() {
+		$expected = '<a rel="alternate" type="application/rss+xml" href="' . get_post_comments_feed_link( self::$post_id, 'rss' ) . '">comments</a>';
+		ob_start();
+		post_comments_feed_link( 'comments', self::$post_id, 'rss' );
+		$actual = ob_get_clean();
+		$this->assertEquals( $expected, $actual );
+	}
+
+	/**
+	 * Tests Atom comments feed link
+	 */
+	function test_post_comments_feed_link_atom() {
+		$expected = '<a rel="alternate" type="application/atom+xml" href="' . get_post_comments_feed_link( self::$post_id, 'atom' ) . '">comments</a>';
+		ob_start();
+		post_comments_feed_link( 'comments', self::$post_id, 'atom' );
+		$actual = ob_get_clean();
+		$this->assertEquals( $expected, $actual );
+	}
+}

Property changes on: tests/phpunit/tests/feed/template.php
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
