Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 952c573

Browse files
committedMay 13, 2021
Auto merge of #85258 - GuillaumeGomez:rollup-kzay7o5, r=GuillaumeGomez
Rollup of 4 pull requests Successful merges: - #85068 (Fix diagnostic for cross crate private tuple struct constructors) - #85175 (Rustdoc cleanup) - #85177 (add BITS associated constant to core::num::Wrapping) - #85240 (Don't suggest adding `'static` lifetime to arguments) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents d2df620 + 3761ada commit 952c573

27 files changed

+258
-329
lines changed
 

‎compiler/rustc_infer/src/infer/error_reporting/nice_region_error/named_anon_conflict.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,16 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
114114
);
115115

116116
diag.span_label(span, format!("lifetime `{}` required", named));
117-
diag.span_suggestion(
118-
new_ty_span,
119-
&format!("add explicit lifetime `{}` to {}", named, span_label_var),
120-
new_ty.to_string(),
121-
Applicability::Unspecified,
122-
);
117+
// Suggesting `'static` is nearly always incorrect, and can steer users
118+
// down the wrong path.
119+
if *named != ty::ReStatic {
120+
diag.span_suggestion(
121+
new_ty_span,
122+
&format!("add explicit lifetime `{}` to {}", named, span_label_var),
123+
new_ty.to_string(),
124+
Applicability::Unspecified,
125+
);
126+
}
123127

124128
Some(diag)
125129
}

‎compiler/rustc_metadata/src/rmeta/decoder.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
2727
use rustc_middle::mir::interpret::{AllocDecodingSession, AllocDecodingState};
2828
use rustc_middle::mir::{self, Body, Promoted};
2929
use rustc_middle::ty::codec::TyDecoder;
30-
use rustc_middle::ty::{self, Ty, TyCtxt};
30+
use rustc_middle::ty::{self, Ty, TyCtxt, Visibility};
3131
use rustc_serialize::{opaque, Decodable, Decoder};
3232
use rustc_session::Session;
3333
use rustc_span::hygiene::ExpnDataDecodeMode;
@@ -1312,6 +1312,17 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
13121312
.collect()
13131313
}
13141314

1315+
fn get_struct_field_visibilities(&self, id: DefIndex) -> Vec<Visibility> {
1316+
self.root
1317+
.tables
1318+
.children
1319+
.get(self, id)
1320+
.unwrap_or_else(Lazy::empty)
1321+
.decode(self)
1322+
.map(|field_index| self.get_visibility(field_index))
1323+
.collect()
1324+
}
1325+
13151326
fn get_inherent_implementations_for_type(
13161327
&self,
13171328
tcx: TyCtxt<'tcx>,

‎compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_ast::expand::allocator::AllocatorKind;
88
use rustc_data_structures::stable_map::FxHashMap;
99
use rustc_data_structures::svh::Svh;
1010
use rustc_hir as hir;
11-
use rustc_hir::def::DefKind;
11+
use rustc_hir::def::{CtorKind, DefKind};
1212
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE};
1313
use rustc_hir::definitions::{DefKey, DefPath, DefPathHash};
1414
use rustc_middle::hir::exports::Export;
@@ -17,7 +17,7 @@ use rustc_middle::middle::cstore::{CrateSource, CrateStore, EncodedMetadata};
1717
use rustc_middle::middle::exported_symbols::ExportedSymbol;
1818
use rustc_middle::middle::stability::DeprecationEntry;
1919
use rustc_middle::ty::query::Providers;
20-
use rustc_middle::ty::{self, TyCtxt};
20+
use rustc_middle::ty::{self, TyCtxt, Visibility};
2121
use rustc_session::utils::NativeLibKind;
2222
use rustc_session::{CrateDisambiguator, Session};
2323
use rustc_span::source_map::{Span, Spanned};
@@ -392,6 +392,20 @@ impl CStore {
392392
self.get_crate_data(def.krate).get_struct_field_names(def.index, sess)
393393
}
394394

