Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
137f20c
rebased: convert rustc_monomorphize errors to SessionDiagnostic
CleanCut Aug 18, 2022
40f4473
replace some usages of [Span]FatalError with error-specific types
CleanCut Aug 23, 2022
33cbbc2
remove stray comment
CleanCut Aug 23, 2022
e914247
bless the change in note/help order due to migrating to SessionDiagno…
CleanCut Aug 24, 2022
30c7506
allow non-monomorphize modules to access hard-coded error message thr…
CleanCut Aug 24, 2022
6cdfdd0
adjust to new error value
CleanCut Aug 24, 2022
82d609c
have LangItemError derive everything LangItem does
CleanCut Aug 24, 2022
706452e
translations(rustc_session): migrate the file cgu_reuse_tracker
beowolx Aug 19, 2022
d5262a9
translations(rustc_session): migrate 80% of the file parse.rs
beowolx Aug 22, 2022
2c77f3e
translations(rustc_session): migrate check_expected_reuse
beowolx Aug 24, 2022
a19139f
remove unnecessary comment
CleanCut Aug 26, 2022
845d567
revert src/tools/cargo submodule to where it ought to be from where w…
CleanCut Aug 26, 2022
6099d17
rustdoc: Resugar async fn return type in `clean`, not `html`
aDotInTheVoid Aug 30, 2022
6c585fc
Clean up render_assoc_items_inner a bit
GuillaumeGomez Aug 30, 2022
86f8c4e
ADD - InvalidSymbolName to migrate symbol-name({}) error to new diagn…
JhonnyBillM Aug 27, 2022
359002b
ADD - migrate InvalidTraitItem and AltInvalidTraitItem errors
JhonnyBillM Aug 21, 2022
bd83bbc
UPDATE - accept String instead of unused 'str
JhonnyBillM Aug 21, 2022
8f5fada
ADD - migrate InvalidDefPath to new diagnostics infra
JhonnyBillM Aug 21, 2022
ef2f6ab
ADD - diagnostics lints to symbol_mangling module
JhonnyBillM Aug 21, 2022
3ee6946
UPDATE - to support diag introduced in PR #100765
JhonnyBillM Aug 21, 2022
8588374
Use in-page links for sanitizer docs.
ehuss Aug 30, 2022
900cda2
Print only blanket implementations on reference primitive type
GuillaumeGomez Aug 30, 2022
477b7ba
Add regression test for implementations displayed on reference primit…
GuillaumeGomez Aug 30, 2022
fe29ac9
fix into_iter on ZST
RalfJung Aug 31, 2022
775e969
Rollup merge of #90946 - GuillaumeGomez:def-id-remove-weird-case, r=M…
RalfJung Aug 31, 2022
6c4bda6
Rollup merge of #100730 - CleanCut:diagnostics-rustc_monomorphize, r=…
RalfJung Aug 31, 2022
24922b7
Rollup merge of #100753 - LuisCardosoOliveira:translation-migrate-ses…
RalfJung Aug 31, 2022
59d2c19
Rollup merge of #100831 - JhonnyBillM:migrate-symbol-mangling-to-diag…
RalfJung Aug 31, 2022
8ed9ac6
Rollup merge of #101204 - aDotInTheVoid:async-resugar-in-clean, r=Gui…
RalfJung Aug 31, 2022
cc02024
Rollup merge of #101216 - ehuss:sanitizer-links, r=JohnTitor
RalfJung Aug 31, 2022
2a02882
Rollup merge of #101237 - RalfJung:into-iter-zst, r=thomcc
RalfJung Aug 31, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,10 @@ fn clean_function<'tcx>(
// NOTE: generics must be cleaned before args
let generics = clean_generics(generics, cx);
let args = clean_args_from_types_and_body_id(cx, sig.decl.inputs, body_id);
let decl = clean_fn_decl_with_args(cx, sig.decl, args);
let mut decl = clean_fn_decl_with_args(cx, sig.decl, args);
if sig.header.is_async() {
decl.output = decl.sugared_async_return_type();
}
(generics, decl)
});
Box::new(Function { decl, generics })
Expand Down
17 changes: 4 additions & 13 deletions src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1310,22 +1310,19 @@ impl clean::FnDecl {
/// <br>Used to determine line-wrapping.
/// * `indent`: The number of spaces to indent each successive line with, if line-wrapping is
/// necessary.
/// * `asyncness`: Whether the function is async or not.
pub(crate) fn full_print<'a, 'tcx: 'a>(
&'a self,
header_len: usize,
indent: usize,
asyncness: hir::IsAsync,
cx: &'a Context<'tcx>,
) -> impl fmt::Display + 'a + Captures<'tcx> {
display_fn(move |f| self.inner_full_print(header_len, indent, asyncness, f, cx))
display_fn(move |f| self.inner_full_print(header_len, indent, f, cx))
}

