diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index e3f227e0cf4..e66224c0b5e 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -2123,7 +2123,7 @@ fn tag_html(class: &str, contents: &str) -> String {
/// documentation.
fn short_stability(item: &clean::Item, cx: &Context) -> Vec {
let mut stability = vec![];
- let error_codes = ErrorCodes::from(UnstableFeatures::from_environment().is_nightly_build());
+ let error_codes = cx.shared.codes;
if let Some(Deprecation { note, since }) = &item.deprecation() {
// We display deprecation messages for #[deprecated] and #[rustc_deprecated]