diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc
index 3305a00c8b3f786f4d1cee05d46b16969484e5a9..7e693c79b2be81397458f0fe3fc9b1df08745d00 100644
--- a/core/modules/file/file.field.inc
+++ b/core/modules/file/file.field.inc
@@ -596,7 +596,7 @@ function theme_file_widget($variables) {
   if (!empty($element['fids']['#value'])) {
     // Add the file size after the file name.
     $file = reset($element['#files']);
-    $element['file_' . $file->id()]['filename']['#markup'] .= ' <span class="file-size">(' . format_size($file->getSize()) . ')</span> ';
+    $element['file_' . $file->id()]['filename']['#suffix'] = ' <span class="file-size">(' . format_size($file->getSize()) . ')</span> ';
   }
   $output .= drupal_render_children($element);
   $output .= '</div>';
@@ -645,7 +645,7 @@ function theme_file_widget_multiple($variables) {
     // Save the uploading row for last.
     if (empty($widget['#files'])) {
       $widget['#title'] = $element['#file_upload_title'];
-      $widget['#description'] = $element['#file_upload_description'];
+      $widget['#description'] = drupal_render($element['#file_upload_description']);
       continue;
     }
 
@@ -703,8 +703,16 @@ function theme_file_widget_multiple($variables) {
 
   drupal_add_tabledrag($table_id, 'order', 'sibling', $weight_class);
 
-  $output = '';
-  $output = empty($rows) ? '' : theme('table', array('header' => $headers, 'rows' => $rows, 'attributes' => array('id' => $table_id)));
+  $build = array(
+    '#theme' => 'table',
+    '#header' => $headers,
+    '#rows' => $rows,
+    '#attributes' => array(
+      'id' => $table_id,
+    ),
+  );
+
+  $output = empty($rows) ? '' : drupal_render($build);
   $output .= drupal_render_children($element);
   return $output;
 }
@@ -804,11 +812,22 @@ function theme_file_formatter_table($variables) {
   foreach ($variables['items'] as $delta => $item) {
     if ($item['display'] && $item['entity']) {
       $rows[] = array(
-        theme('file_link', array('file' => $item['entity'])),
+        array(
+          'data' => array(
+            '#theme' => 'file_link',
+            '#file' => $item['entity'],
+          ),
+        ),
         format_size($item['entity']->getSize()),
       );
     }
   }
 
-  return empty($rows) ? '' : theme('table', array('header' => $header, 'rows' => $rows));
+  $build = array(
+    '#theme' => 'table',
+    '#header' => $header,
+    '#rows' => $rows,
+  );
+
+  return empty($rows) ? '' : drupal_render($build);
 }
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 8db86125bd234beb2f6872f80a6ad34e30b6cd7e..ded5b13fda64ca9d016726227d0606ac61fe3c78 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -978,7 +978,8 @@ function file_ajax_upload() {
     // Invalid request.
     drupal_set_message(t('An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (@size) that this server supports.', array('@size' => format_size(file_upload_max_size()))), 'error');
     $response = new AjaxResponse();
-    return $response->addCommand(new ReplaceCommand(NULL, theme('status_messages')));
+    $status_messages = array('#theme' => 'status_messages');
+    return $response->addCommand(new ReplaceCommand(NULL, drupal_render($status_messages)));
   }
 
   list($form, $form_state) = ajax_get_form();
@@ -987,7 +988,8 @@ function file_ajax_upload() {
     // Invalid form_build_id.
     drupal_set_message(t('An unrecoverable error occurred. Use of this form has expired. Try reloading the page and submitting again.'), 'error');
     $response = new AjaxResponse();
-    return $response->addCommand(new ReplaceCommand(NULL, theme('status_messages')));
+    $status_messages = array('#theme' => 'status_messages');
+    return $response->addCommand(new ReplaceCommand(NULL, drupal_render($status_messages)));
   }
 
   // Get the current element and count the number of files.
@@ -1014,7 +1016,8 @@ function file_ajax_upload() {
     $form['#suffix'] .= '<span class="ajax-new-content"></span>';
   }
 
-  $form['#prefix'] .= theme('status_messages');
+  $status_messages = array('#theme' => 'status_messages');
+  $form['#prefix'] .= drupal_render($status_messages);
   $output = drupal_render($form);
   $js = drupal_add_js();
   $settings = drupal_merge_js_settings($js['settings']['data']);
@@ -1321,17 +1324,18 @@ function file_managed_file_process($element, &$form_state, $form) {
 
   if (!empty($fids) && $element['#files']) {
     foreach ($element['#files'] as $delta => $file) {
+      $file_link = array(
+        '#theme' => 'file_link',
+        '#file' => $file,
+      );
       if ($element['#multiple']) {
         $element['file_' . $delta]['selected'] = array(
           '#type' => 'checkbox',
-          '#title' => theme('file_link', array('file' => $file)) . ' ',
+          '#title' => drupal_render($file_link),
         );
       }
       else {
-        $element['file_' . $delta]['filename'] = array(
-          '#markup' => theme('file_link', array('file' => $file)) . ' ',
-          '#weight' => -10,
-        );
+        $element['file_' . $delta]['filename'] = $file_link += array('#weight' => -10);
       }
     }
   }
@@ -1655,11 +1659,6 @@ function file_managed_file_pre_render($element) {
  */
 function theme_file_link($variables) {
   $file = $variables['file'];
-  $icon_directory = $variables['icon_directory'];
-
-  $url = file_create_url($file->getFileUri());
-  // theme_file_icon() requires a file entity, make sure it gets one.
-  $icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory));
 
   // Set options as per anchor format described at
   // http://microformats.org/wiki/file-format-examples
@@ -1678,7 +1677,13 @@ function theme_file_link($variables) {
     $options['attributes']['title'] = check_plain($file->getFilename());
   }
 
-  return '<span class="file">' . $icon . ' ' . l($link_text, $url, $options) . '</span>';
+  $file_icon = array(
+    '#theme' => 'file_icon',
+    '#file' => $file,
+    '#icon_directory' => $variables['icon_directory'],
+  );
+
+  return '<span class="file">' . drupal_render($file_icon) . ' ' . l($link_text, file_create_url($file->getFileUri()), $options) . '</span>';
 }
 
 /**
diff --git a/core/modules/file/lib/Drupal/file/Plugin/field/widget/FileWidget.php b/core/modules/file/lib/Drupal/file/Plugin/field/widget/FileWidget.php
index a32e2171115f3b44af37b5602c809ec9d1b003e1..245ec340e8fc9306cdd6f9e657fa6a8524a2eb10 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/field/widget/FileWidget.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/field/widget/FileWidget.php
@@ -164,7 +164,12 @@ protected function formMultipleElements(EntityInterface $entity, FieldInterface
       // field. These are added here so that they may be referenced easily
       // through a hook_form_alter().
       $elements['#file_upload_title'] = t('Add a new file');
-      $elements['#file_upload_description'] = theme('file_upload_help', array('description' => '', 'upload_validators' => $elements[0]['#upload_validators'], 'cardinality' => $cardinality));
+      $elements['#file_upload_description'] = array(
+        '#theme' => 'file_upload_help',
+        '#description' => '',
+        '#upload_validators' => $elements[0]['#upload_validators'],
+        '#cardinality' => $cardinality,
+      );
     }
 
     return $elements;
@@ -225,7 +230,13 @@ public function formElement(FieldInterface $items, $delta, array $element, $lang
 
     $default_fids = $element['#extended'] ? $element['#default_value']['fids'] : $element['#default_value'];
     if (empty($default_fids)) {
-      $element['#description'] = theme('file_upload_help', array('description' => $element['#description'], 'upload_validators' => $element['#upload_validators'], 'cardinality' => $cardinality));
+      $file_upload_help = array(
+        '#theme' => 'file_upload_help',
+        '#description' => $element['#description'],
+        '#upload_validators' => $element['#upload_validators'],
+        '#cardinality' => $cardinality,
+      );
+      $element['#description'] = drupal_render($file_upload_help);
       $element['#multiple'] = $cardinality != 1 ? TRUE : FALSE;
       if ($cardinality != 1 && $cardinality != -1) {
         $element['#element_validate'] = array('file_field_widget_multiple_count_validate');
diff --git a/core/modules/file/lib/Drupal/file/Plugin/views/field/FileMime.php b/core/modules/file/lib/Drupal/file/Plugin/views/field/FileMime.php
index 5b69e10eb28dd1c0d4159c10932f586710b9f617..8fa60d59efddea08c27c4ca0ba9dc87820107d15 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/views/field/FileMime.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/views/field/FileMime.php
@@ -36,8 +36,11 @@ public function buildOptionsForm(&$form, &$form_state) {
   public function render($values) {
     $data = $values->{$this->field_alias};
     if (!empty($this->options['filemime_image']) && $data !== NULL && $data !== '') {
-      $fake_file = (object) array('filemime' => $data);
-      $data = theme('file_icon', array('file' => $fake_file));
+      $file_icon = array(
+        '#theme' => 'file_icon',
+        '#file' => $values->_entity,
+      );
+      $data = drupal_render($file_icon);
     }
 
     return $this->render_link($data, $values);
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php
index 87e099e9b057b532242e691472f37c891ed7ccb4..4ef654dc981fd99cc5e3e444172f814aba3b8642 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php
@@ -61,7 +61,11 @@ function testNodeDisplay() {
     // Check that the default formatter is displaying with the file name.
     $node = node_load($nid, TRUE);
     $node_file = file_load($node->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['target_id']);
-    $default_output = theme('file_link', array('file' => $node_file));
+    $file_link = array(
+      '#theme' => 'file_link',
+      '#file' => $node_file,
+    );
+    $default_output = drupal_render($file_link);
     $this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.');
 
     // Turn the "display" option off and check that the file is no longer displayed.
diff --git a/core/modules/image/image.field.inc b/core/modules/image/image.field.inc
index 824f14cc9ee7e467abba9f5fd37d7b1ad3eb1ea1..1f0e87b5394541f10ac8a7e1ec6fa7918561f811 100644
--- a/core/modules/image/image.field.inc
+++ b/core/modules/image/image.field.inc
@@ -404,7 +404,7 @@ function theme_image_widget($variables) {
   $output .= '<div class="image-widget-data">';
   if (!empty($element['fids']['#value'])) {
     $file = reset($element['#files']);
-    $element['file_' . $file->id()]['filename']['#markup'] .= ' <span class="file-size">(' . format_size($file->getSize()) . ')</span> ';
+    $element['file_' . $file->id()]['filename']['#suffix'] = ' <span class="file-size">(' . format_size($file->getSize()) . ')</span> ';
   }
   $output .= drupal_render_children($element);
   $output .= '</div>';