395+
pub fn struct_field_visibilities_untracked(&self, def: DefId) -> Vec<Visibility> {
396+
self.get_crate_data(def.krate).get_struct_field_visibilities(def.index)
397+
}
398+
399+
pub fn ctor_def_id_and_kind_untracked(&self, def: DefId) -> Option<(DefId, CtorKind)> {
400+
self.get_crate_data(def.krate).get_ctor_def_id(def.index).map(|ctor_def_id| {
401+
(ctor_def_id, self.get_crate_data(def.krate).get_ctor_kind(def.index))
402+
})
403+
}
404+
405+
pub fn visibility_untracked(&self, def: DefId) -> Visibility {
406+
self.get_crate_data(def.krate).get_visibility(def.index)
407+
}
408+
395409
pub fn item_children_untracked(
396410
&self,
397411
def_id: DefId,

‎compiler/rustc_resolve/src/build_reduced_graph.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,20 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
995995
// Record some extra data for better diagnostics.
996996
let cstore = self.r.cstore();
997997
match res {
998-
Res::Def(DefKind::Struct | DefKind::Union, def_id) => {
998+
Res::Def(DefKind::Struct, def_id) => {
999+
let field_names = cstore.struct_field_names_untracked(def_id, self.r.session);
1000+
let ctor = cstore.ctor_def_id_and_kind_untracked(def_id);
1001+
if let Some((ctor_def_id, ctor_kind)) = ctor {
1002+
let ctor_res = Res::Def(DefKind::Ctor(CtorOf::Struct, ctor_kind), ctor_def_id);
1003+
let ctor_vis = cstore.visibility_untracked(ctor_def_id);
1004+
let field_visibilities = cstore.struct_field_visibilities_untracked(def_id);
1005+
self.r
1006+
.struct_constructors
1007+
.insert(def_id, (ctor_res, ctor_vis, field_visibilities));
1008+
}
1009+
self.insert_field_names(def_id, field_names);
1010+
}
1011+
Res::Def(DefKind::Union, def_id) => {
9991012
let field_names = cstore.struct_field_names_untracked(def_id, self.r.session);
10001013
self.insert_field_names(def_id, field_names);
10011014
}
@@ -1007,12 +1020,6 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
10071020
self.r.has_self.insert(def_id);
10081021
}
10091022
}
1010-
Res::Def(DefKind::Ctor(CtorOf::Struct, ..), def_id) => {
1011-
let parent = cstore.def_key(def_id).parent;
1012-
if let Some(struct_def_id) = parent.map(|index| DefId { index, ..def_id }) {
1013-
self.r.struct_constructors.insert(struct_def_id, (res, vis, vec![]));
1014-
}
1015-
}
10161023
_ => {}
10171024
}
10181025
}

‎library/core/src/num/wrapping.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,21 @@ macro_rules! wrapping_int_impl {
433433
#[unstable(feature = "wrapping_int_impl", issue = "32463")]
434434
pub const MAX: Self = Self(<$t>::MAX);
435435

436+
/// Returns the size of this integer type in bits.
437+
///
438+
/// # Examples
439+
///
440+
/// Basic usage:
441+
///
442+
/// ```
443+
/// #![feature(wrapping_int_impl)]
444+
/// use std::num::Wrapping;
445+
///
446+
#[doc = concat!("assert_eq!(<Wrapping<", stringify!($t), ">>::BITS, ", stringify!($t), "::BITS);")]
447+
/// ```
448+
#[unstable(feature = "wrapping_int_impl", issue = "32463")]
449+
pub const BITS: u32 = <$t>::BITS;
450+
436451
/// Returns the number of ones in the binary representation of `self`.
437452
///
438453
/// # Examples

‎src/librustdoc/html/render/print_item.rs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -573,10 +573,6 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
573573
)
574574
}
575575

576-
fn write_loading_content(w: &mut Buffer, extra_content: &str) {
577-
write!(w, "{}<span class=\"loading-content\">Loading content...</span>", extra_content)
578-
}
579-
580576
fn trait_item(w: &mut Buffer, cx: &Context<'_>, m: &clean::Item, t: &clean::Item) {
581577
let name = m.name.as_ref().unwrap();
582578
info!("Documenting {} on {:?}", name, t.name);
@@ -601,7 +597,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
601597
for t in types {
602598
trait_item(w, cx, t, it);
603599
}
604-
write_loading_content(w, "</div>");
600+
w.write_str("</div>");
605601
}
606602

607603
if !consts.is_empty() {
@@ -614,7 +610,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
614610
for t in consts {
615611
trait_item(w, cx, t, it);
616612
}
617-
write_loading_content(w, "</div>");
613+
w.write_str("</div>");
618614
}
619615

620616
// Output the documentation for each function individually
@@ -628,7 +624,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
628624
for m in required {
629625
trait_item(w, cx, m, it);
630626
}
631-
write_loading_content(w, "</div>");
627+
w.write_str("</div>");
632628
}
633629
if !provided.is_empty() {
634630
write_small_section_header(
@@ -640,7 +636,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
640636
for m in provided {
641637
trait_item(w, cx, m, it);
642638
}
643-
write_loading_content(w, "</div>");
639+
w.write_str("</div>");
644640
}
645641

646642
// If there are methods directly on this trait object, render them here.
@@ -703,7 +699,6 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
703699
&[],
704700
);
705701
}
706-
write_loading_content(w, "");
707702
}
708703

