diff options
| author | bors <bors@rust-lang.org> | 2023-03-04 22:50:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-03-04 22:50:24 +0000 |
| commit | bb1838847d8bb568a1bd4c4c434c6173c174a496 (patch) | |
| tree | 813b21302e4591e296d30058c221e940d9e1b00e /src | |
| parent | f15f0ea73972786e426732c5b92ba9a904b866c4 (diff) | |
| parent | ff95645e2ca66021187e68a11d1055752aa320d2 (diff) | |
| download | rust-bb1838847d8bb568a1bd4c4c434c6173c174a496.tar.gz rust-bb1838847d8bb568a1bd4c4c434c6173c174a496.zip | |
Auto merge of #108747 - matthiaskrgr:rollup-wfc7fx4, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #108627 (Properly colorize multi-part suggestions in the same line) - #108632 (Omit unchanged options from config.toml in `configure.py`) - #108715 (Remove unclosed_delims from parser) - #108723 (rustdoc: function signature search with traits in `where` clause) - #108724 (field is not used outside the crate) - #108734 (rustdoc: Note in a type's layout/size if it is uninhabited) - #108736 (Remove `allow(potential_query_instability)` from `ast_passes`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rwxr-xr-x | src/bootstrap/configure.py | 22 | ||||
| -rw-r--r-- | src/librustdoc/html/render/print_item.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/html/render/search_index.rs | 34 |
3 files changed, 37 insertions, 25 deletions
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index ab3d0829296..c0d382d8a50 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -488,6 +488,22 @@ for section_key, section_config in config.items(): else: configure_section(sections[section_key], section_config) +def write_uncommented(target, f): + block = [] + is_comment = True + + for line in target: + block.append(line) + if len(line) == 0: + if not is_comment: + for l in block: + f.write(l + "\n") + block = [] + is_comment = True + continue + is_comment = is_comment and line.startswith('#') + return f + # Now that we've built up our `config.toml`, write it all out in the same # order that we read it in. p("") @@ -496,11 +512,9 @@ with bootstrap.output('config.toml') as f: for section in section_order: if section == 'target': for target in targets: - for line in targets[target]: - f.write(line + "\n") + f = write_uncommented(targets[target], f) else: - for line in sections[section]: - f.write(line + "\n") + f = write_uncommented(sections[section], f) with bootstrap.output('Makefile') as f: contents = os.path.join(rust_dir, 'src', 'bootstrap', 'mk', 'Makefile.in') diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 2869a39613f..08796f10d92 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -1839,6 +1839,12 @@ fn document_type_layout(w: &mut Buffer, cx: &Context<'_>, ty_def_id: DefId) { } else { let size = layout.size.bytes() - tag_size; write!(w, "{size} byte{pl}", pl = if size == 1 { "" } else { "s" },); + if layout.abi.is_uninhabited() { + write!( + w, + " (<a href=\"https://doc.rust-lang.org/stable/reference/glossary.html#uninhabited\">uninhabited</a>)" + ); + } } } diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs index 090ea2cb157..e22ac6ec19b 100644 --- a/src/librustdoc/html/render/search_index.rs +++ b/src/librustdoc/html/render/search_index.rs @@ -7,9 +7,7 @@ use rustc_span::symbol::Symbol; use serde::ser::{Serialize, SerializeStruct, Serializer}; use crate::clean; -use crate::clean::types::{ - FnRetTy, Function, GenericBound, Generics, ItemId, Type, WherePredicate, -}; +use crate::clean::types::{FnRetTy, Function, Generics, ItemId, Type, WherePredicate}; use crate::formats::cache::{Cache, OrphanImplItem}; use crate::formats::item_type::ItemType; use crate::html::format::join_with_double_colon; @@ -482,29 +480,23 @@ fn add_generics_and_bounds_as_types<'tcx, 'a>( if let Type::Generic(arg_s) = *arg { // First we check if the bounds are in a `where` predicate... if let Some(where_pred) = generics.where_predicates.iter().find(|g| match g { - WherePredicate::BoundPredicate { ty, .. } => ty.def_id(cache) == arg.def_id(cache), + WherePredicate::BoundPredicate { ty: Type::Generic(ty_s), .. } => *ty_s == arg_s, _ => false, }) { let mut ty_generics = Vec::new(); let bounds = where_pred.get_bounds().unwrap_or_else(|| &[]); for bound in bounds.iter() { - if let GenericBound::TraitBound(poly_trait, _) = bound { - for param_def in poly_trait.generic_params.iter() { - match ¶m_def.kind { - clean::GenericParamDefKind::Type { default: Some(ty), .. } => { - add_generics_and_bounds_as_types( - self_, - generics, - ty, - tcx, - recurse + 1, - &mut ty_generics, - cache, - ) - } - _ => {} - } - } + if let Some(path) = bound.get_trait_path() { + let ty = Type::Path { path }; + add_generics_and_bounds_as_types( + self_, + generics, + &ty, + tcx, + recurse + 1, + &mut ty_generics, + cache, + ); } } insert_ty(res, arg.clone(), ty_generics); |
