Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6dfcf9a
Remove branches from sift_down_to_bottom loop
SkiFire13 Nov 7, 2020
25b3f61
Remove useless branches from sift_down_range loop
SkiFire13 Nov 7, 2020
8d15753
Remove useless bound checks from into_sorted_vec
SkiFire13 Nov 7, 2020
387568c
Added SAFETY comment as request
SkiFire13 Nov 9, 2020
de84ad9
Implement destructuring assignment for structs and slices
fanzier Nov 7, 2020
f344134
Add asm register information for SPIR-V
khyperia Nov 11, 2020
0e34b73
Change capitalization of Spirv to SpirV
khyperia Nov 11, 2020
cd314ae
update rustfmt
calebcartwright Nov 12, 2020
c338c81
Update cargo
ehuss Nov 12, 2020
80b2835
extend min_const_generics param ty tests
lcnr Nov 12, 2020
380b222
Consider mutable ident binding patterns to be simple
ebkalderon Sep 15, 2020
2baa0ce
Don't reuse bindings for `ref mut`
jyn514 Nov 8, 2020
38127ca
Handle and test wildcard arguments
jyn514 Nov 10, 2020
4b0b42a
Rollup merge of #76730 - ebkalderon:rustdoc-fix-mut-args-async-fn, r=…
m-ou-se Nov 12, 2020
755dd14
Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=pe…
m-ou-se Nov 12, 2020
4088981
Rollup merge of #78857 - SkiFire13:bheap-opt, r=KodrAus
m-ou-se Nov 12, 2020
76fa5f2
Rollup merge of #78950 - khyperia:spirv-asm, r=Amanieu
m-ou-se Nov 12, 2020
a2e8fb5
Rollup merge of #78970 - calebcartwright:update-rustfmt, r=Aaron1011
m-ou-se Nov 12, 2020
ef77a43
Rollup merge of #78972 - ehuss:update-cargo, r=ehuss
m-ou-se Nov 12, 2020
38ca6e3
Rollup merge of #78987 - lcnr:integer-sizes, r=varkor
m-ou-se Nov 12, 2020
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
14 changes: 12 additions & 2 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,18 @@ impl<'hir> LoweringContext<'_, 'hir> {
// Check if this is a binding pattern, if so, we can optimize and avoid adding a
// `let <pat> = __argN;` statement. In this case, we do not rename the parameter.
let (ident, is_simple_parameter) = match parameter.pat.kind {
hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, _, ident, _) => {
(ident, true)
hir::PatKind::Binding(
hir::BindingAnnotation::Unannotated | hir::BindingAnnotation::Mutable,
_,
ident,
_,
) => (ident, true),
// For `ref mut` or wildcard arguments, we can't reuse the binding, but
// we can keep the same name for the parameter.
// This lets rustdoc render it correctly in documentation.
hir::PatKind::Binding(_, _, ident, _) => (ident, false),
hir::PatKind::Wild => {
(Ident::with_dummy_span(rustc_span::symbol::kw::Underscore), false)
}
_ => {
// Replace the ident for bindings that aren't simple.
Expand Down
14 changes: 14 additions & 0 deletions src/test/rustdoc/async-fn.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// edition:2018
#![feature(min_const_generics)]

// @has async_fn/fn.foo.html '//pre[@class="rust fn"]' 'pub async fn foo() -> Option<Foo>'
pub async fn foo() -> Option<Foo> {
Expand All @@ -20,6 +21,12 @@ pub async unsafe fn qux() -> char {
'⚠'
}

// @has async_fn/fn.mut_args.html '//pre[@class="rust fn"]' 'pub async fn mut_args(a: usize)'
pub async fn mut_args(mut a: usize) {}

// @has async_fn/fn.mut_ref.html '//pre[@class="rust fn"]' 'pub async fn mut_ref(x: i32)'
pub async fn mut_ref(ref mut x: i32) {}

trait Bar {}

impl Bar for () {}
Expand All @@ -32,9 +39,16 @@ pub async fn quux() -> impl Bar {
// @has async_fn/struct.Foo.html
// @matches - '//code' 'pub async fn f\(\)$'
// @matches - '//code' 'pub async unsafe fn g\(\)$'
// @matches - '//code' 'pub async fn mut_self\(self, first: usize\)$'
pub struct Foo;

impl Foo {
pub async fn f() {}
pub async unsafe fn g() {}
pub async fn mut_self(mut self, mut first: usize) {}
}

pub trait Trait<const N: usize> {}
// @has async_fn/fn.const_generics.html
// @has - '//pre[@class="rust fn"]' 'pub async fn const_generics<const N: usize>(_: impl Trait<N>)'
pub async fn const_generics<const N: usize>(_: impl Trait<N>) {}
3 changes: 1 addition & 2 deletions src/test/rustdoc/const-generics/const-generics-docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ pub async fn a_sink<const N: usize>(v: [u8; N]) -> impl Trait<N> {
}

// @has foo/fn.b_sink.html '//pre[@class="rust fn"]' \
// 'pub async fn b_sink<const N: usize>(__arg0: impl Trait<N>)'
// FIXME(const_generics): This should be `_` not `__arg0`.
// 'pub async fn b_sink<const N: usize>(_: impl Trait<N>)'
pub async fn b_sink<const N: usize>(_: impl Trait<N>) {}

// @has foo/fn.concrete.html '//pre[@class="rust fn"]' \
Expand Down