709704
write_small_section_header(
@@ -715,7 +710,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
715710
for implementor in concrete {
716711
render_implementor(cx, implementor, it, w, &implementor_dups, &[]);
717712
}
718-
write_loading_content(w, "</div>");
713+
w.write_str("</div>");
719714

720715
if t.is_auto {
721716
write_small_section_header(
@@ -734,7 +729,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
734729
&collect_paths_for_type(implementor.inner_impl().for_.clone(), &cx.cache),
735730
);
736731
}
737-
write_loading_content(w, "</div>");
732+
w.write_str("</div>");
738733
}
739734
} else {
740735
// even without any implementations to write in, we still want the heading and list, so the
@@ -743,18 +738,16 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
743738
w,
744739
"implementors",
745740
"Implementors",
746-
"<div class=\"item-list\" id=\"implementors-list\">",
741+
"<div class=\"item-list\" id=\"implementors-list\"></div>",
747742
);
748-
write_loading_content(w, "</div>");
749743

750744
if t.is_auto {
751745
write_small_section_header(
752746
w,
753747
"synthetic-implementors",
754748
"Auto implementors",
755-
"<div class=\"item-list\" id=\"synthetic-implementors-list\">",
749+
"<div class=\"item-list\" id=\"synthetic-implementors-list\"></div>",
756750
);
757-
write_loading_content(w, "</div>");
758751
}
759752
}
760753

‎src/librustdoc/html/static/main.js

