]> git.lizzy.rs Git - rust.git/commitdiff
Implement hover for lints
authorLukas Wirth <lukastw97@gmail.com>
Fri, 4 Jun 2021 15:03:18 +0000 (17:03 +0200)
committerLukas Wirth <lukastw97@gmail.com>
Fri, 4 Jun 2021 15:03:18 +0000 (17:03 +0200)
crates/ide/src/hover.rs
crates/ide_completion/src/completions/attribute/lint.rs
crates/ide_completion/src/generated_lint_completions.rs
crates/ide_completion/src/lib.rs
xtask/src/codegen/gen_lint_completions.rs

index 04598cd068ce497f873664c7cb867cdd2197edcf..4d91c5c4fc8caea20526525e402bf095692c6e98 100644 (file)
@@ -3,6 +3,7 @@
     AsAssocItem, AssocItemContainer, GenericParam, HasAttrs, HasSource, HirDisplay, InFile, Module,
     ModuleDef, Semantics,
 };
+use ide_completion::generated_lint_completions::{CLIPPY_LINTS, FEATURES};
 use ide_db::{
     base_db::SourceDatabase,
     defs::{Definition, NameClass, NameRefClass},
 };
 use itertools::Itertools;
 use stdx::format_to;
-use syntax::{ast, match_ast, AstNode, AstToken, SyntaxKind::*, SyntaxToken, TokenAtOffset, T};
+use syntax::{
+    algo, ast, match_ast, AstNode, AstToken, Direction, SyntaxKind::*, SyntaxToken, TokenAtOffset,
+    T,
+};
 
 use crate::{
     display::{macro_label, TryToNav},
@@ -115,8 +119,8 @@ pub(crate) fn hover(
                 |d| d.defined(db),
             ),
 
-            _ => ast::Comment::cast(token.clone())
-                .and_then(|_| {
+            _ => {
+                if ast::Comment::cast(token.clone()).is_some() {
                     let (attributes, def) = doc_attributes(&sema, &node)?;
                     let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?;
                     let (idl_range, link, ns) =
@@ -129,9 +133,11 @@ pub(crate) fn hover(
                             }
                         })?;
                     range = Some(idl_range);
-                    resolve_doc_path_for_def(db, def, &link, ns)
-                })
-                .map(Definition::ModuleDef),
+                    resolve_doc_path_for_def(db, def, &link, ns).map(Definition::ModuleDef)
+                } else {
+                    return try_hover_for_attribute(&token);
+                }
+            },
         }
     };
 
@@ -194,6 +200,40 @@ pub(crate) fn hover(
     Some(RangeInfo::new(range, res))
 }
 
+fn try_hover_for_attribute(token: &SyntaxToken) -> Option<RangeInfo<HoverResult>> {
+    let attr = token.ancestors().nth(1).and_then(ast::Attr::cast)?;
+    let (path, tt) = attr.as_simple_call()?;
+    if !tt.syntax().text_range().contains(token.text_range().start()) {
+        return None;
+    }
+    let lints = match &*path {
+        "feature" => FEATURES,
+        "allow" | "warn" | "forbid" | "error" => {
+            let is_clippy = algo::skip_trivia_token(token.clone(), Direction::Prev)
+                .filter(|t| t.kind() == T![::])
+                .and_then(|t| algo::skip_trivia_token(t, Direction::Prev))
+                .map_or(false, |t| t.kind() == T![ident] && t.text() == "clippy");
+            if is_clippy {
+                CLIPPY_LINTS
+            } else {
+                &[]
+            }
+        }
+        _ => return None,
+    };
+    let lint = lints
+        .binary_search_by_key(&token.text(), |lint| lint.label)
+        .ok()
+        .map(|idx| &FEATURES[idx])?;
+    Some(RangeInfo::new(
+        token.text_range(),
+        HoverResult {
+            markup: Markup::from(format!("```\n{}\n```\n___\n\n{}", lint.label, lint.description)),
+            ..Default::default()
+        },
+    ))
+}
+
 fn show_implementations_action(db: &RootDatabase, def: Definition) -> Option<HoverAction> {
     fn to_action(nav_target: NavigationTarget) -> HoverAction {
         HoverAction::Implementation(FilePosition {
@@ -3977,4 +4017,42 @@ pub fn foo() {}
             "#]],
         )
     }
+
+    #[test]
+    fn hover_feature() {
+        check(
+            r#"#![feature(box_syntax$0)]"#,
+            expect![[r##"
+                *box_syntax*
+                ```
+                box_syntax
+                ```
+                ___
+
+                # `box_syntax`
+
+                The tracking issue for this feature is: [#49733]
+
+                [#49733]: https://github.com/rust-lang/rust/issues/49733
+
+                See also [`box_patterns`](box-patterns.md)
+
+                ------------------------
+
+                Currently the only stable way to create a `Box` is via the `Box::new` method.
+                Also it is not possible in stable Rust to destructure a `Box` in a match
+                pattern. The unstable `box` keyword can be used to create a `Box`. An example
+                usage would be:
+
+                ```rust
+                #![feature(box_syntax)]
+
+                fn main() {
+                    let b = box 5;
+                }
+                ```
+
+            "##]],
+        )
+    }
 }
index 403630dce46a8c235fcaa90323ad6a73c6c026d1..608e71cecf0297ac7f753b0a67868b7a0b977c20 100644 (file)
@@ -29,128 +29,128 @@ pub(super) fn complete_lint(
     }
 }
 
-pub(crate) struct LintCompletion {
-    pub(crate) label: &'static str,
-    pub(crate) description: &'static str,
+pub struct LintCompletion {
+    pub label: &'static str,
+    pub description: &'static str,
 }
 
 #[rustfmt::skip]
-pub(super) const DEFAULT_LINT_COMPLETIONS: &[LintCompletion] = &[
+pub const DEFAULT_LINT_COMPLETIONS: &[LintCompletion] = &[
     LintCompletion { label: "absolute_paths_not_starting_with_crate", description: r#"fully qualified paths that start with a module name instead of `crate`, `self`, or an extern crate name"# },
+    LintCompletion { label: "ambiguous_associated_items", description: r#"ambiguous associated items"# },
     LintCompletion { label: "anonymous_parameters", description: r#"detects anonymous parameters"# },
-    LintCompletion { label: "box_pointers", description: r#"use of owned (Box type) heap memory"# },
-    LintCompletion { label: "deprecated_in_future", description: r#"detects use of items that will be deprecated in a future version"# },
-    LintCompletion { label: "elided_lifetimes_in_paths", description: r#"hidden lifetime parameters in types are deprecated"# },
-    LintCompletion { label: "explicit_outlives_requirements", description: r#"outlives requirements can be inferred"# },
-    LintCompletion { label: "indirect_structural_match", description: r#"pattern with const indirectly referencing non-structural-match type"# },
-    LintCompletion { label: "keyword_idents", description: r#"detects edition keywords being used as an identifier"# },
-    LintCompletion { label: "macro_use_extern_crate", description: r#"the `#[macro_use]` attribute is now deprecated in favor of using macros via the module system"# },
-    LintCompletion { label: "meta_variable_misuse", description: r#"possible meta-variable misuse at macro definition"# },
-    LintCompletion { label: "missing_copy_implementations", description: r#"detects potentially-forgotten implementations of `Copy`"# },
-    LintCompletion { label: "missing_crate_level_docs", description: r#"detects crates with no crate-level documentation"# },
-    LintCompletion { label: "missing_debug_implementations", description: r#"detects missing implementations of Debug"# },
-    LintCompletion { label: "missing_docs", description: r#"detects missing documentation for public members"# },
-    LintCompletion { label: "missing_doc_code_examples", description: r#"detects publicly-exported items without code samples in their documentation"# },
-    LintCompletion { label: "non_ascii_idents", description: r#"detects non-ASCII identifiers"# },
-    LintCompletion { label: "private_doc_tests", description: r#"detects code samples in docs of private items not documented by rustdoc"# },
-    LintCompletion { label: "single_use_lifetimes", description: r#"detects lifetime parameters that are only used once"# },
-    LintCompletion { label: "trivial_casts", description: r#"detects trivial casts which could be removed"# },
-    LintCompletion { label: "trivial_numeric_casts", description: r#"detects trivial casts of numeric types which could be removed"# },
-    LintCompletion { label: "unaligned_references", description: r#"detects unaligned references to fields of packed structs"# },
-    LintCompletion { label: "unreachable_pub", description: r#"`pub` items not reachable from crate root"# },
-    LintCompletion { label: "unsafe_code", description: r#"usage of `unsafe` code"# },
-    LintCompletion { label: "unsafe_op_in_unsafe_fn", description: r#"unsafe operations in unsafe functions without an explicit unsafe block are deprecated"# },
-    LintCompletion { label: "unstable_features", description: r#"enabling unstable features (deprecated. do not use)"# },
-    LintCompletion { label: "unused_crate_dependencies", description: r#"crate dependencies that are never used"# },
-    LintCompletion { label: "unused_extern_crates", description: r#"extern crates that are never used"# },
-    LintCompletion { label: "unused_import_braces", description: r#"unnecessary braces around an imported item"# },
-    LintCompletion { label: "unused_lifetimes", description: r#"detects lifetime parameters that are never used"# },
-    LintCompletion { label: "unused_qualifications", description: r#"detects unnecessarily qualified names"# },
-    LintCompletion { label: "unused_results", description: r#"unused result of an expression in a statement"# },
-    LintCompletion { label: "variant_size_differences", description: r#"detects enums with widely varying variant sizes"# },
+    LintCompletion { label: "arithmetic_overflow", description: r#"arithmetic operation overflows"# },
     LintCompletion { label: "array_into_iter", description: r#"detects calling `into_iter` on arrays"# },
     LintCompletion { label: "asm_sub_register", description: r#"using only a subset of a register for inline asm inputs"# },
     LintCompletion { label: "bare_trait_objects", description: r#"suggest using `dyn Trait` for trait objects"# },
     LintCompletion { label: "bindings_with_variant_name", description: r#"detects pattern bindings with the same name as one of the matched variants"# },
+    LintCompletion { label: "box_pointers", description: r#"use of owned (Box type) heap memory"# },
     LintCompletion { label: "cenum_impl_drop_cast", description: r#"a C-like enum implementing Drop is cast"# },
     LintCompletion { label: "clashing_extern_declarations", description: r#"detects when an extern fn has been declared with the same name but different types"# },
     LintCompletion { label: "coherence_leak_check", description: r#"distinct impls distinguished only by the leak-check code"# },
+    LintCompletion { label: "conflicting_repr_hints", description: r#"conflicts between `#[repr(..)]` hints that were previously accepted and used in practice"# },
     LintCompletion { label: "confusable_idents", description: r#"detects visually confusable pairs between identifiers"# },
+    LintCompletion { label: "const_err", description: r#"constant evaluation detected erroneous expression"# },
     LintCompletion { label: "dead_code", description: r#"detect unused, unexported items"# },
+    LintCompletion { label: "deprecated_in_future", description: r#"detects use of items that will be deprecated in a future version"# },
     LintCompletion { label: "deprecated", description: r#"detects use of deprecated items"# },
+    LintCompletion { label: "elided_lifetimes_in_paths", description: r#"hidden lifetime parameters in types are deprecated"# },
     LintCompletion { label: "ellipsis_inclusive_range_patterns", description: r#"`...` range patterns are deprecated"# },
+    LintCompletion { label: "explicit_outlives_requirements", description: r#"outlives requirements can be inferred"# },
     LintCompletion { label: "exported_private_dependencies", description: r#"public interface leaks type from a private dependency"# },
+    LintCompletion { label: "ill_formed_attribute_input", description: r#"ill-formed attribute inputs that were previously accepted and used in practice"# },
     LintCompletion { label: "illegal_floating_point_literal_pattern", description: r#"floating-point literals cannot be used in patterns"# },
-    LintCompletion { label: "improper_ctypes", description: r#"proper use of libc types in foreign modules"# },
     LintCompletion { label: "improper_ctypes_definitions", description: r#"proper use of libc types in foreign item definitions"# },
+    LintCompletion { label: "improper_ctypes", description: r#"proper use of libc types in foreign modules"# },
     LintCompletion { label: "incomplete_features", description: r#"incomplete features that may function improperly in some or all cases"# },
+    LintCompletion { label: "incomplete_include", description: r#"trailing content in included file"# },
+    LintCompletion { label: "indirect_structural_match", description: r#"pattern with const indirectly referencing non-structural-match type"# },
     LintCompletion { label: "inline_no_sanitize", description: r#"detects incompatible use of `#[inline(always)]` and `#[no_sanitize(...)]`"# },
     LintCompletion { label: "intra_doc_link_resolution_failure", description: r#"failures in resolving intra-doc link targets"# },
     LintCompletion { label: "invalid_codeblock_attributes", description: r#"codeblock attribute looks a lot like a known one"# },
+    LintCompletion { label: "invalid_type_param_default", description: r#"type parameter default erroneously allowed in invalid location"# },
     LintCompletion { label: "invalid_value", description: r#"an invalid value is being created (such as a NULL reference)"# },
     LintCompletion { label: "irrefutable_let_patterns", description: r#"detects irrefutable patterns in if-let and while-let statements"# },
+    LintCompletion { label: "keyword_idents", description: r#"detects edition keywords being used as an identifier"# },
     LintCompletion { label: "late_bound_lifetime_arguments", description: r#"detects generic lifetime arguments in path segments with late bound lifetime parameters"# },
+    LintCompletion { label: "macro_expanded_macro_exports_accessed_by_absolute_paths", description: r#"macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths"# },
+    LintCompletion { label: "macro_use_extern_crate", description: r#"the `#[macro_use]` attribute is now deprecated in favor of using macros via the module system"# },
+    LintCompletion { label: "meta_variable_misuse", description: r#"possible meta-variable misuse at macro definition"# },
+    LintCompletion { label: "missing_copy_implementations", description: r#"detects potentially-forgotten implementations of `Copy`"# },
+    LintCompletion { label: "missing_crate_level_docs", description: r#"detects crates with no crate-level documentation"# },
+    LintCompletion { label: "missing_debug_implementations", description: r#"detects missing implementations of Debug"# },
+    LintCompletion { label: "missing_doc_code_examples", description: r#"detects publicly-exported items without code samples in their documentation"# },
+    LintCompletion { label: "missing_docs", description: r#"detects missing documentation for public members"# },
+    LintCompletion { label: "missing_fragment_specifier", description: r#"detects missing fragment specifiers in unused `macro_rules!` patterns"# },
     LintCompletion { label: "mixed_script_confusables", description: r#"detects Unicode scripts whose mixed script confusables codepoints are solely used"# },
     LintCompletion { label: "mutable_borrow_reservation_conflict", description: r#"reservation of a two-phased borrow conflicts with other shared borrows"# },
+    LintCompletion { label: "mutable_transmutes", description: r#"mutating transmuted &mut T from &T may cause undefined behavior"# },
+    LintCompletion { label: "no_mangle_const_items", description: r#"const items will not have their symbols exported"# },
+    LintCompletion { label: "no_mangle_generic_items", description: r#"generic items must be mangled"# },
+    LintCompletion { label: "non_ascii_idents", description: r#"detects non-ASCII identifiers"# },
     LintCompletion { label: "non_camel_case_types", description: r#"types, variants, traits and type parameters should have camel case names"# },
     LintCompletion { label: "non_shorthand_field_patterns", description: r#"using `Struct { x: x }` instead of `Struct { x }` in a pattern"# },
     LintCompletion { label: "non_snake_case", description: r#"variables, methods, functions, lifetime parameters and modules should have snake case names"# },
     LintCompletion { label: "non_upper_case_globals", description: r#"static constants should have uppercase identifiers"# },
-    LintCompletion { label: "no_mangle_generic_items", description: r#"generic items must be mangled"# },
+    LintCompletion { label: "order_dependent_trait_objects", description: r#"trait-object types were treated as different depending on marker-trait order"# },
+    LintCompletion { label: "overflowing_literals", description: r#"literal out of range for its type"# },
     LintCompletion { label: "overlapping_patterns", description: r#"detects overlapping patterns"# },
     LintCompletion { label: "path_statements", description: r#"path statements with no effect"# },
+    LintCompletion { label: "patterns_in_fns_without_body", description: r#"patterns in functions without body were erroneously allowed"# },
+    LintCompletion { label: "private_doc_tests", description: r#"detects code samples in docs of private items not documented by rustdoc"# },
     LintCompletion { label: "private_in_public", description: r#"detect private items in public interfaces not caught by the old implementation"# },
     LintCompletion { label: "proc_macro_derive_resolution_fallback", description: r#"detects proc macro derives using inaccessible names from parent modules"# },
+    LintCompletion { label: "pub_use_of_private_extern_crate", description: r#"detect public re-exports of private extern crates"# },
     LintCompletion { label: "redundant_semicolons", description: r#"detects unnecessary trailing semicolons"# },
     LintCompletion { label: "renamed_and_removed_lints", description: r#"lints that have been renamed or removed"# },
     LintCompletion { label: "safe_packed_borrows", description: r#"safe borrows of fields of packed structs were erroneously allowed"# },
+    LintCompletion { label: "single_use_lifetimes", description: r#"detects lifetime parameters that are only used once"# },
+    LintCompletion { label: "soft_unstable", description: r#"a feature gate that doesn't break dependent crates"# },
     LintCompletion { label: "stable_features", description: r#"stable features found in `#[feature]` directive"# },
     LintCompletion { label: "trivial_bounds", description: r#"these bounds don't depend on an type parameters"# },
+    LintCompletion { label: "trivial_casts", description: r#"detects trivial casts which could be removed"# },
+    LintCompletion { label: "trivial_numeric_casts", description: r#"detects trivial casts of numeric types which could be removed"# },
     LintCompletion { label: "type_alias_bounds", description: r#"bounds in type aliases are not enforced"# },
     LintCompletion { label: "tyvar_behind_raw_pointer", description: r#"raw pointer to an inference variable"# },
+    LintCompletion { label: "unaligned_references", description: r#"detects unaligned references to fields of packed structs"# },
     LintCompletion { label: "uncommon_codepoints", description: r#"detects uncommon Unicode codepoints in identifiers"# },
+    LintCompletion { label: "unconditional_panic", description: r#"operation will cause a panic at runtime"# },
     LintCompletion { label: "unconditional_recursion", description: r#"functions that cannot return without calling themselves"# },
+    LintCompletion { label: "unknown_crate_types", description: r#"unknown crate type found in `#[crate_type]` directive"# },
     LintCompletion { label: "unknown_lints", description: r#"unrecognized lint attribute"# },
     LintCompletion { label: "unnameable_test_items", description: r#"detects an item that cannot be named being marked as `#[test_case]`"# },
     LintCompletion { label: "unreachable_code", description: r#"detects unreachable code paths"# },
     LintCompletion { label: "unreachable_patterns", description: r#"detects unreachable patterns"# },
+    LintCompletion { label: "unreachable_pub", description: r#"`pub` items not reachable from crate root"# },
+    LintCompletion { label: "unsafe_code", description: r#"usage of `unsafe` code"# },
+    LintCompletion { label: "unsafe_op_in_unsafe_fn", description: r#"unsafe operations in unsafe functions without an explicit unsafe block are deprecated"# },
+    LintCompletion { label: "unstable_features", description: r#"enabling unstable features (deprecated. do not use)"# },
     LintCompletion { label: "unstable_name_collisions", description: r#"detects name collision with an existing but unstable method"# },
     LintCompletion { label: "unused_allocation", description: r#"detects unnecessary allocations that can be eliminated"# },
     LintCompletion { label: "unused_assignments", description: r#"detect assignments that will never be read"# },
     LintCompletion { label: "unused_attributes", description: r#"detects attributes that were not used by the compiler"# },
     LintCompletion { label: "unused_braces", description: r#"unnecessary braces around an expression"# },
     LintCompletion { label: "unused_comparisons", description: r#"comparisons made useless by limits of the types involved"# },
+    LintCompletion { label: "unused_crate_dependencies", description: r#"crate dependencies that are never used"# },
     LintCompletion { label: "unused_doc_comments", description: r#"detects doc comments that aren't used by rustdoc"# },
+    LintCompletion { label: "unused_extern_crates", description: r#"extern crates that are never used"# },
     LintCompletion { label: "unused_features", description: r#"unused features found in crate-level `#[feature]` directives"# },
+    LintCompletion { label: "unused_import_braces", description: r#"unnecessary braces around an imported item"# },
     LintCompletion { label: "unused_imports", description: r#"imports that are never used"# },
     LintCompletion { label: "unused_labels", description: r#"detects labels that are never used"# },
+    LintCompletion { label: "unused_lifetimes", description: r#"detects lifetime parameters that are never used"# },
     LintCompletion { label: "unused_macros", description: r#"detects macros that were not used"# },
     LintCompletion { label: "unused_must_use", description: r#"unused result of a type flagged as `#[must_use]`"# },
     LintCompletion { label: "unused_mut", description: r#"detect mut variables which don't need to be mutable"# },
     LintCompletion { label: "unused_parens", description: r#"`if`, `match`, `while` and `return` do not need parentheses"# },
+    LintCompletion { label: "unused_qualifications", description: r#"detects unnecessarily qualified names"# },
+    LintCompletion { label: "unused_results", description: r#"unused result of an expression in a statement"# },
     LintCompletion { label: "unused_unsafe", description: r#"unnecessary use of an `unsafe` block"# },
     LintCompletion { label: "unused_variables", description: r#"detect variables which are not used in any way"# },
+    LintCompletion { label: "variant_size_differences", description: r#"detects enums with widely varying variant sizes"# },
     LintCompletion { label: "warnings", description: r#"mass-change the level for lints which produce warnings"# },
     LintCompletion { label: "where_clauses_object_safety", description: r#"checks the object safety of where clauses"# },
     LintCompletion { label: "while_true", description: r#"suggest using `loop { }` instead of `while true { }`"# },
-    LintCompletion { label: "ambiguous_associated_items", description: r#"ambiguous associated items"# },
-    LintCompletion { label: "arithmetic_overflow", description: r#"arithmetic operation overflows"# },
-    LintCompletion { label: "conflicting_repr_hints", description: r#"conflicts between `#[repr(..)]` hints that were previously accepted and used in practice"# },
-    LintCompletion { label: "const_err", description: r#"constant evaluation detected erroneous expression"# },
-    LintCompletion { label: "ill_formed_attribute_input", description: r#"ill-formed attribute inputs that were previously accepted and used in practice"# },
-    LintCompletion { label: "incomplete_include", description: r#"trailing content in included file"# },
-    LintCompletion { label: "invalid_type_param_default", description: r#"type parameter default erroneously allowed in invalid location"# },
-    LintCompletion { label: "macro_expanded_macro_exports_accessed_by_absolute_paths", description: r#"macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths"# },
-    LintCompletion { label: "missing_fragment_specifier", description: r#"detects missing fragment specifiers in unused `macro_rules!` patterns"# },
-    LintCompletion { label: "mutable_transmutes", description: r#"mutating transmuted &mut T from &T may cause undefined behavior"# },
-    LintCompletion { label: "no_mangle_const_items", description: r#"const items will not have their symbols exported"# },
-    LintCompletion { label: "order_dependent_trait_objects", description: r#"trait-object types were treated as different depending on marker-trait order"# },
-    LintCompletion { label: "overflowing_literals", description: r#"literal out of range for its type"# },
-    LintCompletion { label: "patterns_in_fns_without_body", description: r#"patterns in functions without body were erroneously allowed"# },
-    LintCompletion { label: "pub_use_of_private_extern_crate", description: r#"detect public re-exports of private extern crates"# },
-    LintCompletion { label: "soft_unstable", description: r#"a feature gate that doesn't break dependent crates"# },
-    LintCompletion { label: "unconditional_panic", description: r#"operation will cause a panic at runtime"# },
-    LintCompletion { label: "unknown_crate_types", description: r#"unknown crate type found in `#[crate_type]` directive"# },
 ];
 
 #[cfg(test)]
index 0d405350dd496ac1b023c980a411dae7ce6f9b10..fe9554526ccc12ce92a40f423173467ac7f244df 100644 (file)
 //! Generated file, do not edit by hand, see `xtask/src/codegen`
 
 use crate::completions::attribute::LintCompletion;
-pub(super) const FEATURES: &[LintCompletion] = &[
+
+pub const FEATURES: &[LintCompletion] = &[
     LintCompletion {
-        label: "plugin_registrar",
-        description: r##"# `plugin_registrar`
+        label: "abi_c_cmse_nonsecure_call",
+        description: r##"# `abi_c_cmse_nonsecure_call`
 
-The tracking issue for this feature is: [#29597]
+The tracking issue for this feature is: [#81391]
 
-[#29597]: https://github.com/rust-lang/rust/issues/29597
+[#81391]: https://github.com/rust-lang/rust/issues/81391
 
-This feature is part of "compiler plugins." It will often be used with the
-[`plugin`] and `rustc_private` features as well. For more details, see
-their docs.
+------------------------
 
-[`plugin`]: plugin.md
+The [TrustZone-M
+feature](https://developer.arm.com/documentation/100690/latest/) is available
+for targets with the Armv8-M architecture profile (`thumbv8m` in their target
+name).
+LLVM, the Rust compiler and the linker are providing
+[support](https://developer.arm.com/documentation/ecm0359818/latest/) for the
+TrustZone-M feature.
 
-------------------------
+One of the things provided, with this unstable feature, is the
+`C-cmse-nonsecure-call` function ABI. This ABI is used on function pointers to
+non-secure code to mark a non-secure function call (see [section
+5.5](https://developer.arm.com/documentation/ecm0359818/latest/) for details).
+
+With this ABI, the compiler will do the following to perform the call:
+* save registers needed after the call to Secure memory
+* clear all registers that might contain confidential information
+* clear the Least Significant Bit of the function address
+* branches using the BLXNS instruction
+
+To avoid using the non-secure stack, the compiler will constrain the number and
+type of parameters/return value.
+
+The `extern "C-cmse-nonsecure-call"` ABI is otherwise equivalent to the
+`extern "C"` ABI.
+
+<!-- NOTE(ignore) this example is specific to thumbv8m targets -->
+
+``` rust,ignore
+#![no_std]
+#![feature(abi_c_cmse_nonsecure_call)]
+
+#[no_mangle]
+pub fn call_nonsecure_function(addr: usize) -> u32 {
+    let non_secure_function =
+        unsafe { core::mem::transmute::<usize, extern "C-cmse-nonsecure-call" fn() -> u32>(addr) };
+    non_secure_function()
+}
+```
+
+``` text
+$ rustc --emit asm --crate-type lib --target thumbv8m.main-none-eabi function.rs
+
+call_nonsecure_function:
+        .fnstart
+        .save   {r7, lr}
+        push    {r7, lr}
+        .setfp  r7, sp
+        mov     r7, sp
+        .pad    #16
+        sub     sp, #16
+        str     r0, [sp, #12]
+        ldr     r0, [sp, #12]
+        str     r0, [sp, #8]
+        b       .LBB0_1
+.LBB0_1:
+        ldr     r0, [sp, #8]
+        push.w  {r4, r5, r6, r7, r8, r9, r10, r11}
+        bic     r0, r0, #1
+        mov     r1, r0
+        mov     r2, r0
+        mov     r3, r0
+        mov     r4, r0
+        mov     r5, r0
+        mov     r6, r0
+        mov     r7, r0
+        mov     r8, r0
+        mov     r9, r0
+        mov     r10, r0
+        mov     r11, r0
+        mov     r12, r0
+        msr     apsr_nzcvq, r0
+        blxns   r0
+        pop.w   {r4, r5, r6, r7, r8, r9, r10, r11}
+        str     r0, [sp, #4]
+        b       .LBB0_2
+.LBB0_2:
+        ldr     r0, [sp, #4]
+        add     sp, #16
+        pop     {r7, pc}
+```
 "##,
     },
     LintCompletion {
-        label: "inline_const",
-        description: r##"# `inline_const`
+        label: "abi_msp430_interrupt",
+        description: r##"# `abi_msp430_interrupt`
 
-The tracking issue for this feature is: [#76001]
+The tracking issue for this feature is: [#38487]
 
-------
+[#38487]: https://github.com/rust-lang/rust/issues/38487
 
-This feature allows you to use inline constant expressions. For example, you can
-turn this code:
+------------------------
 
-```rust
-# fn add_one(x: i32) -> i32 { x + 1 }
-const MY_COMPUTATION: i32 = 1 + 2 * 3 / 4;
+In the MSP430 architecture, interrupt handlers have a special calling
+convention. You can use the `"msp430-interrupt"` ABI to make the compiler apply
+the right calling convention to the interrupt handlers you define.
 
-fn main() {
-    let x = add_one(MY_COMPUTATION);
-}
-```
+<!-- NOTE(ignore) this example is specific to the msp430 target -->
 
-into this code:
+``` rust,ignore
+#![feature(abi_msp430_interrupt)]
+#![no_std]
 
-```rust
-#![feature(inline_const)]
+// Place the interrupt handler at the appropriate memory address
+// (Alternatively, you can use `#[used]` and remove `pub` and `#[no_mangle]`)
+#[link_section = "__interrupt_vector_10"]
+#[no_mangle]
+pub static TIM0_VECTOR: extern "msp430-interrupt" fn() = tim0;
 
-# fn add_one(x: i32) -> i32 { x + 1 }
-fn main() {
-    let x = add_one(const { 1 + 2 * 3 / 4 });
+// The interrupt handler
+extern "msp430-interrupt" fn tim0() {
+    // ..
 }
 ```
 
-You can also use inline constant expressions in patterns:
+``` text
+$ msp430-elf-objdump -CD ./target/msp430/release/app
+Disassembly of section __interrupt_vector_10:
 
-```rust
-#![feature(inline_const)]
+0000fff2 <TIM0_VECTOR>:
+    fff2:       00 c0           interrupt service routine at 0xc000
 
-const fn one() -> i32 { 1 }
+Disassembly of section .text:
 
-let some_int = 3;
-match some_int {
-    const { 1 + 2 } => println!("Matched 1 + 2"),
-    const { one() } => println!("Matched const fn returning 1"),
-    _ => println!("Didn't match anything :("),
-}
+0000c000 <int::tim0>:
+    c000:       00 13           reti
 ```
-
-[#76001]: https://github.com/rust-lang/rust/issues/76001
 "##,
     },
     LintCompletion {
-        label: "auto_traits",
-        description: r##"# `auto_traits`
+        label: "abi_ptx",
+        description: r##"# `abi_ptx`
 
-The tracking issue for this feature is [#13231]
+The tracking issue for this feature is: [#38788]
 
-[#13231]: https://github.com/rust-lang/rust/issues/13231
+[#38788]: https://github.com/rust-lang/rust/issues/38788
 
-----
+------------------------
 
-The `auto_traits` feature gate allows you to define auto traits.
+When emitting PTX code, all vanilla Rust functions (`fn`) get translated to
+"device" functions. These functions are *not* callable from the host via the
+CUDA API so a crate with only device functions is not too useful!
 
-Auto traits, like [`Send`] or [`Sync`] in the standard library, are marker traits
-that are automatically implemented for every type, unless the type, or a type it contains,
-has explicitly opted out via a negative impl. (Negative impls are separately controlled
-by the `negative_impls` feature.)
+OTOH, "global" functions *can* be called by the host; you can think of them
+as the real public API of your crate. To produce a global function use the
+`"ptx-kernel"` ABI.
 
-[`Send`]: https://doc.rust-lang.org/std/marker/trait.Send.html
-[`Sync`]: https://doc.rust-lang.org/std/marker/trait.Sync.html
+<!-- NOTE(ignore) this example is specific to the nvptx targets -->
 
-```rust,ignore (partial-example)
-impl !Trait for Type {}
-```
+``` rust,ignore
+#![feature(abi_ptx)]
+#![no_std]
 
-Example:
+pub unsafe extern "ptx-kernel" fn global_function() {
+    device_function();
+}
 
-```rust
-#![feature(negative_impls)]
-#![feature(auto_traits)]
+pub fn device_function() {
+    // ..
+}
+```
 
-auto trait Valid {}
+``` text
+$ xargo rustc --target nvptx64-nvidia-cuda --release -- --emit=asm
 
-struct True;
-struct False;
+$ cat $(find -name '*.s')
+//
+// Generated by LLVM NVPTX Back-End
+//
 
-impl !Valid for False {}
+.version 3.2
+.target sm_20
+.address_size 64
 
-struct MaybeValid<T>(T);
+        // .globl       _ZN6kernel15global_function17h46111ebe6516b382E
 
-fn must_be_valid<T: Valid>(_t: T) { }
+.visible .entry _ZN6kernel15global_function17h46111ebe6516b382E()
+{
 
-fn main() {
-    // works
-    must_be_valid( MaybeValid(True) );
 
-    // compiler error - trait bound not satisfied
-    // must_be_valid( MaybeValid(False) );
+        ret;
 }
-```
 
-## Automatic trait implementations
+        // .globl       _ZN6kernel15device_function17hd6a0e4993bbf3f78E
+.visible .func _ZN6kernel15device_function17hd6a0e4993bbf3f78E()
+{
 
-When a type is declared as an `auto trait`, we will automatically
-create impls for every struct/enum/union, unless an explicit impl is
-provided. These automatic impls contain a where clause for each field
-of the form `T: AutoTrait`, where `T` is the type of the field and
-`AutoTrait` is the auto trait in question. As an example, consider the
-struct `List` and the auto trait `Send`:
 
-```rust
-struct List<T> {
-  data: T,
-  next: Option<Box<List<T>>>,
+        ret;
 }
 ```
+"##,
+    },
+    LintCompletion {
+        label: "abi_thiscall",
+        description: r##"# `abi_thiscall`
 
-Presuming that there is no explicit impl of `Send` for `List`, the
-compiler will supply an automatic impl of the form:
+The tracking issue for this feature is: [#42202]
 
-```rust
-struct List<T> {
-  data: T,
-  next: Option<Box<List<T>>>,
-}
+[#42202]: https://github.com/rust-lang/rust/issues/42202
 
-unsafe impl<T> Send for List<T>
-where
-  T: Send, // from the field `data`
-  Option<Box<List<T>>>: Send, // from the field `next`
-{ }
-```
+------------------------
 
-Explicit impls may be either positive or negative. They take the form:
-
-```rust,ignore (partial-example)
-impl<...> AutoTrait for StructName<..> { }
-impl<...> !AutoTrait for StructName<..> { }
-```
-
-## Coinduction: Auto traits permit cyclic matching
-
-Unlike ordinary trait matching, auto traits are **coinductive**. This
-means, in short, that cycles which occur in trait matching are
-considered ok. As an example, consider the recursive struct `List`
-introduced in the previous section. In attempting to determine whether
-`List: Send`, we would wind up in a cycle: to apply the impl, we must
-show that `Option<Box<List>>: Send`, which will in turn require
-`Box<List>: Send` and then finally `List: Send` again. Under ordinary
-trait matching, this cycle would be an error, but for an auto trait it
-is considered a successful match.
-
-## Items
-
-Auto traits cannot have any trait items, such as methods or associated types. This ensures that we can generate default implementations.
-
-## Supertraits
-
-Auto traits cannot have supertraits. This is for soundness reasons, as the interaction of coinduction with implied bounds is difficult to reconcile.
+The MSVC ABI on x86 Windows uses the `thiscall` calling convention for C++
+instance methods by default; it is identical to the usual (C) calling
+convention on x86 Windows except that the first parameter of the method,
+the `this` pointer, is passed in the ECX register.
 "##,
     },
     LintCompletion {
-        label: "ffi_const",
-        description: r##"# `ffi_const`
-
-The tracking issue for this feature is: [#58328]
-
-------
-
-The `#[ffi_const]` attribute applies clang's `const` attribute to foreign
-functions declarations.
-
-That is, `#[ffi_const]` functions shall have no effects except for its return
-value, which can only depend on the values of the function parameters, and is
-not affected by changes to the observable state of the program.
-
-Applying the `#[ffi_const]` attribute to a function that violates these
-requirements is undefined behaviour.
-
-This attribute enables Rust to perform common optimizations, like sub-expression
-elimination, and it can avoid emitting some calls in repeated invocations of the
-function with the same argument values regardless of other operations being
-performed in between these functions calls (as opposed to `#[ffi_pure]`
-functions).
-
-## Pitfalls
-
-A `#[ffi_const]` function can only read global memory that would not affect
-its return value for the whole execution of the program (e.g. immutable global
-memory). `#[ffi_const]` functions are referentially-transparent and therefore
-more strict than `#[ffi_pure]` functions.
+        label: "allocator_api",
+        description: r##"# `allocator_api`
 
-A common pitfall involves applying the `#[ffi_const]` attribute to a
-function that reads memory through pointer arguments which do not necessarily
-point to immutable global memory.
+The tracking issue for this feature is [#32838]
 
-A `#[ffi_const]` function that returns unit has no effect on the abstract
-machine's state, and a `#[ffi_const]` function cannot be `#[ffi_pure]`.
+[#32838]: https://github.com/rust-lang/rust/issues/32838
 
-A `#[ffi_const]` function must not diverge, neither via a side effect (e.g. a
-call to `abort`) nor by infinite loops.
+------------------------
 
-When translating C headers to Rust FFI, it is worth verifying for which targets
-the `const` attribute is enabled in those headers, and using the appropriate
-`cfg` macros in the Rust side to match those definitions. While the semantics of
-`const` are implemented identically by many C and C++ compilers, e.g., clang,
-[GCC], [ARM C/C++ compiler], [IBM ILE C/C++], etc. they are not necessarily
-implemented in this way on all of them. It is therefore also worth verifying
-that the semantics of the C toolchain used to compile the binary being linked
-against are compatible with those of the `#[ffi_const]`.
+Sometimes you want the memory for one collection to use a different
+allocator than the memory for another collection. In this case,
+replacing the global allocator is not a workable option. Instead,
+you need to pass in an instance of an `AllocRef` to each collection
+for which you want a custom allocator.
 
-[#58328]: https://github.com/rust-lang/rust/issues/58328
-[ARM C/C++ compiler]: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491c/Cacgigch.html
-[GCC]: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-const-function-attribute
-[IBM ILE C/C++]: https://www.ibm.com/support/knowledgecenter/fr/ssw_ibm_i_71/rzarg/fn_attrib_const.htm
+TBD
 "##,
     },
     LintCompletion {
-        label: "external_doc",
-        description: r##"# `external_doc`
-
-The tracking issue for this feature is: [#44732]
-
-The `external_doc` feature allows the use of the `include` parameter to the `#[doc]` attribute, to
-include external files in documentation. Use the attribute in place of, or in addition to, regular
-doc comments and `#[doc]` attributes, and `rustdoc` will load the given file when it renders
-documentation for your crate.
-
-With the following files in the same directory:
-
-`external-doc.md`:
-
-```markdown
-# My Awesome Type
-
-This is the documentation for this spectacular type.
-```
-
-`lib.rs`:
-
-```no_run (needs-external-files)
-#![feature(external_doc)]
-
-#[doc(include = "external-doc.md")]
-pub struct MyAwesomeType;
-```
-
-`rustdoc` will load the file `external-doc.md` and use it as the documentation for the `MyAwesomeType`
-struct.
-
-When locating files, `rustdoc` will base paths in the `src/` directory, as if they were alongside the
-`lib.rs` for your crate. So if you want a `docs/` folder to live alongside the `src/` directory,
-start your paths with `../docs/` for `rustdoc` to properly find the file.
+        label: "allocator_internals",
+        description: r##"# `allocator_internals`
 
-This feature was proposed in [RFC #1990] and initially implemented in PR [#44781].
+This feature does not have a tracking issue, it is an unstable implementation
+detail of the `global_allocator` feature not intended for use outside the
+compiler.
 
-[#44732]: https://github.com/rust-lang/rust/issues/44732
-[RFC #1990]: https://github.com/rust-lang/rfcs/pull/1990
-[#44781]: https://github.com/rust-lang/rust/pull/44781
+------------------------
 "##,
     },
     LintCompletion {
-        label: "box_patterns",
-        description: r##"# `box_patterns`
-
-The tracking issue for this feature is: [#29641]
+        label: "arbitrary_enum_discriminant",
+        description: r##"# `arbitrary_enum_discriminant`
 
-[#29641]: https://github.com/rust-lang/rust/issues/29641
+The tracking issue for this feature is: [#60553]
 
-See also [`box_syntax`](box-syntax.md)
+[#60553]: https://github.com/rust-lang/rust/issues/60553
 
 ------------------------
 
-Box patterns let you match on `Box<T>`s:
+The `arbitrary_enum_discriminant` feature permits tuple-like and
+struct-like enum variants with `#[repr(<int-type>)]` to have explicit discriminants.
 
+## Examples
 
 ```rust
-#![feature(box_patterns)]
+#![feature(arbitrary_enum_discriminant)]
 
-fn main() {
-    let b = Some(Box::new(5));
-    match b {
-        Some(box n) if n < 0 => {
-            println!("Box contains negative number {}", n);
-        },
-        Some(box n) if n >= 0 => {
-            println!("Box contains non-negative number {}", n);
-        },
-        None => {
-            println!("No box");
-        },
-        _ => unreachable!()
+#[allow(dead_code)]
+#[repr(u8)]
+enum Enum {
+    Unit = 3,
+    Tuple(u16) = 2,
+    Struct {
+        a: u8,
+        b: u16,
+    } = 1,
+}
+
+impl Enum {
+    fn tag(&self) -> u8 {
+        unsafe { *(self as *const Self as *const u8) }
     }
 }
+
+assert_eq!(3, Enum::Unit.tag());
+assert_eq!(2, Enum::Tuple(5).tag());
+assert_eq!(1, Enum::Struct{a: 7, b: 11}.tag());
 ```
 "##,
     },
     LintCompletion {
-        label: "abi_c_cmse_nonsecure_call",
-        description: r##"# `abi_c_cmse_nonsecure_call`
+        label: "asm",
+        description: r##"# `asm`
 
-The tracking issue for this feature is: [#81391]
+The tracking issue for this feature is: [#72016]
 
-[#81391]: https://github.com/rust-lang/rust/issues/81391
+[#72016]: https://github.com/rust-lang/rust/issues/72016
 
 ------------------------
 
-The [TrustZone-M
-feature](https://developer.arm.com/documentation/100690/latest/) is available
-for targets with the Armv8-M architecture profile (`thumbv8m` in their target
-name).
-LLVM, the Rust compiler and the linker are providing
-[support](https://developer.arm.com/documentation/ecm0359818/latest/) for the
-TrustZone-M feature.
+For extremely low-level manipulations and performance reasons, one
+might wish to control the CPU directly. Rust supports using inline
+assembly to do this via the `asm!` macro.
 
-One of the things provided, with this unstable feature, is the
-`C-cmse-nonsecure-call` function ABI. This ABI is used on function pointers to
-non-secure code to mark a non-secure function call (see [section
-5.5](https://developer.arm.com/documentation/ecm0359818/latest/) for details).
+# Guide-level explanation
+[guide-level-explanation]: #guide-level-explanation
 
-With this ABI, the compiler will do the following to perform the call:
-* save registers needed after the call to Secure memory
-* clear all registers that might contain confidential information
-* clear the Least Significant Bit of the function address
-* branches using the BLXNS instruction
+Rust provides support for inline assembly via the `asm!` macro.
+It can be used to embed handwritten assembly in the assembly output generated by the compiler.
+Generally this should not be necessary, but might be where the required performance or timing
+cannot be otherwise achieved. Accessing low level hardware primitives, e.g. in kernel code, may also demand this functionality.
 
-To avoid using the non-secure stack, the compiler will constrain the number and
-type of parameters/return value.
+> **Note**: the examples here are given in x86/x86-64 assembly, but other architectures are also supported.
 
-The `extern "C-cmse-nonsecure-call"` ABI is otherwise equivalent to the
-`extern "C"` ABI.
+Inline assembly is currently supported on the following architectures:
+- x86 and x86-64
+- ARM
+- AArch64
+- RISC-V
+- NVPTX
+- PowerPC
+- Hexagon
+- MIPS32r2 and MIPS64r2
+- wasm32
 
-<!-- NOTE(ignore) this example is specific to thumbv8m targets -->
+## Basic usage
 
-``` rust,ignore
-#![no_std]
-#![feature(abi_c_cmse_nonsecure_call)]
+Let us start with the simplest possible example:
 
-#[no_mangle]
-pub fn call_nonsecure_function(addr: usize) -> u32 {
-    let non_secure_function =
-        unsafe { core::mem::transmute::<usize, extern "C-cmse-nonsecure-call" fn() -> u32>(addr) };
-    non_secure_function()
+```rust,allow_fail
+#![feature(asm)]
+unsafe {
+    asm!("nop");
 }
 ```
 
-``` text
-$ rustc --emit asm --crate-type lib --target thumbv8m.main-none-eabi function.rs
+This will insert a NOP (no operation) instruction into the assembly generated by the compiler.
+Note that all `asm!` invocations have to be inside an `unsafe` block, as they could insert
+arbitrary instructions and break various invariants. The instructions to be inserted are listed
+in the first argument of the `asm!` macro as a string literal.
 
-call_nonsecure_function:
-        .fnstart
-        .save   {r7, lr}
-        push    {r7, lr}
-        .setfp  r7, sp
-        mov     r7, sp
-        .pad    #16
-        sub     sp, #16
-        str     r0, [sp, #12]
-        ldr     r0, [sp, #12]
-        str     r0, [sp, #8]
-        b       .LBB0_1
-.LBB0_1:
-        ldr     r0, [sp, #8]
-        push.w  {r4, r5, r6, r7, r8, r9, r10, r11}
-        bic     r0, r0, #1
-        mov     r1, r0
-        mov     r2, r0
-        mov     r3, r0
-        mov     r4, r0
-        mov     r5, r0
-        mov     r6, r0
-        mov     r7, r0
-        mov     r8, r0
-        mov     r9, r0
-        mov     r10, r0
-        mov     r11, r0
-        mov     r12, r0
-        msr     apsr_nzcvq, r0
-        blxns   r0
-        pop.w   {r4, r5, r6, r7, r8, r9, r10, r11}
-        str     r0, [sp, #4]
-        b       .LBB0_2
-.LBB0_2:
-        ldr     r0, [sp, #4]
-        add     sp, #16
-        pop     {r7, pc}
-```
-"##,
-    },
-    LintCompletion {
-        label: "member_constraints",
-        description: r##"# `member_constraints`
-
-The tracking issue for this feature is: [#61997]
-
-[#61997]: https://github.com/rust-lang/rust/issues/61997
-
-------------------------
+## Inputs and outputs
 
-The `member_constraints` feature gate lets you use `impl Trait` syntax with
-multiple unrelated lifetime parameters.
+Now inserting an instruction that does nothing is rather boring. Let us do something that
+actually acts on data:
 
-A simple example is:
+```rust,allow_fail
+#![feature(asm)]
+let x: u64;
+unsafe {
+    asm!("mov {}, 5", out(reg) x);
+}
+assert_eq!(x, 5);
+```
 
-```rust
-#![feature(member_constraints)]
+This will write the value `5` into the `u64` variable `x`.
+You can see that the string literal we use to specify instructions is actually a template string.
+It is governed by the same rules as Rust [format strings][format-syntax].
+The arguments that are inserted into the template however look a bit different then you may
+be familiar with. First we need to specify if the variable is an input or an output of the
+inline assembly. In this case it is an output. We declared this by writing `out`.
+We also need to specify in what kind of register the assembly expects the variable.
+In this case we put it in an arbitrary general purpose register by specifying `reg`.
+The compiler will choose an appropriate register to insert into
+the template and will read the variable from there after the inline assembly finishes executing.
 
-trait Trait<'a, 'b> { }
-impl<T> Trait<'_, '_> for T {}
+Let us see another example that also uses an input:
 
-fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Trait<'a, 'b> {
-  (x, y)
+```rust,allow_fail
+#![feature(asm)]
+let i: u64 = 3;
+let o: u64;
+unsafe {
+    asm!(
+        "mov {0}, {1}",
+        "add {0}, {number}",
+        out(reg) o,
+        in(reg) i,
+        number = const 5,
+    );
 }
-
-fn main() { }
+assert_eq!(o, 8);
 ```
 
-Without the `member_constraints` feature gate, the above example is an
-error because both `'a` and `'b` appear in the impl Trait bounds, but
-neither outlives the other.
-"##,
-    },
-    LintCompletion {
-        label: "allocator_internals",
-        description: r##"# `allocator_internals`
-
-This feature does not have a tracking issue, it is an unstable implementation
-detail of the `global_allocator` feature not intended for use outside the
-compiler.
-
-------------------------
-"##,
-    },
-    LintCompletion {
-        label: "cfg_sanitize",
-        description: r##"# `cfg_sanitize`
+This will add `5` to the input in variable `i` and write the result to variable `o`.
+The particular way this assembly does this is first copying the value from `i` to the output,
+and then adding `5` to it.
 
-The tracking issue for this feature is: [#39699]
+The example shows a few things:
 
-[#39699]: https://github.com/rust-lang/rust/issues/39699
+First, we can see that `asm!` allows multiple template string arguments; each
+one is treated as a separate line of assembly code, as if they were all joined
+together with newlines between them. This makes it easy to format assembly
+code.
 
-------------------------
+Second, we can see that inputs are declared by writing `in` instead of `out`.
 
-The `cfg_sanitize` feature makes it possible to execute different code
-depending on whether a particular sanitizer is enabled or not.
+Third, one of our operands has a type we haven't seen yet, `const`.
+This tells the compiler to expand this argument to value directly inside the assembly template.
+This is only possible for constants and literals.
 
-## Examples
+Fourth, we can see that we can specify an argument number, or name as in any format string.
+For inline assembly templates this is particularly useful as arguments are often used more than once.
+For more complex inline assembly using this facility is generally recommended, as it improves
+readability, and allows reordering instructions without changing the argument order.
 
-```rust
-#![feature(cfg_sanitize)]
+We can further refine the above example to avoid the `mov` instruction:
 
-#[cfg(sanitize = "thread")]
-fn a() {
-    // ...
+```rust,allow_fail
+#![feature(asm)]
+let mut x: u64 = 3;
+unsafe {
+    asm!("add {0}, {number}", inout(reg) x, number = const 5);
 }
+assert_eq!(x, 8);
+```
 
-#[cfg(not(sanitize = "thread"))]
-fn a() {
-    // ...
-}
+We can see that `inout` is used to specify an argument that is both input and output.
+This is different from specifying an input and output separately in that it is guaranteed to assign both to the same register.
 
-fn b() {
-    if cfg!(sanitize = "leak") {
-        // ...
-    } else {
-        // ...
-    }
+It is also possible to specify different variables for the input and output parts of an `inout` operand:
+
+```rust,allow_fail
+#![feature(asm)]
+let x: u64 = 3;
+let y: u64;
+unsafe {
+    asm!("add {0}, {number}", inout(reg) x => y, number = const 5);
 }
+assert_eq!(y, 8);
 ```
-"##,
-    },
-    LintCompletion {
-        label: "cfg_panic",
-        description: r##"# `cfg_panic`
-
-The tracking issue for this feature is: [#77443]
 
-[#77443]: https://github.com/rust-lang/rust/issues/77443
+## Late output operands
 
-------------------------
+The Rust compiler is conservative with its allocation of operands. It is assumed that an `out`
+can be written at any time, and can therefore not share its location with any other argument.
+However, to guarantee optimal performance it is important to use as few registers as possible,
+so they won't have to be saved and reloaded around the inline assembly block.
+To achieve this Rust provides a `lateout` specifier. This can be used on any output that is
+written only after all inputs have been consumed.
+There is also a `inlateout` variant of this specifier.
 
-The `cfg_panic` feature makes it possible to execute different code
-depending on the panic strategy.
+Here is an example where `inlateout` *cannot* be used:
 
-Possible values at the moment are `"unwind"` or `"abort"`, although
-it is possible that new panic strategies may be added to Rust in the
-future.
+```rust,allow_fail
+#![feature(asm)]
+let mut a: u64 = 4;
+let b: u64 = 4;
+let c: u64 = 4;
+unsafe {
+    asm!(
+        "add {0}, {1}",
+        "add {0}, {2}",
+        inout(reg) a,
+        in(reg) b,
+        in(reg) c,
+    );
+}
+assert_eq!(a, 12);
+```
 
-## Examples
+Here the compiler is free to allocate the same register for inputs `b` and `c` since it knows they have the same value. However it must allocate a separate register for `a` since it uses `inout` and not `inlateout`. If `inlateout` was used, then `a` and `c` could be allocated to the same register, in which case the first instruction to overwrite the value of `c` and cause the assembly code to produce the wrong result.
 
-```rust
-#![feature(cfg_panic)]
+However the following example can use `inlateout` since the output is only modified after all input registers have been read:
 
-#[cfg(panic = "unwind")]
-fn a() {
-    // ...
+```rust,allow_fail
+#![feature(asm)]
+let mut a: u64 = 4;
+let b: u64 = 4;
+unsafe {
+    asm!("add {0}, {1}", inlateout(reg) a, in(reg) b);
 }
+assert_eq!(a, 8);
+```
 
-#[cfg(not(panic = "unwind"))]
-fn a() {
-    // ...
-}
+As you can see, this assembly fragment will still work correctly if `a` and `b` are assigned to the same register.
 
-fn b() {
-    if cfg!(panic = "abort") {
-        // ...
-    } else {
-        // ...
-    }
+## Explicit register operands
+
+Some instructions require that the operands be in a specific register.
+Therefore, Rust inline assembly provides some more specific constraint specifiers.
+While `reg` is generally available on any architecture, these are highly architecture specific. E.g. for x86 the general purpose registers `eax`, `ebx`, `ecx`, `edx`, `ebp`, `esi`, and `edi`
+among others can be addressed by their name.
+
+```rust,allow_fail,no_run
+#![feature(asm)]
+let cmd = 0xd1;
+unsafe {
+    asm!("out 0x64, eax", in("eax") cmd);
 }
 ```
-"##,
-    },
-    LintCompletion {
-        label: "ffi_pure",
-        description: r##"# `ffi_pure`
 
-The tracking issue for this feature is: [#58329]
+In this example we call the `out` instruction to output the content of the `cmd` variable
+to port `0x64`. Since the `out` instruction only accepts `eax` (and its sub registers) as operand
+we had to use the `eax` constraint specifier.
 
-------
+Note that unlike other operand types, explicit register operands cannot be used in the template string: you can't use `{}` and should write the register name directly instead. Also, they must appear at the end of the operand list after all other operand types.
 
-The `#[ffi_pure]` attribute applies clang's `pure` attribute to foreign
-functions declarations.
+Consider this example which uses the x86 `mul` instruction:
 
-That is, `#[ffi_pure]` functions shall have no effects except for its return
-value, which shall not change across two consecutive function calls with
-the same parameters.
+```rust,allow_fail
+#![feature(asm)]
+fn mul(a: u64, b: u64) -> u128 {
+    let lo: u64;
+    let hi: u64;
 
-Applying the `#[ffi_pure]` attribute to a function that violates these
-requirements is undefined behavior.
+    unsafe {
+        asm!(
+            // The x86 mul instruction takes rax as an implicit input and writes
+            // the 128-bit result of the multiplication to rax:rdx.
+            "mul {}",
+            in(reg) a,
+            inlateout("rax") b => lo,
+            lateout("rdx") hi
+        );
+    }
 
-This attribute enables Rust to perform common optimizations, like sub-expression
-elimination and loop optimizations. Some common examples of pure functions are
-`strlen` or `memcmp`.
+    ((hi as u128) << 64) + lo as u128
+}
+```
 
-These optimizations are only applicable when the compiler can prove that no
-program state observable by the `#[ffi_pure]` function has changed between calls
-of the function, which could alter the result. See also the `#[ffi_const]`
-attribute, which provides stronger guarantees regarding the allowable behavior
-of a function, enabling further optimization.
-
-## Pitfalls
-
-A `#[ffi_pure]` function can read global memory through the function
-parameters (e.g. pointers), globals, etc. `#[ffi_pure]` functions are not
-referentially-transparent, and are therefore more relaxed than `#[ffi_const]`
-functions.
-
-However, accessing global memory through volatile or atomic reads can violate the
-requirement that two consecutive function calls shall return the same value.
-
-A `pure` function that returns unit has no effect on the abstract machine's
-state.
-
-A `#[ffi_pure]` function must not diverge, neither via a side effect (e.g. a
-call to `abort`) nor by infinite loops.
+This uses the `mul` instruction to multiply two 64-bit inputs with a 128-bit result.
+The only explicit operand is a register, that we fill from the variable `a`.
+The second operand is implicit, and must be the `rax` register, which we fill from the variable `b`.
+The lower 64 bits of the result are stored in `rax` from which we fill the variable `lo`.
+The higher 64 bits are stored in `rdx` from which we fill the variable `hi`.
 
-When translating C headers to Rust FFI, it is worth verifying for which targets
-the `pure` attribute is enabled in those headers, and using the appropriate
-`cfg` macros in the Rust side to match those definitions. While the semantics of
-`pure` are implemented identically by many C and C++ compilers, e.g., clang,
-[GCC], [ARM C/C++ compiler], [IBM ILE C/C++], etc. they are not necessarily
-implemented in this way on all of them. It is therefore also worth verifying
-that the semantics of the C toolchain used to compile the binary being linked
-against are compatible with those of the `#[ffi_pure]`.
+## Clobbered registers
 
+In many cases inline assembly will modify state that is not needed as an output.
+Usually this is either because we have to use a scratch register in the assembly,
+or instructions modify state that we don't need to further examine.
+This state is generally referred to as being "clobbered".
+We need to tell the compiler about this since it may need to save and restore this state
+around the inline assembly block.
 
-[#58329]: https://github.com/rust-lang/rust/issues/58329
-[ARM C/C++ compiler]: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491c/Cacigdac.html
-[GCC]: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-pure-function-attribute
-[IBM ILE C/C++]: https://www.ibm.com/support/knowledgecenter/fr/ssw_ibm_i_71/rzarg/fn_attrib_pure.htm
-"##,
-    },
-    LintCompletion {
-        label: "repr128",
-        description: r##"# `repr128`
+```rust,allow_fail
+#![feature(asm)]
+let ebx: u32;
+let ecx: u32;
 
-The tracking issue for this feature is: [#56071]
+unsafe {
+    asm!(
+        "cpuid",
+        // EAX 4 selects the "Deterministic Cache Parameters" CPUID leaf
+        inout("eax") 4 => _,
+        // ECX 0 selects the L0 cache information.
+        inout("ecx") 0 => ecx,
+        lateout("ebx") ebx,
+        lateout("edx") _,
+    );
+}
 
-[#56071]: https://github.com/rust-lang/rust/issues/56071
+println!(
+    "L1 Cache: {}",
+    ((ebx >> 22) + 1) * (((ebx >> 12) & 0x3ff) + 1) * ((ebx & 0xfff) + 1) * (ecx + 1)
+);
+```
 
-------------------------
+In the example above we use the `cpuid` instruction to get the L1 cache size.
+This instruction writes to `eax`, `ebx`, `ecx`, and `edx`, but for the cache size we only care about the contents of `ebx` and `ecx`.
 
-The `repr128` feature adds support for `#[repr(u128)]` on `enum`s.
+However we still need to tell the compiler that `eax` and `edx` have been modified so that it can save any values that were in these registers before the asm. This is done by declaring these as outputs but with `_` instead of a variable name, which indicates that the output value is to be discarded.
 
-```rust
-#![feature(repr128)]
+This can also be used with a general register class (e.g. `reg`) to obtain a scratch register for use inside the asm code:
 
-#[repr(u128)]
-enum Foo {
-    Bar(u64),
+```rust,allow_fail
+#![feature(asm)]
+// Multiply x by 6 using shifts and adds
+let mut x: u64 = 4;
+unsafe {
+    asm!(
+        "mov {tmp}, {x}",
+        "shl {tmp}, 1",
+        "shl {x}, 2",
+        "add {x}, {tmp}",
+        x = inout(reg) x,
+        tmp = out(reg) _,
+    );
 }
+assert_eq!(x, 4 * 6);
 ```
-"##,
-    },
-    LintCompletion {
-        label: "generators",
-        description: r##"# `generators`
 
-The tracking issue for this feature is: [#43122]
+## Symbol operands
 
-[#43122]: https://github.com/rust-lang/rust/issues/43122
+A special operand type, `sym`, allows you to use the symbol name of a `fn` or `static` in inline assembly code.
+This allows you to call a function or access a global variable without needing to keep its address in a register.
 
-------------------------
+```rust,allow_fail
+#![feature(asm)]
+extern "C" fn foo(arg: i32) {
+    println!("arg = {}", arg);
+}
 
-The `generators` feature gate in Rust allows you to define generator or
-coroutine literals. A generator is a "resumable function" that syntactically
-resembles a closure but compiles to much different semantics in the compiler
-itself. The primary feature of a generator is that it can be suspended during
-execution to be resumed at a later date. Generators use the `yield` keyword to
-"return", and then the caller can `resume` a generator to resume execution just
-after the `yield` keyword.
+fn call_foo(arg: i32) {
+    unsafe {
+        asm!(
+            "call {}",
+            sym foo,
+            // 1st argument in rdi, which is caller-saved
+            inout("rdi") arg => _,
+            // All caller-saved registers must be marked as clobbered
+            out("rax") _, out("rcx") _, out("rdx") _, out("rsi") _,
+            out("r8") _, out("r9") _, out("r10") _, out("r11") _,
+            out("xmm0") _, out("xmm1") _, out("xmm2") _, out("xmm3") _,
+            out("xmm4") _, out("xmm5") _, out("xmm6") _, out("xmm7") _,
+            out("xmm8") _, out("xmm9") _, out("xmm10") _, out("xmm11") _,
+            out("xmm12") _, out("xmm13") _, out("xmm14") _, out("xmm15") _,
+            // Also mark AVX-512 registers as clobbered. This is accepted by the
+            // compiler even if AVX-512 is not enabled on the current target.
+            out("xmm16") _, out("xmm17") _, out("xmm18") _, out("xmm19") _,
+            out("xmm20") _, out("xmm21") _, out("xmm22") _, out("xmm23") _,
+            out("xmm24") _, out("xmm25") _, out("xmm26") _, out("xmm27") _,
+            out("xmm28") _, out("xmm29") _, out("xmm30") _, out("xmm31") _,
+        )
+    }
+}
+```
 
-Generators are an extra-unstable feature in the compiler right now. Added in
-[RFC 2033] they're mostly intended right now as a information/constraint
-gathering phase. The intent is that experimentation can happen on the nightly
-compiler before actual stabilization. A further RFC will be required to
-stabilize generators/coroutines and will likely contain at least a few small
-tweaks to the overall design.
+Note that the `fn` or `static` item does not need to be public or `#[no_mangle]`:
+the compiler will automatically insert the appropriate mangled symbol name into the assembly code.
 
-[RFC 2033]: https://github.com/rust-lang/rfcs/pull/2033
+## Register template modifiers
 
-A syntactical example of a generator is:
+In some cases, fine control is needed over the way a register name is formatted when inserted into the template string. This is needed when an architecture's assembly language has several names for the same register, each typically being a "view" over a subset of the register (e.g. the low 32 bits of a 64-bit register).
 
-```rust
-#![feature(generators, generator_trait)]
+By default the compiler will always choose the name that refers to the full register size (e.g. `rax` on x86-64, `eax` on x86, etc).
 
-use std::ops::{Generator, GeneratorState};
-use std::pin::Pin;
+This default can be overriden by using modifiers on the template string operands, just like you would with format strings:
 
-fn main() {
-    let mut generator = || {
-        yield 1;
-        return "foo"
-    };
+```rust,allow_fail
+#![feature(asm)]
+let mut x: u16 = 0xab;
 
-    match Pin::new(&mut generator).resume(()) {
-        GeneratorState::Yielded(1) => {}
-        _ => panic!("unexpected value from resume"),
-    }
-    match Pin::new(&mut generator).resume(()) {
-        GeneratorState::Complete("foo") => {}
-        _ => panic!("unexpected value from resume"),
-    }
+unsafe {
+    asm!("mov {0:h}, {0:l}", inout(reg_abcd) x);
 }
+
+assert_eq!(x, 0xabab);
 ```
 
-Generators are closure-like literals which can contain a `yield` statement. The
-`yield` statement takes an optional expression of a value to yield out of the
-generator. All generator literals implement the `Generator` trait in the
-`std::ops` module. The `Generator` trait has one main method, `resume`, which
-resumes execution of the generator at the previous suspension point.
+In this example, we use the `reg_abcd` register class to restrict the register allocator to the 4 legacy x86 register (`ax`, `bx`, `cx`, `dx`) of which the first two bytes can be addressed independently.
 
-An example of the control flow of generators is that the following example
-prints all numbers in order:
+Let us assume that the register allocator has chosen to allocate `x` in the `ax` register.
+The `h` modifier will emit the register name for the high byte of that register and the `l` modifier will emit the register name for the low byte. The asm code will therefore be expanded as `mov ah, al` which copies the low byte of the value into the high byte.
 
-```rust
-#![feature(generators, generator_trait)]
+If you use a smaller data type (e.g. `u16`) with an operand and forget the use template modifiers, the compiler will emit a warning and suggest the correct modifier to use.
 
-use std::ops::Generator;
-use std::pin::Pin;
+## Memory address operands
 
-fn main() {
-    let mut generator = || {
-        println!("2");
-        yield;
-        println!("4");
-    };
+Sometimes assembly instructions require operands passed via memory addresses/memory locations.
+You have to manually use the memory address syntax specified by the respectively architectures.
+For example, in x86/x86_64 and intel assembly syntax, you should wrap inputs/outputs in `[]`
+to indicate they are memory operands:
 
-    println!("1");
-    Pin::new(&mut generator).resume(());
-    println!("3");
-    Pin::new(&mut generator).resume(());
-    println!("5");
+```rust,allow_fail
+#![feature(asm, llvm_asm)]
+# fn load_fpu_control_word(control: u16) {
+unsafe {
+    asm!("fldcw [{}]", in(reg) &control, options(nostack));
+
+    // Previously this would have been written with the deprecated `llvm_asm!` like this
+    llvm_asm!("fldcw $0" :: "m" (control) :: "volatile");
 }
+# }
 ```
 
-At this time the main intended use case of generators is an implementation
-primitive for async/await syntax, but generators will likely be extended to
-ergonomic implementations of iterators and other primitives in the future.
-Feedback on the design and usage is always appreciated!
+## Labels
 
-### The `Generator` trait
+The compiler is allowed to instantiate multiple copies an `asm!` block, for example when the function containing it is inlined in multiple places. As a consequence, you should only use GNU assembler [local labels] inside inline assembly code. Defining symbols in assembly code may lead to assembler and/or linker errors due to duplicate symbol definitions.
 
-The `Generator` trait in `std::ops` currently looks like:
+Moreover, due to [an llvm bug], you shouldn't use labels exclusively made of `0` and `1` digits, e.g. `0`, `11` or `101010`, as they may end up being interpreted as binary values.
 
-```rust
-# #![feature(arbitrary_self_types, generator_trait)]
-# use std::ops::GeneratorState;
-# use std::pin::Pin;
+```rust,allow_fail
+#![feature(asm)]
 
-pub trait Generator<R = ()> {
-    type Yield;
-    type Return;
-    fn resume(self: Pin<&mut Self>, resume: R) -> GeneratorState<Self::Yield, Self::Return>;
+let mut a = 0;
+unsafe {
+    asm!(
+        "mov {0}, 10",
+        "2:",
+        "sub {0}, 1",
+        "cmp {0}, 3",
+        "jle 2f",
+        "jmp 2b",
+        "2:",
+        "add {0}, 2",
+        out(reg) a
+    );
 }
+assert_eq!(a, 5);
 ```
 
-The `Generator::Yield` type is the type of values that can be yielded with the
-`yield` statement. The `Generator::Return` type is the returned type of the
-generator. This is typically the last expression in a generator's definition or
-any value passed to `return` in a generator. The `resume` function is the entry
-point for executing the `Generator` itself.
+This will decrement the `{0}` register value from 10 to 3, then add 2 and store it in `a`.
 
-The return value of `resume`, `GeneratorState`, looks like:
+This example show a few thing:
 
-```rust
-pub enum GeneratorState<Y, R> {
-    Yielded(Y),
-    Complete(R),
-}
-```
+First that the same number can be used as a label multiple times in the same inline block.
 
-The `Yielded` variant indicates that the generator can later be resumed. This
-corresponds to a `yield` point in a generator. The `Complete` variant indicates
-that the generator is complete and cannot be resumed again. Calling `resume`
-after a generator has returned `Complete` will likely result in a panic of the
-program.
+Second, that when a numeric label is used as a reference (as an instruction operand, for example), the suffixes b (“backward”) or f (“forward”) should be added to the numeric label. It will then refer to the nearest label defined by this number in this direction.
 
-### Closure-like semantics
+[local labels]: https://sourceware.org/binutils/docs/as/Symbol-Names.html#Local-Labels
+[an llvm bug]: https://bugs.llvm.org/show_bug.cgi?id=36144
 
-The closure-like syntax for generators alludes to the fact that they also have
-closure-like semantics. Namely:
+## Options
 
-* When created, a generator executes no code. A closure literal does not
-  actually execute any of the closure's code on construction, and similarly a
-  generator literal does not execute any code inside the generator when
-  constructed.
+By default, an inline assembly block is treated the same way as an external FFI function call with a custom calling convention: it may read/write memory, have observable side effects, etc. However in many cases, it is desirable to give the compiler more information about what the assembly code is actually doing so that it can optimize better.
 
-* Generators can capture outer variables by reference or by move, and this can
-  be tweaked with the `move` keyword at the beginning of the closure. Like
-  closures all generators will have an implicit environment which is inferred by
-  the compiler. Outer variables can be moved into a generator for use as the
-  generator progresses.
-
-* Generator literals produce a value with a unique type which implements the
-  `std::ops::Generator` trait. This allows actual execution of the generator
-  through the `Generator::resume` method as well as also naming it in return
-  types and such.
-
-* Traits like `Send` and `Sync` are automatically implemented for a `Generator`
-  depending on the captured variables of the environment. Unlike closures,
-  generators also depend on variables live across suspension points. This means
-  that although the ambient environment may be `Send` or `Sync`, the generator
-  itself may not be due to internal variables live across `yield` points being
-  not-`Send` or not-`Sync`. Note that generators do
-  not implement traits like `Copy` or `Clone` automatically.
+Let's take our previous example of an `add` instruction:
 
-* Whenever a generator is dropped it will drop all captured environment
-  variables.
+```rust,allow_fail
+#![feature(asm)]
+let mut a: u64 = 4;
+let b: u64 = 4;
+unsafe {
+    asm!(
+        "add {0}, {1}",
+        inlateout(reg) a, in(reg) b,
+        options(pure, nomem, nostack),
+    );
+}
+assert_eq!(a, 8);
+```
 
-### Generators as state machines
+Options can be provided as an optional final argument to the `asm!` macro. We specified three options here:
+- `pure` means that the asm code has no observable side effects and that its output depends only on its inputs. This allows the compiler optimizer to call the inline asm fewer times or even eliminate it entirely.
+- `nomem` means that the asm code does not read or write to memory. By default the compiler will assume that inline assembly can read or write any memory address that is accessible to it (e.g. through a pointer passed as an operand, or a global).
+- `nostack` means that the asm code does not push any data onto the stack. This allows the compiler to use optimizations such as the stack red zone on x86-64 to avoid stack pointer adjustments.
 
-In the compiler, generators are currently compiled as state machines. Each
-`yield` expression will correspond to a different state that stores all live
-variables over that suspension point. Resumption of a generator will dispatch on
-the current state and then execute internally until a `yield` is reached, at
-which point all state is saved off in the generator and a value is returned.
+These allow the compiler to better optimize code using `asm!`, for example by eliminating pure `asm!` blocks whose outputs are not needed.
 
-Let's take a look at an example to see what's going on here:
+See the reference for the full list of available options and their effects.
 
-```rust
-#![feature(generators, generator_trait)]
+# Reference-level explanation
+[reference-level-explanation]: #reference-level-explanation
 
-use std::ops::Generator;
-use std::pin::Pin;
+Inline assembler is implemented as an unsafe macro `asm!()`.
+The first argument to this macro is a template string literal used to build the final assembly.
+The following arguments specify input and output operands.
+When required, options are specified as the final argument.
 
-fn main() {
-    let ret = "foo";
-    let mut generator = move || {
-        yield 1;
-        return ret
-    };
+The following ABNF specifies the general syntax:
 
-    Pin::new(&mut generator).resume(());
-    Pin::new(&mut generator).resume(());
-}
+```text
+dir_spec := "in" / "out" / "lateout" / "inout" / "inlateout"
+reg_spec := <register class> / "<explicit register>"
+operand_expr := expr / "_" / expr "=>" expr / expr "=>" "_"
+reg_operand := dir_spec "(" reg_spec ")" operand_expr
+operand := reg_operand / "const" const_expr / "sym" path
+option := "pure" / "nomem" / "readonly" / "preserves_flags" / "noreturn" / "nostack" / "att_syntax"
+options := "options(" option *["," option] [","] ")"
+asm := "asm!(" format_string *("," format_string) *("," [ident "="] operand) ["," options] [","] ")"
 ```
 
-This generator literal will compile down to something similar to:
+The macro will initially be supported only on ARM, AArch64, Hexagon, PowerPC, x86, x86-64 and RISC-V targets. Support for more targets may be added in the future. The compiler will emit an error if `asm!` is used on an unsupported target.
 
-```rust
-#![feature(arbitrary_self_types, generators, generator_trait)]
+[format-syntax]: https://doc.rust-lang.org/std/fmt/#syntax
 
-use std::ops::{Generator, GeneratorState};
-use std::pin::Pin;
+## Template string arguments
 
-fn main() {
-    let ret = "foo";
-    let mut generator = {
-        enum __Generator {
-            Start(&'static str),
-            Yield1(&'static str),
-            Done,
-        }
+The assembler template uses the same syntax as [format strings][format-syntax] (i.e. placeholders are specified by curly braces). The corresponding arguments are accessed in order, by index, or by name. However, implicit named arguments (introduced by [RFC #2795][rfc-2795]) are not supported.
 
-        impl Generator for __Generator {
-            type Yield = i32;
-            type Return = &'static str;
+An `asm!` invocation may have one or more template string arguments; an `asm!` with multiple template string arguments is treated as if all the strings were concatenated with a `\n` between them. The expected usage is for each template string argument to correspond to a line of assembly code. All template string arguments must appear before any other arguments.
 
-            fn resume(mut self: Pin<&mut Self>, resume: ()) -> GeneratorState<i32, &'static str> {
-                use std::mem;
-                match mem::replace(&mut *self, __Generator::Done) {
-                    __Generator::Start(s) => {
-                        *self = __Generator::Yield1(s);
-                        GeneratorState::Yielded(1)
-                    }
+As with format strings, named arguments must appear after positional arguments. Explicit register operands must appear at the end of the operand list, after named arguments if any.
 
-                    __Generator::Yield1(s) => {
-                        *self = __Generator::Done;
-                        GeneratorState::Complete(s)
-                    }
+Explicit register operands cannot be used by placeholders in the template string. All other named and positional operands must appear at least once in the template string, otherwise a compiler error is generated.
 
-                    __Generator::Done => {
-                        panic!("generator resumed after completion")
-                    }
-                }
-            }
-        }
+The exact assembly code syntax is target-specific and opaque to the compiler except for the way operands are substituted into the template string to form the code passed to the assembler.
 
-        __Generator::Start(ret)
-    };
+The 5 targets specified in this RFC (x86, ARM, AArch64, RISC-V, Hexagon) all use the assembly code syntax of the GNU assembler (GAS). On x86, the `.intel_syntax noprefix` mode of GAS is used by default. On ARM, the `.syntax unified` mode is used. These targets impose an additional restriction on the assembly code: any assembler state (e.g. the current section which can be changed with `.section`) must be restored to its original value at the end of the asm string. Assembly code that does not conform to the GAS syntax will result in assembler-specific behavior.
 
-    Pin::new(&mut generator).resume(());
-    Pin::new(&mut generator).resume(());
-}
-```
+[rfc-2795]: https://github.com/rust-lang/rfcs/pull/2795
 
-Notably here we can see that the compiler is generating a fresh type,
-`__Generator` in this case. This type has a number of states (represented here
-as an `enum`) corresponding to each of the conceptual states of the generator.
-At the beginning we're closing over our outer variable `foo` and then that
-variable is also live over the `yield` point, so it's stored in both states.
+## Operand type
 
-When the generator starts it'll immediately yield 1, but it saves off its state
-just before it does so indicating that it has reached the yield point. Upon
-resuming again we'll execute the `return ret` which returns the `Complete`
-state.
+Several types of operands are supported:
 
-Here we can also note that the `Done` state, if resumed, panics immediately as
-it's invalid to resume a completed generator. It's also worth noting that this
-is just a rough desugaring, not a normative specification for what the compiler
-does.
-"##,
-    },
-    LintCompletion {
-        label: "non_ascii_idents",
-        description: r##"# `non_ascii_idents`
+* `in(<reg>) <expr>`
+  - `<reg>` can refer to a register class or an explicit register. The allocated register name is substituted into the asm template string.
+  - The allocated register will contain the value of `<expr>` at the start of the asm code.
+  - The allocated register must contain the same value at the end of the asm code (except if a `lateout` is allocated to the same register).
+* `out(<reg>) <expr>`
+  - `<reg>` can refer to a register class or an explicit register. The allocated register name is substituted into the asm template string.
+  - The allocated register will contain an undefined value at the start of the asm code.
+  - `<expr>` must be a (possibly uninitialized) place expression, to which the contents of the allocated register is written to at the end of the asm code.
+  - An underscore (`_`) may be specified instead of an expression, which will cause the contents of the register to be discarded at the end of the asm code (effectively acting as a clobber).
+* `lateout(<reg>) <expr>`
+  - Identical to `out` except that the register allocator can reuse a register allocated to an `in`.
+  - You should only write to the register after all inputs are read, otherwise you may clobber an input.
+* `inout(<reg>) <expr>`
+  - `<reg>` can refer to a register class or an explicit register. The allocated register name is substituted into the asm template string.
+  - The allocated register will contain the value of `<expr>` at the start of the asm code.
+  - `<expr>` must be a mutable initialized place expression, to which the contents of the allocated register is written to at the end of the asm code.
+* `inout(<reg>) <in expr> => <out expr>`
+  - Same as `inout` except that the initial value of the register is taken from the value of `<in expr>`.
+  - `<out expr>` must be a (possibly uninitialized) place expression, to which the contents of the allocated register is written to at the end of the asm code.
+  - An underscore (`_`) may be specified instead of an expression for `<out expr>`, which will cause the contents of the register to be discarded at the end of the asm code (effectively acting as a clobber).
+  - `<in expr>` and `<out expr>` may have different types.
+* `inlateout(<reg>) <expr>` / `inlateout(<reg>) <in expr> => <out expr>`
+  - Identical to `inout` except that the register allocator can reuse a register allocated to an `in` (this can happen if the compiler knows the `in` has the same initial value as the `inlateout`).
+  - You should only write to the register after all inputs are read, otherwise you may clobber an input.
+* `const <expr>`
+  - `<expr>` must be an integer constant expression.
+  - The value of the expression is formatted as a string and substituted directly into the asm template string.
+* `sym <path>`
+  - `<path>` must refer to a `fn` or `static`.
+  - A mangled symbol name referring to the item is substituted into the asm template string.
+  - The substituted string does not include any modifiers (e.g. GOT, PLT, relocations, etc).
+  - `<path>` is allowed to point to a `#[thread_local]` static, in which case the asm code can combine the symbol with relocations (e.g. `@plt`, `@TPOFF`) to read from thread-local data.
 
-The tracking issue for this feature is: [#55467]
+Operand expressions are evaluated from left to right, just like function call arguments. After the `asm!` has executed, outputs are written to in left to right order. This is significant if two outputs point to the same place: that place will contain the value of the rightmost output.
 
-[#55467]: https://github.com/rust-lang/rust/issues/55467
+## Register operands
 
-------------------------
+Input and output operands can be specified either as an explicit register or as a register class from which the register allocator can select a register. Explicit registers are specified as string literals (e.g. `"eax"`) while register classes are specified as identifiers (e.g. `reg`). Using string literals for register names enables support for architectures that use special characters in register names, such as MIPS (`$0`, `$1`, etc).
 
-The `non_ascii_idents` feature adds support for non-ASCII identifiers.
+Note that explicit registers treat register aliases (e.g. `r14` vs `lr` on ARM) and smaller views of a register (e.g. `eax` vs `rax`) as equivalent to the base register. It is a compile-time error to use the same explicit register for two input operands or two output operands. Additionally, it is also a compile-time error to use overlapping registers (e.g. ARM VFP) in input operands or in output operands.
 
-## Examples
+Only the following types are allowed as operands for inline assembly:
+- Integers (signed and unsigned)
+- Floating-point numbers
+- Pointers (thin only)
+- Function pointers
+- SIMD vectors (structs defined with `#[repr(simd)]` and which implement `Copy`). This includes architecture-specific vector types defined in `std::arch` such as `__m128` (x86) or `int8x16_t` (ARM).
 
-```rust
-#![feature(non_ascii_idents)]
+Here is the list of currently supported register classes:
 
-const ε: f64 = 0.00001f64;
-const Π: f64 = 3.14f64;
-```
+| Architecture | Register class | Registers | LLVM constraint code |
+| ------------ | -------------- | --------- | -------------------- |
+| x86 | `reg` | `ax`, `bx`, `cx`, `dx`, `si`, `di`, `bp`, `r[8-15]` (x86-64 only) | `r` |
+| x86 | `reg_abcd` | `ax`, `bx`, `cx`, `dx` | `Q` |
+| x86-32 | `reg_byte` | `al`, `bl`, `cl`, `dl`, `ah`, `bh`, `ch`, `dh` | `q` |
+| x86-64 | `reg_byte`\* | `al`, `bl`, `cl`, `dl`, `sil`, `dil`, `bpl`, `r[8-15]b` | `q` |
+| x86 | `xmm_reg` | `xmm[0-7]` (x86) `xmm[0-15]` (x86-64) | `x` |
+| x86 | `ymm_reg` | `ymm[0-7]` (x86) `ymm[0-15]` (x86-64) | `x` |
+| x86 | `zmm_reg` | `zmm[0-7]` (x86) `zmm[0-31]` (x86-64) | `v` |
+| x86 | `kreg` | `k[1-7]` | `Yk` |
+| AArch64 | `reg` | `x[0-30]` | `r` |
+| AArch64 | `vreg` | `v[0-31]` | `w` |
+| AArch64 | `vreg_low16` | `v[0-15]` | `x` |
+| ARM | `reg` | `r[0-12]`, `r14` | `r` |
+| ARM (Thumb) | `reg_thumb` | `r[0-r7]` | `l` |
+| ARM (ARM) | `reg_thumb` | `r[0-r12]`, `r14` | `l` |
+| ARM | `sreg` | `s[0-31]` | `t` |
+| ARM | `sreg_low16` | `s[0-15]` | `x` |
+| ARM | `dreg` | `d[0-31]` | `w` |
+| ARM | `dreg_low16` | `d[0-15]` | `t` |
+| ARM | `dreg_low8` | `d[0-8]` | `x` |
+| ARM | `qreg` | `q[0-15]` | `w` |
+| ARM | `qreg_low8` | `q[0-7]` | `t` |
+| ARM | `qreg_low4` | `q[0-3]` | `x` |
+| MIPS | `reg` | `$[2-25]` | `r` |
+| MIPS | `freg` | `$f[0-31]` | `f` |
+| NVPTX | `reg16` | None\* | `h` |
+| NVPTX | `reg32` | None\* | `r` |
+| NVPTX | `reg64` | None\* | `l` |
+| RISC-V | `reg` | `x1`, `x[5-7]`, `x[9-15]`, `x[16-31]` (non-RV32E) | `r` |
+| RISC-V | `freg` | `f[0-31]` | `f` |
+| Hexagon | `reg` | `r[0-28]` | `r` |
+| PowerPC | `reg` | `r[0-31]` | `r` |
+| PowerPC | `reg_nonzero` | | `r[1-31]` | `b` |
+| PowerPC | `freg` | `f[0-31]` | `f` |
+| wasm32 | `local` | None\* | `r` |
 
-## Changes to the language reference
+> **Note**: On x86 we treat `reg_byte` differently from `reg` because the compiler can allocate `al` and `ah` separately whereas `reg` reserves the whole register.
+>
+> Note #2: On x86-64 the high byte registers (e.g. `ah`) are not available in the `reg_byte` register class.
+>
+> Note #3: NVPTX doesn't have a fixed register set, so named registers are not supported.
+>
+> Note #4: WebAssembly doesn't have registers, so named registers are not supported.
 
-> **<sup>Lexer:<sup>**\
-> IDENTIFIER :\
-> &nbsp;&nbsp; &nbsp;&nbsp; XID_start XID_continue<sup>\*</sup>\
-> &nbsp;&nbsp; | `_` XID_continue<sup>+</sup>
+Additional register classes may be added in the future based on demand (e.g. MMX, x87, etc).
 
-An identifier is any nonempty Unicode string of the following form:
+Each register class has constraints on which value types they can be used with. This is necessary because the way a value is loaded into a register depends on its type. For example, on big-endian systems, loading a `i32x4` and a `i8x16` into a SIMD register may result in different register contents even if the byte-wise memory representation of both values is identical. The availability of supported types for a particular register class may depend on what target features are currently enabled.
 
-Either
+| Architecture | Register class | Target feature | Allowed types |
+| ------------ | -------------- | -------------- | ------------- |
+| x86-32 | `reg` | None | `i16`, `i32`, `f32` |
+| x86-64 | `reg` | None | `i16`, `i32`, `f32`, `i64`, `f64` |
+| x86 | `reg_byte` | None | `i8` |
+| x86 | `xmm_reg` | `sse` | `i32`, `f32`, `i64`, `f64`, <br> `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` |
+| x86 | `ymm_reg` | `avx` | `i32`, `f32`, `i64`, `f64`, <br> `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` <br> `i8x32`, `i16x16`, `i32x8`, `i64x4`, `f32x8`, `f64x4` |
+| x86 | `zmm_reg` | `avx512f` | `i32`, `f32`, `i64`, `f64`, <br> `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` <br> `i8x32`, `i16x16`, `i32x8`, `i64x4`, `f32x8`, `f64x4` <br> `i8x64`, `i16x32`, `i32x16`, `i64x8`, `f32x16`, `f64x8` |
+| x86 | `kreg` | `axv512f` | `i8`, `i16` |
+| x86 | `kreg` | `axv512bw` | `i32`, `i64` |
+| AArch64 | `reg` | None | `i8`, `i16`, `i32`, `f32`, `i64`, `f64` |
+| AArch64 | `vreg` | `fp` | `i8`, `i16`, `i32`, `f32`, `i64`, `f64`, <br> `i8x8`, `i16x4`, `i32x2`, `i64x1`, `f32x2`, `f64x1`, <br> `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` |
+| ARM | `reg` | None | `i8`, `i16`, `i32`, `f32` |
+| ARM | `sreg` | `vfp2` | `i32`, `f32` |
+| ARM | `dreg` | `vfp2` | `i64`, `f64`, `i8x8`, `i16x4`, `i32x2`, `i64x1`, `f32x2` |
+| ARM | `qreg` | `neon` | `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4` |
+| MIPS32 | `reg` | None | `i8`, `i16`, `i32`, `f32` |
+| MIPS32 | `freg` | None | `f32`, `f64` |
+| MIPS64 | `reg` | None | `i8`, `i16`, `i32`, `i64`, `f32`, `f64` |
+| MIPS64 | `freg` | None | `f32`, `f64` |
+| NVPTX | `reg16` | None | `i8`, `i16` |
+| NVPTX | `reg32` | None | `i8`, `i16`, `i32`, `f32` |
+| NVPTX | `reg64` | None | `i8`, `i16`, `i32`, `f32`, `i64`, `f64` |
+| RISC-V32 | `reg` | None | `i8`, `i16`, `i32`, `f32` |
+| RISC-V64 | `reg` | None | `i8`, `i16`, `i32`, `f32`, `i64`, `f64` |
+| RISC-V | `freg` | `f` | `f32` |
+| RISC-V | `freg` | `d` | `f64` |
+| Hexagon | `reg` | None | `i8`, `i16`, `i32`, `f32` |
+| PowerPC | `reg` | None | `i8`, `i16`, `i32` |
+| PowerPC | `reg_nonzero` | None | `i8`, `i16`, `i32` |
+| PowerPC | `freg` | None | `f32`, `f64` |
+| wasm32 | `local` | None | `i8` `i16` `i32` `i64` `f32` `f64` |
 
-   * The first character has property [`XID_start`]
-   * The remaining characters have property [`XID_continue`]
+> **Note**: For the purposes of the above table pointers, function pointers and `isize`/`usize` are treated as the equivalent integer type (`i16`/`i32`/`i64` depending on the target).
 
-Or
+If a value is of a smaller size than the register it is allocated in then the upper bits of that register will have an undefined value for inputs and will be ignored for outputs. The only exception is the `freg` register class on RISC-V where `f32` values are NaN-boxed in a `f64` as required by the RISC-V architecture.
 
-   * The first character is `_`
-   * The identifier is more than one character, `_` alone is not an identifier
-   * The remaining characters have property [`XID_continue`]
+When separate input and output expressions are specified for an `inout` operand, both expressions must have the same type. The only exception is if both operands are pointers or integers, in which case they are only required to have the same size. This restriction exists because the register allocators in LLVM and GCC sometimes cannot handle tied operands with different types.
 
-that does _not_ occur in the set of [strict keywords].
+## Register names
 
-> **Note**: [`XID_start`] and [`XID_continue`] as character properties cover the
-> character ranges used to form the more familiar C and Java language-family
-> identifiers.
+Some registers have multiple names. These are all treated by the compiler as identical to the base register name. Here is the list of all supported register aliases:
 
-[`XID_start`]:  http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Start%3A%5D&abb=on&g=&i=
-[`XID_continue`]: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Continue%3A%5D&abb=on&g=&i=
-[strict keywords]: ../../reference/keywords.md#strict-keywords
-"##,
-    },
-    LintCompletion {
-        label: "compiler_builtins",
-        description: r##"# `compiler_builtins`
+| Architecture | Base register | Aliases |
+| ------------ | ------------- | ------- |
+| x86 | `ax` | `eax`, `rax` |
+| x86 | `bx` | `ebx`, `rbx` |
+| x86 | `cx` | `ecx`, `rcx` |
+| x86 | `dx` | `edx`, `rdx` |
+| x86 | `si` | `esi`, `rsi` |
+| x86 | `di` | `edi`, `rdi` |
+| x86 | `bp` | `bpl`, `ebp`, `rbp` |
+| x86 | `sp` | `spl`, `esp`, `rsp` |
+| x86 | `ip` | `eip`, `rip` |
+| x86 | `st(0)` | `st` |
+| x86 | `r[8-15]` | `r[8-15]b`, `r[8-15]w`, `r[8-15]d` |
+| x86 | `xmm[0-31]` | `ymm[0-31]`, `zmm[0-31]` |
+| AArch64 | `x[0-30]` | `w[0-30]` |
+| AArch64 | `x29` | `fp` |
+| AArch64 | `x30` | `lr` |
+| AArch64 | `sp` | `wsp` |
+| AArch64 | `xzr` | `wzr` |
+| AArch64 | `v[0-31]` | `b[0-31]`, `h[0-31]`, `s[0-31]`, `d[0-31]`, `q[0-31]` |
+| ARM | `r[0-3]` | `a[1-4]` |
+| ARM | `r[4-9]` | `v[1-6]` |
+| ARM | `r9` | `rfp` |
+| ARM | `r10` | `sl` |
+| ARM | `r11` | `fp` |
+| ARM | `r12` | `ip` |
+| ARM | `r13` | `sp` |
+| ARM | `r14` | `lr` |
+| ARM | `r15` | `pc` |
+| RISC-V | `x0` | `zero` |
+| RISC-V | `x1` | `ra` |
+| RISC-V | `x2` | `sp` |
+| RISC-V | `x3` | `gp` |
+| RISC-V | `x4` | `tp` |
+| RISC-V | `x[5-7]` | `t[0-2]` |
+| RISC-V | `x8` | `fp`, `s0` |
+| RISC-V | `x9` | `s1` |
+| RISC-V | `x[10-17]` | `a[0-7]` |
+| RISC-V | `x[18-27]` | `s[2-11]` |
+| RISC-V | `x[28-31]` | `t[3-6]` |
+| RISC-V | `f[0-7]` | `ft[0-7]` |
+| RISC-V | `f[8-9]` | `fs[0-1]` |
+| RISC-V | `f[10-17]` | `fa[0-7]` |
+| RISC-V | `f[18-27]` | `fs[2-11]` |
+| RISC-V | `f[28-31]` | `ft[8-11]` |
+| Hexagon | `r29` | `sp` |
+| Hexagon | `r30` | `fr` |
+| Hexagon | `r31` | `lr` |
 
-This feature is internal to the Rust compiler and is not intended for general use.
+Some registers cannot be used for input or output operands:
 
-------------------------
-"##,
-    },
-    LintCompletion {
-        label: "or_patterns",
-        description: r##"# `or_patterns`
+| Architecture | Unsupported register | Reason |
+| ------------ | -------------------- | ------ |
+| All | `sp` | The stack pointer must be restored to its original value at the end of an asm code block. |
+| All | `bp` (x86), `x29` (AArch64), `x8` (RISC-V), `fr` (Hexagon), `$fp` (MIPS) | The frame pointer cannot be used as an input or output. |
+| ARM | `r7` or `r11` | On ARM the frame pointer can be either `r7` or `r11` depending on the target. The frame pointer cannot be used as an input or output. |
+| All | `si` (x86-32), `bx` (x86-64), `r6` (ARM), `x19` (AArch64), `r19` (Hexagon), `x9` (RISC-V) | This is used internally by LLVM as a "base pointer" for functions with complex stack frames. |
+| x86 | `k0` | This is a constant zero register which can't be modified. |
+| x86 | `ip` | This is the program counter, not a real register. |
+| x86 | `mm[0-7]` | MMX registers are not currently supported (but may be in the future). |
+| x86 | `st([0-7])` | x87 registers are not currently supported (but may be in the future). |
+| AArch64 | `xzr` | This is a constant zero register which can't be modified. |
+| ARM | `pc` | This is the program counter, not a real register. |
+| ARM | `r9` | This is a reserved register on some ARM targets. |
+| MIPS | `$0` or `$zero` | This is a constant zero register which can't be modified. |
+| MIPS | `$1` or `$at` | Reserved for assembler. |
+| MIPS | `$26`/`$k0`, `$27`/`$k1` | OS-reserved registers. |
+| MIPS | `$28`/`$gp` | Global pointer cannot be used as inputs or outputs. |
+| MIPS | `$ra` | Return address cannot be used as inputs or outputs. |
+| RISC-V | `x0` | This is a constant zero register which can't be modified. |
+| RISC-V | `gp`, `tp` | These registers are reserved and cannot be used as inputs or outputs. |
+| Hexagon | `lr` | This is the link register which cannot be used as an input or output. |
 
-The tracking issue for this feature is: [#54883]
+In some cases LLVM will allocate a "reserved register" for `reg` operands even though this register cannot be explicitly specified. Assembly code making use of reserved registers should be careful since `reg` operands may alias with those registers. Reserved registers are the frame pointer and base pointer
+- The frame pointer and LLVM base pointer on all architectures.
+- `r9` on ARM.
+- `x18` on AArch64.
 
-[#54883]: https://github.com/rust-lang/rust/issues/54883
+## Template modifiers
 
-------------------------
+The placeholders can be augmented by modifiers which are specified after the `:` in the curly braces. These modifiers do not affect register allocation, but change the way operands are formatted when inserted into the template string. Only one modifier is allowed per template placeholder.
 
-The `or_pattern` language feature allows `|` to be arbitrarily nested within
-a pattern, for example, `Some(A(0) | B(1 | 2))` becomes a valid pattern.
+The supported modifiers are a subset of LLVM's (and GCC's) [asm template argument modifiers][llvm-argmod], but do not use the same letter codes.
 
-## Examples
+| Architecture | Register class | Modifier | Example output | LLVM modifier |
+| ------------ | -------------- | -------- | -------------- | ------------- |
+| x86-32 | `reg` | None | `eax` | `k` |
+| x86-64 | `reg` | None | `rax` | `q` |
+| x86-32 | `reg_abcd` | `l` | `al` | `b` |
+| x86-64 | `reg` | `l` | `al` | `b` |
+| x86 | `reg_abcd` | `h` | `ah` | `h` |
+| x86 | `reg` | `x` | `ax` | `w` |
+| x86 | `reg` | `e` | `eax` | `k` |
+| x86-64 | `reg` | `r` | `rax` | `q` |
+| x86 | `reg_byte` | None | `al` / `ah` | None |
+| x86 | `xmm_reg` | None | `xmm0` | `x` |
+| x86 | `ymm_reg` | None | `ymm0` | `t` |
+| x86 | `zmm_reg` | None | `zmm0` | `g` |
+| x86 | `*mm_reg` | `x` | `xmm0` | `x` |
+| x86 | `*mm_reg` | `y` | `ymm0` | `t` |
+| x86 | `*mm_reg` | `z` | `zmm0` | `g` |
+| x86 | `kreg` | None | `k1` | None |
+| AArch64 | `reg` | None | `x0` | `x` |
+| AArch64 | `reg` | `w` | `w0` | `w` |
+| AArch64 | `reg` | `x` | `x0` | `x` |
+| AArch64 | `vreg` | None | `v0` | None |
+| AArch64 | `vreg` | `v` | `v0` | None |
+| AArch64 | `vreg` | `b` | `b0` | `b` |
+| AArch64 | `vreg` | `h` | `h0` | `h` |
+| AArch64 | `vreg` | `s` | `s0` | `s` |
+| AArch64 | `vreg` | `d` | `d0` | `d` |
+| AArch64 | `vreg` | `q` | `q0` | `q` |
+| ARM | `reg` | None | `r0` | None |
+| ARM | `sreg` | None | `s0` | None |
+| ARM | `dreg` | None | `d0` | `P` |
+| ARM | `qreg` | None | `q0` | `q` |
+| ARM | `qreg` | `e` / `f` | `d0` / `d1` | `e` / `f` |
+| MIPS | `reg` | None | `$2` | None |
+| MIPS | `freg` | None | `$f0` | None |
+| NVPTX | `reg16` | None | `rs0` | None |
+| NVPTX | `reg32` | None | `r0` | None |
+| NVPTX | `reg64` | None | `rd0` | None |
+| RISC-V | `reg` | None | `x1` | None |
+| RISC-V | `freg` | None | `f0` | None |
+| Hexagon | `reg` | None | `r0` | None |
+| PowerPC | `reg` | None | `0` | None |
+| PowerPC | `reg_nonzero` | None | `3` | `b` |
+| PowerPC | `freg` | None | `0` | None |
 
-```rust,no_run
-#![feature(or_patterns)]
+> Notes:
+> - on ARM `e` / `f`: this prints the low or high doubleword register name of a NEON quad (128-bit) register.
+> - on x86: our behavior for `reg` with no modifiers differs from what GCC does. GCC will infer the modifier based on the operand value type, while we default to the full register size.
+> - on x86 `xmm_reg`: the `x`, `t` and `g` LLVM modifiers are not yet implemented in LLVM (they are supported by GCC only), but this should be a simple change.
 
-pub enum Foo {
-    Bar,
-    Baz,
-    Quux,
-}
+As stated in the previous section, passing an input value smaller than the register width will result in the upper bits of the register containing undefined values. This is not a problem if the inline asm only accesses the lower bits of the register, which can be done by using a template modifier to use a subregister name in the asm code (e.g. `ax` instead of `rax`). Since this an easy pitfall, the compiler will suggest a template modifier to use where appropriate given the input type. If all references to an operand already have modifiers then the warning is suppressed for that operand.
 
-pub fn example(maybe_foo: Option<Foo>) {
-    match maybe_foo {
-        Some(Foo::Bar | Foo::Baz) => {
-            println!("The value contained `Bar` or `Baz`");
-        }
-        Some(_) => {
-            println!("The value did not contain `Bar` or `Baz`");
-        }
-        None => {
-            println!("The value was `None`");
-        }
-    }
-}
-```
+[llvm-argmod]: http://llvm.org/docs/LangRef.html#asm-template-argument-modifiers
+
+## Options
+
+Flags are used to further influence the behavior of the inline assembly block.
+Currently the following options are defined:
+- `pure`: The `asm` block has no side effects, and its outputs depend only on its direct inputs (i.e. the values themselves, not what they point to) or values read from memory (unless the `nomem` options is also set). This allows the compiler to execute the `asm` block fewer times than specified in the program (e.g. by hoisting it out of a loop) or even eliminate it entirely if the outputs are not used.
+- `nomem`: The `asm` blocks does not read or write to any memory. This allows the compiler to cache the values of modified global variables in registers across the `asm` block since it knows that they are not read or written to by the `asm`.
+- `readonly`: The `asm` block does not write to any memory. This allows the compiler to cache the values of unmodified global variables in registers across the `asm` block since it knows that they are not written to by the `asm`.
+- `preserves_flags`: The `asm` block does not modify the flags register (defined in the rules below). This allows the compiler to avoid recomputing the condition flags after the `asm` block.
+- `noreturn`: The `asm` block never returns, and its return type is defined as `!` (never). Behavior is undefined if execution falls through past the end of the asm code. A `noreturn` asm block behaves just like a function which doesn't return; notably, local variables in scope are not dropped before it is invoked.
+- `nostack`: The `asm` block does not push data to the stack, or write to the stack red-zone (if supported by the target). If this option is *not* used then the stack pointer is guaranteed to be suitably aligned (according to the target ABI) for a function call.
+- `att_syntax`: This option is only valid on x86, and causes the assembler to use the `.att_syntax prefix` mode of the GNU assembler. Register operands are substituted in with a leading `%`.
+
+The compiler performs some additional checks on options:
+- The `nomem` and `readonly` options are mutually exclusive: it is a compile-time error to specify both.
+- The `pure` option must be combined with either the `nomem` or `readonly` options, otherwise a compile-time error is emitted.
+- It is a compile-time error to specify `pure` on an asm block with no outputs or only discarded outputs (`_`).
+- It is a compile-time error to specify `noreturn` on an asm block with outputs.
+
+## Rules for inline assembly
+
+- Any registers not specified as inputs will contain an undefined value on entry to the asm block.
+  - An "undefined value" in the context of inline assembly means that the register can (non-deterministically) have any one of the possible values allowed by the architecture. Notably it is not the same as an LLVM `undef` which can have a different value every time you read it (since such a concept does not exist in assembly code).
+- Any registers not specified as outputs must have the same value upon exiting the asm block as they had on entry, otherwise behavior is undefined.
+  - This only applies to registers which can be specified as an input or output. Other registers follow target-specific rules.
+  - Note that a `lateout` may be allocated to the same register as an `in`, in which case this rule does not apply. Code should not rely on this however since it depends on the results of register allocation.
+- Behavior is undefined if execution unwinds out of an asm block.
+  - This also applies if the assembly code calls a function which then unwinds.
+- The set of memory locations that assembly code is allowed the read and write are the same as those allowed for an FFI function.
+  - Refer to the unsafe code guidelines for the exact rules.
+  - If the `readonly` option is set, then only memory reads are allowed.
+  - If the `nomem` option is set then no reads or writes to memory are allowed.
+  - These rules do not apply to memory which is private to the asm code, such as stack space allocated within the asm block.
+- The compiler cannot assume that the instructions in the asm are the ones that will actually end up executed.
+  - This effectively means that the compiler must treat the `asm!` as a black box and only take the interface specification into account, not the instructions themselves.
+  - Runtime code patching is allowed, via target-specific mechanisms (outside the scope of this RFC).
+- Unless the `nostack` option is set, asm code is allowed to use stack space below the stack pointer.
+  - On entry to the asm block the stack pointer is guaranteed to be suitably aligned (according to the target ABI) for a function call.
+  - You are responsible for making sure you don't overflow the stack (e.g. use stack probing to ensure you hit a guard page).
+  - You should adjust the stack pointer when allocating stack memory as required by the target ABI.
+  - The stack pointer must be restored to its original value before leaving the asm block.
+- If the `noreturn` option is set then behavior is undefined if execution falls through to the end of the asm block.
+- If the `pure` option is set then behavior is undefined if the `asm` has side-effects other than its direct outputs. Behavior is also undefined if two executions of the `asm` code with the same inputs result in different outputs.
+  - When used with the `nomem` option, "inputs" are just the direct inputs of the `asm!`.
+  - When used with the `readonly` option, "inputs" comprise the direct inputs of the `asm!` and any memory that the `asm!` block is allowed to read.
+- These flags registers must be restored upon exiting the asm block if the `preserves_flags` option is set:
+  - x86
+    - Status flags in `EFLAGS` (CF, PF, AF, ZF, SF, OF).
+    - Floating-point status word (all).
+    - Floating-point exception flags in `MXCSR` (PE, UE, OE, ZE, DE, IE).
+  - ARM
+    - Condition flags in `CPSR` (N, Z, C, V)
+    - Saturation flag in `CPSR` (Q)
+    - Greater than or equal flags in `CPSR` (GE).
+    - Condition flags in `FPSCR` (N, Z, C, V)
+    - Saturation flag in `FPSCR` (QC)
+    - Floating-point exception flags in `FPSCR` (IDC, IXC, UFC, OFC, DZC, IOC).
+  - AArch64
+    - Condition flags (`NZCV` register).
+    - Floating-point status (`FPSR` register).
+  - RISC-V
+    - Floating-point exception flags in `fcsr` (`fflags`).
+- On x86, the direction flag (DF in `EFLAGS`) is clear on entry to an asm block and must be clear on exit.
+  - Behavior is undefined if the direction flag is set on exiting an asm block.
+- The requirement of restoring the stack pointer and non-output registers to their original value only applies when exiting an `asm!` block.
+  - This means that `asm!` blocks that never return (even if not marked `noreturn`) don't need to preserve these registers.
+  - When returning to a different `asm!` block than you entered (e.g. for context switching), these registers must contain the value they had upon entering the `asm!` block that you are *exiting*.
+    - You cannot exit an `asm!` block that has not been entered. Neither can you exit an `asm!` block that has already been exited.
+    - You are responsible for switching any target-specific state (e.g. thread-local storage, stack bounds).
+    - The set of memory locations that you may access is the intersection of those allowed by the `asm!` blocks you entered and exited.
+- You cannot assume that an `asm!` block will appear exactly once in the output binary. The compiler is allowed to instantiate multiple copies of the `asm!` block, for example when the function containing it is inlined in multiple places.
+
+> **Note**: As a general rule, the flags covered by `preserves_flags` are those which are *not* preserved when performing a function call.
 "##,
     },
     LintCompletion {
-        label: "negative_impls",
-        description: r##"# `negative_impls`
+        label: "auto_traits",
+        description: r##"# `auto_traits`
 
-The tracking issue for this feature is [#68318].
+The tracking issue for this feature is [#13231]
 
-[#68318]: https://github.com/rust-lang/rust/issues/68318
+[#13231]: https://github.com/rust-lang/rust/issues/13231
 
 ----
 
-With the feature gate `negative_impls`, you can write negative impls as well as positive ones:
+The `auto_traits` feature gate allows you to define auto traits.
 
-```rust
-#![feature(negative_impls)]
-trait DerefMut { }
-impl<T: ?Sized> !DerefMut for &T { }
-```
+Auto traits, like [`Send`] or [`Sync`] in the standard library, are marker traits
+that are automatically implemented for every type, unless the type, or a type it contains,
+has explicitly opted out via a negative impl. (Negative impls are separately controlled
+by the `negative_impls` feature.)
 
-Negative impls indicate a semver guarantee that the given trait will not be implemented for the given types. Negative impls play an additional purpose for auto traits, described below.
+[`Send`]: https://doc.rust-lang.org/std/marker/trait.Send.html
+[`Sync`]: https://doc.rust-lang.org/std/marker/trait.Sync.html
 
-Negative impls have the following characteristics:
+```rust,ignore (partial-example)
+impl !Trait for Type {}
+```
 
-* They do not have any items.
-* They must obey the orphan rules as if they were a positive impl.
-* They cannot "overlap" with any positive impls.
+Example:
 
-## Semver interaction
+```rust
+#![feature(negative_impls)]
+#![feature(auto_traits)]
 
-It is a breaking change to remove a negative impl. Negative impls are a commitment not to implement the given trait for the named types.
+auto trait Valid {}
 
-## Orphan and overlap rules
+struct True;
+struct False;
 
-Negative impls must obey the same orphan rules as a positive impl. This implies you cannot add a negative impl for types defined in upstream crates and so forth.
+impl !Valid for False {}
 
-Similarly, negative impls cannot overlap with positive impls, again using the same "overlap" check that we ordinarily use to determine if two impls overlap. (Note that positive impls typically cannot overlap with one another either, except as permitted by specialization.)
+struct MaybeValid<T>(T);
 
-## Interaction with auto traits
+fn must_be_valid<T: Valid>(_t: T) { }
 
-Declaring a negative impl `impl !SomeAutoTrait for SomeType` for an
-auto-trait serves two purposes:
+fn main() {
+    // works
+    must_be_valid( MaybeValid(True) );
 
-* as with any trait, it declares that `SomeType` will never implement `SomeAutoTrait`;
-* it disables the automatic `SomeType: SomeAutoTrait` impl that would otherwise have been generated.
+    // compiler error - trait bound not satisfied
+    // must_be_valid( MaybeValid(False) );
+}
+```
 
-Note that, at present, there is no way to indicate that a given type
-does not implement an auto trait *but that it may do so in the
-future*. For ordinary types, this is done by simply not declaring any
-impl at all, but that is not an option for auto traits. A workaround
-is that one could embed a marker type as one of the fields, where the
-marker type is `!AutoTrait`.
+## Automatic trait implementations
 
-## Immediate uses
+When a type is declared as an `auto trait`, we will automatically
+create impls for every struct/enum/union, unless an explicit impl is
+provided. These automatic impls contain a where clause for each field
+of the form `T: AutoTrait`, where `T` is the type of the field and
+`AutoTrait` is the auto trait in question. As an example, consider the
+struct `List` and the auto trait `Send`:
 
-Negative impls are used to declare that `&T: !DerefMut`  and `&mut T: !Clone`, as required to fix the soundness of `Pin` described in [#66544](https://github.com/rust-lang/rust/issues/66544).
+```rust
+struct List<T> {
+  data: T,
+  next: Option<Box<List<T>>>,
+}
+```
 
-This serves two purposes:
+Presuming that there is no explicit impl of `Send` for `List`, the
+compiler will supply an automatic impl of the form:
 
-* For proving the correctness of unsafe code, we can use that impl as evidence that no `DerefMut` or `Clone` impl exists.
-* It prevents downstream crates from creating such impls.
+```rust
+struct List<T> {
+  data: T,
+  next: Option<Box<List<T>>>,
+}
+
+unsafe impl<T> Send for List<T>
+where
+  T: Send, // from the field `data`
+  Option<Box<List<T>>>: Send, // from the field `next`
+{ }
+```
+
+Explicit impls may be either positive or negative. They take the form:
+
+```rust,ignore (partial-example)
+impl<...> AutoTrait for StructName<..> { }
+impl<...> !AutoTrait for StructName<..> { }
+```
+
+## Coinduction: Auto traits permit cyclic matching
+
+Unlike ordinary trait matching, auto traits are **coinductive**. This
+means, in short, that cycles which occur in trait matching are
+considered ok. As an example, consider the recursive struct `List`
+introduced in the previous section. In attempting to determine whether
+`List: Send`, we would wind up in a cycle: to apply the impl, we must
+show that `Option<Box<List>>: Send`, which will in turn require
+`Box<List>: Send` and then finally `List: Send` again. Under ordinary
+trait matching, this cycle would be an error, but for an auto trait it
+is considered a successful match.
+
+## Items
+
+Auto traits cannot have any trait items, such as methods or associated types. This ensures that we can generate default implementations.
+
+## Supertraits
+
+Auto traits cannot have supertraits. This is for soundness reasons, as the interaction of coinduction with implied bounds is difficult to reconcile.
 "##,
     },
     LintCompletion {
-        label: "cmse_nonsecure_entry",
-        description: r##"# `cmse_nonsecure_entry`
+        label: "box_patterns",
+        description: r##"# `box_patterns`
 
-The tracking issue for this feature is: [#75835]
+The tracking issue for this feature is: [#29641]
 
-[#75835]: https://github.com/rust-lang/rust/issues/75835
+[#29641]: https://github.com/rust-lang/rust/issues/29641
+
+See also [`box_syntax`](box-syntax.md)
 
 ------------------------
 
-The [TrustZone-M
-feature](https://developer.arm.com/documentation/100690/latest/) is available
-for targets with the Armv8-M architecture profile (`thumbv8m` in their target
-name).
-LLVM, the Rust compiler and the linker are providing
-[support](https://developer.arm.com/documentation/ecm0359818/latest/) for the
-TrustZone-M feature.
+Box patterns let you match on `Box<T>`s:
 
-One of the things provided, with this unstable feature, is the
-`cmse_nonsecure_entry` attribute.  This attribute marks a Secure function as an
-entry function (see [section
-5.4](https://developer.arm.com/documentation/ecm0359818/latest/) for details).
-With this attribute, the compiler will do the following:
-* add a special symbol on the function which is the `__acle_se_` prefix and the
-  standard function name
-* constrain the number of parameters to avoid using the Non-Secure stack
-* before returning from the function, clear registers that might contain Secure
-  information
-* use the `BXNS` instruction to return
 
-Because the stack can not be used to pass parameters, there will be compilation
-errors if:
-* the total size of all parameters is too big (for example more than four 32
-  bits integers)
-* the entry function is not using a C ABI
+```rust
+#![feature(box_patterns)]
 
-The special symbol `__acle_se_` will be used by the linker to generate a secure
-gateway veneer.
+fn main() {
+    let b = Some(Box::new(5));
+    match b {
+        Some(box n) if n < 0 => {
+            println!("Box contains negative number {}", n);
+        },
+        Some(box n) if n >= 0 => {
+            println!("Box contains non-negative number {}", n);
+        },
+        None => {
+            println!("No box");
+        },
+        _ => unreachable!()
+    }
+}
+```
+"##,
+    },
+    LintCompletion {
+        label: "box_syntax",
+        description: r##"# `box_syntax`
 
-<!-- NOTE(ignore) this example is specific to thumbv8m targets -->
+The tracking issue for this feature is: [#49733]
 
-``` rust,ignore
-#![feature(cmse_nonsecure_entry)]
+[#49733]: https://github.com/rust-lang/rust/issues/49733
 
-#[no_mangle]
-#[cmse_nonsecure_entry]
-pub extern "C" fn entry_function(input: u32) -> u32 {
-    input + 6
-}
-```
+See also [`box_patterns`](box-patterns.md)
 
-``` text
-$ rustc --emit obj --crate-type lib --target thumbv8m.main-none-eabi function.rs
-$ arm-none-eabi-objdump -D function.o
+------------------------
 
-00000000 <entry_function>:
-   0:   b580            push    {r7, lr}
-   2:   466f            mov     r7, sp
-   4:   b082            sub     sp, #8
-   6:   9001            str     r0, [sp, #4]
-   8:   1d81            adds    r1, r0, #6
-   a:   460a            mov     r2, r1
-   c:   4281            cmp     r1, r0
-   e:   9200            str     r2, [sp, #0]
-  10:   d30b            bcc.n   2a <entry_function+0x2a>
-  12:   e7ff            b.n     14 <entry_function+0x14>
-  14:   9800            ldr     r0, [sp, #0]
-  16:   b002            add     sp, #8
-  18:   e8bd 4080       ldmia.w sp!, {r7, lr}
-  1c:   4671            mov     r1, lr
-  1e:   4672            mov     r2, lr
-  20:   4673            mov     r3, lr
-  22:   46f4            mov     ip, lr
-  24:   f38e 8800       msr     CPSR_f, lr
-  28:   4774            bxns    lr
-  2a:   f240 0000       movw    r0, #0
-  2e:   f2c0 0000       movt    r0, #0
-  32:   f240 0200       movw    r2, #0
-  36:   f2c0 0200       movt    r2, #0
-  3a:   211c            movs    r1, #28
-  3c:   f7ff fffe       bl      0 <_ZN4core9panicking5panic17h5c028258ca2fb3f5E>
-  40:   defe            udf     #254    ; 0xfe
+Currently the only stable way to create a `Box` is via the `Box::new` method.
+Also it is not possible in stable Rust to destructure a `Box` in a match
+pattern. The unstable `box` keyword can be used to create a `Box`. An example
+usage would be:
+
+```rust
+#![feature(box_syntax)]
+
+fn main() {
+    let b = box 5;
+}
 ```
 "##,
     },
     LintCompletion {
-        label: "plugin",
-        description: r##"# `plugin`
+        label: "c_unwind",
+        description: r##"# `c_unwind`
 
-The tracking issue for this feature is: [#29597]
+The tracking issue for this feature is: [#74990]
 
-[#29597]: https://github.com/rust-lang/rust/issues/29597
+[#74990]: https://github.com/rust-lang/rust/issues/74990
 
+------------------------
 
-This feature is part of "compiler plugins." It will often be used with the
-[`plugin_registrar`] and `rustc_private` features.
+Introduces four new ABI strings: "C-unwind", "stdcall-unwind",
+"thiscall-unwind", and "system-unwind". These enable unwinding from other
+languages (such as C++) into Rust frames and from Rust into other languages.
 
-[`plugin_registrar`]: plugin-registrar.md
+See [RFC 2945] for more information.
 
-------------------------
+[RFC 2945]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md
+"##,
+    },
+    LintCompletion {
+        label: "c_variadic",
+        description: r##"# `c_variadic`
 
-`rustc` can load compiler plugins, which are user-provided libraries that
-extend the compiler's behavior with new lint checks, etc.
+The tracking issue for this feature is: [#44930]
 
-A plugin is a dynamic library crate with a designated *registrar* function that
-registers extensions with `rustc`. Other crates can load these extensions using
-the crate attribute `#![plugin(...)]`.  See the
-`rustc_driver::plugin` documentation for more about the
-mechanics of defining and loading a plugin.
+[#44930]: https://github.com/rust-lang/rust/issues/44930
 
-In the vast majority of cases, a plugin should *only* be used through
-`#![plugin]` and not through an `extern crate` item.  Linking a plugin would
-pull in all of librustc_ast and librustc as dependencies of your crate.  This is
-generally unwanted unless you are building another plugin.
+------------------------
 
-The usual practice is to put compiler plugins in their own crate, separate from
-any `macro_rules!` macros or ordinary Rust code meant to be used by consumers
-of a library.
+The `c_variadic` language feature enables C-variadic functions to be
+defined in Rust. The may be called both from within Rust and via FFI.
 
-# Lint plugins
+## Examples
 
-Plugins can extend [Rust's lint
-infrastructure](../../reference/attributes/diagnostics.md#lint-check-attributes) with
-additional checks for code style, safety, etc. Now let's write a plugin
-[`lint-plugin-test.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs)
-that warns about any item named `lintme`.
+```rust
+#![feature(c_variadic)]
 
-```rust,ignore (requires-stage-2)
-#![feature(plugin_registrar)]
-#![feature(box_syntax, rustc_private)]
+pub unsafe extern "C" fn add(n: usize, mut args: ...) -> usize {
+    let mut sum = 0;
+    for _ in 0..n {
+        sum += args.arg::<usize>();
+    }
+    sum
+}
+```
+"##,
+    },
+    LintCompletion {
+        label: "c_variadic",
+        description: r##"# `c_variadic`
 
-extern crate rustc_ast;
+The tracking issue for this feature is: [#44930]
 
-// Load rustc as a plugin to get macros
-extern crate rustc_driver;
-#[macro_use]
-extern crate rustc_lint;
-#[macro_use]
-extern crate rustc_session;
+[#44930]: https://github.com/rust-lang/rust/issues/44930
 
-use rustc_driver::plugin::Registry;
-use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
-use rustc_ast::ast;
-declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
+------------------------
 
-declare_lint_pass!(Pass => [TEST_LINT]);
+The `c_variadic` library feature exposes the `VaList` structure,
+Rust's analogue of C's `va_list` type.
 
-impl EarlyLintPass for Pass {
-    fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
-        if it.ident.name.as_str() == "lintme" {
-            cx.lint(TEST_LINT, |lint| {
-                lint.build("item is named 'lintme'").set_span(it.span).emit()
-            });
-        }
-    }
-}
+## Examples
 
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
-    reg.lint_store.register_lints(&[&TEST_LINT]);
-    reg.lint_store.register_early_pass(|| box Pass);
+```rust
+#![feature(c_variadic)]
+
+use std::ffi::VaList;
+
+pub unsafe extern "C" fn vadd(n: usize, mut args: VaList) -> usize {
+    let mut sum = 0;
+    for _ in 0..n {
+        sum += args.arg::<usize>();
+    }
+    sum
 }
 ```
+"##,
+    },
+    LintCompletion {
+        label: "c_void_variant",
+        description: r##"# `c_void_variant`
 
-Then code like
+This feature is internal to the Rust compiler and is not intended for general use.
 
-```rust,ignore (requires-plugin)
-#![feature(plugin)]
-#![plugin(lint_plugin_test)]
+------------------------
+"##,
+    },
+    LintCompletion {
+        label: "cfg_panic",
+        description: r##"# `cfg_panic`
 
-fn lintme() { }
-```
+The tracking issue for this feature is: [#77443]
 
-will produce a compiler warning:
+[#77443]: https://github.com/rust-lang/rust/issues/77443
 
-```txt
-foo.rs:4:1: 4:16 warning: item is named 'lintme', #[warn(test_lint)] on by default
-foo.rs:4 fn lintme() { }
-         ^~~~~~~~~~~~~~~
-```
+------------------------
 
-The components of a lint plugin are:
+The `cfg_panic` feature makes it possible to execute different code
+depending on the panic strategy.
 
-* one or more `declare_lint!` invocations, which define static `Lint` structs;
+Possible values at the moment are `"unwind"` or `"abort"`, although
+it is possible that new panic strategies may be added to Rust in the
+future.
 
-* a struct holding any state needed by the lint pass (here, none);
+## Examples
 
-* a `LintPass`
-  implementation defining how to check each syntax element. A single
-  `LintPass` may call `span_lint` for several different `Lint`s, but should
-  register them all through the `get_lints` method.
+```rust
+#![feature(cfg_panic)]
 
-Lint passes are syntax traversals, but they run at a late stage of compilation
-where type information is available. `rustc`'s [built-in
-lints](https://github.com/rust-lang/rust/blob/master/src/librustc_session/lint/builtin.rs)
-mostly use the same infrastructure as lint plugins, and provide examples of how
-to access type information.
+#[cfg(panic = "unwind")]
+fn a() {
+    // ...
+}
 
-Lints defined by plugins are controlled by the usual [attributes and compiler
-flags](../../reference/attributes/diagnostics.md#lint-check-attributes), e.g.
-`#[allow(test_lint)]` or `-A test-lint`. These identifiers are derived from the
-first argument to `declare_lint!`, with appropriate case and punctuation
-conversion.
+#[cfg(not(panic = "unwind"))]
+fn a() {
+    // ...
+}
 
-You can run `rustc -W help foo.rs` to see a list of lints known to `rustc`,
-including those provided by plugins loaded by `foo.rs`.
+fn b() {
+    if cfg!(panic = "abort") {
+        // ...
+    } else {
+        // ...
+    }
+}
+```
 "##,
     },
     LintCompletion {
-        label: "intrinsics",
-        description: r##"# `intrinsics`
+        label: "cfg_sanitize",
+        description: r##"# `cfg_sanitize`
 
-The tracking issue for this feature is: None.
+The tracking issue for this feature is: [#39699]
 
-Intrinsics are never intended to be stable directly, but intrinsics are often
-exported in some sort of stable manner. Prefer using the stable interfaces to
-the intrinsic directly when you can.
+[#39699]: https://github.com/rust-lang/rust/issues/39699
 
 ------------------------
 
+The `cfg_sanitize` feature makes it possible to execute different code
+depending on whether a particular sanitizer is enabled or not.
 
-These are imported as if they were FFI functions, with the special
-`rust-intrinsic` ABI. For example, if one was in a freestanding
-context, but wished to be able to `transmute` between types, and
-perform efficient pointer arithmetic, one would import those functions
-via a declaration like
+## Examples
 
 ```rust
-#![feature(intrinsics)]
-# fn main() {}
+#![feature(cfg_sanitize)]
 
-extern "rust-intrinsic" {
-    fn transmute<T, U>(x: T) -> U;
+#[cfg(sanitize = "thread")]
+fn a() {
+    // ...
+}
 
-    fn offset<T>(dst: *const T, offset: isize) -> *const T;
+#[cfg(not(sanitize = "thread"))]
+fn a() {
+    // ...
 }
-```
 
-As with any other FFI functions, these are always `unsafe` to call.
+fn b() {
+    if cfg!(sanitize = "leak") {
+        // ...
+    } else {
+        // ...
+    }
+}
+```
 "##,
     },
     LintCompletion {
-        label: "rustc_attrs",
-        description: r##"# `rustc_attrs`
+        label: "cfg_version",
+        description: r##"# `cfg_version`
 
-This feature has no tracking issue, and is therefore internal to
-the compiler, not being intended for general use.
+The tracking issue for this feature is: [#64796]
 
-Note: `rustc_attrs` enables many rustc-internal attributes and this page
-only discuss a few of them.
+[#64796]: https://github.com/rust-lang/rust/issues/64796
 
 ------------------------
 
-The `rustc_attrs` feature allows debugging rustc type layouts by using
-`#[rustc_layout(...)]` to debug layout at compile time (it even works
-with `cargo check`) as an alternative to `rustc -Z print-type-sizes`
-that is way more verbose.
-
-Options provided by `#[rustc_layout(...)]` are `debug`, `size`, `align`,
-`abi`. Note that it only works on sized types without generics.
+The `cfg_version` feature makes it possible to execute different code
+depending on the compiler version. It will return true if the compiler
+version is greater than or equal to the specified version.
 
 ## Examples
 
-```rust,compile_fail
-#![feature(rustc_attrs)]
+```rust
+#![feature(cfg_version)]
 
-#[rustc_layout(abi, size)]
-pub enum X {
-    Y(u8, u8, u8),
-    Z(isize),
+#[cfg(version("1.42"))] // 1.42 and above
+fn a() {
+    // ...
 }
-```
-
-When that is compiled, the compiler will error with something like
-
-```text
-error: abi: Aggregate { sized: true }
- --> src/lib.rs:4:1
-  |
-4 | / pub enum T {
-5 | |     Y(u8, u8, u8),
-6 | |     Z(isize),
-7 | | }
-  | |_^
 
-error: size: Size { raw: 16 }
- --> src/lib.rs:4:1
-  |
-4 | / pub enum T {
-5 | |     Y(u8, u8, u8),
-6 | |     Z(isize),
-7 | | }
-  | |_^
+#[cfg(not(version("1.42")))] // 1.41 and below
+fn a() {
+    // ...
+}
 
-error: aborting due to 2 previous errors
+fn b() {
+    if cfg!(version("1.42")) {
+        // ...
+    } else {
+        // ...
+    }
+}
 ```
 "##,
     },
     LintCompletion {
-        label: "const_fn",
-        description: r##"# `const_fn`
-
-The tracking issue for this feature is: [#57563]
+        label: "char_error_internals",
+        description: r##"# `char_error_internals`
 
-[#57563]: https://github.com/rust-lang/rust/issues/57563
+This feature is internal to the Rust compiler and is not intended for general use.
 
 ------------------------
-
-The `const_fn` feature enables additional functionality not stabilized in the
-[minimal subset of `const_fn`](https://github.com/rust-lang/rust/issues/53555)
 "##,
     },
     LintCompletion {
-        label: "abi_thiscall",
-        description: r##"# `abi_thiscall`
+        label: "cmse_nonsecure_entry",
+        description: r##"# `cmse_nonsecure_entry`
 
-The tracking issue for this feature is: [#42202]
+The tracking issue for this feature is: [#75835]
 
-[#42202]: https://github.com/rust-lang/rust/issues/42202
+[#75835]: https://github.com/rust-lang/rust/issues/75835
 
 ------------------------
 
-The MSVC ABI on x86 Windows uses the `thiscall` calling convention for C++
-instance methods by default; it is identical to the usual (C) calling
-convention on x86 Windows except that the first parameter of the method,
-the `this` pointer, is passed in the ECX register.
-"##,
-    },
-    LintCompletion {
-        label: "trait_alias",
-        description: r##"# `trait_alias`
+The [TrustZone-M
+feature](https://developer.arm.com/documentation/100690/latest/) is available
+for targets with the Armv8-M architecture profile (`thumbv8m` in their target
+name).
+LLVM, the Rust compiler and the linker are providing
+[support](https://developer.arm.com/documentation/ecm0359818/latest/) for the
+TrustZone-M feature.
 
-The tracking issue for this feature is: [#41517]
+One of the things provided, with this unstable feature, is the
+`cmse_nonsecure_entry` attribute.  This attribute marks a Secure function as an
+entry function (see [section
+5.4](https://developer.arm.com/documentation/ecm0359818/latest/) for details).
+With this attribute, the compiler will do the following:
+* add a special symbol on the function which is the `__acle_se_` prefix and the
+  standard function name
+* constrain the number of parameters to avoid using the Non-Secure stack
+* before returning from the function, clear registers that might contain Secure
+  information
+* use the `BXNS` instruction to return
 
-[#41517]: https://github.com/rust-lang/rust/issues/41517
+Because the stack can not be used to pass parameters, there will be compilation
+errors if:
+* the total size of all parameters is too big (for example more than four 32
+  bits integers)
+* the entry function is not using a C ABI
 
-------------------------
+The special symbol `__acle_se_` will be used by the linker to generate a secure
+gateway veneer.
 
-The `trait_alias` feature adds support for trait aliases. These allow aliases
-to be created for one or more traits (currently just a single regular trait plus
-any number of auto-traits), and used wherever traits would normally be used as
-either bounds or trait objects.
-
-```rust
-#![feature(trait_alias)]
+<!-- NOTE(ignore) this example is specific to thumbv8m targets -->
 
-trait Foo = std::fmt::Debug + Send;
-trait Bar = Foo + Sync;
+``` rust,ignore
+#![feature(cmse_nonsecure_entry)]
 
-// Use trait alias as bound on type parameter.
-fn foo<T: Foo>(v: &T) {
-    println!("{:?}", v);
+#[no_mangle]
+#[cmse_nonsecure_entry]
+pub extern "C" fn entry_function(input: u32) -> u32 {
+    input + 6
 }
+```
 
-pub fn main() {
-    foo(&1);
+``` text
+$ rustc --emit obj --crate-type lib --target thumbv8m.main-none-eabi function.rs
+$ arm-none-eabi-objdump -D function.o
 
-    // Use trait alias for trait objects.
-    let a: &Bar = &123;
-    println!("{:?}", a);
-    let b = Box::new(456) as Box<dyn Foo>;
-    println!("{:?}", b);
-}
+00000000 <entry_function>:
+   0:   b580            push    {r7, lr}
+   2:   466f            mov     r7, sp
+   4:   b082            sub     sp, #8
+   6:   9001            str     r0, [sp, #4]
+   8:   1d81            adds    r1, r0, #6
+   a:   460a            mov     r2, r1
+   c:   4281            cmp     r1, r0
+   e:   9200            str     r2, [sp, #0]
+  10:   d30b            bcc.n   2a <entry_function+0x2a>
+  12:   e7ff            b.n     14 <entry_function+0x14>
+  14:   9800            ldr     r0, [sp, #0]
+  16:   b002            add     sp, #8
+  18:   e8bd 4080       ldmia.w sp!, {r7, lr}
+  1c:   4671            mov     r1, lr
+  1e:   4672            mov     r2, lr
+  20:   4673            mov     r3, lr
+  22:   46f4            mov     ip, lr
+  24:   f38e 8800       msr     CPSR_f, lr
+  28:   4774            bxns    lr
+  2a:   f240 0000       movw    r0, #0
+  2e:   f2c0 0000       movt    r0, #0
+  32:   f240 0200       movw    r2, #0
+  36:   f2c0 0200       movt    r2, #0
+  3a:   211c            movs    r1, #28
+  3c:   f7ff fffe       bl      0 <_ZN4core9panicking5panic17h5c028258ca2fb3f5E>
+  40:   defe            udf     #254    ; 0xfe
 ```
 "##,
     },
     LintCompletion {
-        label: "lang_items",
-        description: r##"# `lang_items`
+        label: "compiler_builtins",
+        description: r##"# `compiler_builtins`
 
-The tracking issue for this feature is: None.
+This feature is internal to the Rust compiler and is not intended for general use.
 
 ------------------------
+"##,
+    },
+    LintCompletion {
+        label: "concat_idents",
+        description: r##"# `concat_idents`
 
-The `rustc` compiler has certain pluggable operations, that is,
-functionality that isn't hard-coded into the language, but is
-implemented in libraries, with a special marker to tell the compiler
-it exists. The marker is the attribute `#[lang = "..."]` and there are
-various different values of `...`, i.e. various different 'lang
-items'.
-
-For example, `Box` pointers require two lang items, one for allocation
-and one for deallocation. A freestanding program that uses the `Box`
-sugar for dynamic allocations via `malloc` and `free`:
-
-```rust,ignore (libc-is-finicky)
-#![feature(lang_items, box_syntax, start, libc, core_intrinsics, rustc_private)]
-#![no_std]
-use core::intrinsics;
-use core::panic::PanicInfo;
-
-extern crate libc;
-
-#[lang = "owned_box"]
-pub struct Box<T>(*mut T);
+The tracking issue for this feature is: [#29599]
 
-#[lang = "exchange_malloc"]
-unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
-    let p = libc::malloc(size as libc::size_t) as *mut u8;
+[#29599]: https://github.com/rust-lang/rust/issues/29599
 
-    // Check if `malloc` failed:
-    if p as usize == 0 {
-        intrinsics::abort();
-    }
+------------------------
 
-    p
-}
+The `concat_idents` feature adds a macro for concatenating multiple identifiers
+into one identifier.
 
-#[lang = "box_free"]
-unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
-    libc::free(ptr as *mut libc::c_void)
-}
+## Examples
 
-#[start]
-fn main(_argc: isize, _argv: *const *const u8) -> isize {
-    let _x = box 1;
+```rust
+#![feature(concat_idents)]
 
-    0
+fn main() {
+    fn foobar() -> u32 { 23 }
+    let f = concat_idents!(foo, bar);
+    assert_eq!(f(), 23);
 }
-
-#[lang = "eh_personality"] extern fn rust_eh_personality() {}
-#[lang = "panic_impl"] extern fn rust_begin_panic(info: &PanicInfo) -> ! { unsafe { intrinsics::abort() } }
-#[no_mangle] pub extern fn rust_eh_register_frames () {}
-#[no_mangle] pub extern fn rust_eh_unregister_frames () {}
 ```
+"##,
+    },
+    LintCompletion {
+        label: "const_eval_limit",
+        description: r##"# `const_eval_limit`
 
-Note the use of `abort`: the `exchange_malloc` lang item is assumed to
-return a valid pointer, and so needs to do the check internally.
+The tracking issue for this feature is: [#67217]
 
-Other features provided by lang items include:
+[#67217]: https://github.com/rust-lang/rust/issues/67217
 
-- overloadable operators via traits: the traits corresponding to the
-  `==`, `<`, dereferencing (`*`) and `+` (etc.) operators are all
-  marked with lang items; those specific four are `eq`, `ord`,
-  `deref`, and `add` respectively.
-- stack unwinding and general failure; the `eh_personality`,
-  `panic` and `panic_bounds_check` lang items.
-- the traits in `std::marker` used to indicate types of
-  various kinds; lang items `send`, `sync` and `copy`.
-- the marker types and variance indicators found in
-  `std::marker`; lang items `covariant_type`,
-  `contravariant_lifetime`, etc.
+The `const_eval_limit` allows someone to limit the evaluation steps the CTFE undertakes to evaluate a `const fn`.
+"##,
+    },
+    LintCompletion {
+        label: "core_intrinsics",
+        description: r##"# `core_intrinsics`
 
-Lang items are loaded lazily by the compiler; e.g. if one never uses
-`Box` then there is no need to define functions for `exchange_malloc`
-and `box_free`. `rustc` will emit an error when an item is needed
-but not found in the current crate or any that it depends on.
+This feature is internal to the Rust compiler and is not intended for general use.
 
-Most lang items are defined by `libcore`, but if you're trying to build
-an executable without the standard library, you'll run into the need
-for lang items. The rest of this page focuses on this use-case, even though
-lang items are a bit broader than that.
+------------------------
+"##,
+    },
+    LintCompletion {
+        label: "core_panic",
+        description: r##"# `core_panic`
 
-### Using libc
+This feature is internal to the Rust compiler and is not intended for general use.
 
-In order to build a `#[no_std]` executable we will need libc as a dependency.
-We can specify this using our `Cargo.toml` file:
+------------------------
+"##,
+    },
+    LintCompletion {
+        label: "core_private_bignum",
+        description: r##"# `core_private_bignum`
 
-```toml
-[dependencies]
-libc = { version = "0.2.14", default-features = false }
-```
+This feature is internal to the Rust compiler and is not intended for general use.
 
-Note that the default features have been disabled. This is a critical step -
-**the default features of libc include the standard library and so must be
-disabled.**
+------------------------
+"##,
+    },
+    LintCompletion {
+        label: "core_private_diy_float",
+        description: r##"# `core_private_diy_float`
 
-### Writing an executable without stdlib
+This feature is internal to the Rust compiler and is not intended for general use.
 
-Controlling the entry point is possible in two ways: the `#[start]` attribute,
-or overriding the default shim for the C `main` function with your own.
+------------------------
+"##,
+    },
+    LintCompletion {
+        label: "crate_visibility_modifier",
+        description: r##"# `crate_visibility_modifier`
 
-The function marked `#[start]` is passed the command line parameters
-in the same format as C:
+The tracking issue for this feature is: [#53120]
 
-```rust,ignore (libc-is-finicky)
-#![feature(lang_items, core_intrinsics, rustc_private)]
-#![feature(start)]
-#![no_std]
-use core::intrinsics;
-use core::panic::PanicInfo;
+[#53120]: https://github.com/rust-lang/rust/issues/53120
 
-// Pull in the system libc library for what crt0.o likely requires.
-extern crate libc;
+-----
 
-// Entry point for this program.
-#[start]
-fn start(_argc: isize, _argv: *const *const u8) -> isize {
-    0
-}
+The `crate_visibility_modifier` feature allows the `crate` keyword to be used
+as a visibility modifier synonymous to `pub(crate)`, indicating that a type
+(function, _&c._) is to be visible to the entire enclosing crate, but not to
+other crates.
 
-// These functions are used by the compiler, but not
-// for a bare-bones hello world. These are normally
-// provided by libstd.
-#[lang = "eh_personality"]
-#[no_mangle]
-pub extern fn rust_eh_personality() {
-}
+```rust
+#![feature(crate_visibility_modifier)]
 
-#[lang = "panic_impl"]
-#[no_mangle]
-pub extern fn rust_begin_panic(info: &PanicInfo) -> ! {
-    unsafe { intrinsics::abort() }
+crate struct Foo {
+    bar: usize,
 }
 ```
+"##,
+    },
+    LintCompletion {
+        label: "custom_test_frameworks",
+        description: r##"# `custom_test_frameworks`
 
-To override the compiler-inserted `main` shim, one has to disable it
-with `#![no_main]` and then create the appropriate symbol with the
-correct ABI and the correct name, which requires overriding the
-compiler's name mangling too:
+The tracking issue for this feature is: [#50297]
 
-```rust,ignore (libc-is-finicky)
-#![feature(lang_items, core_intrinsics, rustc_private)]
-#![feature(start)]
-#![no_std]
-#![no_main]
-use core::intrinsics;
-use core::panic::PanicInfo;
+[#50297]: https://github.com/rust-lang/rust/issues/50297
 
-// Pull in the system libc library for what crt0.o likely requires.
-extern crate libc;
+------------------------
 
-// Entry point for this program.
-#[no_mangle] // ensure that this symbol is called `main` in the output
-pub extern fn main(_argc: i32, _argv: *const *const u8) -> i32 {
-    0
+The `custom_test_frameworks` feature allows the use of `#[test_case]` and `#![test_runner]`.
+Any function, const, or static can be annotated with `#[test_case]` causing it to be aggregated (like `#[test]`)
+and be passed to the test runner determined by the `#![test_runner]` crate attribute.
+
+```rust
+#![feature(custom_test_frameworks)]
+#![test_runner(my_runner)]
+
+fn my_runner(tests: &[&i32]) {
+    for t in tests {
+        if **t == 0 {
+            println!("PASSED");
+        } else {
+            println!("FAILED");
+        }
+    }
 }
 
-// These functions are used by the compiler, but not
-// for a bare-bones hello world. These are normally
-// provided by libstd.
-#[lang = "eh_personality"]
-#[no_mangle]
-pub extern fn rust_eh_personality() {
+#[test_case]
+const WILL_PASS: i32 = 0;
+
+#[test_case]
+const WILL_FAIL: i32 = 4;
+```
+"##,
+    },
+    LintCompletion {
+        label: "dec2flt",
+        description: r##"# `dec2flt`
+
+This feature is internal to the Rust compiler and is not intended for general use.
+
+------------------------
+"##,
+    },
+    LintCompletion {
+        label: "default_free_fn",
+        description: r##"# `default_free_fn`
+
+The tracking issue for this feature is: [#73014]
+
+[#73014]: https://github.com/rust-lang/rust/issues/73014
+
+------------------------
+
+Adds a free `default()` function to the `std::default` module.  This function
+just forwards to [`Default::default()`], but may remove repetition of the word
+"default" from the call site.
+
+[`Default::default()`]: https://doc.rust-lang.org/nightly/std/default/trait.Default.html#tymethod.default
+
+Here is an example:
+
+```rust
+#![feature(default_free_fn)]
+use std::default::default;
+
+#[derive(Default)]
+struct AppConfig {
+    foo: FooConfig,
+    bar: BarConfig,
 }
 
-#[lang = "panic_impl"]
-#[no_mangle]
-pub extern fn rust_begin_panic(info: &PanicInfo) -> ! {
-    unsafe { intrinsics::abort() }
+#[derive(Default)]
+struct FooConfig {
+    foo: i32,
+}
+
+#[derive(Default)]
+struct BarConfig {
+    bar: f32,
+    baz: u8,
+}
+
+fn main() {
+    let options = AppConfig {
+        foo: default(),
+        bar: BarConfig {
+            bar: 10.1,
+            ..default()
+        },
+    };
 }
 ```
+"##,
+    },
+    LintCompletion {
+        label: "derive_clone_copy",
+        description: r##"# `derive_clone_copy`
 
-In many cases, you may need to manually link to the `compiler_builtins` crate
-when building a `no_std` binary. You may observe this via linker error messages
-such as "```undefined reference to `__rust_probestack'```".
+This feature is internal to the Rust compiler and is not intended for general use.
 
-## More about the language items
+------------------------
+"##,
+    },
+    LintCompletion {
+        label: "derive_eq",
+        description: r##"# `derive_eq`
 
-The compiler currently makes a few assumptions about symbols which are
-available in the executable to call. Normally these functions are provided by
-the standard library, but without it you must define your own. These symbols
-are called "language items", and they each have an internal name, and then a
-signature that an implementation must conform to.
+This feature is internal to the Rust compiler and is not intended for general use.
 
-The first of these functions, `rust_eh_personality`, is used by the failure
-mechanisms of the compiler. This is often mapped to GCC's personality function
-(see the [libstd implementation][unwind] for more information), but crates
-which do not trigger a panic can be assured that this function is never
-called. The language item's name is `eh_personality`.
+------------------------
+"##,
+    },
+    LintCompletion {
+        label: "doc_cfg",
+        description: r##"# `doc_cfg`
 
-[unwind]: https://github.com/rust-lang/rust/blob/master/src/libpanic_unwind/gcc.rs
+The tracking issue for this feature is: [#43781]
 
-The second function, `rust_begin_panic`, is also used by the failure mechanisms of the
-compiler. When a panic happens, this controls the message that's displayed on
-the screen. While the language item's name is `panic_impl`, the symbol name is
-`rust_begin_panic`.
+------
 
-Finally, a `eh_catch_typeinfo` static is needed for certain targets which
-implement Rust panics on top of C++ exceptions.
+The `doc_cfg` feature allows an API be documented as only available in some specific platforms.
+This attribute has two effects:
 
-## List of all language items
+1. In the annotated item's documentation, there will be a message saying "This is supported on
+    (platform) only".
 
-This is a list of all language items in Rust along with where they are located in
-the source code.
+2. The item's doc-tests will only run on the specific platform.
 
-- Primitives
-  - `i8`: `libcore/num/mod.rs`
-  - `i16`: `libcore/num/mod.rs`
-  - `i32`: `libcore/num/mod.rs`
-  - `i64`: `libcore/num/mod.rs`
-  - `i128`: `libcore/num/mod.rs`
-  - `isize`: `libcore/num/mod.rs`
-  - `u8`: `libcore/num/mod.rs`
-  - `u16`: `libcore/num/mod.rs`
-  - `u32`: `libcore/num/mod.rs`
-  - `u64`: `libcore/num/mod.rs`
-  - `u128`: `libcore/num/mod.rs`
-  - `usize`: `libcore/num/mod.rs`
-  - `f32`: `libstd/f32.rs`
-  - `f64`: `libstd/f64.rs`
-  - `char`: `libcore/char.rs`
-  - `slice`: `liballoc/slice.rs`
-  - `str`: `liballoc/str.rs`
-  - `const_ptr`: `libcore/ptr.rs`
-  - `mut_ptr`: `libcore/ptr.rs`
-  - `unsafe_cell`: `libcore/cell.rs`
-- Runtime
-  - `start`: `libstd/rt.rs`
-  - `eh_personality`: `libpanic_unwind/emcc.rs` (EMCC)
-  - `eh_personality`: `libpanic_unwind/gcc.rs` (GNU)
-  - `eh_personality`: `libpanic_unwind/seh.rs` (SEH)
-  - `eh_catch_typeinfo`: `libpanic_unwind/emcc.rs` (EMCC)
-  - `panic`: `libcore/panicking.rs`
-  - `panic_bounds_check`: `libcore/panicking.rs`
-  - `panic_impl`: `libcore/panicking.rs`
-  - `panic_impl`: `libstd/panicking.rs`
-- Allocations
-  - `owned_box`: `liballoc/boxed.rs`
-  - `exchange_malloc`: `liballoc/heap.rs`
-  - `box_free`: `liballoc/heap.rs`
-- Operands
-  - `not`: `libcore/ops/bit.rs`
-  - `bitand`: `libcore/ops/bit.rs`
-  - `bitor`: `libcore/ops/bit.rs`
-  - `bitxor`: `libcore/ops/bit.rs`
-  - `shl`: `libcore/ops/bit.rs`
-  - `shr`: `libcore/ops/bit.rs`
-  - `bitand_assign`: `libcore/ops/bit.rs`
-  - `bitor_assign`: `libcore/ops/bit.rs`
-  - `bitxor_assign`: `libcore/ops/bit.rs`
-  - `shl_assign`: `libcore/ops/bit.rs`
-  - `shr_assign`: `libcore/ops/bit.rs`
-  - `deref`: `libcore/ops/deref.rs`
-  - `deref_mut`: `libcore/ops/deref.rs`
-  - `index`: `libcore/ops/index.rs`
-  - `index_mut`: `libcore/ops/index.rs`
-  - `add`: `libcore/ops/arith.rs`
-  - `sub`: `libcore/ops/arith.rs`
-  - `mul`: `libcore/ops/arith.rs`
-  - `div`: `libcore/ops/arith.rs`
-  - `rem`: `libcore/ops/arith.rs`
-  - `neg`: `libcore/ops/arith.rs`
-  - `add_assign`: `libcore/ops/arith.rs`
-  - `sub_assign`: `libcore/ops/arith.rs`
-  - `mul_assign`: `libcore/ops/arith.rs`
-  - `div_assign`: `libcore/ops/arith.rs`
-  - `rem_assign`: `libcore/ops/arith.rs`
-  - `eq`: `libcore/cmp.rs`
-  - `ord`: `libcore/cmp.rs`
-- Functions
-  - `fn`: `libcore/ops/function.rs`
-  - `fn_mut`: `libcore/ops/function.rs`
-  - `fn_once`: `libcore/ops/function.rs`
-  - `generator_state`: `libcore/ops/generator.rs`
-  - `generator`: `libcore/ops/generator.rs`
-- Other
-  - `coerce_unsized`: `libcore/ops/unsize.rs`
-  - `drop`: `libcore/ops/drop.rs`
-  - `drop_in_place`: `libcore/ptr.rs`
-  - `clone`: `libcore/clone.rs`
-  - `copy`: `libcore/marker.rs`
-  - `send`: `libcore/marker.rs`
-  - `sized`: `libcore/marker.rs`
-  - `unsize`: `libcore/marker.rs`
-  - `sync`: `libcore/marker.rs`
-  - `phantom_data`: `libcore/marker.rs`
-  - `discriminant_kind`: `libcore/marker.rs`
-  - `freeze`: `libcore/marker.rs`
-  - `debug_trait`: `libcore/fmt/mod.rs`
-  - `non_zero`: `libcore/nonzero.rs`
-  - `arc`: `liballoc/sync.rs`
-  - `rc`: `liballoc/rc.rs`
+In addition to allowing the use of the `#[doc(cfg)]` attribute, this feature enables the use of a
+special conditional compilation flag, `#[cfg(doc)]`, set whenever building documentation on your
+crate.
+
+This feature was introduced as part of PR [#43348] to allow the platform-specific parts of the
+standard library be documented.
+
+```rust
+#![feature(doc_cfg)]
+
+#[cfg(any(windows, doc))]
+#[doc(cfg(windows))]
+/// The application's icon in the notification area (a.k.a. system tray).
+///
+/// # Examples
+///
+/// ```no_run
+/// extern crate my_awesome_ui_library;
+/// use my_awesome_ui_library::current_app;
+/// use my_awesome_ui_library::windows::notification;
+///
+/// let icon = current_app().get::<notification::Icon>();
+/// icon.show();
+/// icon.show_message("Hello");
+/// ```
+pub struct Icon {
+    // ...
+}
+```
+
+[#43781]: https://github.com/rust-lang/rust/issues/43781
+[#43348]: https://github.com/rust-lang/rust/issues/43348
+"##,
+    },
+    LintCompletion {
+        label: "doc_masked",
+        description: r##"# `doc_masked`
+
+The tracking issue for this feature is: [#44027]
+
+-----
+
+The `doc_masked` feature allows a crate to exclude types from a given crate from appearing in lists
+of trait implementations. The specifics of the feature are as follows:
+
+1. When rustdoc encounters an `extern crate` statement annotated with a `#[doc(masked)]` attribute,
+   it marks the crate as being masked.
+
+2. When listing traits a given type implements, rustdoc ensures that traits from masked crates are
+   not emitted into the documentation.
+
+3. When listing types that implement a given trait, rustdoc ensures that types from masked crates
+   are not emitted into the documentation.
+
+This feature was introduced in PR [#44026] to ensure that compiler-internal and
+implementation-specific types and traits were not included in the standard library's documentation.
+Such types would introduce broken links into the documentation.
+
+[#44026]: https://github.com/rust-lang/rust/pull/44026
+[#44027]: https://github.com/rust-lang/rust/pull/44027
+"##,
+    },
+    LintCompletion {
+        label: "doc_notable_trait",
+        description: r##"# `doc_notable_trait`
+
+The tracking issue for this feature is: [#45040]
+
+The `doc_notable_trait` feature allows the use of the `#[doc(notable_trait)]`
+attribute, which will display the trait in a "Notable traits" dialog for
+functions returning types that implement the trait. For example, this attribute
+is applied to the `Iterator`, `Future`, `io::Read`, and `io::Write` traits in
+the standard library.
+
+You can do this on your own traits like so:
+
+```
+#![feature(doc_notable_trait)]
+
+#[doc(notable_trait)]
+pub trait MyTrait {}
+
+pub struct MyStruct;
+impl MyTrait for MyStruct {}
+
+/// The docs for this function will have a button that displays a dialog about
+/// `MyStruct` implementing `MyTrait`.
+pub fn my_fn() -> MyStruct { MyStruct }
+```
+
+This feature was originally implemented in PR [#45039].
+
+See also its documentation in [the rustdoc book][rustdoc-book-notable_trait].
+
+[#45040]: https://github.com/rust-lang/rust/issues/45040
+[#45039]: https://github.com/rust-lang/rust/pull/45039
+[rustdoc-book-notable_trait]: ../../rustdoc/unstable-features.html#adding-your-trait-to-the-notable-traits-dialog
+"##,
+    },
+    LintCompletion {
+        label: "external_doc",
+        description: r##"# `external_doc`
+
+The tracking issue for this feature is: [#44732]
+
+The `external_doc` feature allows the use of the `include` parameter to the `#[doc]` attribute, to
+include external files in documentation. Use the attribute in place of, or in addition to, regular
+doc comments and `#[doc]` attributes, and `rustdoc` will load the given file when it renders
+documentation for your crate.
+
+With the following files in the same directory:
+
+`external-doc.md`:
+
+```markdown
+# My Awesome Type
+
+This is the documentation for this spectacular type.
+```
+
+`lib.rs`:
+
+```no_run (needs-external-files)
+#![feature(external_doc)]
+
+#[doc(include = "external-doc.md")]
+pub struct MyAwesomeType;
+```
+
+`rustdoc` will load the file `external-doc.md` and use it as the documentation for the `MyAwesomeType`
+struct.
+
+When locating files, `rustdoc` will base paths in the `src/` directory, as if they were alongside the
+`lib.rs` for your crate. So if you want a `docs/` folder to live alongside the `src/` directory,
+start your paths with `../docs/` for `rustdoc` to properly find the file.
+
+This feature was proposed in [RFC #1990] and initially implemented in PR [#44781].
+
+[#44732]: https://github.com/rust-lang/rust/issues/44732
+[RFC #1990]: https://github.com/rust-lang/rfcs/pull/1990
+[#44781]: https://github.com/rust-lang/rust/pull/44781
+"##,
+    },
+    LintCompletion {
+        label: "fd",
+        description: r##"# `fd`
+
+This feature is internal to the Rust compiler and is not intended for general use.
+
+------------------------
+"##,
+    },
+    LintCompletion {
+        label: "fd_read",
+        description: r##"# `fd_read`
+
+This feature is internal to the Rust compiler and is not intended for general use.
+
+------------------------
+"##,
+    },
+    LintCompletion {
+        label: "ffi_const",
+        description: r##"# `ffi_const`
+
+The tracking issue for this feature is: [#58328]
+
+------
+
+The `#[ffi_const]` attribute applies clang's `const` attribute to foreign
+functions declarations.
+
+That is, `#[ffi_const]` functions shall have no effects except for its return
+value, which can only depend on the values of the function parameters, and is
+not affected by changes to the observable state of the program.
+
+Applying the `#[ffi_const]` attribute to a function that violates these
+requirements is undefined behaviour.
+
+This attribute enables Rust to perform common optimizations, like sub-expression
+elimination, and it can avoid emitting some calls in repeated invocations of the
+function with the same argument values regardless of other operations being
+performed in between these functions calls (as opposed to `#[ffi_pure]`
+functions).
+
+## Pitfalls
+
+A `#[ffi_const]` function can only read global memory that would not affect
+its return value for the whole execution of the program (e.g. immutable global
+memory). `#[ffi_const]` functions are referentially-transparent and therefore
+more strict than `#[ffi_pure]` functions.
+
+A common pitfall involves applying the `#[ffi_const]` attribute to a
+function that reads memory through pointer arguments which do not necessarily
+point to immutable global memory.
+
+A `#[ffi_const]` function that returns unit has no effect on the abstract
+machine's state, and a `#[ffi_const]` function cannot be `#[ffi_pure]`.
+
+A `#[ffi_const]` function must not diverge, neither via a side effect (e.g. a
+call to `abort`) nor by infinite loops.
+
+When translating C headers to Rust FFI, it is worth verifying for which targets
+the `const` attribute is enabled in those headers, and using the appropriate
+`cfg` macros in the Rust side to match those definitions. While the semantics of
+`const` are implemented identically by many C and C++ compilers, e.g., clang,
+[GCC], [ARM C/C++ compiler], [IBM ILE C/C++], etc. they are not necessarily
+implemented in this way on all of them. It is therefore also worth verifying
+that the semantics of the C toolchain used to compile the binary being linked
+against are compatible with those of the `#[ffi_const]`.
+
+[#58328]: https://github.com/rust-lang/rust/issues/58328
+[ARM C/C++ compiler]: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491c/Cacgigch.html
+[GCC]: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-const-function-attribute
+[IBM ILE C/C++]: https://www.ibm.com/support/knowledgecenter/fr/ssw_ibm_i_71/rzarg/fn_attrib_const.htm
 "##,
     },
     LintCompletion {
-        label: "doc_spotlight",
-        description: r##"# `doc_spotlight`
-
-The tracking issue for this feature is: [#45040]
+        label: "ffi_pure",
+        description: r##"# `ffi_pure`
 
-The `doc_spotlight` feature allows the use of the `spotlight` parameter to the `#[doc]` attribute,
-to "spotlight" a specific trait on the return values of functions. Adding a `#[doc(spotlight)]`
-attribute to a trait definition will make rustdoc print extra information for functions which return
-a type that implements that trait. For example, this attribute is applied to the `Iterator`,
-`io::Read`, `io::Write`, and `Future` traits in the standard library.
+The tracking issue for this feature is: [#58329]
 
-You can do this on your own traits, like this:
+------
 
-```
-#![feature(doc_spotlight)]
+The `#[ffi_pure]` attribute applies clang's `pure` attribute to foreign
+functions declarations.
 
-#[doc(spotlight)]
-pub trait MyTrait {}
+That is, `#[ffi_pure]` functions shall have no effects except for its return
+value, which shall not change across two consecutive function calls with
+the same parameters.
 
-pub struct MyStruct;
-impl MyTrait for MyStruct {}
+Applying the `#[ffi_pure]` attribute to a function that violates these
+requirements is undefined behavior.
 
-/// The docs for this function will have an extra line about `MyStruct` implementing `MyTrait`,
-/// without having to write that yourself!
-pub fn my_fn() -> MyStruct { MyStruct }
-```
+This attribute enables Rust to perform common optimizations, like sub-expression
+elimination and loop optimizations. Some common examples of pure functions are
+`strlen` or `memcmp`.
 
-This feature was originally implemented in PR [#45039].
+These optimizations are only applicable when the compiler can prove that no
+program state observable by the `#[ffi_pure]` function has changed between calls
+of the function, which could alter the result. See also the `#[ffi_const]`
+attribute, which provides stronger guarantees regarding the allowable behavior
+of a function, enabling further optimization.
 
-[#45040]: https://github.com/rust-lang/rust/issues/45040
-[#45039]: https://github.com/rust-lang/rust/pull/45039
-"##,
-    },
-    LintCompletion {
-        label: "c_variadic",
-        description: r##"# `c_variadic`
+## Pitfalls
 
-The tracking issue for this feature is: [#44930]
+A `#[ffi_pure]` function can read global memory through the function
+parameters (e.g. pointers), globals, etc. `#[ffi_pure]` functions are not
+referentially-transparent, and are therefore more relaxed than `#[ffi_const]`
+functions.
 
-[#44930]: https://github.com/rust-lang/rust/issues/44930
+However, accessing global memory through volatile or atomic reads can violate the
+requirement that two consecutive function calls shall return the same value.
 
-------------------------
+A `pure` function that returns unit has no effect on the abstract machine's
+state.
 
-The `c_variadic` language feature enables C-variadic functions to be
-defined in Rust. The may be called both from within Rust and via FFI.
+A `#[ffi_pure]` function must not diverge, neither via a side effect (e.g. a
+call to `abort`) nor by infinite loops.
 
-## Examples
+When translating C headers to Rust FFI, it is worth verifying for which targets
+the `pure` attribute is enabled in those headers, and using the appropriate
+`cfg` macros in the Rust side to match those definitions. While the semantics of
+`pure` are implemented identically by many C and C++ compilers, e.g., clang,
+[GCC], [ARM C/C++ compiler], [IBM ILE C/C++], etc. they are not necessarily
+implemented in this way on all of them. It is therefore also worth verifying
+that the semantics of the C toolchain used to compile the binary being linked
+against are compatible with those of the `#[ffi_pure]`.
 
-```rust
-#![feature(c_variadic)]
 
-pub unsafe extern "C" fn add(n: usize, mut args: ...) -> usize {
-    let mut sum = 0;
-    for _ in 0..n {
-        sum += args.arg::<usize>();
-    }
-    sum
-}
-```
+[#58329]: https://github.com/rust-lang/rust/issues/58329
+[ARM C/C++ compiler]: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491c/Cacigdac.html
+[GCC]: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-pure-function-attribute
+[IBM ILE C/C++]: https://www.ibm.com/support/knowledgecenter/fr/ssw_ibm_i_71/rzarg/fn_attrib_pure.htm
 "##,
     },
     LintCompletion {
-        label: "intra_doc_pointers",
-        description: r##"# `intra-doc-pointers`
-
-The tracking issue for this feature is: [#80896]
+        label: "flt2dec",
+        description: r##"# `flt2dec`
 
-[#80896]: https://github.com/rust-lang/rust/issues/80896
+This feature is internal to the Rust compiler and is not intended for general use.
 
 ------------------------
+"##,
+    },
+    LintCompletion {
+        label: "fmt_internals",
+        description: r##"# `fmt_internals`
 
-Rustdoc does not currently allow disambiguating between `*const` and `*mut`, and
-raw pointers in intra-doc links are unstable until it does.
+This feature is internal to the Rust compiler and is not intended for general use.
 
-```rust
-#![feature(intra_doc_pointers)]
-//! [pointer::add]
-```
+------------------------
 "##,
     },
     LintCompletion {
-        label: "box_syntax",
-        description: r##"# `box_syntax`
+        label: "fn_traits",
+        description: r##"# `fn_traits`
 
-The tracking issue for this feature is: [#49733]
+The tracking issue for this feature is [#29625]
 
-[#49733]: https://github.com/rust-lang/rust/issues/49733
+See Also: [`unboxed_closures`](../language-features/unboxed-closures.md)
 
-See also [`box_patterns`](box-patterns.md)
+[#29625]: https://github.com/rust-lang/rust/issues/29625
 
-------------------------
+----
 
-Currently the only stable way to create a `Box` is via the `Box::new` method.
-Also it is not possible in stable Rust to destructure a `Box` in a match
-pattern. The unstable `box` keyword can be used to create a `Box`. An example
-usage would be:
+The `fn_traits` feature allows for implementation of the [`Fn*`] traits
+for creating custom closure-like types.
+
+[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html
 
 ```rust
-#![feature(box_syntax)]
+#![feature(unboxed_closures)]
+#![feature(fn_traits)]
+
+struct Adder {
+    a: u32
+}
+
+impl FnOnce<(u32, )> for Adder {
+    type Output = u32;
+    extern "rust-call" fn call_once(self, b: (u32, )) -> Self::Output {
+        self.a + b.0
+    }
+}
 
 fn main() {
-    let b = box 5;
+    let adder = Adder { a: 3 };
+    assert_eq!(adder(2), 5);
 }
 ```
 "##,
     },
     LintCompletion {
-        label: "unsized_locals",
-        description: r##"# `unsized_locals`
+        label: "format_args_capture",
+        description: r##"# `format_args_capture`
 
-The tracking issue for this feature is: [#48055]
+The tracking issue for this feature is: [#67984]
 
-[#48055]: https://github.com/rust-lang/rust/issues/48055
+[#67984]: https://github.com/rust-lang/rust/issues/67984
 
 ------------------------
 
-This implements [RFC1909]. When turned on, you can have unsized arguments and locals:
-
-[RFC1909]: https://github.com/rust-lang/rfcs/blob/master/text/1909-unsized-rvalues.md
+Enables `format_args!` (and macros which use `format_args!` in their implementation, such
+as `format!`, `print!` and `panic!`) to capture variables from the surrounding scope.
+This avoids the need to pass named parameters when the binding in question
+already exists in scope.
 
 ```rust
-#![allow(incomplete_features)]
-#![feature(unsized_locals, unsized_fn_params)]
+#![feature(format_args_capture)]
 
-use std::any::Any;
+let (person, species, name) = ("Charlie Brown", "dog", "Snoopy");
 
-fn main() {
-    let x: Box<dyn Any> = Box::new(42);
-    let x: dyn Any = *x;
-    //  ^ unsized local variable
-    //               ^^ unsized temporary
-    foo(x);
-}
+// captures named argument `person`
+print!("Hello {person}");
 
-fn foo(_: dyn Any) {}
-//     ^^^^^^ unsized argument
+// captures named arguments `species` and `name`
+format!("The {species}'s name is {name}.");
 ```
 
-The RFC still forbids the following unsized expressions:
+This also works for formatting parameters such as width and precision:
 
-```rust,compile_fail
-#![feature(unsized_locals)]
+```rust
+#![feature(format_args_capture)]
 
-use std::any::Any;
+let precision = 2;
+let s = format!("{:.precision$}", 1.324223);
 
-struct MyStruct<T: ?Sized> {
-    content: T,
-}
+assert_eq!(&s, "1.32");
+```
 
-struct MyTupleStruct<T: ?Sized>(T);
+A non-exhaustive list of macros which benefit from this functionality include:
+- `format!`
+- `print!` and `println!`
+- `eprint!` and `eprintln!`
+- `write!` and `writeln!`
+- `panic!`
+- `unreachable!`
+- `unimplemented!`
+- `todo!`
+- `assert!` and similar
+- macros in many thirdparty crates, such as `log`
+"##,
+    },
+    LintCompletion {
+        label: "generators",
+        description: r##"# `generators`
 
-fn answer() -> Box<dyn Any> {
-    Box::new(42)
-}
+The tracking issue for this feature is: [#43122]
 
-fn main() {
-    // You CANNOT have unsized statics.
-    static X: dyn Any = *answer();  // ERROR
-    const Y: dyn Any = *answer();  // ERROR
+[#43122]: https://github.com/rust-lang/rust/issues/43122
 
-    // You CANNOT have struct initialized unsized.
-    MyStruct { content: *answer() };  // ERROR
-    MyTupleStruct(*answer());  // ERROR
-    (42, *answer());  // ERROR
+------------------------
 
-    // You CANNOT have unsized return types.
-    fn my_function() -> dyn Any { *answer() }  // ERROR
+The `generators` feature gate in Rust allows you to define generator or
+coroutine literals. A generator is a "resumable function" that syntactically
+resembles a closure but compiles to much different semantics in the compiler
+itself. The primary feature of a generator is that it can be suspended during
+execution to be resumed at a later date. Generators use the `yield` keyword to
+"return", and then the caller can `resume` a generator to resume execution just
+after the `yield` keyword.
 
-    // You CAN have unsized local variables...
-    let mut x: dyn Any = *answer();  // OK
-    // ...but you CANNOT reassign to them.
-    x = *answer();  // ERROR
+Generators are an extra-unstable feature in the compiler right now. Added in
+[RFC 2033] they're mostly intended right now as a information/constraint
+gathering phase. The intent is that experimentation can happen on the nightly
+compiler before actual stabilization. A further RFC will be required to
+stabilize generators/coroutines and will likely contain at least a few small
+tweaks to the overall design.
 
-    // You CANNOT even initialize them separately.
-    let y: dyn Any;  // OK
-    y = *answer();  // ERROR
+[RFC 2033]: https://github.com/rust-lang/rfcs/pull/2033
 
-    // Not mentioned in the RFC, but by-move captured variables are also Sized.
-    let x: dyn Any = *answer();
-    (move || {  // ERROR
-        let y = x;
-    })();
+A syntactical example of a generator is:
 
-    // You CAN create a closure with unsized arguments,
-    // but you CANNOT call it.
-    // This is an implementation detail and may be changed in the future.
-    let f = |x: dyn Any| {};
-    f(*answer());  // ERROR
+```rust
+#![feature(generators, generator_trait)]
+
+use std::ops::{Generator, GeneratorState};
+use std::pin::Pin;
+
+fn main() {
+    let mut generator = || {
+        yield 1;
+        return "foo"
+    };
+
+    match Pin::new(&mut generator).resume(()) {
+        GeneratorState::Yielded(1) => {}
+        _ => panic!("unexpected value from resume"),
+    }
+    match Pin::new(&mut generator).resume(()) {
+        GeneratorState::Complete("foo") => {}
+        _ => panic!("unexpected value from resume"),
+    }
 }
 ```
 
-## By-value trait objects
+Generators are closure-like literals which can contain a `yield` statement. The
+`yield` statement takes an optional expression of a value to yield out of the
+generator. All generator literals implement the `Generator` trait in the
+`std::ops` module. The `Generator` trait has one main method, `resume`, which
+resumes execution of the generator at the previous suspension point.
 
-With this feature, you can have by-value `self` arguments without `Self: Sized` bounds.
+An example of the control flow of generators is that the following example
+prints all numbers in order:
 
 ```rust
-#![feature(unsized_fn_params)]
-
-trait Foo {
-    fn foo(self) {}
-}
+#![feature(generators, generator_trait)]
 
-impl<T: ?Sized> Foo for T {}
+use std::ops::Generator;
+use std::pin::Pin;
 
 fn main() {
-    let slice: Box<[i32]> = Box::new([1, 2, 3]);
-    <[i32] as Foo>::foo(*slice);
+    let mut generator = || {
+        println!("2");
+        yield;
+        println!("4");
+    };
+
+    println!("1");
+    Pin::new(&mut generator).resume(());
+    println!("3");
+    Pin::new(&mut generator).resume(());
+    println!("5");
 }
 ```
 
-And `Foo` will also be object-safe.
+At this time the main intended use case of generators is an implementation
+primitive for async/await syntax, but generators will likely be extended to
+ergonomic implementations of iterators and other primitives in the future.
+Feedback on the design and usage is always appreciated!
+
+### The `Generator` trait
+
+The `Generator` trait in `std::ops` currently looks like:
 
 ```rust
-#![feature(unsized_fn_params)]
+# #![feature(arbitrary_self_types, generator_trait)]
+# use std::ops::GeneratorState;
+# use std::pin::Pin;
 
-trait Foo {
-    fn foo(self) {}
+pub trait Generator<R = ()> {
+    type Yield;
+    type Return;
+    fn resume(self: Pin<&mut Self>, resume: R) -> GeneratorState<Self::Yield, Self::Return>;
 }
+```
 
-impl<T: ?Sized> Foo for T {}
+The `Generator::Yield` type is the type of values that can be yielded with the
+`yield` statement. The `Generator::Return` type is the returned type of the
+generator. This is typically the last expression in a generator's definition or
+any value passed to `return` in a generator. The `resume` function is the entry
+point for executing the `Generator` itself.
 
-fn main () {
-    let slice: Box<dyn Foo> = Box::new([1, 2, 3]);
-    // doesn't compile yet
-    <dyn Foo as Foo>::foo(*slice);
+The return value of `resume`, `GeneratorState`, looks like:
+
+```rust
+pub enum GeneratorState<Y, R> {
+    Yielded(Y),
+    Complete(R),
 }
 ```
 
-One of the objectives of this feature is to allow `Box<dyn FnOnce>`.
+The `Yielded` variant indicates that the generator can later be resumed. This
+corresponds to a `yield` point in a generator. The `Complete` variant indicates
+that the generator is complete and cannot be resumed again. Calling `resume`
+after a generator has returned `Complete` will likely result in a panic of the
+program.
 
-## Variable length arrays
+### Closure-like semantics
 
-The RFC also describes an extension to the array literal syntax: `[e; dyn n]`. In the syntax, `n` isn't necessarily a constant expression. The array is dynamically allocated on the stack and has the type of `[T]`, instead of `[T; n]`.
+The closure-like syntax for generators alludes to the fact that they also have
+closure-like semantics. Namely:
 
-```rust,ignore (not-yet-implemented)
-#![feature(unsized_locals)]
+* When created, a generator executes no code. A closure literal does not
+  actually execute any of the closure's code on construction, and similarly a
+  generator literal does not execute any code inside the generator when
+  constructed.
 
-fn mergesort<T: Ord>(a: &mut [T]) {
-    let mut tmp = [T; dyn a.len()];
-    // ...
-}
+* Generators can capture outer variables by reference or by move, and this can
+  be tweaked with the `move` keyword at the beginning of the closure. Like
+  closures all generators will have an implicit environment which is inferred by
+  the compiler. Outer variables can be moved into a generator for use as the
+  generator progresses.
 
-fn main() {
-    let mut a = [3, 1, 5, 6];
-    mergesort(&mut a);
-    assert_eq!(a, [1, 3, 5, 6]);
-}
-```
+* Generator literals produce a value with a unique type which implements the
+  `std::ops::Generator` trait. This allows actual execution of the generator
+  through the `Generator::resume` method as well as also naming it in return
+  types and such.
 
-VLAs are not implemented yet. The syntax isn't final, either. We may need an alternative syntax for Rust 2015 because, in Rust 2015, expressions like `[e; dyn(1)]` would be ambiguous. One possible alternative proposed in the RFC is `[e; n]`: if `n` captures one or more local variables, then it is considered as `[e; dyn n]`.
+* Traits like `Send` and `Sync` are automatically implemented for a `Generator`
+  depending on the captured variables of the environment. Unlike closures,
+  generators also depend on variables live across suspension points. This means
+  that although the ambient environment may be `Send` or `Sync`, the generator
+  itself may not be due to internal variables live across `yield` points being
+  not-`Send` or not-`Sync`. Note that generators do
+  not implement traits like `Copy` or `Clone` automatically.
 
-## Advisory on stack usage
+* Whenever a generator is dropped it will drop all captured environment
+  variables.
 
-It's advised not to casually use the `#![feature(unsized_locals)]` feature. Typical use-cases are:
+### Generators as state machines
 
-- When you need a by-value trait objects.
-- When you really need a fast allocation of small temporary arrays.
+In the compiler, generators are currently compiled as state machines. Each
+`yield` expression will correspond to a different state that stores all live
+variables over that suspension point. Resumption of a generator will dispatch on
+the current state and then execute internally until a `yield` is reached, at
+which point all state is saved off in the generator and a value is returned.
 
-Another pitfall is repetitive allocation and temporaries. Currently the compiler simply extends the stack frame every time it encounters an unsized assignment. So for example, the code
+Let's take a look at an example to see what's going on here:
 
 ```rust
-#![feature(unsized_locals)]
+#![feature(generators, generator_trait)]
+
+use std::ops::Generator;
+use std::pin::Pin;
 
 fn main() {
-    let x: Box<[i32]> = Box::new([1, 2, 3, 4, 5]);
-    let _x = {{{{{{{{{{*x}}}}}}}}}};
+    let ret = "foo";
+    let mut generator = move || {
+        yield 1;
+        return ret
+    };
+
+    Pin::new(&mut generator).resume(());
+    Pin::new(&mut generator).resume(());
 }
 ```
 
-and the code
+This generator literal will compile down to something similar to:
 
 ```rust
-#![feature(unsized_locals)]
-
-fn main() {
-    for _ in 0..10 {
-        let x: Box<[i32]> = Box::new([1, 2, 3, 4, 5]);
-        let _x = *x;
-    }
-}
-```
-
-will unnecessarily extend the stack frame.
-"##,
-    },
-    LintCompletion {
-        label: "arbitrary_enum_discriminant",
-        description: r##"# `arbitrary_enum_discriminant`
+#![feature(arbitrary_self_types, generators, generator_trait)]
 
-The tracking issue for this feature is: [#60553]
+use std::ops::{Generator, GeneratorState};
+use std::pin::Pin;
 
-[#60553]: https://github.com/rust-lang/rust/issues/60553
+fn main() {
+    let ret = "foo";
+    let mut generator = {
+        enum __Generator {
+            Start(&'static str),
+            Yield1(&'static str),
+            Done,
+        }
 
-------------------------
+        impl Generator for __Generator {
+            type Yield = i32;
+            type Return = &'static str;
 
-The `arbitrary_enum_discriminant` feature permits tuple-like and
-struct-like enum variants with `#[repr(<int-type>)]` to have explicit discriminants.
+            fn resume(mut self: Pin<&mut Self>, resume: ()) -> GeneratorState<i32, &'static str> {
+                use std::mem;
+                match mem::replace(&mut *self, __Generator::Done) {
+                    __Generator::Start(s) => {
+                        *self = __Generator::Yield1(s);
+                        GeneratorState::Yielded(1)
+                    }
 
-## Examples
+                    __Generator::Yield1(s) => {
+                        *self = __Generator::Done;
+                        GeneratorState::Complete(s)
+                    }
 
-```rust
-#![feature(arbitrary_enum_discriminant)]
+                    __Generator::Done => {
+                        panic!("generator resumed after completion")
+                    }
+                }
+            }
+        }
 
-#[allow(dead_code)]
-#[repr(u8)]
-enum Enum {
-    Unit = 3,
-    Tuple(u16) = 2,
-    Struct {
-        a: u8,
-        b: u16,
-    } = 1,
-}
+        __Generator::Start(ret)
+    };
 
-impl Enum {
-    fn tag(&self) -> u8 {
-        unsafe { *(self as *const Self as *const u8) }
-    }
+    Pin::new(&mut generator).resume(());
+    Pin::new(&mut generator).resume(());
 }
-
-assert_eq!(3, Enum::Unit.tag());
-assert_eq!(2, Enum::Tuple(5).tag());
-assert_eq!(1, Enum::Struct{a: 7, b: 11}.tag());
 ```
-"##,
-    },
-    LintCompletion {
-        label: "unboxed_closures",
-        description: r##"# `unboxed_closures`
-
-The tracking issue for this feature is [#29625]
-
-See Also: [`fn_traits`](../library-features/fn-traits.md)
-
-[#29625]: https://github.com/rust-lang/rust/issues/29625
-
-----
 
-The `unboxed_closures` feature allows you to write functions using the `"rust-call"` ABI,
-required for implementing the [`Fn*`] family of traits. `"rust-call"` functions must have
-exactly one (non self) argument, a tuple representing the argument list.
-
-[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html
-
-```rust
-#![feature(unboxed_closures)]
+Notably here we can see that the compiler is generating a fresh type,
+`__Generator` in this case. This type has a number of states (represented here
+as an `enum`) corresponding to each of the conceptual states of the generator.
+At the beginning we're closing over our outer variable `foo` and then that
+variable is also live over the `yield` point, so it's stored in both states.
 
-extern "rust-call" fn add_args(args: (u32, u32)) -> u32 {
-    args.0 + args.1
-}
+When the generator starts it'll immediately yield 1, but it saves off its state
+just before it does so indicating that it has reached the yield point. Upon
+resuming again we'll execute the `return ret` which returns the `Complete`
+state.
 
-fn main() {}
-```
+Here we can also note that the `Done` state, if resumed, panics immediately as
+it's invalid to resume a completed generator. It's also worth noting that this
+is just a rough desugaring, not a normative specification for what the compiler
+does.
 "##,
     },
     LintCompletion {
-        label: "custom_test_frameworks",
-        description: r##"# `custom_test_frameworks`
+        label: "global_asm",
+        description: r##"# `global_asm`
 
-The tracking issue for this feature is: [#50297]
+The tracking issue for this feature is: [#35119]
 
-[#50297]: https://github.com/rust-lang/rust/issues/50297
+[#35119]: https://github.com/rust-lang/rust/issues/35119
 
 ------------------------
 
-The `custom_test_frameworks` feature allows the use of `#[test_case]` and `#![test_runner]`.
-Any function, const, or static can be annotated with `#[test_case]` causing it to be aggregated (like `#[test]`)
-and be passed to the test runner determined by the `#![test_runner]` crate attribute.
-
-```rust
-#![feature(custom_test_frameworks)]
-#![test_runner(my_runner)]
+The `global_asm!` macro allows the programmer to write arbitrary
+assembly outside the scope of a function body, passing it through
+`rustc` and `llvm` to the assembler. That is to say, `global_asm!` is
+equivalent to assembling the asm with an external assembler and then
+linking the resulting object file with the current crate.
 
-fn my_runner(tests: &[&i32]) {
-    for t in tests {
-        if **t == 0 {
-            println!("PASSED");
-        } else {
-            println!("FAILED");
-        }
-    }
-}
+`global_asm!` fills a role not currently satisfied by either `asm!`
+or `#[naked]` functions. The programmer has _all_ features of the
+assembler at their disposal. The linker will expect to resolve any
+symbols defined in the inline assembly, modulo any symbols marked as
+external. It also means syntax for directives and assembly follow the
+conventions of the assembler in your toolchain.
 
-#[test_case]
-const WILL_PASS: i32 = 0;
+A simple usage looks like this:
 
-#[test_case]
-const WILL_FAIL: i32 = 4;
+```rust,ignore (requires-external-file)
+#![feature(global_asm)]
+# // you also need relevant target_arch cfgs
+global_asm!(include_str!("something_neato.s"));
 ```
-"##,
-    },
-    LintCompletion {
-        label: "abi_msp430_interrupt",
-        description: r##"# `abi_msp430_interrupt`
 
-The tracking issue for this feature is: [#38487]
-
-[#38487]: https://github.com/rust-lang/rust/issues/38487
+And a more complicated usage looks like this:
 
-------------------------
+```rust,no_run
+#![feature(global_asm)]
+# #[cfg(any(target_arch="x86", target_arch="x86_64"))]
+# mod x86 {
 
-In the MSP430 architecture, interrupt handlers have a special calling
-convention. You can use the `"msp430-interrupt"` ABI to make the compiler apply
-the right calling convention to the interrupt handlers you define.
+pub mod sally {
+    global_asm!(
+        ".global foo",
+        "foo:",
+        "jmp baz",
+    );
 
-<!-- NOTE(ignore) this example is specific to the msp430 target -->
+    #[no_mangle]
+    pub unsafe extern "C" fn baz() {}
+}
 
-``` rust,ignore
-#![feature(abi_msp430_interrupt)]
-#![no_std]
+// the symbols `foo` and `bar` are global, no matter where
+// `global_asm!` was used.
+extern "C" {
+    fn foo();
+    fn bar();
+}
 
-// Place the interrupt handler at the appropriate memory address
-// (Alternatively, you can use `#[used]` and remove `pub` and `#[no_mangle]`)
-#[link_section = "__interrupt_vector_10"]
-#[no_mangle]
-pub static TIM0_VECTOR: extern "msp430-interrupt" fn() = tim0;
+pub mod harry {
+    global_asm!(
+        ".global bar",
+        "bar:",
+        "jmp quux",
+    );
 
-// The interrupt handler
-extern "msp430-interrupt" fn tim0() {
-    // ..
+    #[no_mangle]
+    pub unsafe extern "C" fn quux() {}
 }
+# }
 ```
 
-``` text
-$ msp430-elf-objdump -CD ./target/msp430/release/app
-Disassembly of section __interrupt_vector_10:
+You may use `global_asm!` multiple times, anywhere in your crate, in
+whatever way suits you. However, you should not rely on assembler state
+(e.g. assembler macros) defined in one `global_asm!` to be available in
+another one. It is implementation-defined whether the multiple usages
+are concatenated into one or assembled separately.
 
-0000fff2 <TIM0_VECTOR>:
-    fff2:       00 c0           interrupt service routine at 0xc000
+`global_asm!` also supports `const` operands like `asm!`, which allows
+constants defined in Rust to be used in assembly code:
 
-Disassembly of section .text:
+```rust,no_run
+#![feature(global_asm)]
+# #[cfg(any(target_arch="x86", target_arch="x86_64"))]
+# mod x86 {
+const C: i32 = 1234;
+global_asm!(
+    ".global bar",
+    "bar: .word {c}",
+    c = const C,
+);
+# }
+```
 
-0000c000 <int::tim0>:
-    c000:       00 13           reti
+The syntax for passing operands is the same as `asm!` except that only
+`const` operands are allowed. Refer to the [asm](asm.md) documentation
+for more details.
+
+On x86, the assembly code will use intel syntax by default. You can
+override this by adding `options(att_syntax)` at the end of the macro
+arguments list:
+
+```rust,no_run
+#![feature(global_asm)]
+# #[cfg(any(target_arch="x86", target_arch="x86_64"))]
+# mod x86 {
+global_asm!("movl ${}, %ecx", const 5, options(att_syntax));
+// is equivalent to
+global_asm!("mov ecx, {}", const 5);
+# }
 ```
+
+------------------------
+
+If you don't need quite as much power and flexibility as
+`global_asm!` provides, and you don't mind restricting your inline
+assembly to `fn` bodies only, you might try the
+[asm](asm.md) feature instead.
 "##,
     },
     LintCompletion {
@@ -2157,53 +2623,6 @@ fn main() {
 Note however that because the types of `a` and `b` are opaque in the above
 example, calling inherent methods or methods outside of the specified traits
 (e.g., `a.abs()` or `b.abs()`) is not allowed, and yields an error.
-"##,
-    },
-    LintCompletion {
-        label: "cfg_version",
-        description: r##"# `cfg_version`
-
-The tracking issue for this feature is: [#64796]
-
-[#64796]: https://github.com/rust-lang/rust/issues/64796
-
-------------------------
-
-The `cfg_version` feature makes it possible to execute different code
-depending on the compiler version.
-
-## Examples
-
-```rust
-#![feature(cfg_version)]
-
-#[cfg(version("1.42"))]
-fn a() {
-    // ...
-}
-
-#[cfg(not(version("1.42")))]
-fn a() {
-    // ...
-}
-
-fn b() {
-    if cfg!(version("1.42")) {
-        // ...
-    } else {
-        // ...
-    }
-}
-```
-"##,
-    },
-    LintCompletion {
-        label: "link_cfg",
-        description: r##"# `link_cfg`
-
-This feature is internal to the Rust compiler and is not intended for general use.
-
-------------------------
 "##,
     },
     LintCompletion {
@@ -2248,461 +2667,457 @@ struct Bar<T: 'static> {
 struct Foo<U> {
     bar: Bar<U>
 }
-struct Bar<T: 'static> {
-    x: T,
-}
-```
-"##,
-    },
-    LintCompletion {
-        label: "marker_trait_attr",
-        description: r##"# `marker_trait_attr`
-
-The tracking issue for this feature is: [#29864]
-
-[#29864]: https://github.com/rust-lang/rust/issues/29864
-
-------------------------
-
-Normally, Rust keeps you from adding trait implementations that could
-overlap with each other, as it would be ambiguous which to use.  This
-feature, however, carves out an exception to that rule: a trait can
-opt-in to having overlapping implementations, at the cost that those
-implementations are not allowed to override anything (and thus the
-trait itself cannot have any associated items, as they're pointless
-when they'd need to do the same thing for every type anyway).
-
-```rust
-#![feature(marker_trait_attr)]
-
-#[marker] trait CheapToClone: Clone {}
-
-impl<T: Copy> CheapToClone for T {}
-
-// These could potentially overlap with the blanket implementation above,
-// so are only allowed because CheapToClone is a marker trait.
-impl<T: CheapToClone, U: CheapToClone> CheapToClone for (T, U) {}
-impl<T: CheapToClone> CheapToClone for std::ops::Range<T> {}
-
-fn cheap_clone<T: CheapToClone>(t: T) -> T {
-    t.clone()
-}
-```
-
-This is expected to replace the unstable `overlapping_marker_traits`
-feature, which applied to all empty traits (without needing an opt-in).
-"##,
-    },
-    LintCompletion {
-        label: "doc_masked",
-        description: r##"# `doc_masked`
-
-The tracking issue for this feature is: [#44027]
-
------
-
-The `doc_masked` feature allows a crate to exclude types from a given crate from appearing in lists
-of trait implementations. The specifics of the feature are as follows:
-
-1. When rustdoc encounters an `extern crate` statement annotated with a `#[doc(masked)]` attribute,
-   it marks the crate as being masked.
-
-2. When listing traits a given type implements, rustdoc ensures that traits from masked crates are
-   not emitted into the documentation.
-
-3. When listing types that implement a given trait, rustdoc ensures that types from masked crates
-   are not emitted into the documentation.
-
-This feature was introduced in PR [#44026] to ensure that compiler-internal and
-implementation-specific types and traits were not included in the standard library's documentation.
-Such types would introduce broken links into the documentation.
-
-[#44026]: https://github.com/rust-lang/rust/pull/44026
-[#44027]: https://github.com/rust-lang/rust/pull/44027
-"##,
-    },
-    LintCompletion {
-        label: "abi_ptx",
-        description: r##"# `abi_ptx`
-
-The tracking issue for this feature is: [#38788]
-
-[#38788]: https://github.com/rust-lang/rust/issues/38788
-
-------------------------
-
-When emitting PTX code, all vanilla Rust functions (`fn`) get translated to
-"device" functions. These functions are *not* callable from the host via the
-CUDA API so a crate with only device functions is not too useful!
+struct Bar<T: 'static> {
+    x: T,
+}
+```
+"##,
+    },
+    LintCompletion {
+        label: "inline_const",
+        description: r##"# `inline_const`
 
-OTOH, "global" functions *can* be called by the host; you can think of them
-as the real public API of your crate. To produce a global function use the
-`"ptx-kernel"` ABI.
+The tracking issue for this feature is: [#76001]
 
-<!-- NOTE(ignore) this example is specific to the nvptx targets -->
+------
 
-``` rust,ignore
-#![feature(abi_ptx)]
-#![no_std]
+This feature allows you to use inline constant expressions. For example, you can
+turn this code:
 
-pub unsafe extern "ptx-kernel" fn global_function() {
-    device_function();
-}
+```rust
+# fn add_one(x: i32) -> i32 { x + 1 }
+const MY_COMPUTATION: i32 = 1 + 2 * 3 / 4;
 
-pub fn device_function() {
-    // ..
+fn main() {
+    let x = add_one(MY_COMPUTATION);
 }
 ```
 
-``` text
-$ xargo rustc --target nvptx64-nvidia-cuda --release -- --emit=asm
+into this code:
 
-$ cat $(find -name '*.s')
-//
-// Generated by LLVM NVPTX Back-End
-//
+```rust
+#![feature(inline_const)]
 
-.version 3.2
-.target sm_20
-.address_size 64
+# fn add_one(x: i32) -> i32 { x + 1 }
+fn main() {
+    let x = add_one(const { 1 + 2 * 3 / 4 });
+}
+```
 
-        // .globl       _ZN6kernel15global_function17h46111ebe6516b382E
+You can also use inline constant expressions in patterns:
 
-.visible .entry _ZN6kernel15global_function17h46111ebe6516b382E()
-{
+```rust
+#![feature(inline_const)]
 
+const fn one() -> i32 { 1 }
 
-        ret;
+let some_int = 3;
+match some_int {
+    const { 1 + 2 } => println!("Matched 1 + 2"),
+    const { one() } => println!("Matched const fn returning 1"),
+    _ => println!("Didn't match anything :("),
 }
+```
 
-        // .globl       _ZN6kernel15device_function17hd6a0e4993bbf3f78E
-.visible .func _ZN6kernel15device_function17hd6a0e4993bbf3f78E()
-{
+[#76001]: https://github.com/rust-lang/rust/issues/76001
+"##,
+    },
+    LintCompletion {
+        label: "int_error_internals",
+        description: r##"# `int_error_internals`
 
+This feature is internal to the Rust compiler and is not intended for general use.
 
-        ret;
-}
-```
+------------------------
 "##,
     },
     LintCompletion {
-        label: "profiler_runtime",
-        description: r##"# `profiler_runtime`
+        label: "internal_output_capture",
+        description: r##"# `internal_output_capture`
 
-The tracking issue for this feature is: [#42524](https://github.com/rust-lang/rust/issues/42524).
+This feature is internal to the Rust compiler and is not intended for general use.
 
 ------------------------
 "##,
     },
     LintCompletion {
-        label: "crate_visibility_modifier",
-        description: r##"# `crate_visibility_modifier`
+        label: "intra_doc_pointers",
+        description: r##"# `intra-doc-pointers`
 
-The tracking issue for this feature is: [#53120]
+The tracking issue for this feature is: [#80896]
 
-[#53120]: https://github.com/rust-lang/rust/issues/53120
+[#80896]: https://github.com/rust-lang/rust/issues/80896
 
------
+------------------------
 
-The `crate_visibility_modifier` feature allows the `crate` keyword to be used
-as a visibility modifier synonymous to `pub(crate)`, indicating that a type
-(function, _&c._) is to be visible to the entire enclosing crate, but not to
-other crates.
+Rustdoc does not currently allow disambiguating between `*const` and `*mut`, and
+raw pointers in intra-doc links are unstable until it does.
 
 ```rust
-#![feature(crate_visibility_modifier)]
-
-crate struct Foo {
-    bar: usize,
-}
+#![feature(intra_doc_pointers)]
+//! [pointer::add]
 ```
 "##,
     },
     LintCompletion {
-        label: "doc_cfg",
-        description: r##"# `doc_cfg`
-
-The tracking issue for this feature is: [#43781]
-
-------
+        label: "intrinsics",
+        description: r##"# `intrinsics`
 
-The `doc_cfg` feature allows an API be documented as only available in some specific platforms.
-This attribute has two effects:
+The tracking issue for this feature is: None.
 
-1. In the annotated item's documentation, there will be a message saying "This is supported on
-    (platform) only".
+Intrinsics are never intended to be stable directly, but intrinsics are often
+exported in some sort of stable manner. Prefer using the stable interfaces to
+the intrinsic directly when you can.
 
-2. The item's doc-tests will only run on the specific platform.
+------------------------
 
-In addition to allowing the use of the `#[doc(cfg)]` attribute, this feature enables the use of a
-special conditional compilation flag, `#[cfg(doc)]`, set whenever building documentation on your
-crate.
 
-This feature was introduced as part of PR [#43348] to allow the platform-specific parts of the
-standard library be documented.
+These are imported as if they were FFI functions, with the special
+`rust-intrinsic` ABI. For example, if one was in a freestanding
+context, but wished to be able to `transmute` between types, and
+perform efficient pointer arithmetic, one would import those functions
+via a declaration like
 
 ```rust
-#![feature(doc_cfg)]
+#![feature(intrinsics)]
+# fn main() {}
 
-#[cfg(any(windows, doc))]
-#[doc(cfg(windows))]
-/// The application's icon in the notification area (a.k.a. system tray).
-///
-/// # Examples
-///
-/// ```no_run
-/// extern crate my_awesome_ui_library;
-/// use my_awesome_ui_library::current_app;
-/// use my_awesome_ui_library::windows::notification;
-///
-/// let icon = current_app().get::<notification::Icon>();
-/// icon.show();
-/// icon.show_message("Hello");
-/// ```
-pub struct Icon {
-    // ...
+extern "rust-intrinsic" {
+    fn transmute<T, U>(x: T) -> U;
+
+    fn offset<T>(dst: *const T, offset: isize) -> *const T;
 }
 ```
 
-[#43781]: https://github.com/rust-lang/rust/issues/43781
-[#43348]: https://github.com/rust-lang/rust/issues/43348
+As with any other FFI functions, these are always `unsafe` to call.
 "##,
     },
     LintCompletion {
-        label: "unsized_tuple_coercion",
-        description: r##"# `unsized_tuple_coercion`
+        label: "is_sorted",
+        description: r##"# `is_sorted`
 
-The tracking issue for this feature is: [#42877]
+The tracking issue for this feature is: [#53485]
 
-[#42877]: https://github.com/rust-lang/rust/issues/42877
+[#53485]: https://github.com/rust-lang/rust/issues/53485
 
 ------------------------
 
-This is a part of [RFC0401]. According to the RFC, there should be an implementation like this:
+Add the methods `is_sorted`, `is_sorted_by` and `is_sorted_by_key` to `[T]`;
+add the methods `is_sorted`, `is_sorted_by` and `is_sorted_by_key` to
+`Iterator`.
+"##,
+    },
+    LintCompletion {
+        label: "lang_items",
+        description: r##"# `lang_items`
 
-```rust,ignore (partial-example)
-impl<..., T, U: ?Sized> Unsized<(..., U)> for (..., T) where T: Unsized<U> {}
-```
+The tracking issue for this feature is: None.
 
-This implementation is currently gated behind `#[feature(unsized_tuple_coercion)]` to avoid insta-stability. Therefore you can use it like this:
+------------------------
 
-```rust
-#![feature(unsized_tuple_coercion)]
+The `rustc` compiler has certain pluggable operations, that is,
+functionality that isn't hard-coded into the language, but is
+implemented in libraries, with a special marker to tell the compiler
+it exists. The marker is the attribute `#[lang = "..."]` and there are
+various different values of `...`, i.e. various different 'lang
+items'.
 
-fn main() {
-    let x : ([i32; 3], [i32; 3]) = ([1, 2, 3], [4, 5, 6]);
-    let y : &([i32; 3], [i32]) = &x;
-    assert_eq!(y.1[0], 4);
-}
-```
+For example, `Box` pointers require two lang items, one for allocation
+and one for deallocation. A freestanding program that uses the `Box`
+sugar for dynamic allocations via `malloc` and `free`:
 
-[RFC0401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md
-"##,
-    },
-    LintCompletion {
-        label: "no_sanitize",
-        description: r##"# `no_sanitize`
+```rust,ignore (libc-is-finicky)
+#![feature(lang_items, box_syntax, start, libc, core_intrinsics, rustc_private)]
+#![no_std]
+use core::intrinsics;
+use core::panic::PanicInfo;
 
-The tracking issue for this feature is: [#39699]
+extern crate libc;
 
-[#39699]: https://github.com/rust-lang/rust/issues/39699
+#[lang = "owned_box"]
+pub struct Box<T>(*mut T);
 
-------------------------
+#[lang = "exchange_malloc"]
+unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
+    let p = libc::malloc(size as libc::size_t) as *mut u8;
 
-The `no_sanitize` attribute can be used to selectively disable sanitizer
-instrumentation in an annotated function. This might be useful to: avoid
-instrumentation overhead in a performance critical function, or avoid
-instrumenting code that contains constructs unsupported by given sanitizer.
+    // Check if `malloc` failed:
+    if p as usize == 0 {
+        intrinsics::abort();
+    }
 
-The precise effect of this annotation depends on particular sanitizer in use.
-For example, with `no_sanitize(thread)`, the thread sanitizer will no longer
-instrument non-atomic store / load operations, but it will instrument atomic
-operations to avoid reporting false positives and provide meaning full stack
-traces.
+    p
+}
 
-## Examples
+#[lang = "box_free"]
+unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
+    libc::free(ptr as *mut libc::c_void)
+}
 
-``` rust
-#![feature(no_sanitize)]
+#[start]
+fn main(_argc: isize, _argv: *const *const u8) -> isize {
+    let _x = box 1;
 
-#[no_sanitize(address)]
-fn foo() {
-  // ...
+    0
 }
-```
-"##,
-    },
-    LintCompletion {
-        label: "try_blocks",
-        description: r##"# `try_blocks`
 
-The tracking issue for this feature is: [#31436]
+#[lang = "eh_personality"] extern fn rust_eh_personality() {}
+#[lang = "panic_impl"] extern fn rust_begin_panic(info: &PanicInfo) -> ! { unsafe { intrinsics::abort() } }
+#[no_mangle] pub extern fn rust_eh_register_frames () {}
+#[no_mangle] pub extern fn rust_eh_unregister_frames () {}
+```
+
+Note the use of `abort`: the `exchange_malloc` lang item is assumed to
+return a valid pointer, and so needs to do the check internally.
 
-[#31436]: https://github.com/rust-lang/rust/issues/31436
+Other features provided by lang items include:
 
-------------------------
+- overloadable operators via traits: the traits corresponding to the
+  `==`, `<`, dereferencing (`*`) and `+` (etc.) operators are all
+  marked with lang items; those specific four are `eq`, `ord`,
+  `deref`, and `add` respectively.
+- stack unwinding and general failure; the `eh_personality`,
+  `panic` and `panic_bounds_check` lang items.
+- the traits in `std::marker` used to indicate types of
+  various kinds; lang items `send`, `sync` and `copy`.
+- the marker types and variance indicators found in
+  `std::marker`; lang items `covariant_type`,
+  `contravariant_lifetime`, etc.
 
-The `try_blocks` feature adds support for `try` blocks. A `try`
-block creates a new scope one can use the `?` operator in.
+Lang items are loaded lazily by the compiler; e.g. if one never uses
+`Box` then there is no need to define functions for `exchange_malloc`
+and `box_free`. `rustc` will emit an error when an item is needed
+but not found in the current crate or any that it depends on.
 
-```rust,edition2018
-#![feature(try_blocks)]
+Most lang items are defined by `libcore`, but if you're trying to build
+an executable without the standard library, you'll run into the need
+for lang items. The rest of this page focuses on this use-case, even though
+lang items are a bit broader than that.
 
-use std::num::ParseIntError;
+### Using libc
 
-let result: Result<i32, ParseIntError> = try {
-    "1".parse::<i32>()?
-        + "2".parse::<i32>()?
-        + "3".parse::<i32>()?
-};
-assert_eq!(result, Ok(6));
+In order to build a `#[no_std]` executable we will need libc as a dependency.
+We can specify this using our `Cargo.toml` file:
 
-let result: Result<i32, ParseIntError> = try {
-    "1".parse::<i32>()?
-        + "foo".parse::<i32>()?
-        + "3".parse::<i32>()?
-};
-assert!(result.is_err());
+```toml
+[dependencies]
+libc = { version = "0.2.14", default-features = false }
 ```
-"##,
-    },
-    LintCompletion {
-        label: "transparent_unions",
-        description: r##"# `transparent_unions`
 
-The tracking issue for this feature is [#60405]
+Note that the default features have been disabled. This is a critical step -
+**the default features of libc include the standard library and so must be
+disabled.**
 
-[#60405]: https://github.com/rust-lang/rust/issues/60405
+### Writing an executable without stdlib
 
-----
+Controlling the entry point is possible in two ways: the `#[start]` attribute,
+or overriding the default shim for the C `main` function with your own.
 
-The `transparent_unions` feature allows you mark `union`s as
-`#[repr(transparent)]`. A `union` may be `#[repr(transparent)]` in exactly the
-same conditions in which a `struct` may be `#[repr(transparent)]` (generally,
-this means the `union` must have exactly one non-zero-sized field). Some
-concrete illustrations follow.
+The function marked `#[start]` is passed the command line parameters
+in the same format as C:
 
-```rust
-#![feature(transparent_unions)]
+```rust,ignore (libc-is-finicky)
+#![feature(lang_items, core_intrinsics, rustc_private)]
+#![feature(start)]
+#![no_std]
+use core::intrinsics;
+use core::panic::PanicInfo;
 
-// This union has the same representation as `f32`.
-#[repr(transparent)]
-union SingleFieldUnion {
-    field: f32,
+// Pull in the system libc library for what crt0.o likely requires.
+extern crate libc;
+
+// Entry point for this program.
+#[start]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+    0
 }
 
-// This union has the same representation as `usize`.
-#[repr(transparent)]
-union MultiFieldUnion {
-    field: usize,
-    nothing: (),
+// These functions are used by the compiler, but not
+// for a bare-bones hello world. These are normally
+// provided by libstd.
+#[lang = "eh_personality"]
+#[no_mangle]
+pub extern fn rust_eh_personality() {
+}
+
+#[lang = "panic_impl"]
+#[no_mangle]
+pub extern fn rust_begin_panic(info: &PanicInfo) -> ! {
+    unsafe { intrinsics::abort() }
 }
 ```
 
-For consistency with transparent `struct`s, `union`s must have exactly one
-non-zero-sized field. If all fields are zero-sized, the `union` must not be
-`#[repr(transparent)]`:
+To override the compiler-inserted `main` shim, one has to disable it
+with `#![no_main]` and then create the appropriate symbol with the
+correct ABI and the correct name, which requires overriding the
+compiler's name mangling too:
 
-```rust
-#![feature(transparent_unions)]
+```rust,ignore (libc-is-finicky)
+#![feature(lang_items, core_intrinsics, rustc_private)]
+#![feature(start)]
+#![no_std]
+#![no_main]
+use core::intrinsics;
+use core::panic::PanicInfo;
 
-// This (non-transparent) union is already valid in stable Rust:
-pub union GoodUnion {
-    pub nothing: (),
+// Pull in the system libc library for what crt0.o likely requires.
+extern crate libc;
+
+// Entry point for this program.
+#[no_mangle] // ensure that this symbol is called `main` in the output
+pub extern fn main(_argc: i32, _argv: *const *const u8) -> i32 {
+    0
 }
 
-// Error: transparent union needs exactly one non-zero-sized field, but has 0
-// #[repr(transparent)]
-// pub union BadUnion {
-//     pub nothing: (),
-// }
+// These functions are used by the compiler, but not
+// for a bare-bones hello world. These are normally
+// provided by libstd.
+#[lang = "eh_personality"]
+#[no_mangle]
+pub extern fn rust_eh_personality() {
+}
+
+#[lang = "panic_impl"]
+#[no_mangle]
+pub extern fn rust_begin_panic(info: &PanicInfo) -> ! {
+    unsafe { intrinsics::abort() }
+}
 ```
 
-The one exception is if the `union` is generic over `T` and has a field of type
-`T`, it may be `#[repr(transparent)]` even if `T` is a zero-sized type:
+In many cases, you may need to manually link to the `compiler_builtins` crate
+when building a `no_std` binary. You may observe this via linker error messages
+such as "```undefined reference to `__rust_probestack'```".
 
-```rust
-#![feature(transparent_unions)]
+## More about the language items
 
-// This union has the same representation as `T`.
-#[repr(transparent)]
-pub union GenericUnion<T: Copy> { // Unions with non-`Copy` fields are unstable.
-    pub field: T,
-    pub nothing: (),
-}
+The compiler currently makes a few assumptions about symbols which are
+available in the executable to call. Normally these functions are provided by
+the standard library, but without it you must define your own. These symbols
+are called "language items", and they each have an internal name, and then a
+signature that an implementation must conform to.
 
-// This is okay even though `()` is a zero-sized type.
-pub const THIS_IS_OKAY: GenericUnion<()> = GenericUnion { field: () };
-```
+The first of these functions, `rust_eh_personality`, is used by the failure
+mechanisms of the compiler. This is often mapped to GCC's personality function
+(see the [libstd implementation][unwind] for more information), but crates
+which do not trigger a panic can be assured that this function is never
+called. The language item's name is `eh_personality`.
 
-Like transarent `struct`s, a transparent `union` of type `U` has the same
-layout, size, and ABI as its single non-ZST field. If it is generic over a type
-`T`, and all its fields are ZSTs except for exactly one field of type `T`, then
-it has the same layout and ABI as `T` (even if `T` is a ZST when monomorphized).
+[unwind]: https://github.com/rust-lang/rust/blob/master/library/panic_unwind/src/gcc.rs
 
-Like transparent `struct`s, transparent `union`s are FFI-safe if and only if
-their underlying representation type is also FFI-safe.
+The second function, `rust_begin_panic`, is also used by the failure mechanisms of the
+compiler. When a panic happens, this controls the message that's displayed on
+the screen. While the language item's name is `panic_impl`, the symbol name is
+`rust_begin_panic`.
 
-A `union` may not be eligible for the same nonnull-style optimizations that a
-`struct` or `enum` (with the same fields) are eligible for. Adding
-`#[repr(transparent)]` to  `union` does not change this. To give a more concrete
-example, it is unspecified whether `size_of::<T>()` is equal to
-`size_of::<Option<T>>()`, where `T` is a `union` (regardless of whether or not
-it is transparent). The Rust compiler is free to perform this optimization if
-possible, but is not required to, and different compiler versions may differ in
-their application of these optimizations.
-"##,
-    },
-    LintCompletion {
-        label: "const_eval_limit",
-        description: r##"# `const_eval_limit`
+Finally, a `eh_catch_typeinfo` static is needed for certain targets which
+implement Rust panics on top of C++ exceptions.
 
-The tracking issue for this feature is: [#67217]
+## List of all language items
 
-[#67217]: https://github.com/rust-lang/rust/issues/67217
+This is a list of all language items in Rust along with where they are located in
+the source code.
 
-The `const_eval_limit` allows someone to limit the evaluation steps the CTFE undertakes to evaluate a `const fn`.
+- Primitives
+  - `i8`: `libcore/num/mod.rs`
+  - `i16`: `libcore/num/mod.rs`
+  - `i32`: `libcore/num/mod.rs`
+  - `i64`: `libcore/num/mod.rs`
+  - `i128`: `libcore/num/mod.rs`
+  - `isize`: `libcore/num/mod.rs`
+  - `u8`: `libcore/num/mod.rs`
+  - `u16`: `libcore/num/mod.rs`
+  - `u32`: `libcore/num/mod.rs`
+  - `u64`: `libcore/num/mod.rs`
+  - `u128`: `libcore/num/mod.rs`
+  - `usize`: `libcore/num/mod.rs`
+  - `f32`: `libstd/f32.rs`
+  - `f64`: `libstd/f64.rs`
+  - `char`: `libcore/char.rs`
+  - `slice`: `liballoc/slice.rs`
+  - `str`: `liballoc/str.rs`
+  - `const_ptr`: `libcore/ptr.rs`
+  - `mut_ptr`: `libcore/ptr.rs`
+  - `unsafe_cell`: `libcore/cell.rs`
+- Runtime
+  - `start`: `libstd/rt.rs`
+  - `eh_personality`: `libpanic_unwind/emcc.rs` (EMCC)
+  - `eh_personality`: `libpanic_unwind/gcc.rs` (GNU)
+  - `eh_personality`: `libpanic_unwind/seh.rs` (SEH)
+  - `eh_catch_typeinfo`: `libpanic_unwind/emcc.rs` (EMCC)
+  - `panic`: `libcore/panicking.rs`
+  - `panic_bounds_check`: `libcore/panicking.rs`
+  - `panic_impl`: `libcore/panicking.rs`
+  - `panic_impl`: `libstd/panicking.rs`
+- Allocations
+  - `owned_box`: `liballoc/boxed.rs`
+  - `exchange_malloc`: `liballoc/heap.rs`
+  - `box_free`: `liballoc/heap.rs`
+- Operands
+  - `not`: `libcore/ops/bit.rs`
+  - `bitand`: `libcore/ops/bit.rs`
+  - `bitor`: `libcore/ops/bit.rs`
+  - `bitxor`: `libcore/ops/bit.rs`
+  - `shl`: `libcore/ops/bit.rs`
+  - `shr`: `libcore/ops/bit.rs`
+  - `bitand_assign`: `libcore/ops/bit.rs`
+  - `bitor_assign`: `libcore/ops/bit.rs`
+  - `bitxor_assign`: `libcore/ops/bit.rs`
+  - `shl_assign`: `libcore/ops/bit.rs`
+  - `shr_assign`: `libcore/ops/bit.rs`
+  - `deref`: `libcore/ops/deref.rs`
+  - `deref_mut`: `libcore/ops/deref.rs`
+  - `index`: `libcore/ops/index.rs`
+  - `index_mut`: `libcore/ops/index.rs`
+  - `add`: `libcore/ops/arith.rs`
+  - `sub`: `libcore/ops/arith.rs`
+  - `mul`: `libcore/ops/arith.rs`
+  - `div`: `libcore/ops/arith.rs`
+  - `rem`: `libcore/ops/arith.rs`
+  - `neg`: `libcore/ops/arith.rs`
+  - `add_assign`: `libcore/ops/arith.rs`
+  - `sub_assign`: `libcore/ops/arith.rs`
+  - `mul_assign`: `libcore/ops/arith.rs`
+  - `div_assign`: `libcore/ops/arith.rs`
+  - `rem_assign`: `libcore/ops/arith.rs`
+  - `eq`: `libcore/cmp.rs`
+  - `ord`: `libcore/cmp.rs`
+- Functions
+  - `fn`: `libcore/ops/function.rs`
+  - `fn_mut`: `libcore/ops/function.rs`
+  - `fn_once`: `libcore/ops/function.rs`
+  - `generator_state`: `libcore/ops/generator.rs`
+  - `generator`: `libcore/ops/generator.rs`
+- Other
+  - `coerce_unsized`: `libcore/ops/unsize.rs`
+  - `drop`: `libcore/ops/drop.rs`
+  - `drop_in_place`: `libcore/ptr.rs`
+  - `clone`: `libcore/clone.rs`
+  - `copy`: `libcore/marker.rs`
+  - `send`: `libcore/marker.rs`
+  - `sized`: `libcore/marker.rs`
+  - `unsize`: `libcore/marker.rs`
+  - `sync`: `libcore/marker.rs`
+  - `phantom_data`: `libcore/marker.rs`
+  - `discriminant_kind`: `libcore/marker.rs`
+  - `freeze`: `libcore/marker.rs`
+  - `debug_trait`: `libcore/fmt/mod.rs`
+  - `non_zero`: `libcore/nonzero.rs`
+  - `arc`: `liballoc/sync.rs`
+  - `rc`: `liballoc/rc.rs`
 "##,
     },
     LintCompletion {
-        label: "link_args",
-        description: r##"# `link_args`
-
-The tracking issue for this feature is: [#29596]
+        label: "libstd_sys_internals",
+        description: r##"# `libstd_sys_internals`
 
-[#29596]: https://github.com/rust-lang/rust/issues/29596
+This feature is internal to the Rust compiler and is not intended for general use.
 
 ------------------------
-
-You can tell `rustc` how to customize linking, and that is via the `link_args`
-attribute. This attribute is applied to `extern` blocks and specifies raw flags
-which need to get passed to the linker when producing an artifact. An example
-usage would be:
-
-```rust,no_run
-#![feature(link_args)]
-
-#[link_args = "-foo -bar -baz"]
-extern "C" {}
-# fn main() {}
-```
-
-Note that this feature is currently hidden behind the `feature(link_args)` gate
-because this is not a sanctioned way of performing linking. Right now `rustc`
-shells out to the system linker (`gcc` on most systems, `link.exe` on MSVC), so
-it makes sense to provide extra command line arguments, but this will not
-always be the case. In the future `rustc` may use LLVM directly to link native
-libraries, in which case `link_args` will have no meaning. You can achieve the
-same effect as the `link_args` attribute with the `-C link-args` argument to
-`rustc`.
-
-It is highly recommended to *not* use this attribute, and rather use the more
-formal `#[link(...)]` attribute on `extern` blocks instead.
 "##,
     },
     LintCompletion {
-        label: "internal_output_capture",
-        description: r##"# `internal_output_capture`
+        label: "libstd_thread_internals",
+        description: r##"# `libstd_thread_internals`
 
 This feature is internal to the Rust compiler and is not intended for general use.
 
@@ -2710,8 +3125,8 @@ pub union GenericUnion<T: Copy> { // Unions with non-`Copy` fields are unstable.
 "##,
     },
     LintCompletion {
-        label: "windows_handle",
-        description: r##"# `windows_handle`
+        label: "link_cfg",
+        description: r##"# `link_cfg`
 
 This feature is internal to the Rust compiler and is not intended for general use.
 
@@ -2719,962 +3134,618 @@ pub union GenericUnion<T: Copy> { // Unions with non-`Copy` fields are unstable.
 "##,
     },
     LintCompletion {
-        label: "asm",
-        description: r##"# `asm`
+        label: "llvm_asm",
+        description: r##"# `llvm_asm`
 
-The tracking issue for this feature is: [#72016]
+The tracking issue for this feature is: [#70173]
 
-[#72016]: https://github.com/rust-lang/rust/issues/72016
+[#70173]: https://github.com/rust-lang/rust/issues/70173
 
 ------------------------
 
 For extremely low-level manipulations and performance reasons, one
 might wish to control the CPU directly. Rust supports using inline
-assembly to do this via the `asm!` macro.
-
-# Guide-level explanation
-[guide-level-explanation]: #guide-level-explanation
-
-Rust provides support for inline assembly via the `asm!` macro.
-It can be used to embed handwritten assembly in the assembly output generated by the compiler.
-Generally this should not be necessary, but might be where the required performance or timing
-cannot be otherwise achieved. Accessing low level hardware primitives, e.g. in kernel code, may also demand this functionality.
-
-> **Note**: the examples here are given in x86/x86-64 assembly, but other architectures are also supported.
-
-Inline assembly is currently supported on the following architectures:
-- x86 and x86-64
-- ARM
-- AArch64
-- RISC-V
-- NVPTX
-- Hexagon
-- MIPS32r2 and MIPS64r2
-- wasm32
-
-## Basic usage
-
-Let us start with the simplest possible example:
-
-```rust,allow_fail
-# #![feature(asm)]
-unsafe {
-    asm!("nop");
-}
-```
-
-This will insert a NOP (no operation) instruction into the assembly generated by the compiler.
-Note that all `asm!` invocations have to be inside an `unsafe` block, as they could insert
-arbitrary instructions and break various invariants. The instructions to be inserted are listed
-in the first argument of the `asm!` macro as a string literal.
-
-## Inputs and outputs
-
-Now inserting an instruction that does nothing is rather boring. Let us do something that
-actually acts on data:
-
-```rust,allow_fail
-# #![feature(asm)]
-let x: u64;
-unsafe {
-    asm!("mov {}, 5", out(reg) x);
-}
-assert_eq!(x, 5);
-```
-
-This will write the value `5` into the `u64` variable `x`.
-You can see that the string literal we use to specify instructions is actually a template string.
-It is governed by the same rules as Rust [format strings][format-syntax].
-The arguments that are inserted into the template however look a bit different then you may
-be familiar with. First we need to specify if the variable is an input or an output of the
-inline assembly. In this case it is an output. We declared this by writing `out`.
-We also need to specify in what kind of register the assembly expects the variable.
-In this case we put it in an arbitrary general purpose register by specifying `reg`.
-The compiler will choose an appropriate register to insert into
-the template and will read the variable from there after the inline assembly finishes executing.
-
-Let us see another example that also uses an input:
-
-```rust,allow_fail
-# #![feature(asm)]
-let i: u64 = 3;
-let o: u64;
-unsafe {
-    asm!(
-        "mov {0}, {1}",
-        "add {0}, {number}",
-        out(reg) o,
-        in(reg) i,
-        number = const 5,
-    );
-}
-assert_eq!(o, 8);
-```
-
-This will add `5` to the input in variable `i` and write the result to variable `o`.
-The particular way this assembly does this is first copying the value from `i` to the output,
-and then adding `5` to it.
-
-The example shows a few things:
-
-First, we can see that `asm!` allows multiple template string arguments; each
-one is treated as a separate line of assembly code, as if they were all joined
-together with newlines between them. This makes it easy to format assembly
-code.
-
-Second, we can see that inputs are declared by writing `in` instead of `out`.
-
-Third, one of our operands has a type we haven't seen yet, `const`.
-This tells the compiler to expand this argument to value directly inside the assembly template.
-This is only possible for constants and literals.
-
-Fourth, we can see that we can specify an argument number, or name as in any format string.
-For inline assembly templates this is particularly useful as arguments are often used more than once.
-For more complex inline assembly using this facility is generally recommended, as it improves
-readability, and allows reordering instructions without changing the argument order.
-
-We can further refine the above example to avoid the `mov` instruction:
-
-```rust,allow_fail
-# #![feature(asm)]
-let mut x: u64 = 3;
-unsafe {
-    asm!("add {0}, {number}", inout(reg) x, number = const 5);
-}
-assert_eq!(x, 8);
-```
-
-We can see that `inout` is used to specify an argument that is both input and output.
-This is different from specifying an input and output separately in that it is guaranteed to assign both to the same register.
-
-It is also possible to specify different variables for the input and output parts of an `inout` operand:
-
-```rust,allow_fail
-# #![feature(asm)]
-let x: u64 = 3;
-let y: u64;
-unsafe {
-    asm!("add {0}, {number}", inout(reg) x => y, number = const 5);
-}
-assert_eq!(y, 8);
-```
-
-## Late output operands
-
-The Rust compiler is conservative with its allocation of operands. It is assumed that an `out`
-can be written at any time, and can therefore not share its location with any other argument.
-However, to guarantee optimal performance it is important to use as few registers as possible,
-so they won't have to be saved and reloaded around the inline assembly block.
-To achieve this Rust provides a `lateout` specifier. This can be used on any output that is
-written only after all inputs have been consumed.
-There is also a `inlateout` variant of this specifier.
-
-Here is an example where `inlateout` *cannot* be used:
-
-```rust,allow_fail
-# #![feature(asm)]
-let mut a: u64 = 4;
-let b: u64 = 4;
-let c: u64 = 4;
-unsafe {
-    asm!(
-        "add {0}, {1}",
-        "add {0}, {2}",
-        inout(reg) a,
-        in(reg) b,
-        in(reg) c,
-    );
-}
-assert_eq!(a, 12);
-```
-
-Here the compiler is free to allocate the same register for inputs `b` and `c` since it knows they have the same value. However it must allocate a separate register for `a` since it uses `inout` and not `inlateout`. If `inlateout` was used, then `a` and `c` could be allocated to the same register, in which case the first instruction to overwrite the value of `c` and cause the assembly code to produce the wrong result.
-
-However the following example can use `inlateout` since the output is only modified after all input registers have been read:
-
-```rust,allow_fail
-# #![feature(asm)]
-let mut a: u64 = 4;
-let b: u64 = 4;
-unsafe {
-    asm!("add {0}, {1}", inlateout(reg) a, in(reg) b);
-}
-assert_eq!(a, 8);
-```
-
-As you can see, this assembly fragment will still work correctly if `a` and `b` are assigned to the same register.
-
-## Explicit register operands
-
-Some instructions require that the operands be in a specific register.
-Therefore, Rust inline assembly provides some more specific constraint specifiers.
-While `reg` is generally available on any architecture, these are highly architecture specific. E.g. for x86 the general purpose registers `eax`, `ebx`, `ecx`, `edx`, `ebp`, `esi`, and `edi`
-among others can be addressed by their name.
+assembly to do this via the `llvm_asm!` macro.
 
-```rust,allow_fail,no_run
-# #![feature(asm)]
-let cmd = 0xd1;
-unsafe {
-    asm!("out 0x64, eax", in("eax") cmd);
-}
+```rust,ignore (pseudo-code)
+llvm_asm!(assembly template
+   : output operands
+   : input operands
+   : clobbers
+   : options
+   );
 ```
 
-In this example we call the `out` instruction to output the content of the `cmd` variable
-to port `0x64`. Since the `out` instruction only accepts `eax` (and its sub registers) as operand
-we had to use the `eax` constraint specifier.
+Any use of `llvm_asm` is feature gated (requires `#![feature(llvm_asm)]` on the
+crate to allow) and of course requires an `unsafe` block.
 
-Note that unlike other operand types, explicit register operands cannot be used in the template string: you can't use `{}` and should write the register name directly instead. Also, they must appear at the end of the operand list after all other operand types.
+> **Note**: the examples here are given in x86/x86-64 assembly, but
+> all platforms are supported.
 
-Consider this example which uses the x86 `mul` instruction:
+## Assembly template
 
-```rust,allow_fail
-# #![feature(asm)]
-fn mul(a: u64, b: u64) -> u128 {
-    let lo: u64;
-    let hi: u64;
+The `assembly template` is the only required parameter and must be a
+literal string (i.e. `""`)
 
+```rust
+#![feature(llvm_asm)]
+
+#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+fn foo() {
     unsafe {
-        asm!(
-            // The x86 mul instruction takes rax as an implicit input and writes
-            // the 128-bit result of the multiplication to rax:rdx.
-            "mul {}",
-            in(reg) a,
-            inlateout("rax") b => lo,
-            lateout("rdx") hi
-        );
+        llvm_asm!("NOP");
     }
+}
 
-    ((hi as u128) << 64) + lo as u128
+// Other platforms:
+#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
+fn foo() { /* ... */ }
+
+fn main() {
+    // ...
+    foo();
+    // ...
 }
 ```
 
-This uses the `mul` instruction to multiply two 64-bit inputs with a 128-bit result.
-The only explicit operand is a register, that we fill from the variable `a`.
-The second operand is implicit, and must be the `rax` register, which we fill from the variable `b`.
-The lower 64 bits of the result are stored in `rax` from which we fill the variable `lo`.
-The higher 64 bits are stored in `rdx` from which we fill the variable `hi`.
-
-## Clobbered registers
+(The `feature(llvm_asm)` and `#[cfg]`s are omitted from now on.)
 
-In many cases inline assembly will modify state that is not needed as an output.
-Usually this is either because we have to use a scratch register in the assembly,
-or instructions modify state that we don't need to further examine.
-This state is generally referred to as being "clobbered".
-We need to tell the compiler about this since it may need to save and restore this state
-around the inline assembly block.
+Output operands, input operands, clobbers and options are all optional
+but you must add the right number of `:` if you skip them:
 
-```rust,allow_fail
-# #![feature(asm)]
-let ebx: u32;
-let ecx: u32;
+```rust
+# #![feature(llvm_asm)]
+# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+# fn main() { unsafe {
+llvm_asm!("xor %eax, %eax"
+    :
+    :
+    : "eax"
+   );
+# } }
+# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
+# fn main() {}
+```
 
-unsafe {
-    asm!(
-        "cpuid",
-        // EAX 4 selects the "Deterministic Cache Parameters" CPUID leaf
-        inout("eax") 4 => _,
-        // ECX 0 selects the L0 cache information.
-        inout("ecx") 0 => ecx,
-        lateout("ebx") ebx,
-        lateout("edx") _,
-    );
-}
+Whitespace also doesn't matter:
 
-println!(
-    "L1 Cache: {}",
-    ((ebx >> 22) + 1) * (((ebx >> 12) & 0x3ff) + 1) * ((ebx & 0xfff) + 1) * (ecx + 1)
-);
+```rust
+# #![feature(llvm_asm)]
+# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+# fn main() { unsafe {
+llvm_asm!("xor %eax, %eax" ::: "eax");
+# } }
+# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
+# fn main() {}
 ```
 
-In the example above we use the `cpuid` instruction to get the L1 cache size.
-This instruction writes to `eax`, `ebx`, `ecx`, and `edx`, but for the cache size we only care about the contents of `ebx` and `ecx`.
+## Operands
 
-However we still need to tell the compiler that `eax` and `edx` have been modified so that it can save any values that were in these registers before the asm. This is done by declaring these as outputs but with `_` instead of a variable name, which indicates that the output value is to be discarded.
+Input and output operands follow the same format: `:
+"constraints1"(expr1), "constraints2"(expr2), ..."`. Output operand
+expressions must be mutable place, or not yet assigned:
 
-This can also be used with a general register class (e.g. `reg`) to obtain a scratch register for use inside the asm code:
+```rust
+# #![feature(llvm_asm)]
+# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+fn add(a: i32, b: i32) -> i32 {
+    let c: i32;
+    unsafe {
+        llvm_asm!("add $2, $0"
+             : "=r"(c)
+             : "0"(a), "r"(b)
+             );
+    }
+    c
+}
+# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
+# fn add(a: i32, b: i32) -> i32 { a + b }
 
-```rust,allow_fail
-# #![feature(asm)]
-// Multiply x by 6 using shifts and adds
-let mut x: u64 = 4;
-unsafe {
-    asm!(
-        "mov {tmp}, {x}",
-        "shl {tmp}, 1",
-        "shl {x}, 2",
-        "add {x}, {tmp}",
-        x = inout(reg) x,
-        tmp = out(reg) _,
-    );
+fn main() {
+    assert_eq!(add(3, 14159), 14162)
 }
-assert_eq!(x, 4 * 6);
 ```
 
-## Symbol operands
+If you would like to use real operands in this position, however,
+you are required to put curly braces `{}` around the register that
+you want, and you are required to put the specific size of the
+operand. This is useful for very low level programming, where
+which register you use is important:
 
-A special operand type, `sym`, allows you to use the symbol name of a `fn` or `static` in inline assembly code.
-This allows you to call a function or access a global variable without needing to keep its address in a register.
+```rust
+# #![feature(llvm_asm)]
+# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+# unsafe fn read_byte_in(port: u16) -> u8 {
+let result: u8;
+llvm_asm!("in %dx, %al" : "={al}"(result) : "{dx}"(port));
+result
+# }
+```
 
-```rust,allow_fail
-# #![feature(asm)]
-extern "C" fn foo(arg: i32) {
-    println!("arg = {}", arg);
-}
+## Clobbers
 
-fn call_foo(arg: i32) {
-    unsafe {
-        asm!(
-            "call {}",
-            sym foo,
-            // 1st argument in rdi, which is caller-saved
-            inout("rdi") arg => _,
-            // All caller-saved registers must be marked as clobberred
-            out("rax") _, out("rcx") _, out("rdx") _, out("rsi") _,
-            out("r8") _, out("r9") _, out("r10") _, out("r11") _,
-            out("xmm0") _, out("xmm1") _, out("xmm2") _, out("xmm3") _,
-            out("xmm4") _, out("xmm5") _, out("xmm6") _, out("xmm7") _,
-            out("xmm8") _, out("xmm9") _, out("xmm10") _, out("xmm11") _,
-            out("xmm12") _, out("xmm13") _, out("xmm14") _, out("xmm15") _,
-        )
-    }
-}
+Some instructions modify registers which might otherwise have held
+different values so we use the clobbers list to indicate to the
+compiler not to assume any values loaded into those registers will
+stay valid.
+
+```rust
+# #![feature(llvm_asm)]
+# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+# fn main() { unsafe {
+// Put the value 0x200 in eax:
+llvm_asm!("mov $$0x200, %eax" : /* no outputs */ : /* no inputs */ : "eax");
+# } }
+# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
+# fn main() {}
 ```
 
-Note that the `fn` or `static` item does not need to be public or `#[no_mangle]`:
-the compiler will automatically insert the appropriate mangled symbol name into the assembly code.
+Input and output registers need not be listed since that information
+is already communicated by the given constraints. Otherwise, any other
+registers used either implicitly or explicitly should be listed.
 
-## Register template modifiers
+If the assembly changes the condition code register `cc` should be
+specified as one of the clobbers. Similarly, if the assembly modifies
+memory, `memory` should also be specified.
 
-In some cases, fine control is needed over the way a register name is formatted when inserted into the template string. This is needed when an architecture's assembly language has several names for the same register, each typically being a "view" over a subset of the register (e.g. the low 32 bits of a 64-bit register).
+## Options
 
-By default the compiler will always choose the name that refers to the full register size (e.g. `rax` on x86-64, `eax` on x86, etc).
+The last section, `options` is specific to Rust. The format is comma
+separated literal strings (i.e. `:"foo", "bar", "baz"`). It's used to
+specify some extra info about the inline assembly:
 
-This default can be overriden by using modifiers on the template string operands, just like you would with format strings:
+Current valid options are:
 
-```rust,allow_fail
-# #![feature(asm)]
-let mut x: u16 = 0xab;
+1. `volatile` - specifying this is analogous to
+   `__asm__ __volatile__ (...)` in gcc/clang.
+2. `alignstack` - certain instructions expect the stack to be
+   aligned a certain way (i.e. SSE) and specifying this indicates to
+   the compiler to insert its usual stack alignment code
+3. `intel` - use intel syntax instead of the default AT&T.
 
+```rust
+# #![feature(llvm_asm)]
+# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+# fn main() {
+let result: i32;
 unsafe {
-    asm!("mov {0:h}, {0:l}", inout(reg_abcd) x);
+   llvm_asm!("mov eax, 2" : "={eax}"(result) : : : "intel")
 }
-
-assert_eq!(x, 0xabab);
+println!("eax is currently {}", result);
+# }
+# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
+# fn main() {}
 ```
 
-In this example, we use the `reg_abcd` register class to restrict the register allocator to the 4 legacy x86 register (`ax`, `bx`, `cx`, `dx`) of which the first two bytes can be addressed independently.
+## More Information
 
-Let us assume that the register allocator has chosen to allocate `x` in the `ax` register.
-The `h` modifier will emit the register name for the high byte of that register and the `l` modifier will emit the register name for the low byte. The asm code will therefore be expanded as `mov ah, al` which copies the low byte of the value into the high byte.
+The current implementation of the `llvm_asm!` macro is a direct binding to [LLVM's
+inline assembler expressions][llvm-docs], so be sure to check out [their
+documentation as well][llvm-docs] for more information about clobbers,
+constraints, etc.
+
+[llvm-docs]: http://llvm.org/docs/LangRef.html#inline-assembler-expressions
+
+If you need more power and don't mind losing some of the niceties of
+`llvm_asm!`, check out [global_asm](global-asm.md).
+"##,
+    },
+    LintCompletion {
+        label: "marker_trait_attr",
+        description: r##"# `marker_trait_attr`
+
+The tracking issue for this feature is: [#29864]
+
+[#29864]: https://github.com/rust-lang/rust/issues/29864
+
+------------------------
+
+Normally, Rust keeps you from adding trait implementations that could
+overlap with each other, as it would be ambiguous which to use.  This
+feature, however, carves out an exception to that rule: a trait can
+opt-in to having overlapping implementations, at the cost that those
+implementations are not allowed to override anything (and thus the
+trait itself cannot have any associated items, as they're pointless
+when they'd need to do the same thing for every type anyway).
 
-If you use a smaller data type (e.g. `u16`) with an operand and forget the use template modifiers, the compiler will emit a warning and suggest the correct modifier to use.
+```rust
+#![feature(marker_trait_attr)]
 
-## Memory address operands
+#[marker] trait CheapToClone: Clone {}
 
-Sometimes assembly instructions require operands passed via memory addresses/memory locations.
-You have to manually use the memory address syntax specified by the respectively architectures.
-For example, in x86/x86_64 and intel assembly syntax, you should wrap inputs/outputs in `[]`
-to indicate they are memory operands:
+impl<T: Copy> CheapToClone for T {}
 
-```rust,allow_fail
-# #![feature(asm, llvm_asm)]
-# fn load_fpu_control_word(control: u16) {
-unsafe {
-    asm!("fldcw [{}]", in(reg) &control, options(nostack));
+// These could potentially overlap with the blanket implementation above,
+// so are only allowed because CheapToClone is a marker trait.
+impl<T: CheapToClone, U: CheapToClone> CheapToClone for (T, U) {}
+impl<T: CheapToClone> CheapToClone for std::ops::Range<T> {}
 
-    // Previously this would have been written with the deprecated `llvm_asm!` like this
-    llvm_asm!("fldcw $0" :: "m" (control) :: "volatile");
+fn cheap_clone<T: CheapToClone>(t: T) -> T {
+    t.clone()
 }
-# }
 ```
 
-## Options
-
-By default, an inline assembly block is treated the same way as an external FFI function call with a custom calling convention: it may read/write memory, have observable side effects, etc. However in many cases, it is desirable to give the compiler more information about what the assembly code is actually doing so that it can optimize better.
-
-Let's take our previous example of an `add` instruction:
+This is expected to replace the unstable `overlapping_marker_traits`
+feature, which applied to all empty traits (without needing an opt-in).
+"##,
+    },
+    LintCompletion {
+        label: "native_link_modifiers",
+        description: r##"# `native_link_modifiers`
 
-```rust,allow_fail
-# #![feature(asm)]
-let mut a: u64 = 4;
-let b: u64 = 4;
-unsafe {
-    asm!(
-        "add {0}, {1}",
-        inlateout(reg) a, in(reg) b,
-        options(pure, nomem, nostack),
-    );
-}
-assert_eq!(a, 8);
-```
+The tracking issue for this feature is: [#81490]
 
-Options can be provided as an optional final argument to the `asm!` macro. We specified three options here:
-- `pure` means that the asm code has no observable side effects and that its output depends only on its inputs. This allows the compiler optimizer to call the inline asm fewer times or even eliminate it entirely.
-- `nomem` means that the asm code does not read or write to memory. By default the compiler will assume that inline assembly can read or write any memory address that is accessible to it (e.g. through a pointer passed as an operand, or a global).
-- `nostack` means that the asm code does not push any data onto the stack. This allows the compiler to use optimizations such as the stack red zone on x86-64 to avoid stack pointer adjustments.
+[#81490]: https://github.com/rust-lang/rust/issues/81490
 
-These allow the compiler to better optimize code using `asm!`, for example by eliminating pure `asm!` blocks whose outputs are not needed.
+------------------------
 
-See the reference for the full list of available options and their effects.
+The `native_link_modifiers` feature allows you to use the `modifiers` syntax with the `#[link(..)]` attribute.
 
-# Reference-level explanation
-[reference-level-explanation]: #reference-level-explanation
+Modifiers are specified as a comma-delimited string with each modifier prefixed with either a `+` or `-` to indicate that the modifier is enabled or disabled, respectively. The last boolean value specified for a given modifier wins.
+"##,
+    },
+    LintCompletion {
+        label: "native_link_modifiers_as_needed",
+        description: r##"# `native_link_modifiers_as_needed`
 
-Inline assembler is implemented as an unsafe macro `asm!()`.
-The first argument to this macro is a template string literal used to build the final assembly.
-The following arguments specify input and output operands.
-When required, options are specified as the final argument.
+The tracking issue for this feature is: [#81490]
 
-The following ABNF specifies the general syntax:
+[#81490]: https://github.com/rust-lang/rust/issues/81490
 
-```text
-dir_spec := "in" / "out" / "lateout" / "inout" / "inlateout"
-reg_spec := <register class> / "<explicit register>"
-operand_expr := expr / "_" / expr "=>" expr / expr "=>" "_"
-reg_operand := dir_spec "(" reg_spec ")" operand_expr
-operand := reg_operand / "const" const_expr / "sym" path
-option := "pure" / "nomem" / "readonly" / "preserves_flags" / "noreturn" / "nostack" / "att_syntax"
-options := "options(" option *["," option] [","] ")"
-asm := "asm!(" format_string *("," format_string) *("," [ident "="] operand) ["," options] [","] ")"
-```
+------------------------
 
-The macro will initially be supported only on ARM, AArch64, Hexagon, x86, x86-64 and RISC-V targets. Support for more targets may be added in the future. The compiler will emit an error if `asm!` is used on an unsupported target.
+The `native_link_modifiers_as_needed` feature allows you to use the `as-needed` modifier.
 
-[format-syntax]: https://doc.rust-lang.org/std/fmt/#syntax
+`as-needed` is only compatible with the `dynamic` and `framework` linking kinds. Using any other kind will result in a compiler error.
 
-## Template string arguments
+`+as-needed` means that the library will be actually linked only if it satisfies some undefined symbols at the point at which it is specified on the command line, making it similar to static libraries in this regard.
 
-The assembler template uses the same syntax as [format strings][format-syntax] (i.e. placeholders are specified by curly braces). The corresponding arguments are accessed in order, by index, or by name. However, implicit named arguments (introduced by [RFC #2795][rfc-2795]) are not supported.
+This modifier translates to `--as-needed` for ld-like linkers, and to `-dead_strip_dylibs` / `-needed_library` / `-needed_framework` for ld64.
+The modifier does nothing for linkers that don't support it (e.g. `link.exe`).
 
-An `asm!` invocation may have one or more template string arguments; an `asm!` with multiple template string arguments is treated as if all the strings were concatenated with a `\n` between them. The expected usage is for each template string argument to correspond to a line of assembly code. All template string arguments must appear before any other arguments.
+The default for this modifier is unclear, some targets currently specify it as `+as-needed`, some do not. We may want to try making `+as-needed` a default for all targets.
+"##,
+    },
+    LintCompletion {
+        label: "native_link_modifiers_bundle",
+        description: r##"# `native_link_modifiers_bundle`
 
-As with format strings, named arguments must appear after positional arguments. Explicit register operands must appear at the end of the operand list, after named arguments if any.
+The tracking issue for this feature is: [#81490]
 
-Explicit register operands cannot be used by placeholders in the template string. All other named and positional operands must appear at least once in the template string, otherwise a compiler error is generated.
+[#81490]: https://github.com/rust-lang/rust/issues/81490
 
-The exact assembly code syntax is target-specific and opaque to the compiler except for the way operands are substituted into the template string to form the code passed to the assembler.
+------------------------
 
-The 5 targets specified in this RFC (x86, ARM, AArch64, RISC-V, Hexagon) all use the assembly code syntax of the GNU assembler (GAS). On x86, the `.intel_syntax noprefix` mode of GAS is used by default. On ARM, the `.syntax unified` mode is used. These targets impose an additional restriction on the assembly code: any assembler state (e.g. the current section which can be changed with `.section`) must be restored to its original value at the end of the asm string. Assembly code that does not conform to the GAS syntax will result in assembler-specific behavior.
+The `native_link_modifiers_bundle` feature allows you to use the `bundle` modifier.
 
-[rfc-2795]: https://github.com/rust-lang/rfcs/pull/2795
+Only compatible with the `static` linking kind. Using any other kind will result in a compiler error.
 
-## Operand type
+`+bundle` means objects from the static library are bundled into the produced crate (a rlib, for example) and are used from this crate later during linking of the final binary.
 
-Several types of operands are supported:
+`-bundle` means the static library is included into the produced rlib "by name" and object files from it are included only during linking of the final binary, the file search by that name is also performed during final linking.
 
-* `in(<reg>) <expr>`
-  - `<reg>` can refer to a register class or an explicit register. The allocated register name is substituted into the asm template string.
-  - The allocated register will contain the value of `<expr>` at the start of the asm code.
-  - The allocated register must contain the same value at the end of the asm code (except if a `lateout` is allocated to the same register).
-* `out(<reg>) <expr>`
-  - `<reg>` can refer to a register class or an explicit register. The allocated register name is substituted into the asm template string.
-  - The allocated register will contain an undefined value at the start of the asm code.
-  - `<expr>` must be a (possibly uninitialized) place expression, to which the contents of the allocated register is written to at the end of the asm code.
-  - An underscore (`_`) may be specified instead of an expression, which will cause the contents of the register to be discarded at the end of the asm code (effectively acting as a clobber).
-* `lateout(<reg>) <expr>`
-  - Identical to `out` except that the register allocator can reuse a register allocated to an `in`.
-  - You should only write to the register after all inputs are read, otherwise you may clobber an input.
-* `inout(<reg>) <expr>`
-  - `<reg>` can refer to a register class or an explicit register. The allocated register name is substituted into the asm template string.
-  - The allocated register will contain the value of `<expr>` at the start of the asm code.
-  - `<expr>` must be a mutable initialized place expression, to which the contents of the allocated register is written to at the end of the asm code.
-* `inout(<reg>) <in expr> => <out expr>`
-  - Same as `inout` except that the initial value of the register is taken from the value of `<in expr>`.
-  - `<out expr>` must be a (possibly uninitialized) place expression, to which the contents of the allocated register is written to at the end of the asm code.
-  - An underscore (`_`) may be specified instead of an expression for `<out expr>`, which will cause the contents of the register to be discarded at the end of the asm code (effectively acting as a clobber).
-  - `<in expr>` and `<out expr>` may have different types.
-* `inlateout(<reg>) <expr>` / `inlateout(<reg>) <in expr> => <out expr>`
-  - Identical to `inout` except that the register allocator can reuse a register allocated to an `in` (this can happen if the compiler knows the `in` has the same initial value as the `inlateout`).
-  - You should only write to the register after all inputs are read, otherwise you may clobber an input.
-* `const <expr>`
-  - `<expr>` must be an integer or floating-point constant expression.
-  - The value of the expression is formatted as a string and substituted directly into the asm template string.
-* `sym <path>`
-  - `<path>` must refer to a `fn` or `static`.
-  - A mangled symbol name referring to the item is substituted into the asm template string.
-  - The substituted string does not include any modifiers (e.g. GOT, PLT, relocations, etc).
-  - `<path>` is allowed to point to a `#[thread_local]` static, in which case the asm code can combine the symbol with relocations (e.g. `@plt`, `@TPOFF`) to read from thread-local data.
+This modifier is supposed to supersede the `static-nobundle` linking kind defined by [RFC 1717](https://github.com/rust-lang/rfcs/pull/1717).
 
-Operand expressions are evaluated from left to right, just like function call arguments. After the `asm!` has executed, outputs are written to in left to right order. This is significant if two outputs point to the same place: that place will contain the value of the rightmost output.
+The default for this modifier is currently `+bundle`, but it could be changed later on some future edition boundary.
+"##,
+    },
+    LintCompletion {
+        label: "native_link_modifiers_verbatim",
+        description: r##"# `native_link_modifiers_verbatim`
 
-## Register operands
+The tracking issue for this feature is: [#81490]
 
-Input and output operands can be specified either as an explicit register or as a register class from which the register allocator can select a register. Explicit registers are specified as string literals (e.g. `"eax"`) while register classes are specified as identifiers (e.g. `reg`). Using string literals for register names enables support for architectures that use special characters in register names, such as MIPS (`$0`, `$1`, etc).
+[#81490]: https://github.com/rust-lang/rust/issues/81490
 
-Note that explicit registers treat register aliases (e.g. `r14` vs `lr` on ARM) and smaller views of a register (e.g. `eax` vs `rax`) as equivalent to the base register. It is a compile-time error to use the same explicit register for two input operands or two output operands. Additionally, it is also a compile-time error to use overlapping registers (e.g. ARM VFP) in input operands or in output operands.
+------------------------
 
-Only the following types are allowed as operands for inline assembly:
-- Integers (signed and unsigned)
-- Floating-point numbers
-- Pointers (thin only)
-- Function pointers
-- SIMD vectors (structs defined with `#[repr(simd)]` and which implement `Copy`). This includes architecture-specific vector types defined in `std::arch` such as `__m128` (x86) or `int8x16_t` (ARM).
+The `native_link_modifiers_verbatim` feature allows you to use the `verbatim` modifier.
 
-Here is the list of currently supported register classes:
+`+verbatim` means that rustc itself won't add any target-specified library prefixes or suffixes (like `lib` or `.a`) to the library name, and will try its best to ask for the same thing from the linker.
 
-| Architecture | Register class | Registers | LLVM constraint code |
-| ------------ | -------------- | --------- | -------------------- |
-| x86 | `reg` | `ax`, `bx`, `cx`, `dx`, `si`, `di`, `r[8-15]` (x86-64 only) | `r` |
-| x86 | `reg_abcd` | `ax`, `bx`, `cx`, `dx` | `Q` |
-| x86-32 | `reg_byte` | `al`, `bl`, `cl`, `dl`, `ah`, `bh`, `ch`, `dh` | `q` |
-| x86-64 | `reg_byte` | `al`, `bl`, `cl`, `dl`, `sil`, `dil`, `r[8-15]b`, `ah`\*, `bh`\*, `ch`\*, `dh`\* | `q` |
-| x86 | `xmm_reg` | `xmm[0-7]` (x86) `xmm[0-15]` (x86-64) | `x` |
-| x86 | `ymm_reg` | `ymm[0-7]` (x86) `ymm[0-15]` (x86-64) | `x` |
-| x86 | `zmm_reg` | `zmm[0-7]` (x86) `zmm[0-31]` (x86-64) | `v` |
-| x86 | `kreg` | `k[1-7]` | `Yk` |
-| AArch64 | `reg` | `x[0-28]`, `x30` | `r` |
-| AArch64 | `vreg` | `v[0-31]` | `w` |
-| AArch64 | `vreg_low16` | `v[0-15]` | `x` |
-| ARM | `reg` | `r[0-5]` `r7`\*, `r[8-10]`, `r11`\*, `r12`, `r14` | `r` |
-| ARM (Thumb) | `reg_thumb` | `r[0-r7]` | `l` |
-| ARM (ARM) | `reg_thumb` | `r[0-r10]`, `r12`, `r14` | `l` |
-| ARM | `sreg` | `s[0-31]` | `t` |
-| ARM | `sreg_low16` | `s[0-15]` | `x` |
-| ARM | `dreg` | `d[0-31]` | `w` |
-| ARM | `dreg_low16` | `d[0-15]` | `t` |
-| ARM | `dreg_low8` | `d[0-8]` | `x` |
-| ARM | `qreg` | `q[0-15]` | `w` |
-| ARM | `qreg_low8` | `q[0-7]` | `t` |
-| ARM | `qreg_low4` | `q[0-3]` | `x` |
-| MIPS | `reg` | `$[2-25]` | `r` |
-| MIPS | `freg` | `$f[0-31]` | `f` |
-| NVPTX | `reg16` | None\* | `h` |
-| NVPTX | `reg32` | None\* | `r` |
-| NVPTX | `reg64` | None\* | `l` |
-| RISC-V | `reg` | `x1`, `x[5-7]`, `x[9-15]`, `x[16-31]` (non-RV32E) | `r` |
-| RISC-V | `freg` | `f[0-31]` | `f` |
-| Hexagon | `reg` | `r[0-28]` | `r` |
-| wasm32 | `local` | None\* | `r` |
+For `ld`-like linkers rustc will use the `-l:filename` syntax (note the colon) when passing the library, so the linker won't add any prefixes or suffixes as well.
+See [`-l namespec`](https://sourceware.org/binutils/docs/ld/Options.html) in ld documentation for more details.
+For linkers not supporting any verbatim modifiers (e.g. `link.exe` or `ld64`) the library name will be passed as is.
 
-> **Note**: On x86 we treat `reg_byte` differently from `reg` because the compiler can allocate `al` and `ah` separately whereas `reg` reserves the whole register.
->
-> Note #2: On x86-64 the high byte registers (e.g. `ah`) are only available when used as an explicit register. Specifying the `reg_byte` register class for an operand will always allocate a low byte register.
->
-> Note #3: NVPTX doesn't have a fixed register set, so named registers are not supported.
->
-> Note #4: On ARM the frame pointer is either `r7` or `r11` depending on the platform.
->
-> Note #5: WebAssembly doesn't have registers, so named registers are not supported.
+The default for this modifier is `-verbatim`.
 
-Additional register classes may be added in the future based on demand (e.g. MMX, x87, etc).
+This RFC changes the behavior of `raw-dylib` linking kind specified by [RFC 2627](https://github.com/rust-lang/rfcs/pull/2627). The `.dll` suffix (or other target-specified suffixes for other targets) is now added automatically.
+If your DLL doesn't have the `.dll` suffix, it can be specified with `+verbatim`.
+"##,
+    },
+    LintCompletion {
+        label: "native_link_modifiers_whole_archive",
+        description: r##"# `native_link_modifiers_whole_archive`
 
-Each register class has constraints on which value types they can be used with. This is necessary because the way a value is loaded into a register depends on its type. For example, on big-endian systems, loading a `i32x4` and a `i8x16` into a SIMD register may result in different register contents even if the byte-wise memory representation of both values is identical. The availability of supported types for a particular register class may depend on what target features are currently enabled.
+The tracking issue for this feature is: [#81490]
 
-| Architecture | Register class | Target feature | Allowed types |
-| ------------ | -------------- | -------------- | ------------- |
-| x86-32 | `reg` | None | `i16`, `i32`, `f32` |
-| x86-64 | `reg` | None | `i16`, `i32`, `f32`, `i64`, `f64` |
-| x86 | `reg_byte` | None | `i8` |
-| x86 | `xmm_reg` | `sse` | `i32`, `f32`, `i64`, `f64`, <br> `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` |
-| x86 | `ymm_reg` | `avx` | `i32`, `f32`, `i64`, `f64`, <br> `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` <br> `i8x32`, `i16x16`, `i32x8`, `i64x4`, `f32x8`, `f64x4` |
-| x86 | `zmm_reg` | `avx512f` | `i32`, `f32`, `i64`, `f64`, <br> `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` <br> `i8x32`, `i16x16`, `i32x8`, `i64x4`, `f32x8`, `f64x4` <br> `i8x64`, `i16x32`, `i32x16`, `i64x8`, `f32x16`, `f64x8` |
-| x86 | `kreg` | `axv512f` | `i8`, `i16` |
-| x86 | `kreg` | `axv512bw` | `i32`, `i64` |
-| AArch64 | `reg` | None | `i8`, `i16`, `i32`, `f32`, `i64`, `f64` |
-| AArch64 | `vreg` | `fp` | `i8`, `i16`, `i32`, `f32`, `i64`, `f64`, <br> `i8x8`, `i16x4`, `i32x2`, `i64x1`, `f32x2`, `f64x1`, <br> `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` |
-| ARM | `reg` | None | `i8`, `i16`, `i32`, `f32` |
-| ARM | `sreg` | `vfp2` | `i32`, `f32` |
-| ARM | `dreg` | `vfp2` | `i64`, `f64`, `i8x8`, `i16x4`, `i32x2`, `i64x1`, `f32x2` |
-| ARM | `qreg` | `neon` | `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4` |
-| MIPS32 | `reg` | None | `i8`, `i16`, `i32`, `f32` |
-| MIPS32 | `freg` | None | `f32`, `f64` |
-| MIPS64 | `reg` | None | `i8`, `i16`, `i32`, `i64`, `f32`, `f64` |
-| MIPS64 | `freg` | None | `f32`, `f64` |
-| NVPTX | `reg16` | None | `i8`, `i16` |
-| NVPTX | `reg32` | None | `i8`, `i16`, `i32`, `f32` |
-| NVPTX | `reg64` | None | `i8`, `i16`, `i32`, `f32`, `i64`, `f64` |
-| RISC-V32 | `reg` | None | `i8`, `i16`, `i32`, `f32` |
-| RISC-V64 | `reg` | None | `i8`, `i16`, `i32`, `f32`, `i64`, `f64` |
-| RISC-V | `freg` | `f` | `f32` |
-| RISC-V | `freg` | `d` | `f64` |
-| Hexagon | `reg` | None | `i8`, `i16`, `i32`, `f32` |
-| wasm32 | `local` | None | `i8` `i16` `i32` `i64` `f32` `f64` |
+[#81490]: https://github.com/rust-lang/rust/issues/81490
 
-> **Note**: For the purposes of the above table pointers, function pointers and `isize`/`usize` are treated as the equivalent integer type (`i16`/`i32`/`i64` depending on the target).
+------------------------
 
-If a value is of a smaller size than the register it is allocated in then the upper bits of that register will have an undefined value for inputs and will be ignored for outputs. The only exception is the `freg` register class on RISC-V where `f32` values are NaN-boxed in a `f64` as required by the RISC-V architecture.
+The `native_link_modifiers_whole_archive` feature allows you to use the `whole-archive` modifier.
 
-When separate input and output expressions are specified for an `inout` operand, both expressions must have the same type. The only exception is if both operands are pointers or integers, in which case they are only required to have the same size. This restriction exists because the register allocators in LLVM and GCC sometimes cannot handle tied operands with different types.
+Only compatible with the `static` linking kind. Using any other kind will result in a compiler error.
 
-## Register names
+`+whole-archive` means that the static library is linked as a whole archive without throwing any object files away.
 
-Some registers have multiple names. These are all treated by the compiler as identical to the base register name. Here is the list of all supported register aliases:
+This modifier translates to `--whole-archive` for `ld`-like linkers, to `/WHOLEARCHIVE` for `link.exe`, and to `-force_load` for `ld64`.
+The modifier does nothing for linkers that don't support it.
 
-| Architecture | Base register | Aliases |
-| ------------ | ------------- | ------- |
-| x86 | `ax` | `eax`, `rax` |
-| x86 | `bx` | `ebx`, `rbx` |
-| x86 | `cx` | `ecx`, `rcx` |
-| x86 | `dx` | `edx`, `rdx` |
-| x86 | `si` | `esi`, `rsi` |
-| x86 | `di` | `edi`, `rdi` |
-| x86 | `bp` | `bpl`, `ebp`, `rbp` |
-| x86 | `sp` | `spl`, `esp`, `rsp` |
-| x86 | `ip` | `eip`, `rip` |
-| x86 | `st(0)` | `st` |
-| x86 | `r[8-15]` | `r[8-15]b`, `r[8-15]w`, `r[8-15]d` |
-| x86 | `xmm[0-31]` | `ymm[0-31]`, `zmm[0-31]` |
-| AArch64 | `x[0-30]` | `w[0-30]` |
-| AArch64 | `x29` | `fp` |
-| AArch64 | `x30` | `lr` |
-| AArch64 | `sp` | `wsp` |
-| AArch64 | `xzr` | `wzr` |
-| AArch64 | `v[0-31]` | `b[0-31]`, `h[0-31]`, `s[0-31]`, `d[0-31]`, `q[0-31]` |
-| ARM | `r[0-3]` | `a[1-4]` |
-| ARM | `r[4-9]` | `v[1-6]` |
-| ARM | `r9` | `rfp` |
-| ARM | `r10` | `sl` |
-| ARM | `r11` | `fp` |
-| ARM | `r12` | `ip` |
-| ARM | `r13` | `sp` |
-| ARM | `r14` | `lr` |
-| ARM | `r15` | `pc` |
-| RISC-V | `x0` | `zero` |
-| RISC-V | `x1` | `ra` |
-| RISC-V | `x2` | `sp` |
-| RISC-V | `x3` | `gp` |
-| RISC-V | `x4` | `tp` |
-| RISC-V | `x[5-7]` | `t[0-2]` |
-| RISC-V | `x8` | `fp`, `s0` |
-| RISC-V | `x9` | `s1` |
-| RISC-V | `x[10-17]` | `a[0-7]` |
-| RISC-V | `x[18-27]` | `s[2-11]` |
-| RISC-V | `x[28-31]` | `t[3-6]` |
-| RISC-V | `f[0-7]` | `ft[0-7]` |
-| RISC-V | `f[8-9]` | `fs[0-1]` |
-| RISC-V | `f[10-17]` | `fa[0-7]` |
-| RISC-V | `f[18-27]` | `fs[2-11]` |
-| RISC-V | `f[28-31]` | `ft[8-11]` |
-| Hexagon | `r29` | `sp` |
-| Hexagon | `r30` | `fr` |
-| Hexagon | `r31` | `lr` |
+The default for this modifier is `-whole-archive`.
+"##,
+    },
+    LintCompletion {
+        label: "negative_impls",
+        description: r##"# `negative_impls`
 
-Some registers cannot be used for input or output operands:
+The tracking issue for this feature is [#68318].
 
-| Architecture | Unsupported register | Reason |
-| ------------ | -------------------- | ------ |
-| All | `sp` | The stack pointer must be restored to its original value at the end of an asm code block. |
-| All | `bp` (x86), `x29` (AArch64), `x8` (RISC-V), `fr` (Hexagon), `$fp` (MIPS) | The frame pointer cannot be used as an input or output. |
-| ARM | `r7` or `r11` | On ARM the frame pointer can be either `r7` or `r11` depending on the target. The frame pointer cannot be used as an input or output. |
-| ARM | `r6` | `r6` is used internally by LLVM as a base pointer and therefore cannot be used as an input or output. |
-| x86 | `k0` | This is a constant zero register which can't be modified. |
-| x86 | `ip` | This is the program counter, not a real register. |
-| x86 | `mm[0-7]` | MMX registers are not currently supported (but may be in the future). |
-| x86 | `st([0-7])` | x87 registers are not currently supported (but may be in the future). |
-| AArch64 | `xzr` | This is a constant zero register which can't be modified. |
-| ARM | `pc` | This is the program counter, not a real register. |
-| MIPS | `$0` or `$zero` | This is a constant zero register which can't be modified. |
-| MIPS | `$1` or `$at` | Reserved for assembler. |
-| MIPS | `$26`/`$k0`, `$27`/`$k1` | OS-reserved registers. |
-| MIPS | `$28`/`$gp` | Global pointer cannot be used as inputs or outputs. |
-| MIPS | `$ra` | Return address cannot be used as inputs or outputs. |
-| RISC-V | `x0` | This is a constant zero register which can't be modified. |
-| RISC-V | `gp`, `tp` | These registers are reserved and cannot be used as inputs or outputs. |
-| Hexagon | `lr` | This is the link register which cannot be used as an input or output. |
+[#68318]: https://github.com/rust-lang/rust/issues/68318
 
-In some cases LLVM will allocate a "reserved register" for `reg` operands even though this register cannot be explicitly specified. Assembly code making use of reserved registers should be careful since `reg` operands may alias with those registers. Reserved registers are:
-- The frame pointer on all architectures.
-- `r6` on ARM.
+----
 
-## Template modifiers
+With the feature gate `negative_impls`, you can write negative impls as well as positive ones:
 
-The placeholders can be augmented by modifiers which are specified after the `:` in the curly braces. These modifiers do not affect register allocation, but change the way operands are formatted when inserted into the template string. Only one modifier is allowed per template placeholder.
+```rust
+#![feature(negative_impls)]
+trait DerefMut { }
+impl<T: ?Sized> !DerefMut for &T { }
+```
 
-The supported modifiers are a subset of LLVM's (and GCC's) [asm template argument modifiers][llvm-argmod], but do not use the same letter codes.
+Negative impls indicate a semver guarantee that the given trait will not be implemented for the given types. Negative impls play an additional purpose for auto traits, described below.
 
-| Architecture | Register class | Modifier | Example output | LLVM modifier |
-| ------------ | -------------- | -------- | -------------- | ------------- |
-| x86-32 | `reg` | None | `eax` | `k` |
-| x86-64 | `reg` | None | `rax` | `q` |
-| x86-32 | `reg_abcd` | `l` | `al` | `b` |
-| x86-64 | `reg` | `l` | `al` | `b` |
-| x86 | `reg_abcd` | `h` | `ah` | `h` |
-| x86 | `reg` | `x` | `ax` | `w` |
-| x86 | `reg` | `e` | `eax` | `k` |
-| x86-64 | `reg` | `r` | `rax` | `q` |
-| x86 | `reg_byte` | None | `al` / `ah` | None |
-| x86 | `xmm_reg` | None | `xmm0` | `x` |
-| x86 | `ymm_reg` | None | `ymm0` | `t` |
-| x86 | `zmm_reg` | None | `zmm0` | `g` |
-| x86 | `*mm_reg` | `x` | `xmm0` | `x` |
-| x86 | `*mm_reg` | `y` | `ymm0` | `t` |
-| x86 | `*mm_reg` | `z` | `zmm0` | `g` |
-| x86 | `kreg` | None | `k1` | None |
-| AArch64 | `reg` | None | `x0` | `x` |
-| AArch64 | `reg` | `w` | `w0` | `w` |
-| AArch64 | `reg` | `x` | `x0` | `x` |
-| AArch64 | `vreg` | None | `v0` | None |
-| AArch64 | `vreg` | `v` | `v0` | None |
-| AArch64 | `vreg` | `b` | `b0` | `b` |
-| AArch64 | `vreg` | `h` | `h0` | `h` |
-| AArch64 | `vreg` | `s` | `s0` | `s` |
-| AArch64 | `vreg` | `d` | `d0` | `d` |
-| AArch64 | `vreg` | `q` | `q0` | `q` |
-| ARM | `reg` | None | `r0` | None |
-| ARM | `sreg` | None | `s0` | None |
-| ARM | `dreg` | None | `d0` | `P` |
-| ARM | `qreg` | None | `q0` | `q` |
-| ARM | `qreg` | `e` / `f` | `d0` / `d1` | `e` / `f` |
-| MIPS | `reg` | None | `$2` | None |
-| MIPS | `freg` | None | `$f0` | None |
-| NVPTX | `reg16` | None | `rs0` | None |
-| NVPTX | `reg32` | None | `r0` | None |
-| NVPTX | `reg64` | None | `rd0` | None |
-| RISC-V | `reg` | None | `x1` | None |
-| RISC-V | `freg` | None | `f0` | None |
-| Hexagon | `reg` | None | `r0` | None |
+Negative impls have the following characteristics:
 
-> Notes:
-> - on ARM `e` / `f`: this prints the low or high doubleword register name of a NEON quad (128-bit) register.
-> - on x86: our behavior for `reg` with no modifiers differs from what GCC does. GCC will infer the modifier based on the operand value type, while we default to the full register size.
-> - on x86 `xmm_reg`: the `x`, `t` and `g` LLVM modifiers are not yet implemented in LLVM (they are supported by GCC only), but this should be a simple change.
+* They do not have any items.
+* They must obey the orphan rules as if they were a positive impl.
+* They cannot "overlap" with any positive impls.
 
-As stated in the previous section, passing an input value smaller than the register width will result in the upper bits of the register containing undefined values. This is not a problem if the inline asm only accesses the lower bits of the register, which can be done by using a template modifier to use a subregister name in the asm code (e.g. `ax` instead of `rax`). Since this an easy pitfall, the compiler will suggest a template modifier to use where appropriate given the input type. If all references to an operand already have modifiers then the warning is suppressed for that operand.
+## Semver interaction
 
-[llvm-argmod]: http://llvm.org/docs/LangRef.html#asm-template-argument-modifiers
+It is a breaking change to remove a negative impl. Negative impls are a commitment not to implement the given trait for the named types.
 
-## Options
+## Orphan and overlap rules
 
-Flags are used to further influence the behavior of the inline assembly block.
-Currently the following options are defined:
-- `pure`: The `asm` block has no side effects, and its outputs depend only on its direct inputs (i.e. the values themselves, not what they point to) or values read from memory (unless the `nomem` options is also set). This allows the compiler to execute the `asm` block fewer times than specified in the program (e.g. by hoisting it out of a loop) or even eliminate it entirely if the outputs are not used.
-- `nomem`: The `asm` blocks does not read or write to any memory. This allows the compiler to cache the values of modified global variables in registers across the `asm` block since it knows that they are not read or written to by the `asm`.
-- `readonly`: The `asm` block does not write to any memory. This allows the compiler to cache the values of unmodified global variables in registers across the `asm` block since it knows that they are not written to by the `asm`.
-- `preserves_flags`: The `asm` block does not modify the flags register (defined in the rules below). This allows the compiler to avoid recomputing the condition flags after the `asm` block.
-- `noreturn`: The `asm` block never returns, and its return type is defined as `!` (never). Behavior is undefined if execution falls through past the end of the asm code. A `noreturn` asm block behaves just like a function which doesn't return; notably, local variables in scope are not dropped before it is invoked.
-- `nostack`: The `asm` block does not push data to the stack, or write to the stack red-zone (if supported by the target). If this option is *not* used then the stack pointer is guaranteed to be suitably aligned (according to the target ABI) for a function call.
-- `att_syntax`: This option is only valid on x86, and causes the assembler to use the `.att_syntax prefix` mode of the GNU assembler. Register operands are substituted in with a leading `%`.
+Negative impls must obey the same orphan rules as a positive impl. This implies you cannot add a negative impl for types defined in upstream crates and so forth.
 
-The compiler performs some additional checks on options:
-- The `nomem` and `readonly` options are mutually exclusive: it is a compile-time error to specify both.
-- The `pure` option must be combined with either the `nomem` or `readonly` options, otherwise a compile-time error is emitted.
-- It is a compile-time error to specify `pure` on an asm block with no outputs or only discarded outputs (`_`).
-- It is a compile-time error to specify `noreturn` on an asm block with outputs.
+Similarly, negative impls cannot overlap with positive impls, again using the same "overlap" check that we ordinarily use to determine if two impls overlap. (Note that positive impls typically cannot overlap with one another either, except as permitted by specialization.)
 
-## Rules for inline assembly
+## Interaction with auto traits
 
-- Any registers not specified as inputs will contain an undefined value on entry to the asm block.
-  - An "undefined value" in the context of inline assembly means that the register can (non-deterministically) have any one of the possible values allowed by the architecture. Notably it is not the same as an LLVM `undef` which can have a different value every time you read it (since such a concept does not exist in assembly code).
-- Any registers not specified as outputs must have the same value upon exiting the asm block as they had on entry, otherwise behavior is undefined.
-  - This only applies to registers which can be specified as an input or output. Other registers follow target-specific rules.
-  - Note that a `lateout` may be allocated to the same register as an `in`, in which case this rule does not apply. Code should not rely on this however since it depends on the results of register allocation.
-- Behavior is undefined if execution unwinds out of an asm block.
-  - This also applies if the assembly code calls a function which then unwinds.
-- The set of memory locations that assembly code is allowed the read and write are the same as those allowed for an FFI function.
-  - Refer to the unsafe code guidelines for the exact rules.
-  - If the `readonly` option is set, then only memory reads are allowed.
-  - If the `nomem` option is set then no reads or writes to memory are allowed.
-  - These rules do not apply to memory which is private to the asm code, such as stack space allocated within the asm block.
-- The compiler cannot assume that the instructions in the asm are the ones that will actually end up executed.
-  - This effectively means that the compiler must treat the `asm!` as a black box and only take the interface specification into account, not the instructions themselves.
-  - Runtime code patching is allowed, via target-specific mechanisms (outside the scope of this RFC).
-- Unless the `nostack` option is set, asm code is allowed to use stack space below the stack pointer.
-  - On entry to the asm block the stack pointer is guaranteed to be suitably aligned (according to the target ABI) for a function call.
-  - You are responsible for making sure you don't overflow the stack (e.g. use stack probing to ensure you hit a guard page).
-  - You should adjust the stack pointer when allocating stack memory as required by the target ABI.
-  - The stack pointer must be restored to its original value before leaving the asm block.
-- If the `noreturn` option is set then behavior is undefined if execution falls through to the end of the asm block.
-- If the `pure` option is set then behavior is undefined if the `asm` has side-effects other than its direct outputs. Behavior is also undefined if two executions of the `asm` code with the same inputs result in different outputs.
-  - When used with the `nomem` option, "inputs" are just the direct inputs of the `asm!`.
-  - When used with the `readonly` option, "inputs" comprise the direct inputs of the `asm!` and any memory that the `asm!` block is allowed to read.
-- These flags registers must be restored upon exiting the asm block if the `preserves_flags` option is set:
-  - x86
-    - Status flags in `EFLAGS` (CF, PF, AF, ZF, SF, OF).
-    - Floating-point status word (all).
-    - Floating-point exception flags in `MXCSR` (PE, UE, OE, ZE, DE, IE).
-  - ARM
-    - Condition flags in `CPSR` (N, Z, C, V)
-    - Saturation flag in `CPSR` (Q)
-    - Greater than or equal flags in `CPSR` (GE).
-    - Condition flags in `FPSCR` (N, Z, C, V)
-    - Saturation flag in `FPSCR` (QC)
-    - Floating-point exception flags in `FPSCR` (IDC, IXC, UFC, OFC, DZC, IOC).
-  - AArch64
-    - Condition flags (`NZCV` register).
-    - Floating-point status (`FPSR` register).
-  - RISC-V
-    - Floating-point exception flags in `fcsr` (`fflags`).
-- On x86, the direction flag (DF in `EFLAGS`) is clear on entry to an asm block and must be clear on exit.
-  - Behavior is undefined if the direction flag is set on exiting an asm block.
-- The requirement of restoring the stack pointer and non-output registers to their original value only applies when exiting an `asm!` block.
-  - This means that `asm!` blocks that never return (even if not marked `noreturn`) don't need to preserve these registers.
-  - When returning to a different `asm!` block than you entered (e.g. for context switching), these registers must contain the value they had upon entering the `asm!` block that you are *exiting*.
-    - You cannot exit an `asm!` block that has not been entered. Neither can you exit an `asm!` block that has already been exited.
-    - You are responsible for switching any target-specific state (e.g. thread-local storage, stack bounds).
-    - The set of memory locations that you may access is the intersection of those allowed by the `asm!` blocks you entered and exited.
-- You cannot assume that an `asm!` block will appear exactly once in the output binary. The compiler is allowed to instantiate multiple copies of the `asm!` block, for example when the function containing it is inlined in multiple places.
-  - As a consequence, you should only use [local labels] inside inline assembly code. Defining symbols in assembly code may lead to assembler and/or linker errors due to duplicate symbol definitions.
+Declaring a negative impl `impl !SomeAutoTrait for SomeType` for an
+auto-trait serves two purposes:
 
-> **Note**: As a general rule, the flags covered by `preserves_flags` are those which are *not* preserved when performing a function call.
+* as with any trait, it declares that `SomeType` will never implement `SomeAutoTrait`;
+* it disables the automatic `SomeType: SomeAutoTrait` impl that would otherwise have been generated.
 
-[local labels]: https://sourceware.org/binutils/docs/as/Symbol-Names.html#Local-Labels
+Note that, at present, there is no way to indicate that a given type
+does not implement an auto trait *but that it may do so in the
+future*. For ordinary types, this is done by simply not declaring any
+impl at all, but that is not an option for auto traits. A workaround
+is that one could embed a marker type as one of the fields, where the
+marker type is `!AutoTrait`.
+
+## Immediate uses
+
+Negative impls are used to declare that `&T: !DerefMut`  and `&mut T: !Clone`, as required to fix the soundness of `Pin` described in [#66544](https://github.com/rust-lang/rust/issues/66544).
+
+This serves two purposes:
+
+* For proving the correctness of unsafe code, we can use that impl as evidence that no `DerefMut` or `Clone` impl exists.
+* It prevents downstream crates from creating such impls.
 "##,
     },
     LintCompletion {
-        label: "flt2dec",
-        description: r##"# `flt2dec`
+        label: "no_coverage",
+        description: r##"# `no_coverage`
 
-This feature is internal to the Rust compiler and is not intended for general use.
+The tracking issue for this feature is: [#84605]
+
+[#84605]: https://github.com/rust-lang/rust/issues/84605
+
+---
+
+The `no_coverage` attribute can be used to selectively disable coverage
+instrumentation in an annotated function. This might be useful to:
+
+-   Avoid instrumentation overhead in a performance critical function
+-   Avoid generating coverage for a function that is not meant to be executed,
+    but still target 100% coverage for the rest of the program.
+
+## Example
+
+```rust
+#![feature(no_coverage)]
+
+// `foo()` will get coverage instrumentation (by default)
+fn foo() {
+  // ...
+}
+
+#[no_coverage]
+fn bar() {
+  // ...
+}
+```
+"##,
+    },
+    LintCompletion {
+        label: "no_sanitize",
+        description: r##"# `no_sanitize`
+
+The tracking issue for this feature is: [#39699]
+
+[#39699]: https://github.com/rust-lang/rust/issues/39699
 
 ------------------------
+
+The `no_sanitize` attribute can be used to selectively disable sanitizer
+instrumentation in an annotated function. This might be useful to: avoid
+instrumentation overhead in a performance critical function, or avoid
+instrumenting code that contains constructs unsupported by given sanitizer.
+
+The precise effect of this annotation depends on particular sanitizer in use.
+For example, with `no_sanitize(thread)`, the thread sanitizer will no longer
+instrument non-atomic store / load operations, but it will instrument atomic
+operations to avoid reporting false positives and provide meaning full stack
+traces.
+
+## Examples
+
+``` rust
+#![feature(no_sanitize)]
+
+#[no_sanitize(address)]
+fn foo() {
+  // ...
+}
+```
 "##,
     },
     LintCompletion {
-        label: "global_asm",
-        description: r##"# `global_asm`
+        label: "plugin",
+        description: r##"# `plugin`
 
-The tracking issue for this feature is: [#35119]
+The tracking issue for this feature is: [#29597]
+
+[#29597]: https://github.com/rust-lang/rust/issues/29597
 
-[#35119]: https://github.com/rust-lang/rust/issues/35119
+
+This feature is part of "compiler plugins." It will often be used with the
+[`plugin_registrar`] and `rustc_private` features.
+
+[`plugin_registrar`]: plugin-registrar.md
 
 ------------------------
 
-The `global_asm!` macro allows the programmer to write arbitrary
-assembly outside the scope of a function body, passing it through
-`rustc` and `llvm` to the assembler. The macro is a no-frills
-interface to LLVM's concept of [module-level inline assembly]. That is,
-all caveats applicable to LLVM's module-level inline assembly apply
-to `global_asm!`.
+`rustc` can load compiler plugins, which are user-provided libraries that
+extend the compiler's behavior with new lint checks, etc.
+
+A plugin is a dynamic library crate with a designated *registrar* function that
+registers extensions with `rustc`. Other crates can load these extensions using
+the crate attribute `#![plugin(...)]`.  See the
+`rustc_driver::plugin` documentation for more about the
+mechanics of defining and loading a plugin.
+
+In the vast majority of cases, a plugin should *only* be used through
+`#![plugin]` and not through an `extern crate` item.  Linking a plugin would
+pull in all of librustc_ast and librustc as dependencies of your crate.  This is
+generally unwanted unless you are building another plugin.
 
-[module-level inline assembly]: http://llvm.org/docs/LangRef.html#module-level-inline-assembly
+The usual practice is to put compiler plugins in their own crate, separate from
+any `macro_rules!` macros or ordinary Rust code meant to be used by consumers
+of a library.
 
-`global_asm!` fills a role not currently satisfied by either `asm!`
-or `#[naked]` functions. The programmer has _all_ features of the
-assembler at their disposal. The linker will expect to resolve any
-symbols defined in the inline assembly, modulo any symbols marked as
-external. It also means syntax for directives and assembly follow the
-conventions of the assembler in your toolchain.
+# Lint plugins
 
-A simple usage looks like this:
+Plugins can extend [Rust's lint
+infrastructure](../../reference/attributes/diagnostics.md#lint-check-attributes) with
+additional checks for code style, safety, etc. Now let's write a plugin
+[`lint-plugin-test.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs)
+that warns about any item named `lintme`.
 
-```rust,ignore (requires-external-file)
-#![feature(global_asm)]
-# // you also need relevant target_arch cfgs
-global_asm!(include_str!("something_neato.s"));
-```
+```rust,ignore (requires-stage-2)
+#![feature(plugin_registrar)]
+#![feature(box_syntax, rustc_private)]
 
-And a more complicated usage looks like this:
+extern crate rustc_ast;
 
-```rust,no_run
-#![feature(global_asm)]
-# #[cfg(any(target_arch="x86", target_arch="x86_64"))]
-# mod x86 {
+// Load rustc as a plugin to get macros
+extern crate rustc_driver;
+#[macro_use]
+extern crate rustc_lint;
+#[macro_use]
+extern crate rustc_session;
 
-pub mod sally {
-    global_asm!(r#"
-        .global foo
-      foo:
-        jmp baz
-    "#);
+use rustc_driver::plugin::Registry;
+use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
+use rustc_ast::ast;
+declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
 
-    #[no_mangle]
-    pub unsafe extern "C" fn baz() {}
-}
+declare_lint_pass!(Pass => [TEST_LINT]);
 
-// the symbols `foo` and `bar` are global, no matter where
-// `global_asm!` was used.
-extern "C" {
-    fn foo();
-    fn bar();
+impl EarlyLintPass for Pass {
+    fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
+        if it.ident.name.as_str() == "lintme" {
+            cx.lint(TEST_LINT, |lint| {
+                lint.build("item is named 'lintme'").set_span(it.span).emit()
+            });
+        }
+    }
 }
 
-pub mod harry {
-    global_asm!(r#"
-        .global bar
-      bar:
-        jmp quux
-    "#);
-
-    #[no_mangle]
-    pub unsafe extern "C" fn quux() {}
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+    reg.lint_store.register_lints(&[&TEST_LINT]);
+    reg.lint_store.register_early_pass(|| box Pass);
 }
-# }
 ```
 
-You may use `global_asm!` multiple times, anywhere in your crate, in
-whatever way suits you. The effect is as if you concatenated all
-usages and placed the larger, single usage in the crate root.
-
-------------------------
-
-If you don't need quite as much power and flexibility as
-`global_asm!` provides, and you don't mind restricting your inline
-assembly to `fn` bodies only, you might try the
-[asm](asm.md) feature instead.
-"##,
-    },
-    LintCompletion {
-        label: "derive_eq",
-        description: r##"# `derive_eq`
-
-This feature is internal to the Rust compiler and is not intended for general use.
-
-------------------------
-"##,
-    },
-    LintCompletion {
-        label: "default_free_fn",
-        description: r##"# `default_free_fn`
+Then code like
 
-The tracking issue for this feature is: [#73014]
+```rust,ignore (requires-plugin)
+#![feature(plugin)]
+#![plugin(lint_plugin_test)]
 
-[#73014]: https://github.com/rust-lang/rust/issues/73014
+fn lintme() { }
+```
 
-------------------------
+will produce a compiler warning:
 
-Adds a free `default()` function to the `std::default` module.  This function
-just forwards to [`Default::default()`], but may remove repetition of the word
-"default" from the call site.
+```txt
+foo.rs:4:1: 4:16 warning: item is named 'lintme', #[warn(test_lint)] on by default
+foo.rs:4 fn lintme() { }
+         ^~~~~~~~~~~~~~~
+```
 
-[`Default::default()`]: https://doc.rust-lang.org/nightly/std/default/trait.Default.html#tymethod.default
+The components of a lint plugin are:
 
-Here is an example:
+* one or more `declare_lint!` invocations, which define static `Lint` structs;
 
-```rust
-#![feature(default_free_fn)]
-use std::default::default;
+* a struct holding any state needed by the lint pass (here, none);
 
-#[derive(Default)]
-struct AppConfig {
-    foo: FooConfig,
-    bar: BarConfig,
-}
+* a `LintPass`
+  implementation defining how to check each syntax element. A single
+  `LintPass` may call `span_lint` for several different `Lint`s, but should
+  register them all through the `get_lints` method.
 
-#[derive(Default)]
-struct FooConfig {
-    foo: i32,
-}
+Lint passes are syntax traversals, but they run at a late stage of compilation
+where type information is available. `rustc`'s [built-in
+lints](https://github.com/rust-lang/rust/blob/master/src/librustc_session/lint/builtin.rs)
+mostly use the same infrastructure as lint plugins, and provide examples of how
+to access type information.
 
-#[derive(Default)]
-struct BarConfig {
-    bar: f32,
-    baz: u8,
-}
+Lints defined by plugins are controlled by the usual [attributes and compiler
+flags](../../reference/attributes/diagnostics.md#lint-check-attributes), e.g.
+`#[allow(test_lint)]` or `-A test-lint`. These identifiers are derived from the
+first argument to `declare_lint!`, with appropriate case and punctuation
+conversion.
 
-fn main() {
-    let options = AppConfig {
-        foo: default(),
-        bar: BarConfig {
-            bar: 10.1,
-            ..default()
-        },
-    };
-}
-```
+You can run `rustc -W help foo.rs` to see a list of lints known to `rustc`,
+including those provided by plugins loaded by `foo.rs`.
 "##,
     },
     LintCompletion {
-        label: "char_error_internals",
-        description: r##"# `char_error_internals`
+        label: "plugin_registrar",
+        description: r##"# `plugin_registrar`
 
-This feature is internal to the Rust compiler and is not intended for general use.
+The tracking issue for this feature is: [#29597]
+
+[#29597]: https://github.com/rust-lang/rust/issues/29597
+
+This feature is part of "compiler plugins." It will often be used with the
+[`plugin`] and `rustc_private` features as well. For more details, see
+their docs.
+
+[`plugin`]: plugin.md
 
 ------------------------
 "##,
     },
     LintCompletion {
-        label: "libstd_sys_internals",
-        description: r##"# `libstd_sys_internals`
+        label: "print_internals",
+        description: r##"# `print_internals`
 
 This feature is internal to the Rust compiler and is not intended for general use.
 
@@ -3682,23 +3753,17 @@ fn main() {
 "##,
     },
     LintCompletion {
-        label: "is_sorted",
-        description: r##"# `is_sorted`
-
-The tracking issue for this feature is: [#53485]
+        label: "profiler_runtime",
+        description: r##"# `profiler_runtime`
 
-[#53485]: https://github.com/rust-lang/rust/issues/53485
+The tracking issue for this feature is: [#42524](https://github.com/rust-lang/rust/issues/42524).
 
 ------------------------
-
-Add the methods `is_sorted`, `is_sorted_by` and `is_sorted_by_key` to `[T]`;
-add the methods `is_sorted`, `is_sorted_by` and `is_sorted_by_key` to
-`Iterator`.
 "##,
     },
     LintCompletion {
-        label: "c_void_variant",
-        description: r##"# `c_void_variant`
+        label: "profiler_runtime_lib",
+        description: r##"# `profiler_runtime_lib`
 
 This feature is internal to the Rust compiler and is not intended for general use.
 
@@ -3706,85 +3771,96 @@ fn main() {
 "##,
     },
     LintCompletion {
-        label: "concat_idents",
-        description: r##"# `concat_idents`
+        label: "repr128",
+        description: r##"# `repr128`
 
-The tracking issue for this feature is: [#29599]
+The tracking issue for this feature is: [#56071]
 
-[#29599]: https://github.com/rust-lang/rust/issues/29599
+[#56071]: https://github.com/rust-lang/rust/issues/56071
 
 ------------------------
 
-The `concat_idents` feature adds a macro for concatenating multiple identifiers
-into one identifier.
-
-## Examples
+The `repr128` feature adds support for `#[repr(u128)]` on `enum`s.
 
 ```rust
-#![feature(concat_idents)]
+#![feature(repr128)]
 
-fn main() {
-    fn foobar() -> u32 { 23 }
-    let f = concat_idents!(foo, bar);
-    assert_eq!(f(), 23);
+#[repr(u128)]
+enum Foo {
+    Bar(u64),
 }
 ```
 "##,
     },
     LintCompletion {
-        label: "format_args_capture",
-        description: r##"# `format_args_capture`
+        label: "rt",
+        description: r##"# `rt`
 
-The tracking issue for this feature is: [#67984]
+This feature is internal to the Rust compiler and is not intended for general use.
 
-[#67984]: https://github.com/rust-lang/rust/issues/67984
+------------------------
+"##,
+    },
+    LintCompletion {
+        label: "rustc_attrs",
+        description: r##"# `rustc_attrs`
+
+This feature has no tracking issue, and is therefore internal to
+the compiler, not being intended for general use.
+
+Note: `rustc_attrs` enables many rustc-internal attributes and this page
+only discuss a few of them.
 
 ------------------------
 
-Enables `format_args!` (and macros which use `format_args!` in their implementation, such
-as `format!`, `print!` and `panic!`) to capture variables from the surrounding scope.
-This avoids the need to pass named parameters when the binding in question
-already exists in scope.
+The `rustc_attrs` feature allows debugging rustc type layouts by using
+`#[rustc_layout(...)]` to debug layout at compile time (it even works
+with `cargo check`) as an alternative to `rustc -Z print-type-sizes`
+that is way more verbose.
 
-```rust
-#![feature(format_args_capture)]
+Options provided by `#[rustc_layout(...)]` are `debug`, `size`, `align`,
+`abi`. Note that it only works on sized types without generics.
 
-let (person, species, name) = ("Charlie Brown", "dog", "Snoopy");
+## Examples
 
-// captures named argument `person`
-print!("Hello {person}");
+```rust,compile_fail
+#![feature(rustc_attrs)]
 
-// captures named arguments `species` and `name`
-format!("The {species}'s name is {name}.");
+#[rustc_layout(abi, size)]
+pub enum X {
+    Y(u8, u8, u8),
+    Z(isize),
+}
 ```
 
-This also works for formatting parameters such as width and precision:
+When that is compiled, the compiler will error with something like
 
-```rust
-#![feature(format_args_capture)]
+```text
+error: abi: Aggregate { sized: true }
+ --> src/lib.rs:4:1
+  |
+4 | / pub enum T {
+5 | |     Y(u8, u8, u8),
+6 | |     Z(isize),
+7 | | }
+  | |_^
 
-let precision = 2;
-let s = format!("{:.precision$}", 1.324223);
+error: size: Size { raw: 16 }
+ --> src/lib.rs:4:1
+  |
+4 | / pub enum T {
+5 | |     Y(u8, u8, u8),
+6 | |     Z(isize),
+7 | | }
+  | |_^
 
-assert_eq!(&s, "1.32");
+error: aborting due to 2 previous errors
 ```
-
-A non-exhaustive list of macros which benefit from this functionality include:
-- `format!`
-- `print!` and `println!`
-- `eprint!` and `eprintln!`
-- `write!` and `writeln!`
-- `panic!`
-- `unreachable!`
-- `unimplemented!`
-- `todo!`
-- `assert!` and similar
-- macros in many thirdparty crates, such as `log`
 "##,
     },
     LintCompletion {
-        label: "print_internals",
-        description: r##"# `print_internals`
+        label: "sort_internals",
+        description: r##"# `sort_internals`
 
 This feature is internal to the Rust compiler and is not intended for general use.
 
@@ -3792,205 +3868,179 @@ fn foobar() -> u32 { 23 }
 "##,
     },
     LintCompletion {
-        label: "llvm_asm",
-        description: r##"# `llvm_asm`
-
-The tracking issue for this feature is: [#70173]
+        label: "str_internals",
+        description: r##"# `str_internals`
 
-[#70173]: https://github.com/rust-lang/rust/issues/70173
+This feature is internal to the Rust compiler and is not intended for general use.
 
 ------------------------
+"##,
+    },
+    LintCompletion {
+        label: "test",
+        description: r##"# `test`
 
-For extremely low-level manipulations and performance reasons, one
-might wish to control the CPU directly. Rust supports using inline
-assembly to do this via the `llvm_asm!` macro.
+The tracking issue for this feature is: None.
 
-```rust,ignore (pseudo-code)
-llvm_asm!(assembly template
-   : output operands
-   : input operands
-   : clobbers
-   : options
-   );
-```
+------------------------
 
-Any use of `llvm_asm` is feature gated (requires `#![feature(llvm_asm)]` on the
-crate to allow) and of course requires an `unsafe` block.
+The internals of the `test` crate are unstable, behind the `test` flag.  The
+most widely used part of the `test` crate are benchmark tests, which can test
+the performance of your code.  Let's make our `src/lib.rs` look like this
+(comments elided):
 
-> **Note**: the examples here are given in x86/x86-64 assembly, but
-> all platforms are supported.
+```rust,no_run
+#![feature(test)]
 
-## Assembly template
+extern crate test;
 
-The `assembly template` is the only required parameter and must be a
-literal string (i.e. `""`)
+pub fn add_two(a: i32) -> i32 {
+    a + 2
+}
 
-```rust
-#![feature(llvm_asm)]
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use test::Bencher;
 
-#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
-fn foo() {
-    unsafe {
-        llvm_asm!("NOP");
+    #[test]
+    fn it_works() {
+        assert_eq!(4, add_two(2));
     }
-}
-
-// Other platforms:
-#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
-fn foo() { /* ... */ }
 
-fn main() {
-    // ...
-    foo();
-    // ...
+    #[bench]
+    fn bench_add_two(b: &mut Bencher) {
+        b.iter(|| add_two(2));
+    }
 }
 ```
 
-(The `feature(llvm_asm)` and `#[cfg]`s are omitted from now on.)
+Note the `test` feature gate, which enables this unstable feature.
 
-Output operands, input operands, clobbers and options are all optional
-but you must add the right number of `:` if you skip them:
+We've imported the `test` crate, which contains our benchmarking support.
+We have a new function as well, with the `bench` attribute. Unlike regular
+tests, which take no arguments, benchmark tests take a `&mut Bencher`. This
+`Bencher` provides an `iter` method, which takes a closure. This closure
+contains the code we'd like to benchmark.
 
-```rust
-# #![feature(llvm_asm)]
-# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
-# fn main() { unsafe {
-llvm_asm!("xor %eax, %eax"
-    :
-    :
-    : "eax"
-   );
-# } }
-# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
-# fn main() {}
-```
+We can run benchmark tests with `cargo bench`:
 
-Whitespace also doesn't matter:
+```bash
+$ cargo bench
+   Compiling adder v0.0.1 (file:///home/steve/tmp/adder)
+     Running target/release/adder-91b3e234d4ed382a
 
-```rust
-# #![feature(llvm_asm)]
-# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
-# fn main() { unsafe {
-llvm_asm!("xor %eax, %eax" ::: "eax");
-# } }
-# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
-# fn main() {}
+running 2 tests
+test tests::it_works ... ignored
+test tests::bench_add_two ... bench:         1 ns/iter (+/- 0)
+
+test result: ok. 0 passed; 0 failed; 1 ignored; 1 measured
 ```
 
-## Operands
+Our non-benchmark test was ignored. You may have noticed that `cargo bench`
+takes a bit longer than `cargo test`. This is because Rust runs our benchmark
+a number of times, and then takes the average. Because we're doing so little
+work in this example, we have a `1 ns/iter (+/- 0)`, but this would show
+the variance if there was one.
 
-Input and output operands follow the same format: `:
-"constraints1"(expr1), "constraints2"(expr2), ..."`. Output operand
-expressions must be mutable place, or not yet assigned:
+Advice on writing benchmarks:
 
-```rust
-# #![feature(llvm_asm)]
-# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
-fn add(a: i32, b: i32) -> i32 {
-    let c: i32;
-    unsafe {
-        llvm_asm!("add $2, $0"
-             : "=r"(c)
-             : "0"(a), "r"(b)
-             );
-    }
-    c
-}
-# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
-# fn add(a: i32, b: i32) -> i32 { a + b }
 
-fn main() {
-    assert_eq!(add(3, 14159), 14162)
-}
-```
+* Move setup code outside the `iter` loop; only put the part you want to measure inside
+* Make the code do "the same thing" on each iteration; do not accumulate or change state
+* Make the outer function idempotent too; the benchmark runner is likely to run
+  it many times
+*  Make the inner `iter` loop short and fast so benchmark runs are fast and the
+   calibrator can adjust the run-length at fine resolution
+* Make the code in the `iter` loop do something simple, to assist in pinpointing
+  performance improvements (or regressions)
 
-If you would like to use real operands in this position, however,
-you are required to put curly braces `{}` around the register that
-you want, and you are required to put the specific size of the
-operand. This is useful for very low level programming, where
-which register you use is important:
+## Gotcha: optimizations
 
-```rust
-# #![feature(llvm_asm)]
-# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
-# unsafe fn read_byte_in(port: u16) -> u8 {
-let result: u8;
-llvm_asm!("in %dx, %al" : "={al}"(result) : "{dx}"(port));
-result
-# }
-```
+There's another tricky part to writing benchmarks: benchmarks compiled with
+optimizations activated can be dramatically changed by the optimizer so that
+the benchmark is no longer benchmarking what one expects. For example, the
+compiler might recognize that some calculation has no external effects and
+remove it entirely.
 
-## Clobbers
+```rust,no_run
+#![feature(test)]
 
-Some instructions modify registers which might otherwise have held
-different values so we use the clobbers list to indicate to the
-compiler not to assume any values loaded into those registers will
-stay valid.
+extern crate test;
+use test::Bencher;
 
-```rust
-# #![feature(llvm_asm)]
-# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
-# fn main() { unsafe {
-// Put the value 0x200 in eax:
-llvm_asm!("mov $$0x200, %eax" : /* no outputs */ : /* no inputs */ : "eax");
-# } }
-# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
-# fn main() {}
+#[bench]
+fn bench_xor_1000_ints(b: &mut Bencher) {
+    b.iter(|| {
+        (0..1000).fold(0, |old, new| old ^ new);
+    });
+}
 ```
 
-Input and output registers need not be listed since that information
-is already communicated by the given constraints. Otherwise, any other
-registers used either implicitly or explicitly should be listed.
+gives the following results
 
-If the assembly changes the condition code register `cc` should be
-specified as one of the clobbers. Similarly, if the assembly modifies
-memory, `memory` should also be specified.
+```text
+running 1 test
+test bench_xor_1000_ints ... bench:         0 ns/iter (+/- 0)
 
-## Options
+test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
+```
 
-The last section, `options` is specific to Rust. The format is comma
-separated literal strings (i.e. `:"foo", "bar", "baz"`). It's used to
-specify some extra info about the inline assembly:
+The benchmarking runner offers two ways to avoid this. Either, the closure that
+the `iter` method receives can return an arbitrary value which forces the
+optimizer to consider the result used and ensures it cannot remove the
+computation entirely. This could be done for the example above by adjusting the
+`b.iter` call to
 
-Current valid options are:
+```rust
+# struct X;
+# impl X { fn iter<T, F>(&self, _: F) where F: FnMut() -> T {} } let b = X;
+b.iter(|| {
+    // Note lack of `;` (could also use an explicit `return`).
+    (0..1000).fold(0, |old, new| old ^ new)
+});
+```
 
-1. `volatile` - specifying this is analogous to
-   `__asm__ __volatile__ (...)` in gcc/clang.
-2. `alignstack` - certain instructions expect the stack to be
-   aligned a certain way (i.e. SSE) and specifying this indicates to
-   the compiler to insert its usual stack alignment code
-3. `intel` - use intel syntax instead of the default AT&T.
+Or, the other option is to call the generic `test::black_box` function, which
+is an opaque "black box" to the optimizer and so forces it to consider any
+argument as used.
 
 ```rust
-# #![feature(llvm_asm)]
-# #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+#![feature(test)]
+
+extern crate test;
+
 # fn main() {
-let result: i32;
-unsafe {
-   llvm_asm!("mov eax, 2" : "={eax}"(result) : : : "intel")
-}
-println!("eax is currently {}", result);
+# struct X;
+# impl X { fn iter<T, F>(&self, _: F) where F: FnMut() -> T {} } let b = X;
+b.iter(|| {
+    let n = test::black_box(1000);
+
+    (0..n).fold(0, |a, b| a ^ b)
+})
 # }
-# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
-# fn main() {}
 ```
 
-## More Information
+Neither of these read or modify the value, and are very cheap for small values.
+Larger values can be passed indirectly to reduce overhead (e.g.
+`black_box(&huge_struct)`).
 
-The current implementation of the `llvm_asm!` macro is a direct binding to [LLVM's
-inline assembler expressions][llvm-docs], so be sure to check out [their
-documentation as well][llvm-docs] for more information about clobbers,
-constraints, etc.
+Performing either of the above changes gives the following benchmarking results
 
-[llvm-docs]: http://llvm.org/docs/LangRef.html#inline-assembler-expressions
+```text
+running 1 test
+test bench_xor_1000_ints ... bench:       131 ns/iter (+/- 3)
 
-If you need more power and don't mind losing some of the niceties of
-`llvm_asm!`, check out [global_asm](global-asm.md).
+test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
+```
+
+However, the optimizer can still modify a testcase in an undesirable manner
+even when using either of the above.
 "##,
     },
     LintCompletion {
-        label: "core_intrinsics",
-        description: r##"# `core_intrinsics`
+        label: "thread_local_internals",
+        description: r##"# `thread_local_internals`
 
 This feature is internal to the Rust compiler and is not intended for general use.
 
@@ -4041,456 +4091,478 @@ fn main() {
 "##,
     },
     LintCompletion {
-        label: "update_panic_count",
-        description: r##"# `update_panic_count`
+        label: "trait_alias",
+        description: r##"# `trait_alias`
 
-This feature is internal to the Rust compiler and is not intended for general use.
+The tracking issue for this feature is: [#41517]
+
+[#41517]: https://github.com/rust-lang/rust/issues/41517
 
 ------------------------
-"##,
-    },
-    LintCompletion {
-        label: "core_private_bignum",
-        description: r##"# `core_private_bignum`
 
-This feature is internal to the Rust compiler and is not intended for general use.
+The `trait_alias` feature adds support for trait aliases. These allow aliases
+to be created for one or more traits (currently just a single regular trait plus
+any number of auto-traits), and used wherever traits would normally be used as
+either bounds or trait objects.
 
-------------------------
-"##,
-    },
-    LintCompletion {
-        label: "sort_internals",
-        description: r##"# `sort_internals`
+```rust
+#![feature(trait_alias)]
 
-This feature is internal to the Rust compiler and is not intended for general use.
+trait Foo = std::fmt::Debug + Send;
+trait Bar = Foo + Sync;
 
-------------------------
-"##,
-    },
-    LintCompletion {
-        label: "windows_net",
-        description: r##"# `windows_net`
+// Use trait alias as bound on type parameter.
+fn foo<T: Foo>(v: &T) {
+    println!("{:?}", v);
+}
 
-This feature is internal to the Rust compiler and is not intended for general use.
+pub fn main() {
+    foo(&1);
 
-------------------------
+    // Use trait alias for trait objects.
+    let a: &Bar = &123;
+    println!("{:?}", a);
+    let b = Box::new(456) as Box<dyn Foo>;
+    println!("{:?}", b);
+}
+```
 "##,
     },
     LintCompletion {
-        label: "c_variadic",
-        description: r##"# `c_variadic`
-
-The tracking issue for this feature is: [#44930]
+        label: "transparent_unions",
+        description: r##"# `transparent_unions`
 
-[#44930]: https://github.com/rust-lang/rust/issues/44930
+The tracking issue for this feature is [#60405]
 
-------------------------
+[#60405]: https://github.com/rust-lang/rust/issues/60405
 
-The `c_variadic` library feature exposes the `VaList` structure,
-Rust's analogue of C's `va_list` type.
+----
 
-## Examples
+The `transparent_unions` feature allows you mark `union`s as
+`#[repr(transparent)]`. A `union` may be `#[repr(transparent)]` in exactly the
+same conditions in which a `struct` may be `#[repr(transparent)]` (generally,
+this means the `union` must have exactly one non-zero-sized field). Some
+concrete illustrations follow.
 
 ```rust
-#![feature(c_variadic)]
+#![feature(transparent_unions)]
 
-use std::ffi::VaList;
+// This union has the same representation as `f32`.
+#[repr(transparent)]
+union SingleFieldUnion {
+    field: f32,
+}
 
-pub unsafe extern "C" fn vadd(n: usize, mut args: VaList) -> usize {
-    let mut sum = 0;
-    for _ in 0..n {
-        sum += args.arg::<usize>();
-    }
-    sum
+// This union has the same representation as `usize`.
+#[repr(transparent)]
+union MultiFieldUnion {
+    field: usize,
+    nothing: (),
 }
 ```
-"##,
-    },
-    LintCompletion {
-        label: "core_private_diy_float",
-        description: r##"# `core_private_diy_float`
 
-This feature is internal to the Rust compiler and is not intended for general use.
+For consistency with transparent `struct`s, `union`s must have exactly one
+non-zero-sized field. If all fields are zero-sized, the `union` must not be
+`#[repr(transparent)]`:
 
-------------------------
-"##,
-    },
-    LintCompletion {
-        label: "profiler_runtime_lib",
-        description: r##"# `profiler_runtime_lib`
+```rust
+#![feature(transparent_unions)]
 
-This feature is internal to the Rust compiler and is not intended for general use.
+// This (non-transparent) union is already valid in stable Rust:
+pub union GoodUnion {
+    pub nothing: (),
+}
 
-------------------------
-"##,
-    },
-    LintCompletion {
-        label: "thread_local_internals",
-        description: r##"# `thread_local_internals`
+// Error: transparent union needs exactly one non-zero-sized field, but has 0
+// #[repr(transparent)]
+// pub union BadUnion {
+//     pub nothing: (),
+// }
+```
 
-This feature is internal to the Rust compiler and is not intended for general use.
+The one exception is if the `union` is generic over `T` and has a field of type
+`T`, it may be `#[repr(transparent)]` even if `T` is a zero-sized type:
 
-------------------------
-"##,
-    },
-    LintCompletion {
-        label: "int_error_internals",
-        description: r##"# `int_error_internals`
+```rust
+#![feature(transparent_unions)]
 
-This feature is internal to the Rust compiler and is not intended for general use.
+// This union has the same representation as `T`.
+#[repr(transparent)]
+pub union GenericUnion<T: Copy> { // Unions with non-`Copy` fields are unstable.
+    pub field: T,
+    pub nothing: (),
+}
 
-------------------------
-"##,
-    },
-    LintCompletion {
-        label: "windows_stdio",
-        description: r##"# `windows_stdio`
+// This is okay even though `()` is a zero-sized type.
+pub const THIS_IS_OKAY: GenericUnion<()> = GenericUnion { field: () };
+```
 
-This feature is internal to the Rust compiler and is not intended for general use.
+Like transarent `struct`s, a transparent `union` of type `U` has the same
+layout, size, and ABI as its single non-ZST field. If it is generic over a type
+`T`, and all its fields are ZSTs except for exactly one field of type `T`, then
+it has the same layout and ABI as `T` (even if `T` is a ZST when monomorphized).
 
-------------------------
+Like transparent `struct`s, transparent `union`s are FFI-safe if and only if
+their underlying representation type is also FFI-safe.
+
+A `union` may not be eligible for the same nonnull-style optimizations that a
+`struct` or `enum` (with the same fields) are eligible for. Adding
+`#[repr(transparent)]` to  `union` does not change this. To give a more concrete
+example, it is unspecified whether `size_of::<T>()` is equal to
+`size_of::<Option<T>>()`, where `T` is a `union` (regardless of whether or not
+it is transparent). The Rust compiler is free to perform this optimization if
+possible, but is not required to, and different compiler versions may differ in
+their application of these optimizations.
 "##,
     },
     LintCompletion {
-        label: "fmt_internals",
-        description: r##"# `fmt_internals`
+        label: "try_blocks",
+        description: r##"# `try_blocks`
 
-This feature is internal to the Rust compiler and is not intended for general use.
+The tracking issue for this feature is: [#31436]
+
+[#31436]: https://github.com/rust-lang/rust/issues/31436
 
 ------------------------
-"##,
-    },
-    LintCompletion {
-        label: "fd_read",
-        description: r##"# `fd_read`
 
-This feature is internal to the Rust compiler and is not intended for general use.
+The `try_blocks` feature adds support for `try` blocks. A `try`
+block creates a new scope one can use the `?` operator in.
 
-------------------------
-"##,
-    },
-    LintCompletion {
-        label: "str_internals",
-        description: r##"# `str_internals`
+```rust,edition2018
+#![feature(try_blocks)]
 
-This feature is internal to the Rust compiler and is not intended for general use.
+use std::num::ParseIntError;
+
+let result: Result<i32, ParseIntError> = try {
+    "1".parse::<i32>()?
+        + "2".parse::<i32>()?
+        + "3".parse::<i32>()?
+};
+assert_eq!(result, Ok(6));
 
-------------------------
+let result: Result<i32, ParseIntError> = try {
+    "1".parse::<i32>()?
+        + "foo".parse::<i32>()?
+        + "3".parse::<i32>()?
+};
+assert!(result.is_err());
+```
 "##,
     },
     LintCompletion {
-        label: "test",
-        description: r##"# `test`
+        label: "try_trait",
+        description: r##"# `try_trait`
 
-The tracking issue for this feature is: None.
+The tracking issue for this feature is: [#42327]
+
+[#42327]: https://github.com/rust-lang/rust/issues/42327
 
 ------------------------
 
-The internals of the `test` crate are unstable, behind the `test` flag.  The
-most widely used part of the `test` crate are benchmark tests, which can test
-the performance of your code.  Let's make our `src/lib.rs` look like this
-(comments elided):
+This introduces a new trait `Try` for extending the `?` operator to types
+other than `Result` (a part of [RFC 1859]).  The trait provides the canonical
+way to _view_ a type in terms of a success/failure dichotomy.  This will
+allow `?` to supplant the `try_opt!` macro on `Option` and the `try_ready!`
+macro on `Poll`, among other things.
 
-```rust,no_run
-#![feature(test)]
+[RFC 1859]: https://github.com/rust-lang/rfcs/pull/1859
 
-extern crate test;
+Here's an example implementation of the trait:
 
-pub fn add_two(a: i32) -> i32 {
-    a + 2
-}
+```rust,ignore (cannot-reimpl-Try)
+/// A distinct type to represent the `None` value of an `Option`.
+///
+/// This enables using the `?` operator on `Option`; it's rarely useful alone.
+#[derive(Debug)]
+#[unstable(feature = "try_trait", issue = "42327")]
+pub struct None { _priv: () }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
-    use test::Bencher;
+#[unstable(feature = "try_trait", issue = "42327")]
+impl<T> ops::Try for Option<T>  {
+    type Ok = T;
+    type Error = None;
 
-    #[test]
-    fn it_works() {
-        assert_eq!(4, add_two(2));
+    fn into_result(self) -> Result<T, None> {
+        self.ok_or(None { _priv: () })
     }
 
-    #[bench]
-    fn bench_add_two(b: &mut Bencher) {
-        b.iter(|| add_two(2));
+    fn from_ok(v: T) -> Self {
+        Some(v)
+    }
+
+    fn from_error(_: None) -> Self {
+        None
     }
 }
 ```
 
-Note the `test` feature gate, which enables this unstable feature.
+Note the `Error` associated type here is a new marker.  The `?` operator
+allows interconversion between different `Try` implementers only when
+the error type can be converted `Into` the error type of the enclosing
+function (or catch block).  Having a distinct error type (as opposed to
+just `()`, or similar) restricts this to where it's semantically meaningful.
+"##,
+    },
+    LintCompletion {
+        label: "unboxed_closures",
+        description: r##"# `unboxed_closures`
 
-We've imported the `test` crate, which contains our benchmarking support.
-We have a new function as well, with the `bench` attribute. Unlike regular
-tests, which take no arguments, benchmark tests take a `&mut Bencher`. This
-`Bencher` provides an `iter` method, which takes a closure. This closure
-contains the code we'd like to benchmark.
+The tracking issue for this feature is [#29625]
 
-We can run benchmark tests with `cargo bench`:
+See Also: [`fn_traits`](../library-features/fn-traits.md)
 
-```bash
-$ cargo bench
-   Compiling adder v0.0.1 (file:///home/steve/tmp/adder)
-     Running target/release/adder-91b3e234d4ed382a
+[#29625]: https://github.com/rust-lang/rust/issues/29625
 
-running 2 tests
-test tests::it_works ... ignored
-test tests::bench_add_two ... bench:         1 ns/iter (+/- 0)
+----
 
-test result: ok. 0 passed; 0 failed; 1 ignored; 1 measured
-```
+The `unboxed_closures` feature allows you to write functions using the `"rust-call"` ABI,
+required for implementing the [`Fn*`] family of traits. `"rust-call"` functions must have
+exactly one (non self) argument, a tuple representing the argument list.
 
-Our non-benchmark test was ignored. You may have noticed that `cargo bench`
-takes a bit longer than `cargo test`. This is because Rust runs our benchmark
-a number of times, and then takes the average. Because we're doing so little
-work in this example, we have a `1 ns/iter (+/- 0)`, but this would show
-the variance if there was one.
+[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html
 
-Advice on writing benchmarks:
+```rust
+#![feature(unboxed_closures)]
 
+extern "rust-call" fn add_args(args: (u32, u32)) -> u32 {
+    args.0 + args.1
+}
 
-* Move setup code outside the `iter` loop; only put the part you want to measure inside
-* Make the code do "the same thing" on each iteration; do not accumulate or change state
-* Make the outer function idempotent too; the benchmark runner is likely to run
-  it many times
-*  Make the inner `iter` loop short and fast so benchmark runs are fast and the
-   calibrator can adjust the run-length at fine resolution
-* Make the code in the `iter` loop do something simple, to assist in pinpointing
-  performance improvements (or regressions)
+fn main() {}
+```
+"##,
+    },
+    LintCompletion {
+        label: "unsized_locals",
+        description: r##"# `unsized_locals`
 
-## Gotcha: optimizations
+The tracking issue for this feature is: [#48055]
 
-There's another tricky part to writing benchmarks: benchmarks compiled with
-optimizations activated can be dramatically changed by the optimizer so that
-the benchmark is no longer benchmarking what one expects. For example, the
-compiler might recognize that some calculation has no external effects and
-remove it entirely.
+[#48055]: https://github.com/rust-lang/rust/issues/48055
 
-```rust,no_run
-#![feature(test)]
+------------------------
 
-extern crate test;
-use test::Bencher;
+This implements [RFC1909]. When turned on, you can have unsized arguments and locals:
 
-#[bench]
-fn bench_xor_1000_ints(b: &mut Bencher) {
-    b.iter(|| {
-        (0..1000).fold(0, |old, new| old ^ new);
-    });
-}
-```
+[RFC1909]: https://github.com/rust-lang/rfcs/blob/master/text/1909-unsized-rvalues.md
 
-gives the following results
+```rust
+#![allow(incomplete_features)]
+#![feature(unsized_locals, unsized_fn_params)]
 
-```text
-running 1 test
-test bench_xor_1000_ints ... bench:         0 ns/iter (+/- 0)
+use std::any::Any;
 
-test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
+fn main() {
+    let x: Box<dyn Any> = Box::new(42);
+    let x: dyn Any = *x;
+    //  ^ unsized local variable
+    //               ^^ unsized temporary
+    foo(x);
+}
+
+fn foo(_: dyn Any) {}
+//     ^^^^^^ unsized argument
 ```
 
-The benchmarking runner offers two ways to avoid this. Either, the closure that
-the `iter` method receives can return an arbitrary value which forces the
-optimizer to consider the result used and ensures it cannot remove the
-computation entirely. This could be done for the example above by adjusting the
-`b.iter` call to
+The RFC still forbids the following unsized expressions:
 
-```rust
-# struct X;
-# impl X { fn iter<T, F>(&self, _: F) where F: FnMut() -> T {} } let b = X;
-b.iter(|| {
-    // Note lack of `;` (could also use an explicit `return`).
-    (0..1000).fold(0, |old, new| old ^ new)
-});
-```
+```rust,compile_fail
+#![feature(unsized_locals)]
 
-Or, the other option is to call the generic `test::black_box` function, which
-is an opaque "black box" to the optimizer and so forces it to consider any
-argument as used.
+use std::any::Any;
 
-```rust
-#![feature(test)]
+struct MyStruct<T: ?Sized> {
+    content: T,
+}
 
-extern crate test;
+struct MyTupleStruct<T: ?Sized>(T);
 
-# fn main() {
-# struct X;
-# impl X { fn iter<T, F>(&self, _: F) where F: FnMut() -> T {} } let b = X;
-b.iter(|| {
-    let n = test::black_box(1000);
+fn answer() -> Box<dyn Any> {
+    Box::new(42)
+}
 
-    (0..n).fold(0, |a, b| a ^ b)
-})
-# }
-```
+fn main() {
+    // You CANNOT have unsized statics.
+    static X: dyn Any = *answer();  // ERROR
+    const Y: dyn Any = *answer();  // ERROR
 
-Neither of these read or modify the value, and are very cheap for small values.
-Larger values can be passed indirectly to reduce overhead (e.g.
-`black_box(&huge_struct)`).
+    // You CANNOT have struct initialized unsized.
+    MyStruct { content: *answer() };  // ERROR
+    MyTupleStruct(*answer());  // ERROR
+    (42, *answer());  // ERROR
 
-Performing either of the above changes gives the following benchmarking results
+    // You CANNOT have unsized return types.
+    fn my_function() -> dyn Any { *answer() }  // ERROR
 
-```text
-running 1 test
-test bench_xor_1000_ints ... bench:       131 ns/iter (+/- 3)
+    // You CAN have unsized local variables...
+    let mut x: dyn Any = *answer();  // OK
+    // ...but you CANNOT reassign to them.
+    x = *answer();  // ERROR
 
-test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
+    // You CANNOT even initialize them separately.
+    let y: dyn Any;  // OK
+    y = *answer();  // ERROR
+
+    // Not mentioned in the RFC, but by-move captured variables are also Sized.
+    let x: dyn Any = *answer();
+    (move || {  // ERROR
+        let y = x;
+    })();
+
+    // You CAN create a closure with unsized arguments,
+    // but you CANNOT call it.
+    // This is an implementation detail and may be changed in the future.
+    let f = |x: dyn Any| {};
+    f(*answer());  // ERROR
+}
 ```
 
-However, the optimizer can still modify a testcase in an undesirable manner
-even when using either of the above.
-"##,
-    },
-    LintCompletion {
-        label: "windows_c",
-        description: r##"# `windows_c`
+## By-value trait objects
+
+With this feature, you can have by-value `self` arguments without `Self: Sized` bounds.
+
+```rust
+#![feature(unsized_fn_params)]
 
-This feature is internal to the Rust compiler and is not intended for general use.
+trait Foo {
+    fn foo(self) {}
+}
 
-------------------------
-"##,
-    },
-    LintCompletion {
-        label: "dec2flt",
-        description: r##"# `dec2flt`
+impl<T: ?Sized> Foo for T {}
 
-This feature is internal to the Rust compiler and is not intended for general use.
+fn main() {
+    let slice: Box<[i32]> = Box::new([1, 2, 3]);
+    <[i32] as Foo>::foo(*slice);
+}
+```
 
-------------------------
-"##,
-    },
-    LintCompletion {
-        label: "derive_clone_copy",
-        description: r##"# `derive_clone_copy`
+And `Foo` will also be object-safe.
 
-This feature is internal to the Rust compiler and is not intended for general use.
+```rust
+#![feature(unsized_fn_params)]
 
-------------------------
-"##,
-    },
-    LintCompletion {
-        label: "allocator_api",
-        description: r##"# `allocator_api`
+trait Foo {
+    fn foo(self) {}
+}
 
-The tracking issue for this feature is [#32838]
+impl<T: ?Sized> Foo for T {}
 
-[#32838]: https://github.com/rust-lang/rust/issues/32838
+fn main () {
+    let slice: Box<dyn Foo> = Box::new([1, 2, 3]);
+    // doesn't compile yet
+    <dyn Foo as Foo>::foo(*slice);
+}
+```
 
-------------------------
+One of the objectives of this feature is to allow `Box<dyn FnOnce>`.
 
-Sometimes you want the memory for one collection to use a different
-allocator than the memory for another collection. In this case,
-replacing the global allocator is not a workable option. Instead,
-you need to pass in an instance of an `AllocRef` to each collection
-for which you want a custom allocator.
+## Variable length arrays
 
-TBD
-"##,
-    },
-    LintCompletion {
-        label: "core_panic",
-        description: r##"# `core_panic`
+The RFC also describes an extension to the array literal syntax: `[e; dyn n]`. In the syntax, `n` isn't necessarily a constant expression. The array is dynamically allocated on the stack and has the type of `[T]`, instead of `[T; n]`.
 
-This feature is internal to the Rust compiler and is not intended for general use.
+```rust,ignore (not-yet-implemented)
+#![feature(unsized_locals)]
 
-------------------------
-"##,
-    },
-    LintCompletion {
-        label: "fn_traits",
-        description: r##"# `fn_traits`
+fn mergesort<T: Ord>(a: &mut [T]) {
+    let mut tmp = [T; dyn a.len()];
+    // ...
+}
 
-The tracking issue for this feature is [#29625]
+fn main() {
+    let mut a = [3, 1, 5, 6];
+    mergesort(&mut a);
+    assert_eq!(a, [1, 3, 5, 6]);
+}
+```
 
-See Also: [`unboxed_closures`](../language-features/unboxed-closures.md)
+VLAs are not implemented yet. The syntax isn't final, either. We may need an alternative syntax for Rust 2015 because, in Rust 2015, expressions like `[e; dyn(1)]` would be ambiguous. One possible alternative proposed in the RFC is `[e; n]`: if `n` captures one or more local variables, then it is considered as `[e; dyn n]`.
 
-[#29625]: https://github.com/rust-lang/rust/issues/29625
+## Advisory on stack usage
 
-----
+It's advised not to casually use the `#![feature(unsized_locals)]` feature. Typical use-cases are:
 
-The `fn_traits` feature allows for implementation of the [`Fn*`] traits
-for creating custom closure-like types.
+- When you need a by-value trait objects.
+- When you really need a fast allocation of small temporary arrays.
 
-[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html
+Another pitfall is repetitive allocation and temporaries. Currently the compiler simply extends the stack frame every time it encounters an unsized assignment. So for example, the code
 
 ```rust
-#![feature(unboxed_closures)]
-#![feature(fn_traits)]
+#![feature(unsized_locals)]
 
-struct Adder {
-    a: u32
+fn main() {
+    let x: Box<[i32]> = Box::new([1, 2, 3, 4, 5]);
+    let _x = {{{{{{{{{{*x}}}}}}}}}};
 }
+```
 
-impl FnOnce<(u32, )> for Adder {
-    type Output = u32;
-    extern "rust-call" fn call_once(self, b: (u32, )) -> Self::Output {
-        self.a + b.0
-    }
-}
+and the code
+
+```rust
+#![feature(unsized_locals)]
 
 fn main() {
-    let adder = Adder { a: 3 };
-    assert_eq!(adder(2), 5);
+    for _ in 0..10 {
+        let x: Box<[i32]> = Box::new([1, 2, 3, 4, 5]);
+        let _x = *x;
+    }
 }
 ```
+
+will unnecessarily extend the stack frame.
 "##,
     },
     LintCompletion {
-        label: "try_trait",
-        description: r##"# `try_trait`
+        label: "unsized_tuple_coercion",
+        description: r##"# `unsized_tuple_coercion`
 
-The tracking issue for this feature is: [#42327]
+The tracking issue for this feature is: [#42877]
 
-[#42327]: https://github.com/rust-lang/rust/issues/42327
+[#42877]: https://github.com/rust-lang/rust/issues/42877
 
 ------------------------
 
-This introduces a new trait `Try` for extending the `?` operator to types
-other than `Result` (a part of [RFC 1859]).  The trait provides the canonical
-way to _view_ a type in terms of a success/failure dichotomy.  This will
-allow `?` to supplant the `try_opt!` macro on `Option` and the `try_ready!`
-macro on `Poll`, among other things.
+This is a part of [RFC0401]. According to the RFC, there should be an implementation like this:
 
-[RFC 1859]: https://github.com/rust-lang/rfcs/pull/1859
+```rust,ignore (partial-example)
+impl<..., T, U: ?Sized> Unsized<(..., U)> for (..., T) where T: Unsized<U> {}
+```
 
-Here's an example implementation of the trait:
+This implementation is currently gated behind `#[feature(unsized_tuple_coercion)]` to avoid insta-stability. Therefore you can use it like this:
 
-```rust,ignore (cannot-reimpl-Try)
-/// A distinct type to represent the `None` value of an `Option`.
-///
-/// This enables using the `?` operator on `Option`; it's rarely useful alone.
-#[derive(Debug)]
-#[unstable(feature = "try_trait", issue = "42327")]
-pub struct None { _priv: () }
+```rust
+#![feature(unsized_tuple_coercion)]
 
-#[unstable(feature = "try_trait", issue = "42327")]
-impl<T> ops::Try for Option<T>  {
-    type Ok = T;
-    type Error = None;
+fn main() {
+    let x : ([i32; 3], [i32; 3]) = ([1, 2, 3], [4, 5, 6]);
+    let y : &([i32; 3], [i32]) = &x;
+    assert_eq!(y.1[0], 4);
+}
+```
 
-    fn into_result(self) -> Result<T, None> {
-        self.ok_or(None { _priv: () })
-    }
+[RFC0401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md
+"##,
+    },
+    LintCompletion {
+        label: "update_panic_count",
+        description: r##"# `update_panic_count`
 
-    fn from_ok(v: T) -> Self {
-        Some(v)
-    }
+This feature is internal to the Rust compiler and is not intended for general use.
 
-    fn from_error(_: None) -> Self {
-        None
-    }
-}
-```
+------------------------
+"##,
+    },
+    LintCompletion {
+        label: "windows_c",
+        description: r##"# `windows_c`
 
-Note the `Error` associated type here is a new marker.  The `?` operator
-allows interconversion between different `Try` implementers only when
-the error type can be converted `Into` the error type of the enclosing
-function (or catch block).  Having a distinct error type (as opposed to
-just `()`, or similar) restricts this to where it's semantically meaningful.
+This feature is internal to the Rust compiler and is not intended for general use.
+
+------------------------
 "##,
     },
     LintCompletion {
-        label: "rt",
-        description: r##"# `rt`
+        label: "windows_handle",
+        description: r##"# `windows_handle`
 
 This feature is internal to the Rust compiler and is not intended for general use.
 
@@ -4498,8 +4570,8 @@ fn from_error(_: None) -> Self {
 "##,
     },
     LintCompletion {
-        label: "fd",
-        description: r##"# `fd`
+        label: "windows_net",
+        description: r##"# `windows_net`
 
 This feature is internal to the Rust compiler and is not intended for general use.
 
@@ -4507,8 +4579,8 @@ fn from_error(_: None) -> Self {
 "##,
     },
     LintCompletion {
-        label: "libstd_thread_internals",
-        description: r##"# `libstd_thread_internals`
+        label: "windows_stdio",
+        description: r##"# `windows_stdio`
 
 This feature is internal to the Rust compiler and is not intended for general use.
 
@@ -4517,7 +4589,7 @@ fn from_error(_: None) -> Self {
     },
 ];
 
-pub(super) const CLIPPY_LINTS: &[LintCompletion] = &[
+pub const CLIPPY_LINTS: &[LintCompletion] = &[
     LintCompletion {
         label: "clippy::absurd_extreme_comparisons",
         description: r##"Checks for comparisons where one side of the relation is\neither the minimum or maximum value for its type and warns if it involves a\ncase that is always true or always false. Only integer and boolean types are\nchecked."##,
@@ -4578,6 +4650,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::blocks_in_if_conditions",
         description: r##"Checks for `if` conditions that use blocks containing an\nexpression, statements or conditions that use closures with blocks."##,
     },
+    LintCompletion {
+        label: "clippy::bool_assert_comparison",
+        description: r##"This lint warns about boolean comparisons in assert-like macros."##,
+    },
     LintCompletion {
         label: "clippy::bool_comparison",
         description: r##"Checks for expressions of the form `x == true`,\n`x != true` and order comparisons such as `x < true` (or vice versa) and\nsuggest using the variable directly."##,
@@ -4598,6 +4674,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::boxed_local",
         description: r##"Checks for usage of `Box<T>` where an unboxed `T` would\nwork fine."##,
     },
+    LintCompletion {
+        label: "clippy::branches_sharing_code",
+        description: r##"Checks if the `if` and `else` block contain shared code that can be\nmoved out of the blocks."##,
+    },
     LintCompletion {
         label: "clippy::builtin_type_shadow",
         description: r##"Warns if a generic shadows a built-in type."##,
@@ -4670,6 +4750,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::clone_on_ref_ptr",
         description: r##"Checks for usage of `.clone()` on a ref-counted pointer,\n(`Rc`, `Arc`, `rc::Weak`, or `sync::Weak`), and suggests calling Clone via unified\nfunction syntax instead (e.g., `Rc::clone(foo)`)."##,
     },
+    LintCompletion {
+        label: "clippy::cloned_instead_of_copied",
+        description: r##"Checks for usages of `cloned()` on an `Iterator` or `Option` where\n`copied()` could be used instead."##,
+    },
     LintCompletion { label: "clippy::cmp_nan", description: r##"Checks for comparisons to NaN."## },
     LintCompletion {
         label: "clippy::cmp_null",
@@ -4787,10 +4871,6 @@ fn from_error(_: None) -> Self {
         label: "clippy::double_parens",
         description: r##"Checks for unnecessary double parentheses."##,
     },
-    LintCompletion {
-        label: "clippy::drop_bounds",
-        description: r##"Nothing. This lint has been deprecated."##,
-    },
     LintCompletion {
         label: "clippy::drop_copy",
         description: r##"Checks for calls to `std::mem::drop` with a value\nthat derives the Copy trait"##,
@@ -4917,7 +4997,7 @@ fn from_error(_: None) -> Self {
     },
     LintCompletion {
         label: "clippy::filter_map",
-        description: r##"Checks for usage of `_.filter(_).map(_)`,\n`_.filter(_).flat_map(_)`, `_.filter_map(_).flat_map(_)` and similar."##,
+        description: r##"Nothing. This lint has been deprecated."##,
     },
     LintCompletion {
         label: "clippy::filter_map_identity",
@@ -4939,6 +5019,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::flat_map_identity",
         description: r##"Checks for usage of `flat_map(|x| x)`."##,
     },
+    LintCompletion {
+        label: "clippy::flat_map_option",
+        description: r##"Checks for usages of `Iterator::flat_map()` where `filter_map()` could be\nused instead."##,
+    },
     LintCompletion {
         label: "clippy::float_arithmetic",
         description: r##"Checks for float arithmetic."##,
@@ -5035,6 +5119,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::if_same_then_else",
         description: r##"Checks for `if/else` with the same body as the *then* part\nand the *else* part."##,
     },
+    LintCompletion {
+        label: "clippy::if_then_some_else_none",
+        description: r##"Checks for if-else that could be written to `bool::then`."##,
+    },
     LintCompletion {
         label: "clippy::ifs_same_cond",
         description: r##"Checks for consecutive `if`s with the same condition."##,
@@ -5065,7 +5153,7 @@ fn from_error(_: None) -> Self {
     },
     LintCompletion {
         label: "clippy::inconsistent_struct_constructor",
-        description: r##"Checks for struct constructors where the order of the field init\nshorthand in the constructor is inconsistent with the order in the struct definition."##,
+        description: r##"Checks for struct constructors where all fields are shorthand and\nthe order of the field init shorthand in the constructor is inconsistent\nwith the order in the struct definition."##,
     },
     LintCompletion {
         label: "clippy::indexing_slicing",
@@ -5127,10 +5215,6 @@ fn from_error(_: None) -> Self {
         label: "clippy::integer_division",
         description: r##"Checks for division of integers"##,
     },
-    LintCompletion {
-        label: "clippy::into_iter_on_array",
-        description: r##"Nothing. This lint has been deprecated."##,
-    },
     LintCompletion {
         label: "clippy::into_iter_on_ref",
         description: r##"Checks for `into_iter` calls on references which should be replaced by `iter`\nor `iter_mut`."##,
@@ -5140,8 +5224,8 @@ fn from_error(_: None) -> Self {
         description: r##"Checks for usage of invalid atomic\nordering in atomic loads/stores/exchanges/updates and\nmemory fences."##,
     },
     LintCompletion {
-        label: "clippy::invalid_ref",
-        description: r##"Nothing. This lint has been deprecated."##,
+        label: "clippy::invalid_null_ptr_usage",
+        description: r##"This lint checks for invalid usages of `ptr::null`."##,
     },
     LintCompletion {
         label: "clippy::invalid_regex",
@@ -5163,6 +5247,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::iter_cloned_collect",
         description: r##"Checks for the use of `.cloned().collect()` on slice to\ncreate a `Vec`."##,
     },
+    LintCompletion {
+        label: "clippy::iter_count",
+        description: r##"Checks for the use of `.iter().count()`."##,
+    },
     LintCompletion {
         label: "clippy::iter_next_loop",
         description: r##"Checks for loops on `x.next()`."##,
@@ -5299,6 +5387,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::manual_saturating_arithmetic",
         description: r##"Checks for `.checked_add/sub(x).unwrap_or(MAX/MIN)`."##,
     },
+    LintCompletion {
+        label: "clippy::manual_str_repeat",
+        description: r##"Checks for manual implementations of `str::repeat`"##,
+    },
     LintCompletion {
         label: "clippy::manual_strip",
         description: r##"Suggests using `strip_{prefix,suffix}` over `str::{starts,ends}_with` and slicing using\nthe pattern's length."##,
@@ -5333,7 +5425,7 @@ fn from_error(_: None) -> Self {
     },
     LintCompletion {
         label: "clippy::map_flatten",
-        description: r##"Checks for usage of `_.map(_).flatten(_)`,"##,
+        description: r##"Checks for usage of `_.map(_).flatten(_)` on `Iterator` and `Option`"##,
     },
     LintCompletion {
         label: "clippy::map_identity",
@@ -5523,6 +5615,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::needless_arbitrary_self_type",
         description: r##"The lint checks for `self` in fn parameters that\nspecify the `Self`-type explicitly"##,
     },
+    LintCompletion {
+        label: "clippy::needless_bitwise_bool",
+        description: r##"Checks for uses of bitwise and/or operators between booleans, where performance may be improved by using\na lazy and."##,
+    },
     LintCompletion {
         label: "clippy::needless_bool",
         description: r##"Checks for expressions of the form `if c { true } else {\nfalse }` (or vice versa) and suggests using the condition directly."##,
@@ -5533,7 +5629,7 @@ fn from_error(_: None) -> Self {
     },
     LintCompletion {
         label: "clippy::needless_borrowed_reference",
-        description: r##"Checks for useless borrowed references."##,
+        description: r##"Checks for bindings that destructure a reference and borrow the inner\nvalue with `&ref`."##,
     },
     LintCompletion {
         label: "clippy::needless_collect",
@@ -5547,6 +5643,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::needless_doctest_main",
         description: r##"Checks for `fn main() { .. }` in doctests"##,
     },
+    LintCompletion {
+        label: "clippy::needless_for_each",
+        description: r##"Checks for usage of `for_each` that would be more simply written as a\n`for` loop."##,
+    },
     LintCompletion {
         label: "clippy::needless_lifetimes",
         description: r##"Checks for lifetime annotations which can be removed by\nrelying on lifetime elision."##,
@@ -5599,6 +5699,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::non_ascii_literal",
         description: r##"Checks for non-ASCII characters in string literals."##,
     },
+    LintCompletion {
+        label: "clippy::non_octal_unix_permissions",
+        description: r##"Checks for non-octal values used to set Unix file permissions."##,
+    },
     LintCompletion {
         label: "clippy::nonminimal_bool",
         description: r##"Checks for boolean expressions that can be written more\nconcisely."##,
@@ -5609,7 +5713,7 @@ fn from_error(_: None) -> Self {
     },
     LintCompletion {
         label: "clippy::not_unsafe_ptr_arg_deref",
-        description: r##"Checks for public functions that dereference raw pointer\narguments but are not marked unsafe."##,
+        description: r##"Checks for public functions that dereference raw pointer\narguments but are not marked `unsafe`."##,
     },
     LintCompletion {
         label: "clippy::ok_expect",
@@ -5627,6 +5731,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::option_env_unwrap",
         description: r##"Checks for usage of `option_env!(...).unwrap()` and\nsuggests usage of the `env!` macro."##,
     },
+    LintCompletion {
+        label: "clippy::option_filter_map",
+        description: r##"Checks for indirect collection of populated `Option`"##,
+    },
     LintCompletion {
         label: "clippy::option_if_let_else",
         description: r##"Lints usage of `if let Some(v) = ... { y } else { x }` which is more\nidiomatically done with `Option::map_or` (if the else bit is a pure\nexpression) or `Option::map_or_else` (if the else bit is an impure\nexpression)."##,
@@ -5660,10 +5768,6 @@ fn from_error(_: None) -> Self {
         label: "clippy::panic_in_result_fn",
         description: r##"Checks for usage of `panic!`, `unimplemented!`, `todo!`, `unreachable!` or assertions in a function of type result."##,
     },
-    LintCompletion {
-        label: "clippy::panic_params",
-        description: r##"Nothing. This lint has been deprecated."##,
-    },
     LintCompletion {
         label: "clippy::panicking_unwrap",
         description: r##"Checks for calls of `unwrap[_err]()` that will always fail."##,
@@ -5726,7 +5830,7 @@ fn from_error(_: None) -> Self {
     },
     LintCompletion {
         label: "clippy::pub_enum_variant_names",
-        description: r##"Detects public enumeration variants that are\nprefixed or suffixed by the same characters."##,
+        description: r##"Nothing. This lint has been deprecated."##,
     },
     LintCompletion {
         label: "clippy::question_mark",
@@ -5800,6 +5904,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::redundant_static_lifetimes",
         description: r##"Checks for constants and statics with an explicit `'static` lifetime."##,
     },
+    LintCompletion {
+        label: "clippy::ref_binding_to_reference",
+        description: r##"Checks for `ref` bindings which create a reference to a reference."##,
+    },
     LintCompletion {
         label: "clippy::ref_in_deref",
         description: r##"Checks for references in expressions that use\nauto dereference."##,
@@ -5834,7 +5942,7 @@ fn from_error(_: None) -> Self {
     },
     LintCompletion {
         label: "clippy::result_unit_err",
-        description: r##"Checks for public functions that return a `Result`\nwith an `Err` type of `()`. It suggests using a custom type that\nimplements [`std::error::Error`]."##,
+        description: r##"Checks for public functions that return a `Result`\nwith an `Err` type of `()`. It suggests using a custom type that\nimplements `std::error::Error`."##,
     },
     LintCompletion {
         label: "clippy::reversed_empty_ranges",
@@ -5850,7 +5958,7 @@ fn from_error(_: None) -> Self {
     },
     LintCompletion {
         label: "clippy::search_is_some",
-        description: r##"Checks for an iterator or string search (such as `find()`,\n`position()`, or `rposition()`) followed by a call to `is_some()`."##,
+        description: r##"Checks for an iterator or string search (such as `find()`,\n`position()`, or `rposition()`) followed by a call to `is_some()` or `is_none()`."##,
     },
     LintCompletion {
         label: "clippy::self_assignment",
@@ -5858,7 +5966,7 @@ fn from_error(_: None) -> Self {
     },
     LintCompletion {
         label: "clippy::semicolon_if_nothing_returned",
-        description: r##"Looks for blocks of expressions and fires if the last expression returns `()`\nbut is not followed by a semicolon."##,
+        description: r##"Looks for blocks of expressions and fires if the last expression returns\n`()` but is not followed by a semicolon."##,
     },
     LintCompletion {
         label: "clippy::serde_api_misuse",
@@ -5992,6 +6100,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::suspicious_operation_groupings",
         description: r##"Checks for unlikely usages of binary operators that are almost\ncertainly typos and/or copy/paste errors, given the other usages\nof binary operators nearby."##,
     },
+    LintCompletion {
+        label: "clippy::suspicious_splitn",
+        description: r##"Checks for calls to [`splitn`]\n(https://doc.rust-lang.org/std/primitive.str.html#method.splitn) and\nrelated functions with either zero or one splits."##,
+    },
     LintCompletion {
         label: "clippy::suspicious_unary_op_formatting",
         description: r##"Checks the formatting of a unary operator on the right hand side\nof a binary operator. It lints if there is no space between the binary and unary operators,\nbut there is a space between the unary and its operand."##,
@@ -6004,10 +6116,6 @@ fn from_error(_: None) -> Self {
         label: "clippy::temporary_assignment",
         description: r##"Checks for construction of a structure or tuple just to\nassign a value in it."##,
     },
-    LintCompletion {
-        label: "clippy::temporary_cstring_as_ptr",
-        description: r##"Nothing. This lint has been deprecated."##,
-    },
     LintCompletion {
         label: "clippy::to_digit_is_some",
         description: r##"Checks for `.to_digit(..).is_some()` on `char`s."##,
@@ -6117,10 +6225,6 @@ fn from_error(_: None) -> Self {
         label: "clippy::unit_return_expecting_ord",
         description: r##"Checks for functions that expect closures of type\nFn(...) -> Ord where the implemented closure returns the unit type.\nThe lint also suggests to remove the semi-colon at the end of the statement if present."##,
     },
-    LintCompletion {
-        label: "clippy::unknown_clippy_lints",
-        description: r##"Nothing. This lint has been deprecated."##,
-    },
     LintCompletion {
         label: "clippy::unnecessary_cast",
         description: r##"Checks for casts to the same type, casts of int literals to integer types\nand casts of float literals to float types."##,
@@ -6145,6 +6249,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::unnecessary_operation",
         description: r##"Checks for expression statements that can be reduced to a\nsub-expression."##,
     },
+    LintCompletion {
+        label: "clippy::unnecessary_self_imports",
+        description: r##"Checks for imports ending in `::{self}`."##,
+    },
     LintCompletion {
         label: "clippy::unnecessary_sort_by",
         description: r##"Detects uses of `Vec::sort_by` passing in a closure\nwhich compares the two arguments, either directly or indirectly."##,
@@ -6205,6 +6313,10 @@ fn from_error(_: None) -> Self {
         label: "clippy::unstable_as_slice",
         description: r##"Nothing. This lint has been deprecated."##,
     },
+    LintCompletion {
+        label: "clippy::unused_async",
+        description: r##"Checks for functions that are declared `async` but have no `.await`s inside of them."##,
+    },
     LintCompletion {
         label: "clippy::unused_collect",
         description: r##"Nothing. This lint has been deprecated."##,
@@ -6213,10 +6325,6 @@ fn from_error(_: None) -> Self {
         label: "clippy::unused_io_amount",
         description: r##"Checks for unused written/read amount."##,
     },
-    LintCompletion {
-        label: "clippy::unused_label",
-        description: r##"Nothing. This lint has been deprecated."##,
-    },
     LintCompletion {
         label: "clippy::unused_self",
         description: r##"Checks methods that contain a `self` argument but don't use it"##,
@@ -6347,11 +6455,11 @@ fn from_error(_: None) -> Self {
     },
     LintCompletion {
         label: "clippy::wrong_pub_self_convention",
-        description: r##"This is the same as\n[`wrong_self_convention`](#wrong_self_convention), but for public items."##,
+        description: r##"Nothing. This lint has been deprecated."##,
     },
     LintCompletion {
         label: "clippy::wrong_self_convention",
-        description: r##"Checks for methods with certain name prefixes and which\ndoesn't match how self is taken. The actual rules are:\n\n|Prefix |`self` taken          |\n|-------|----------------------|\n|`as_`  |`&self` or `&mut self`|\n|`from_`| none                 |\n|`into_`|`self`                |\n|`is_`  |`&self` or none       |\n|`to_`  |`&self`               |"##,
+        description: r##"Checks for methods with certain name prefixes and which\ndoesn't match how self is taken. The actual rules are:\n\n|Prefix |Postfix     |`self` taken           | `self` type  |\n|-------|------------|-----------------------|--------------|\n|`as_`  | none       |`&self` or `&mut self` | any          |\n|`from_`| none       | none                  | any          |\n|`into_`| none       |`self`                 | any          |\n|`is_`  | none       |`&self` or none        | any          |\n|`to_`  | `_mut`     |`&mut self`            | any          |\n|`to_`  | not `_mut` |`self`                 | `Copy`       |\n|`to_`  | not `_mut` |`&self`                | not `Copy`   |\n\nNote: Clippy doesn't trigger methods with `to_` prefix in:\n- Traits definition.\nClippy can not tell if a type that implements a trait is `Copy` or not.\n- Traits implementation, when `&self` is taken.\nThe method signature is controlled by the trait and often `&self` is required for all types that implement the trait\n(see e.g. the `std::string::ToString` trait).\n\nPlease find more info here:\nhttps://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv"##,
     },
     LintCompletion {
         label: "clippy::wrong_transmute",
index 1152a985023fabb9605764275d7991d02c8a8a45..1f015874510d9516270a51de65708f70008b6eb8 100644 (file)
@@ -4,13 +4,14 @@
 mod item;
 mod context;
 mod patterns;
-mod generated_lint_completions;
 #[cfg(test)]
 mod test_utils;
 mod render;
 
 mod completions;
 
+pub mod generated_lint_completions;
+
 use completions::flyimport::position_for_import;
 use ide_db::{
     base_db::FilePosition,
index 24dbc6a3959d5027a2a8bf3105ca0615d8aa0d7f..f5736d1b5a0bc605bc61b01c1b8b5a86d1db3e89 100644 (file)
@@ -28,9 +28,9 @@ pub(crate) fn generate_lint_completions() -> Result<()> {
 }
 
 fn generate_descriptor(buf: &mut String, src_dir: PathBuf) -> Result<()> {
-    buf.push_str(r#"pub(super) const FEATURES: &[LintCompletion] = &["#);
+    buf.push_str(r#"pub const FEATURES: &[LintCompletion] = &["#);
     buf.push('\n');
-    ["language-features", "library-features"]
+    let mut vec = ["language-features", "library-features"]
         .iter()
         .flat_map(|it| WalkDir::new(src_dir.join(it)))
         .filter_map(|e| e.ok())
@@ -38,13 +38,17 @@ fn generate_descriptor(buf: &mut String, src_dir: PathBuf) -> Result<()> {
             // Get all `.md ` files
             entry.file_type().is_file() && entry.path().extension().unwrap_or_default() == "md"
         })
-        .for_each(|entry| {
+        .map(|entry| {
             let path = entry.path();
             let feature_ident = path.file_stem().unwrap().to_str().unwrap().replace("-", "_");
             let doc = read_file(path).unwrap();
-
-            push_lint_completion(buf, &feature_ident, &doc);
-        });
+            (feature_ident, doc)
+        })
+        .collect::<Vec<_>>();
+    vec.sort_by(|(feature_ident, _), (feature_ident2, _)| feature_ident.cmp(feature_ident2));
+    vec.into_iter().for_each(|(feature_ident, doc)| {
+        push_lint_completion(buf, &feature_ident, &doc);
+    });
     buf.push_str("];\n");
     Ok(())
 }
@@ -85,8 +89,8 @@ fn generate_descriptor_clippy(buf: &mut String, path: &Path) -> Result<()> {
                 .into();
         }
     }
-
-    buf.push_str(r#"pub(super) const CLIPPY_LINTS: &[LintCompletion] = &["#);
+    clippy_lints.sort_by(|lint, lint2| lint.id.cmp(&lint2.id));
+    buf.push_str(r#"pub const CLIPPY_LINTS: &[LintCompletion] = &["#);
     buf.push('\n');
     clippy_lints.into_iter().for_each(|clippy_lint| {
         let lint_ident = format!("clippy::{}", clippy_lint.id);