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 574c9dd

Browse files
committedJun 22, 2021
Auto merge of #86559 - Dylan-DPC:rollup-aixg3q5, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - #86223 (Specify the kind of the item for E0121) - #86521 (Add comments around code where ordering is important due for panic-safety) - #86523 (Improvements to intra-doc link macro disambiguators) - #86542 (Line numbers aligned with content) - #86549 (Add destructuring example of E0508) - #86557 (Update books) Failed merges: - #86548 (Fix crate filter search reset) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 6a758ea + bd04f4c commit 574c9dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+569
-460
lines changed
 

‎compiler/rustc_error_codes/src/error_codes/E0508.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,16 @@ fn main() {
3939
let _value = array[0].clone();
4040
}
4141
```
42+
43+
If you really want to move the value out, you can use a destructuring array
44+
pattern to move it:
45+
46+
```
47+
struct NonCopy;
48+
49+
fn main() {
50+
let array = [NonCopy; 1];
51+
// Destructuring the array
52+
let [_value] = array;
53+
}
54+
```

‎compiler/rustc_hir/src/hir.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2815,6 +2815,27 @@ impl ItemKind<'_> {
28152815
_ => return None,
28162816
})
28172817
}
2818+
2819+
pub fn descr(&self) -> &'static str {
2820+
match self {
2821+
ItemKind::ExternCrate(..) => "extern crate",
2822+
ItemKind::Use(..) => "`use` import",
2823+
ItemKind::Static(..) => "static item",
2824+
ItemKind::Const(..) => "constant item",
2825+
ItemKind::Fn(..) => "function",
2826+
ItemKind::Mod(..) => "module",
2827+
ItemKind::ForeignMod { .. } => "extern block",
2828+
ItemKind::GlobalAsm(..) => "global asm item",
2829+
ItemKind::TyAlias(..) => "type alias",
2830+
ItemKind::OpaqueTy(..) => "opaque type",
2831+
ItemKind::Enum(..) => "enum",
2832+
ItemKind::Struct(..) => "struct",
2833+
ItemKind::Union(..) => "union",
2834+
ItemKind::Trait(..) => "trait",
2835+
ItemKind::TraitAlias(..) => "trait alias",
2836+
ItemKind::Impl(..) => "implementation",
2837+
}
2838+
}
28182839
}
28192840

28202841
/// A reference from an trait to one of its associated items. This

0 commit comments

Comments
 (0)
Please sign in to comment.