Lines changed: 139 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -156,152 +156,154 @@ function hideThemeButtonState() {
156156
"use strict";
157157

158158
window.searchState = {
159-
loadingText: "Loading search results...",
160-
input: document.getElementsByClassName("search-input")[0],
161-
outputElement: function() {
162-
return document.getElementById("search");
163-
},
164-
title: null,
165-
titleBeforeSearch: document.title,
166-
timeout: null,
167-
// On the search screen, so you remain on the last tab you opened.
168-
//
169-
// 0 for "In Names"
170-
// 1 for "In Parameters"
171-
// 2 for "In Return Types"
172-
currentTab: 0,
173-
mouseMovedAfterSearch: true,
174-
clearInputTimeout: function() {
175-
if (searchState.timeout !== null) {
176-
clearTimeout(searchState.timeout);
177-
searchState.timeout = null;
178-
}
179-
},
180-
// Sets the focus on the search bar at the top of the page
181-
focus: function() {
182-
searchState.input.focus();
183-
},
184-
// Removes the focus from the search bar.
185-
defocus: function() {
186-
searchState.input.blur();
187-
},
188-
showResults: function(search) {
189-
if (search === null || typeof search === 'undefined') {
190-
search = searchState.outputElement();
191-
}
192-
addClass(main, "hidden");
193-
removeClass(search, "hidden");
194-
searchState.mouseMovedAfterSearch = false;
195-
document.title = searchState.title;
196-
},
197-
hideResults: function(search) {
198-
if (search === null || typeof search === 'undefined') {
199-
search = searchState.outputElement();
200-
}
201-
addClass(search, "hidden");
202-
removeClass(main, "hidden");
203-
document.title = searchState.titleBeforeSearch;
204-
// We also remove the query parameter from the URL.
205-
if (searchState.browserSupportsHistoryApi()) {
206-
history.replaceState("", window.currentCrate + " - Rust",
207-
getNakedUrl() + window.location.hash);
208-
}
209-
},
210-
getQueryStringParams: function() {
211-
var params = {};
212-
window.location.search.substring(1).split("&").
213-
map(function(s) {
214-
var pair = s.split("=");
215-
params[decodeURIComponent(pair[0])] =
216-
typeof pair[1] === "undefined" ? null : decodeURIComponent(pair[1]);
217-
});
218-
return params;
219-
},
220-
putBackSearch: function(search_input) {
221-
var search = searchState.outputElement();
222-
if (search_input.value !== "" && hasClass(search, "hidden")) {
223-
searchState.showResults(search);
224-
if (searchState.browserSupportsHistoryApi()) {
225-
var extra = "?search=" + encodeURIComponent(search_input.value);
226-
history.replaceState(search_input.value, "",
227-
getNakedUrl() + extra + window.location.hash);
159+
loadingText: "Loading search results...",
160+
input: document.getElementsByClassName("search-input")[0],
161+
outputElement: function() {
162+
return document.getElementById("search");
163+
},
164+
title: null,
165+
titleBeforeSearch: document.title,
166+
timeout: null,
167+
// On the search screen, so you remain on the last tab you opened.
168+
//
169+
// 0 for "In Names"
170+
// 1 for "In Parameters"
171+
// 2 for "In Return Types"
172+
currentTab: 0,
173+
mouseMovedAfterSearch: true,
174+
clearInputTimeout: function() {
175+
if (searchState.timeout !== null) {
176+
clearTimeout(searchState.timeout);
177+
searchState.timeout = null;
178+
}
179+
},
180+
// Sets the focus on the search bar at the top of the page
181+
focus: function() {
182+
searchState.input.focus();
183+
},
184+
// Removes the focus from the search bar.
185+
defocus: function() {
186+
searchState.input.blur();
187+
},
188+
showResults: function(search) {
189+
if (search === null || typeof search === 'undefined') {
190+
search = searchState.outputElement();
228191
}
192+
addClass(main, "hidden");
193+
removeClass(search, "hidden");
194+
searchState.mouseMovedAfterSearch = false;
229195
document.title = searchState.title;
230-
}
231-
},
232-
browserSupportsHistoryApi: function() {
233-
return window.history && typeof window.history.pushState === "function";
234-
},
235-
setup: function() {
236-
var search_input = searchState.input;
237-
if (!searchState.input) {
238-
return;
239-
}
240-
function loadScript(url) {
241-
var script = document.createElement('script');
242-
script.src = url;
243-
document.head.append(script);
244-
}
245-
246-
var searchLoaded = false;
247-
function loadSearch() {
248-
if (!searchLoaded) {
249-
searchLoaded = true;
250-
loadScript(window.searchJS);
251-
loadScript(window.searchIndexJS);
196+
},
197+
hideResults: function(search) {
198+
if (search === null || typeof search === 'undefined') {
199+
search = searchState.outputElement();
200+
}
201+
addClass(search, "hidden");
202+
removeClass(main, "hidden");
203+
document.title = searchState.titleBeforeSearch;
204+
// We also remove the query parameter from the URL.
205+
if (searchState.browserSupportsHistoryApi()) {
206+
history.replaceState("", window.currentCrate + " - Rust",
207+
getNakedUrl() + window.location.hash);
208+
}
209+
},
210+
getQueryStringParams: function() {
211+
var params = {};
212+
window.location.search.substring(1).split("&").
213+
map(function(s) {
214+
var pair = s.split("=");
215+
params[decodeURIComponent(pair[0])] =
216+
typeof pair[1] === "undefined" ? null : decodeURIComponent(pair[1]);
217+
});
218+
return params;
219+
},
220+
putBackSearch: function(search_input) {
221+
var search = searchState.outputElement();
222+
if (search_input.value !== "" && hasClass(search, "hidden")) {
223+
searchState.showResults(search);
224+
if (searchState.browserSupportsHistoryApi()) {
225+
var extra = "?search=" + encodeURIComponent(search_input.value);
226+
history.replaceState(search_input.value, "",
227+
getNakedUrl() + extra + window.location.hash);
228+
}
229+
document.title = searchState.title;
230+
}
231+
},
232+
browserSupportsHistoryApi: function() {
233+
return window.history && typeof window.history.pushState === "function";
234+
},
235+
setup: function() {
236+
var search_input = searchState.input;
237+
if (!searchState.input) {
238+
return;
239+
}
240+
function loadScript(url) {
241+
var script = document.createElement('script');
242+
script.src = url;
243+
document.head.append(script);
252244
}
253-
}
254245

255-
search_input.addEventListener("focus", function() {
256-
searchState.putBackSearch(this);
257-
search_input.origPlaceholder = searchState.input.placeholder;
258-
search_input.placeholder = "Type your search here.";
259-
loadSearch();
260-
});
261-
search_input.addEventListener("blur", function() {
262-
search_input.placeholder = searchState.input.origPlaceholder;
263-
});
246+
var searchLoaded = false;
247+
function loadSearch() {
248+
if (!searchLoaded) {
249+
searchLoaded = true;
250+
loadScript(window.searchJS);
251+
loadScript(window.searchIndexJS);
252+
}
253+
}
264254

265-
document.addEventListener("mousemove", function() {
266-
searchState.mouseMovedAfterSearch = true;
267-
});
255+
search_input.addEventListener("focus", function() {
256+
searchState.putBackSearch(this);
257+
search_input.origPlaceholder = searchState.input.placeholder;
258+
search_input.placeholder = "Type your search here.";
259+
loadSearch();
260+
});
261+
search_input.addEventListener("blur", function() {
262+
search_input.placeholder = searchState.input.origPlaceholder;
263+
});
268264

269-
search_input.removeAttribute('disabled');
265+
document.addEventListener("mousemove", function() {
266+
searchState.mouseMovedAfterSearch = true;
267+
});
270268

271-
// `crates{version}.js` should always be loaded before this script, so we can use it safely.
272-
searchState.addCrateDropdown(window.ALL_CRATES);
273-
var params = searchState.getQueryStringParams();
274-
if (params.search !== undefined) {
275-
var search = searchState.outputElement();
276-
search.innerHTML = "<h3 style=\"text-align: center;\">" +
277-
searchState.loadingText + "</h3>";
278-
searchState.showResults(search);
279-
loadSearch();
280-
}
281-
},
282-
addCrateDropdown: function(crates) {
283-
var elem = document.getElementById("crate-search");
269+
search_input.removeAttribute('disabled');
270+
271+
// `crates{version}.js` should always be loaded before this script, so we can use it
272+
// safely.
273+
searchState.addCrateDropdown(window.ALL_CRATES);
274+
var params = searchState.getQueryStringParams();
275+
if (params.search !== undefined) {
276+
var search = searchState.outputElement();
277+
search.innerHTML = "<h3 style=\"text-align: center;\">" +
278+
searchState.loadingText + "</h3>";
279+
searchState.showResults(search);
280+
loadSearch();
281+
}
282+
},
283+
addCrateDropdown: function(crates) {
284+
var elem = document.getElementById("crate-search");
284285

285-
if (!elem) {
286-
return;
287-
}
288-
var savedCrate = getSettingValue("saved-filter-crate");
289-
for (var i = 0, len = crates.length; i < len; ++i) {
290-
var option = document.createElement("option");
291-
option.value = crates[i];
292-
option.innerText = crates[i];
293-
elem.appendChild(option);
294-
// Set the crate filter from saved storage, if the current page has the saved crate
295-
// filter.
296-
//
297-
// If not, ignore the crate filter -- we want to support filtering for crates on sites
298-
// like doc.rust-lang.org where the crates may differ from page to page while on the
299-
// same domain.
300-
if (crates[i] === savedCrate) {
301-
elem.value = savedCrate;
286+
if (!elem) {
287+
return;
302288
}
303-
}
304-
},
289+
var savedCrate = getSettingValue("saved-filter-crate");
290+
for (var i = 0, len = crates.length; i < len; ++i) {
291+
var option = document.createElement("option");
292+
option.value = crates[i];
293+
option.innerText = crates[i];
294+
elem.appendChild(option);
295+
// Set the crate filter from saved storage, if the current page has the saved crate
296+
// filter.
297+
//
298+
// If not, ignore the crate filter -- we want to support filtering for crates on
299+
// sites like doc.rust-lang.org where the crates may differ from page to page while
300+
// on the
301+
// same domain.
302+
if (crates[i] === savedCrate) {
303+
elem.value = savedCrate;
304+
}
305+
}
306+
},
305307
};
306308

307309
function getPageId() {
@@ -1045,26 +1047,6 @@ function hideThemeButtonState() {
10451047
};
10461048
}
10471049

1048-
if (main) {
1049-
onEachLazy(main.getElementsByClassName("loading-content"), function(e) {
1050-
e.remove();
1051-
});
1052-
onEachLazy(main.childNodes, function(e) {
1053-
// Unhide the actual content once loading is complete. Headers get
1054-
// flex treatment for their horizontal layout, divs get block treatment
1055-
// for vertical layout (column-oriented flex layout for divs caused
1056-
// errors in mobile browsers).
1057-
if (e.tagName === "H2" || e.tagName === "H3") {
1058-
var nextTagName = e.nextElementSibling.tagName;
1059-
if (nextTagName === "H2" || nextTagName === "H3") {
1060-
e.nextElementSibling.style.display = "flex";
1061-
} else if (nextTagName !== "DETAILS") {
1062-
e.nextElementSibling.style.display = "block";
1063-
}
1064-
}
1065-
});
1066-
}
1067-
10681050
function buildHelperPopup() {
10691051
var popup = document.createElement("aside");
10701052
addClass(popup, "hidden");

‎src/librustdoc/html/static/noscript.css

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,6 @@ of content is hidden by default (depending on the settings too), we have to over
44
rules.
55
*/
66

7-
#main > h2 + div, #main > h2 + h3, #main > h3 + div {
8-
display: block;
9-
}
10-
11-
.loading-content {
12-
display: none;
13-
}
14-
15-
#main > h2 + div, #main > h3 + div {
16-
display: block;
17-
}
18-
19-
#main > h2 + h3 {
20-
display: flex;
21-
}
22-
23-
#main .impl-items .hidden {
24-
display: block !important;
25-
}
26-
27-
#main .impl-items h4.hidden {
28-
/* Without this rule, the version and the "[src]" span aren't on the same line as the header. */
29-
display: flex !important;
30-
}
31-
327
#main .attributes {
338
/* Since there is no toggle (the "[-]") when JS is disabled, no need for this margin either. */
349
margin-left: 0 !important;