fn inner_full_print(
&self,
header_len: usize,
indent: usize,
asyncness: hir::IsAsync,
f: &mut fmt::Formatter<'_>,
cx: &Context<'_>,
) -> fmt::Result {
Expand Down Expand Up @@ -1390,15 +1387,9 @@ impl clean::FnDecl {
args_plain.push_str(", ...");
}

let arrow_plain;
let arrow = if let hir::IsAsync::Async = asyncness {
let output = self.sugared_async_return_type();
arrow_plain = format!("{:#}", output.print(cx));
if f.alternate() { arrow_plain.clone() } else { format!("{}", output.print(cx)) }
} else {
arrow_plain = format!("{:#}", self.output.print(cx));
if f.alternate() { arrow_plain.clone() } else { format!("{}", self.output.print(cx)) }
};
let arrow_plain = format!("{:#}", self.output.print(cx));
let arrow =
if f.alternate() { arrow_plain.clone() } else { format!("{}", self.output.print(cx)) };

let declaration_len = header_len + args_plain.len() + arrow_plain.len();
let output = if declaration_len > 80 {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ fn assoc_method(
href = href,
name = name,
generics = g.print(cx),
decl = d.full_print(header_len, indent, header.asyncness, cx),
decl = d.full_print(header_len, indent, cx),
notable_traits = notable_traits_decl(d, cx),
where_clause = print_where_clause(g, cx, indent, end_newline),
)
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/render/print_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ fn item_function(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, f: &cle
name = name,
generics = f.generics.print(cx),
where_clause = print_where_clause(&f.generics, cx, 0, Ending::Newline),
decl = f.decl.full_print(header_len, 0, header.asyncness, cx),
decl = f.decl.full_print(header_len, 0, cx),
notable_traits = notable_traits_decl(&f.decl, cx),
);
});
Expand Down
36 changes: 36 additions & 0 deletions src/test/rustdoc-json/fns/async_return.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// edition:2021
// ignore-tidy-linelength

// Regression test for <https://github.com/rust-lang/rust/issues/101199>

use std::future::Future;

// @is "$.index[*][?(@.name=='get_int')].inner.decl.output" '{"inner": "i32", "kind": "primitive"}'
// @is "$.index[*][?(@.name=='get_int')].inner.header.async" false
pub fn get_int() -> i32 {
42
}

// @is "$.index[*][?(@.name=='get_int_async')].inner.decl.output" '{"inner": "i32", "kind": "primitive"}'
// @is "$.index[*][?(@.name=='get_int_async')].inner.header.async" true
pub async fn get_int_async() -> i32 {
42
}

// @is "$.index[*][?(@.name=='get_int_future')].inner.decl.output.kind" '"impl_trait"'
// @is "$.index[*][?(@.name=='get_int_future')].inner.decl.output.inner[0].trait_bound.trait.name" '"Future"'
// @is "$.index[*][?(@.name=='get_int_future')].inner.decl.output.inner[0].trait_bound.trait.args.angle_bracketed.bindings[0].name" '"Output"'
// @is "$.index[*][?(@.name=='get_int_future')].inner.decl.output.inner[0].trait_bound.trait.args.angle_bracketed.bindings[0].binding.equality.type" '{"inner": "i32", "kind": "primitive"}'
// @is "$.index[*][?(@.name=='get_int_future')].inner.header.async" false
pub fn get_int_future() -> impl Future<Output = i32> {
async { 42 }
}

// @is "$.index[*][?(@.name=='get_int_future_async')].inner.decl.output.kind" '"impl_trait"'
// @is "$.index[*][?(@.name=='get_int_future_async')].inner.decl.output.inner[0].trait_bound.trait.name" '"Future"'
// @is "$.index[*][?(@.name=='get_int_future_async')].inner.decl.output.inner[0].trait_bound.trait.args.angle_bracketed.bindings[0].name" '"Output"'
// @is "$.index[*][?(@.name=='get_int_future_async')].inner.decl.output.inner[0].trait_bound.trait.args.angle_bracketed.bindings[0].binding.equality.type" '{"inner": "i32", "kind": "primitive"}'
// @is "$.index[*][?(@.name=='get_int_future_async')].inner.header.async" true
pub async fn get_int_future_async() -> impl Future<Output = i32> {
async { 42 }
}