‎src/librustdoc/html/static/rustdoc.css

Lines changed: 2 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ h4.type.trait-impl, h4.associatedconstant.trait-impl, h4.associatedtype.trait-im
145145

146146
h1, h2, h3, h4,
147147
.sidebar, a.source, .search-input, .content table td:first-child > a,
148-
.collapse-toggle, div.item-list .out-of-band,
148+
div.item-list .out-of-band,
149149
#source-sidebar, #sidebar-toggle,
150150
details.rustdoc-toggle > summary::before,
151151
details.undocumented > summary::before,
@@ -431,11 +431,6 @@ nav.sub {
431431
#main > .docblock h2 { font-size: 1.15em; }
432432
#main > .docblock h3, #main > .docblock h4, #main > .docblock h5 { font-size: 1em; }
433433

434-
#main > h2 + div, #main > h2 + h3, #main > h3 + div {
435-
display: none; /* Changed to flex or block via js once the page is loaded */
436-
flex-wrap: wrap;
437-
}
438-
439434
.docblock h1 { font-size: 1em; }
440435
.docblock h2 { font-size: 0.95em; }
441436
.docblock h3, .docblock h4, .docblock h5 { font-size: 0.9em; }
@@ -565,9 +560,6 @@ h4 > code, h3 > code, .invisible > code {
565560
.content .docblock >.impl-items table td {
566561
padding: 0;
567562
}
568-
.toggle-wrapper.marg-left > .collapse-toggle {
569-
left: -24px;
570-
}
571563
.content .docblock > .impl-items .table-display, .impl-items table td {
572564
border: none;
573565
}
@@ -974,45 +966,6 @@ a.test-arrow:hover{
974966
font-weight: 300;
975967
}
976968

977-
.collapse-toggle {
978-
font-weight: 300;
979-
position: absolute;
980-
left: -23px;
981-
top: 0;
982-
}
983-
984-
h3 > .collapse-toggle, h4 > .collapse-toggle {
985-
font-size: 0.8em;
986-
top: 5px;
987-
}
988-
989-
.toggle-wrapper > .collapse-toggle {
990-
left: -24px;
991-
margin-top: 0px;
992-
}
993-
994-
.toggle-wrapper {
995-
position: relative;
996-
margin-top: 0;
997-
}
998-
999-
.toggle-wrapper.collapsed {
1000-
height: 25px;
1001-
transition: height .2s;
1002-
margin-bottom: .6em;
1003-
}
1004-
1005-
.collapse-toggle > .inner {
1006-
display: inline-block;
1007-
width: 1.2ch;
1008-
text-align: center;
1009-
}
1010-
1011-
.collapse-toggle.hidden-default {
1012-
position: relative;
1013-
margin-left: 20px;
1014-
}
1015-
1016969
.since + .srclink {
1017970
display: table-cell;
1018971
padding-left: 10px;
@@ -1029,14 +982,6 @@ h3 > .collapse-toggle, h4 > .collapse-toggle {
1029982
margin-right: 5px;
1030983
}
1031984

1032-
.toggle-wrapper > .collapse-toggle {
1033-
left: 0;
1034-
}
1035-
1036-
.variant + .toggle-wrapper + .docblock > p {
1037-
margin-top: 5px;
1038-
}
1039-
1040985
.sub-variant, .sub-variant > h3 {
1041986
margin-top: 0px !important;
1042987
padding-top: 1px;
@@ -1457,14 +1402,6 @@ h4 > .notable-traits {
14571402
position: inherit;
14581403
}
14591404

1460-
.toggle-wrapper > .collapse-toggle {
1461-
left: 0px;
1462-
}
1463-
1464-
.toggle-wrapper {
1465-
height: 1.5em;
1466-
}
1467-
14681405
#search {
14691406
margin-left: 0;
14701407
}
@@ -1555,14 +1492,6 @@ h4 > .notable-traits {
15551492
border-bottom: 1px solid;
15561493
}
15571494

1558-
.collapse-toggle {
1559-
left: -20px;
1560-
}
1561-
1562-
.impl > .collapse-toggle {
1563-
left: -10px;
1564-
}
1565-
15661495
.item-list > details.rustdoc-toggle > summary:not(.hideme)::before {
15671496
left: -10px;
15681497
}
@@ -1602,7 +1531,7 @@ h4 > .notable-traits {
16021531
}
16031532

16041533
@media print {
1605-
nav.sub, .content .out-of-band, .collapse-toggle {
1534+
nav.sub, .content .out-of-band {
16061535
display: none;
16071536
}
16081537
}

‎src/librustdoc/html/static/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,7 @@ window.initSearch = function(rawSearchIndex) {
15051505
};
15061506

15071507
if (window.searchIndex !== undefined) {
1508-
initSearch(window.searchIndex);
1508+
initSearch(window.searchIndex);
15091509
}
15101510

15111511
})();

‎src/librustdoc/html/static/themes/ayu.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ a {
224224
color: #39AFD7;
225225
}
226226

227-
.collapse-toggle,
228227
details.rustdoc-toggle > summary.hideme > span,
229228
details.rustdoc-toggle > summary::before,
230229
details.undocumented > summary::before {

‎src/librustdoc/html/static/themes/dark.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ a.test-arrow {
186186
color: #dedede;
187187
}
188188

189-
.collapse-toggle,
190189
details.rustdoc-toggle > summary.hideme > span,
191190
details.rustdoc-toggle > summary::before,
192191
details.undocumented > summary::before {

‎src/librustdoc/html/static/themes/light.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ a.test-arrow {
184184
color: #f5f5f5;
185185
}
186186

187-
.collapse-toggle,
188187
details.rustdoc-toggle > summary.hideme > span,
189188
details.rustdoc-toggle > summary::before,
190189
details.undocumented > summary::before {

‎src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
error[E0621]: explicit lifetime required in the type of `x`
22
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
33
|
4-
LL | fn foo(x: &()) {
5-
| --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()`
64
LL | / bar(|| {
75
LL | |
86
LL | | let _ = x;

‎src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
error[E0621]: explicit lifetime required in the type of `x`
22
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
33
|
4-
LL | fn foo(x: &()) {
5-
| --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()`
64
LL | bar(|| {
75
| ^^^ lifetime `'static` required
86

‎src/test/ui/generator/generator-region-requirements.stderr

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
error[E0621]: explicit lifetime required in the type of `x`
22
--> $DIR/generator-region-requirements.rs:12:51
33
|
4-
LL | fn dangle(x: &mut i32) -> &'static mut i32 {
5-
| -------- help: add explicit lifetime `'static` to the type of `x`: `&'static mut i32`
6-
...
74
LL | GeneratorState::Complete(c) => return c,
85
| ^ lifetime `'static` required
96

‎src/test/ui/generic-associated-types/projection-type-lifetime-mismatch.stderr

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
error[E0621]: explicit lifetime required in the type of `x`
22
--> $DIR/projection-type-lifetime-mismatch.rs:18:5
33
|
4-
LL | fn f(x: &impl for<'a> X<Y<'a> = &'a ()>) -> &'static () {
5-
| ------------------------------- help: add explicit lifetime `'static` to the type of `x`: `&'static impl for<'a> X<Y<'a> = &'a ()>`
64
LL | x.m()
75
| ^^^^^ lifetime `'static` required
86

97
error[E0621]: explicit lifetime required in the type of `x`
108
--> $DIR/projection-type-lifetime-mismatch.rs:23:5
119
|
12-
LL | fn g<T: for<'a> X<Y<'a> = &'a ()>>(x: &T) -> &'static () {
13-
| -- help: add explicit lifetime `'static` to the type of `x`: `&'static T`
1410
LL | x.m()
1511
| ^^^^^ lifetime `'static` required
1612

1713
error[E0621]: explicit lifetime required in the type of `x`
1814
--> $DIR/projection-type-lifetime-mismatch.rs:28:5
1915
|
20-
LL | fn h(x: &()) -> &'static () {
21-
| --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()`
2216
LL | x.m()
2317
| ^^^^^ lifetime `'static` required
2418

‎src/test/ui/issues/auxiliary/issue-75907.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,15 @@ pub struct Bar(pub u8, u8, u8);
33
pub fn make_bar() -> Bar {
44
Bar(1, 12, 10)
55
}
6+
7+
mod inner {
8+
pub struct Foo(u8, pub u8, u8);
9+
10+
impl Foo {
11+
pub fn new() -> Foo {
12+
Foo(1, 12, 10)
13+
}
14+
}
15+
}
16+
17+
pub use inner::Foo;

‎src/test/ui/issues/issue-46983.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
error[E0621]: explicit lifetime required in the type of `x`
22
--> $DIR/issue-46983.rs:2:5
33
|
4-
LL | fn foo(x: &u32) -> &'static u32 {
5-
| ---- help: add explicit lifetime `'static` to the type of `x`: `&'static u32`
64
LL | &*x
75
| ^^^ lifetime `'static` required
86

‎src/test/ui/issues/issue-75907_b.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33

44
extern crate issue_75907 as a;
55

6-
use a::{make_bar, Bar};
6+
use a::{make_bar, Bar, Foo};
77

88
fn main() {
99
let Bar(x, y, z) = make_bar();
1010
//~^ ERROR cannot match against a tuple struct which contains private fields
11+
12+
let Foo(x, y, z) = Foo::new();
13+
//~^ ERROR cannot match against a tuple struct which contains private fields
1114
}

‎src/test/ui/issues/issue-75907_b.stderr

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,30 @@ error[E0532]: cannot match against a tuple struct which contains private fields
22
--> $DIR/issue-75907_b.rs:9:9
33
|
44
LL | let Bar(x, y, z) = make_bar();
5-
| ^^^ constructor is not visible here due to private fields
5+
| ^^^
6+
|
7+
note: constructor is not visible here due to private fields
8+
--> $DIR/issue-75907_b.rs:9:16
9+
|
10+
LL | let Bar(x, y, z) = make_bar();
11+
| ^ ^ private field
12+
| |
13+
| private field
14+
15+
error[E0532]: cannot match against a tuple struct which contains private fields
16+
--> $DIR/issue-75907_b.rs:12:9
17+
|
18+
LL | let Foo(x, y, z) = Foo::new();
19+
| ^^^
20+
|
21+
note: constructor is not visible here due to private fields
22+
--> $DIR/issue-75907_b.rs:12:13
23+
|
24+
LL | let Foo(x, y, z) = Foo::new();
25+
| ^ ^ private field
26+
| |
27+
| private field
628

7-
error: aborting due to previous error
29+
error: aborting due to 2 previous errors
830

931
For more information about this error, try `rustc --explain E0532`.

‎src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
error[E0621]: explicit lifetime required in the type of `x`
22
--> $DIR/region-lbr-anon-does-not-outlive-static.rs:9:5
33
|
4-
LL | fn foo(x: &u32) -> &'static u32 {
5-
| ---- help: add explicit lifetime `ReStatic` to the type of `x`: `&ReStatic u32`
64
LL | &*x
75
| ^^^ lifetime `ReStatic` required
86

‎src/test/ui/nll/guarantor-issue-46974.stderr

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ LL | *x
1212
error[E0621]: explicit lifetime required in the type of `s`
1313
--> $DIR/guarantor-issue-46974.rs:15:5
1414
|
15-
LL | fn bar(s: &Box<(i32,)>) -> &'static i32 {
16-
| ------------ help: add explicit lifetime `'static` to the type of `s`: `&'static Box<(i32,)>`
17-
LL | // FIXME(#46983): error message should be better
1815
LL | &s.0
1916
| ^^^^ lifetime `'static` required
2017

‎src/test/ui/regions/regions-static-bound.migrate.nll.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,12 @@ LL | t
1111
error[E0621]: explicit lifetime required in the type of `u`
1212
--> $DIR/regions-static-bound.rs:14:5
1313
|
14-
LL | fn error(u: &(), v: &()) {
15-
| --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()`
1614
LL | static_id(&u);
1715
| ^^^^^^^^^^^^^ lifetime `'static` required
1816

1917
error[E0621]: explicit lifetime required in the type of `v`
2018
--> $DIR/regions-static-bound.rs:16:5
2119
|
22-
LL | fn error(u: &(), v: &()) {
23-
| --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()`
24-
...
2520
LL | static_id_indirect(&v);
2621
| ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
2722

‎src/test/ui/regions/regions-static-bound.migrate.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,12 @@ LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
1414
error[E0621]: explicit lifetime required in the type of `u`
1515
--> $DIR/regions-static-bound.rs:14:5
1616
|
17-
LL | fn error(u: &(), v: &()) {
18-
| --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()`
1917
LL | static_id(&u);
2018
| ^^^^^^^^^ lifetime `'static` required
2119

2220
error[E0621]: explicit lifetime required in the type of `v`
2321
--> $DIR/regions-static-bound.rs:16:5
2422
|
25-
LL | fn error(u: &(), v: &()) {
26-
| --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()`
27-
...
2823
LL | static_id_indirect(&v);
2924
| ^^^^^^^^^^^^^^^^^^ lifetime `'static` required
3025

‎src/test/ui/regions/regions-static-bound.nll.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,12 @@ LL | t
1111
error[E0621]: explicit lifetime required in the type of `u`
1212
--> $DIR/regions-static-bound.rs:14:5
1313
|
14-
LL | fn error(u: &(), v: &()) {
15-
| --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()`
1614
LL | static_id(&u);
1715
| ^^^^^^^^^^^^^ lifetime `'static` required
1816

1917
error[E0621]: explicit lifetime required in the type of `v`
2018
--> $DIR/regions-static-bound.rs:16:5
2119
|
22-
LL | fn error(u: &(), v: &()) {
23-
| --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()`
24-
...
2520
LL | static_id_indirect(&v);
2621
| ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
2722

‎src/test/ui/rfc-2008-non-exhaustive/struct.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0423]: cannot initialize a tuple struct which contains private fields
22
--> $DIR/struct.rs:20:14
33
|
44
LL | let ts = TupleStruct(640, 480);
5-
| ^^^^^^^^^^^ constructor is not visible here due to private fields
5+
| ^^^^^^^^^^^
66

77
error[E0423]: expected value, found struct `UnitStruct`
88
--> $DIR/struct.rs:29:14

0 commit comments

Comments
 (0)
Please sign in to comment.