diff --git a/src/README.md b/src/README.md
index 32ca4a105741b..2f7cf90c5f030 100644
--- a/src/README.md
+++ b/src/README.md
@@ -5,7 +5,4 @@ This directory contains the source code of the rust project, including:
For more information on how various parts of the compiler work, see the [rustc guide].
-There is also useful content in this README:
-https://github.com/rust-lang/rust/tree/master/src/librustc/infer/lexical_region_resolve.
-
[rustc guide]: https://rust-lang.github.io/rustc-guide/about-this-guide.html
diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs
index 5993a97c40d6a..58e638e93ba34 100644
--- a/src/librustc/hir/map/definitions.rs
+++ b/src/librustc/hir/map/definitions.rs
@@ -53,7 +53,7 @@ impl DefPathTable {
#[inline(always)]
pub fn def_key(&self, index: DefIndex) -> DefKey {
- self.index_to_key[index.index()].clone()
+ self.index_to_key[index.index()]
}
#[inline(always)]
@@ -111,7 +111,7 @@ pub struct Definitions {
/// A unique identifier that we can use to lookup a definition
/// precisely. It combines the index of the definition's parent (if
/// any) with a `DisambiguatedDefPathData`.
-#[derive(Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)]
+#[derive(Copy, Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)]
pub struct DefKey {
/// The parent path.
pub parent: Option,
@@ -164,7 +164,7 @@ impl DefKey {
/// between them. This introduces some artificial ordering dependency
/// but means that if you have, e.g., two impls for the same type in
/// the same module, they do get distinct `DefId`s.
-#[derive(Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)]
+#[derive(Copy, Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)]
pub struct DisambiguatedDefPathData {
pub data: DefPathData,
pub disambiguator: u32
@@ -277,7 +277,7 @@ impl DefPath {
}
}
-#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
pub enum DefPathData {
// Root: these should only be used for the root nodes, because
// they are treated specially by the `def_path` function.
@@ -359,7 +359,7 @@ impl Definitions {
#[inline]
pub fn opt_def_index(&self, node: ast::NodeId) -> Option {
- self.node_to_def_index.get(&node).cloned()
+ self.node_to_def_index.get(&node).copied()
}
#[inline]
@@ -413,7 +413,7 @@ impl Definitions {
#[inline]
pub fn opt_span(&self, def_id: DefId) -> Option {
if def_id.krate == LOCAL_CRATE {
- self.def_index_to_span.get(&def_id.index).cloned()
+ self.def_index_to_span.get(&def_id.index).copied()
} else {
None
}
@@ -472,7 +472,7 @@ impl Definitions {
// Find the next free disambiguator for this key.
let disambiguator = {
- let next_disamb = self.next_disambiguator.entry((parent, data.clone())).or_insert(0);
+ let next_disamb = self.next_disambiguator.entry((parent, data)).or_insert(0);
let disambiguator = *next_disamb;
*next_disamb = next_disamb.checked_add(1).expect("disambiguator overflow");
disambiguator
@@ -525,7 +525,7 @@ impl Definitions {
}
pub fn expansion_that_defined(&self, index: DefIndex) -> ExpnId {
- self.expansions_that_defined.get(&index).cloned().unwrap_or(ExpnId::root())
+ self.expansions_that_defined.get(&index).copied().unwrap_or(ExpnId::root())
}
pub fn parent_module_of_macro_def(&self, expn_id: ExpnId) -> DefId {
diff --git a/src/librustc/infer/lexical_region_resolve/README.md b/src/librustc/infer/lexical_region_resolve/README.md
index 7eb4da86ec081..c26b5625a90b6 100644
--- a/src/librustc/infer/lexical_region_resolve/README.md
+++ b/src/librustc/infer/lexical_region_resolve/README.md
@@ -1,268 +1,7 @@
-# Region inference
-> WARNING: This README is obsolete and will be removed soon! For
-> more info on how the current borrowck works, see the [rustc guide].
->
-> As of edition 2018, region inference is done using Non-lexical lifetimes,
-> which is described in the guide and [this RFC].
+Lexical Region Resolution was removed in https://github.com/rust-lang/rust/pull/64790.
-[rustc guide]: https://rust-lang.github.io/rustc-guide/borrow_check/region_inference.html
-[this RFC]: https://github.com/rust-lang/rfcs/blob/master/text/2094-nll.md
+Rust now uses Non-lexical lifetimes. For more info, please see the [borrowck
+chapter][bc] in the rustc-guide.
-## Terminology
-
-Note that we use the terms region and lifetime interchangeably.
-
-## Introduction
-
-Region inference uses a somewhat more involved algorithm than type
-inference. It is not the most efficient thing ever written though it
-seems to work well enough in practice (famous last words). The reason
-that we use a different algorithm is because, unlike with types, it is
-impractical to hand-annotate with regions (in some cases, there aren't
-even the requisite syntactic forms). So we have to get it right, and
-it's worth spending more time on a more involved analysis. Moreover,
-regions are a simpler case than types: they don't have aggregate
-structure, for example.
-
-## The problem
-
-Basically our input is a directed graph where nodes can be divided
-into two categories: region variables and concrete regions. Each edge
-`R -> S` in the graph represents a constraint that the region `R` is a
-subregion of the region `S`.
-
-Region variable nodes can have arbitrary degree. There is one region
-variable node per region variable.
-
-Each concrete region node is associated with some, well, concrete
-region: e.g., a free lifetime, or the region for a particular scope.
-Note that there may be more than one concrete region node for a
-particular region value. Moreover, because of how the graph is built,
-we know that all concrete region nodes have either in-degree 1 or
-out-degree 1.
-
-Before resolution begins, we build up the constraints in a hashmap
-that maps `Constraint` keys to spans. During resolution, we construct
-the actual `Graph` structure that we describe here.
-
-## Computing the values for region variables
-
-The algorithm is a simple dataflow algorithm. Each region variable
-begins as empty. We iterate over the constraints, and for each constraint
-we grow the relevant region variable to be as big as it must be to meet all the
-constraints. This means the region variables can grow to be `'static` if
-necessary.
-
-## Verification
-
-After all constraints are fully propoagated, we do a "verification"
-step where we walk over the verify bounds and check that they are
-satisfied. These bounds represent the "maximal" values that a region
-variable can take on, basically.
-
-## The Region Hierarchy
-
-### Without closures
-
-Let's first consider the region hierarchy without thinking about
-closures, because they add a lot of complications. The region
-hierarchy *basically* mirrors the lexical structure of the code.
-There is a region for every piece of 'evaluation' that occurs, meaning
-every expression, block, and pattern (patterns are considered to
-"execute" by testing the value they are applied to and creating any
-relevant bindings). So, for example:
-
-```rust
-fn foo(x: isize, y: isize) { // -+
-// +------------+ // |
-// | +-----+ // |
-// | +-+ +-+ +-+ // |
-// | | | | | | | // |
-// v v v v v v v // |
- let z = x + y; // |
- ... // |
-} // -+
-
-fn bar() { ... }
-```
-
-In this example, there is a region for the fn body block as a whole,
-and then a subregion for the declaration of the local variable.
-Within that, there are sublifetimes for the assignment pattern and
-also the expression `x + y`. The expression itself has sublifetimes
-for evaluating `x` and `y`.
-
-#s## Function calls
-
-Function calls are a bit tricky. I will describe how we handle them
-*now* and then a bit about how we can improve them (Issue #6268).
-
-Consider a function call like `func(expr1, expr2)`, where `func`,
-`arg1`, and `arg2` are all arbitrary expressions. Currently,
-we construct a region hierarchy like:
-
- +----------------+
- | |
- +--+ +---+ +---+|
- v v v v v vv
- func(expr1, expr2)
-
-Here you can see that the call as a whole has a region and the
-function plus arguments are subregions of that. As a side-effect of
-this, we get a lot of spurious errors around nested calls, in
-particular when combined with `&mut` functions. For example, a call
-like this one
-
-```rust
-self.foo(self.bar())
-```
-
-where both `foo` and `bar` are `&mut self` functions will always yield
-an error.
-
-Here is a more involved example (which is safe) so we can see what's
-going on:
-
-```rust
-struct Foo { f: usize, g: usize }
-// ...
-fn add(p: &mut usize, v: usize) {
- *p += v;
-}
-// ...
-fn inc(p: &mut usize) -> usize {
- *p += 1; *p
-}
-fn weird() {
- let mut x: Box = box Foo { /* ... */ };
- 'a: add(&mut (*x).f,
- 'b: inc(&mut (*x).f)) // (..)
-}
-```
-
-The important part is the line marked `(..)` which contains a call to
-`add()`. The first argument is a mutable borrow of the field `f`. The
-second argument also borrows the field `f`. Now, in the current borrow
-checker, the first borrow is given the lifetime of the call to
-`add()`, `'a`. The second borrow is given the lifetime of `'b` of the
-call to `inc()`. Because `'b` is considered to be a sublifetime of
-`'a`, an error is reported since there are two co-existing mutable
-borrows of the same data.
-
-However, if we were to examine the lifetimes a bit more carefully, we
-can see that this error is unnecessary. Let's examine the lifetimes
-involved with `'a` in detail. We'll break apart all the steps involved
-in a call expression:
-
-```rust
-'a: {
- 'a_arg1: let a_temp1: ... = add;
- 'a_arg2: let a_temp2: &'a mut usize = &'a mut (*x).f;
- 'a_arg3: let a_temp3: usize = {
- let b_temp1: ... = inc;
- let b_temp2: &'b = &'b mut (*x).f;
- 'b_call: b_temp1(b_temp2)
- };
- 'a_call: a_temp1(a_temp2, a_temp3) // (**)
-}
-```
-
-Here we see that the lifetime `'a` includes a number of substatements.
-In particular, there is this lifetime I've called `'a_call` that
-corresponds to the *actual execution of the function `add()`*, after
-all arguments have been evaluated. There is a corresponding lifetime
-`'b_call` for the execution of `inc()`. If we wanted to be precise
-about it, the lifetime of the two borrows should be `'a_call` and
-`'b_call` respectively, since the references that were created
-will not be dereferenced except during the execution itself.
-
-However, this model by itself is not sound. The reason is that
-while the two references that are created will never be used
-simultaneously, it is still true that the first reference is
-*created* before the second argument is evaluated, and so even though
-it will not be *dereferenced* during the evaluation of the second
-argument, it can still be *invalidated* by that evaluation. Consider
-this similar but unsound example:
-
-```rust
-struct Foo { f: usize, g: usize }
-// ...
-fn add(p: &mut usize, v: usize) {
- *p += v;
-}
-// ...
-fn consume(x: Box) -> usize {
- x.f + x.g
-}
-fn weird() {
- let mut x: Box = box Foo { ... };
- 'a: add(&mut (*x).f, consume(x)) // (..)
-}
-```
-
-In this case, the second argument to `add` actually consumes `x`, thus
-invalidating the first argument.
-
-So, for now, we exclude the `call` lifetimes from our model.
-Eventually I would like to include them, but we will have to make the
-borrow checker handle this situation correctly. In particular, if
-there is a reference created whose lifetime does not enclose
-the borrow expression, we must issue sufficient restrictions to ensure
-that the pointee remains valid.
-
-### Modeling closures
-
-Integrating closures properly into the model is a bit of
-work-in-progress. In an ideal world, we would model closures as
-closely as possible after their desugared equivalents. That is, a
-closure type would be modeled as a struct, and the region hierarchy of
-different closure bodies would be completely distinct from all other
-fns. We are generally moving in that direction but there are
-complications in terms of the implementation.
-
-In practice what we currently do is somewhat different. The basis for
-the current approach is the observation that the only time that
-regions from distinct fn bodies interact with one another is through
-an upvar or the type of a fn parameter (since closures live in the fn
-body namespace, they can in fact have fn parameters whose types
-include regions from the surrounding fn body). For these cases, there
-are separate mechanisms which ensure that the regions that appear in
-upvars/parameters outlive the dynamic extent of each call to the
-closure:
-
-1. Types must outlive the region of any expression where they are used.
- For a closure type `C` to outlive a region `'r`, that implies that the
- types of all its upvars must outlive `'r`.
-2. Parameters must outlive the region of any fn that they are passed to.
-
-Therefore, we can -- sort of -- assume that any region from an
-enclosing fns is larger than any region from one of its enclosed
-fn. And that is precisely what we do: when building the region
-hierarchy, each region lives in its own distinct subtree, but if we
-are asked to compute the `LUB(r1, r2)` of two regions, and those
-regions are in disjoint subtrees, we compare the lexical nesting of
-the two regions.
-
-*Ideas for improving the situation:* (FIXME #3696) The correctness
-argument here is subtle and a bit hand-wavy. The ideal, as stated
-earlier, would be to model things in such a way that it corresponds
-more closely to the desugared code. The best approach for doing this
-is a bit unclear: it may in fact be possible to *actually* desugar
-before we start, but I don't think so. The main option that I've been
-thinking through is imposing a "view shift" as we enter the fn body,
-so that regions appearing in the types of fn parameters and upvars are
-translated from being regions in the outer fn into free region
-parameters, just as they would be if we applied the desugaring. The
-challenge here is that type inference may not have fully run, so the
-types may not be fully known: we could probably do this translation
-lazilly, as type variables are instantiated. We would also have to
-apply a kind of inverse translation to the return value. This would be
-a good idea anyway, as right now it is possible for free regions
-instantiated within the closure to leak into the parent: this
-currently leads to type errors, since those regions cannot outlive any
-expressions within the parent hierarchy. Much like the current
-handling of closures, there are no known cases where this leads to a
-type-checking accepting incorrect code (though it sometimes rejects
-what might be considered correct code; see rust-lang/rust#22557), but
-it still doesn't feel like the right approach.
+[bc]: https://rust-lang.github.io/rustc-guide/borrow_check/region_inference.html
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index fb9c95724c955..f7e0d0131dea2 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -467,7 +467,9 @@ impl rustc_serialize::UseSpecializedDecodable for ClearCrossCrate<
/// Grouped information about the source code origin of a MIR entity.
/// Intended to be inspected by diagnostics and debuginfo.
/// Most passes can work with it as a whole, within a single function.
-#[derive(Copy, Clone, Debug, PartialEq, RustcEncodable, RustcDecodable, HashStable)]
+// The unoffical Cranelift backend, at least as of #65828, needs `SourceInfo` to implement `Eq` and
+// `Hash`. Please ping @bjorn3 if removing them.
+#[derive(Copy, Clone, Debug, Eq, PartialEq, RustcEncodable, RustcDecodable, Hash, HashStable)]
pub struct SourceInfo {
/// The source span for the AST pertaining to this MIR entity.
pub span: Span,
diff --git a/src/librustc_codegen_ssa/README.md b/src/librustc_codegen_ssa/README.md
index a09a0c22c1ba5..2a3a4fcc5fca4 100644
--- a/src/librustc_codegen_ssa/README.md
+++ b/src/librustc_codegen_ssa/README.md
@@ -1,121 +1,3 @@
-# Refactoring of `rustc_codegen_llvm`
-by Denis Merigoux, October 23rd 2018
+Please read the rustc-guide chapter on [Backend Agnostic Codegen][bac].
-## State of the code before the refactoring
-
-All the code related to the compilation of MIR into LLVM IR was contained inside the `rustc_codegen_llvm` crate. Here is the breakdown of the most important elements:
-* the `back` folder (7,800 LOC) implements the mechanisms for creating the different object files and archive through LLVM, but also the communication mechanisms for parallel code generation;
-* the `debuginfo` (3,200 LOC) folder contains all code that passes debug information down to LLVM;
-* the `llvm` (2,200 LOC) folder defines the FFI necessary to communicate with LLVM using the C++ API;
-* the `mir` (4,300 LOC) folder implements the actual lowering from MIR to LLVM IR;
-* the `base.rs` (1,300 LOC) file contains some helper functions but also the high-level code that launches the code generation and distributes the work.
-* the `builder.rs` (1,200 LOC) file contains all the functions generating individual LLVM IR instructions inside a basic block;
-* the `common.rs` (450 LOC) contains various helper functions and all the functions generating LLVM static values;
-* the `type_.rs` (300 LOC) defines most of the type translations to LLVM IR.
-
-The goal of this refactoring is to separate inside this crate code that is specific to the LLVM from code that can be reused for other rustc backends. For instance, the `mir` folder is almost entirely backend-specific but it relies heavily on other parts of the crate. The separation of the code must not affect the logic of the code nor its performance.
-
-For these reasons, the separation process involves two transformations that have to be done at the same time for the resulting code to compile :
-
-1. replace all the LLVM-specific types by generics inside function signatures and structure definitions;
-2. encapsulate all functions calling the LLVM FFI inside a set of traits that will define the interface between backend-agnostic code and the backend.
-
-While the LLVM-specific code will be left in `rustc_codegen_llvm`, all the new traits and backend-agnostic code will be moved in `rustc_codegen_ssa` (name suggestion by @eddyb).
-
-## Generic types and structures
-
-@irinagpopa started to parametrize the types of `rustc_codegen_llvm` by a generic `Value` type, implemented in LLVM by a reference `&'ll Value`. This work has been extended to all structures inside the `mir` folder and elsewhere, as well as for LLVM's `BasicBlock` and `Type` types.
-
-The two most important structures for the LLVM codegen are `CodegenCx` and `Builder`. They are parametrized by multiple lifetime parameters and the type for `Value`.
-
-```rust
-struct CodegenCx<'ll, 'tcx> {
- /* ... */
-}
-
-struct Builder<'a, 'll, 'tcx> {
- cx: &'a CodegenCx<'ll, 'tcx>,
- /* ... */
-}
-```
-
-`CodegenCx` is used to compile one codegen-unit that can contain multiple functions, whereas `Builder` is created to compile one basic block.
-
-The code in `rustc_codegen_llvm` has to deal with multiple explicit lifetime parameters, that correspond to the following:
-* `'tcx` is the longest lifetime, that corresponds to the original `TyCtxt` containing the program's information;
-* `'a` is a short-lived reference of a `CodegenCx` or another object inside a struct;
-* `'ll` is the lifetime of references to LLVM objects such as `Value` or `Type`.
-
-Although there are already many lifetime parameters in the code, making it generic uncovered situations where the borrow-checker was passing only due to the special nature of the LLVM objects manipulated (they are extern pointers). For instance, a additional lifetime parameter had to be added to `LocalAnalyser` in `analyse.rs`, leading to the definition:
-
-```rust
-struct LocalAnalyzer<'mir, 'a, 'tcx> {
- /* ... */
-}
-```
-
-However, the two most important structures `CodegenCx` and `Builder` are not defined in the backend-agnostic code. Indeed, their content is highly specific of the backend and it makes more sense to leave their definition to the backend implementor than to allow just a narrow spot via a generic field for the backend's context.
-
-## Traits and interface
-
-Because they have to be defined by the backend, `CodegenCx` and `Builder` will be the structures implementing all the traits defining the backend's interface. These traits are defined in the folder `rustc_codegen_ssa/traits` and all the backend-agnostic code is parametrized by them. For instance, let us explain how a function in `base.rs` is parametrized:
-
-```rust
-pub fn codegen_instance<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
- cx: &'a Bx::CodegenCx,
- instance: Instance<'tcx>
-) {
- /* ... */
-}
-```
-
-In this signature, we have the two lifetime parameters explained earlier and the master type `Bx` which satisfies the trait `BuilderMethods` corresponding to the interface satisfied by the `Builder` struct. The `BuilderMethods` defines an associated type `Bx::CodegenCx` that itself satisfies the `CodegenMethods` traits implemented by the struct `CodegenCx`.
-
-On the trait side, here is an example with part of the definition of `BuilderMethods` in `traits/builder.rs`:
-
-```rust
-pub trait BuilderMethods<'a, 'tcx>:
- HasCodegen<'tcx>
- + DebugInfoBuilderMethods<'tcx>
- + ArgTypeMethods<'tcx>
- + AbiBuilderMethods<'tcx>
- + IntrinsicCallMethods<'tcx>
- + AsmBuilderMethods<'tcx>
-{
- fn new_block<'b>(
- cx: &'a Self::CodegenCx,
- llfn: Self::Function,
- name: &'b str
- ) -> Self;
- /* ... */
- fn cond_br(
- &mut self,
- cond: Self::Value,
- then_llbb: Self::BasicBlock,
- else_llbb: Self::BasicBlock,
- );
- /* ... */
-}
-```
-
-Finally, a master structure implementing the `ExtraBackendMethods` trait is used for high-level codegen-driving functions like `codegen_crate` in `base.rs`. For LLVM, it is the empty `LlvmCodegenBackend`. `ExtraBackendMethods` should be implemented by the same structure that implements the `CodegenBackend` defined in `rustc_codegen_utils/codegen_backend.rs`.
-
-During the traitification process, certain functions have been converted from methods of a local structure to methods of `CodegenCx` or `Builder` and a corresponding `self` parameter has been added. Indeed, LLVM stores information internally that it can access when called through its API. This information does not show up in a Rust data structure carried around when these methods are called. However, when implementing a Rust backend for `rustc`, these methods will need information from `CodegenCx`, hence the additional parameter (unused in the LLVM implementation of the trait).
-
-## State of the code after the refactoring
-
-The traits offer an API which is very similar to the API of LLVM. This is not the best solution since LLVM has a very special way of doing things: when addding another backend, the traits definition might be changed in order to offer more flexibility.
-
-However, the current separation between backend-agnostic and LLVM-specific code has allows the reuse of a significant part of the old `rustc_codegen_llvm`. Here is the new LOC breakdown between backend-agnostic (BA) and LLVM for the most important elements:
-
-* `back` folder: 3,800 (BA) vs 4,100 (LLVM);
-* `mir` folder: 4,400 (BA) vs 0 (LLVM);
-* `base.rs`: 1,100 (BA) vs 250 (LLVM);
-* `builder.rs`: 1,400 (BA) vs 0 (LLVM);
-* `common.rs`: 350 (BA) vs 350 (LLVM);
-
-The `debuginfo` folder has been left almost untouched by the splitting and is specific to LLVM. Only its high-level features have been traitified.
-
-The new `traits` folder has 1500 LOC only for trait definitions. Overall, the 27,000 LOC-sized old `rustc_codegen_llvm` code has been split into the new 18,500 LOC-sized new `rustc_codegen_llvm` and the 12,000 LOC-sized `rustc_codegen_ssa`. We can say that this refactoring allowed the reuse of approximately 10,000 LOC that would otherwise have had to be duplicated between the multiple backends of `rustc`.
-
-The refactored version of `rustc`'s backend introduced no regression over the test suite nor in performance benchmark, which is in coherence with the nature of the refactoring that used only compile-time parametricity (no trait objects).
+[bac]: https://rust-lang.github.io/rustc-guide/codegen/backend-agnostic.html
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index e3b55a141338a..2a7f9ad25def0 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -1583,27 +1583,26 @@ impl EmitterWriter {
Ok(())
}
- fn emit_messages_default(&mut self,
- level: &Level,
- message: &[(String, Style)],
- code: &Option,
- span: &MultiSpan,
- children: &[SubDiagnostic],
- suggestions: &[CodeSuggestion]) {
+ fn emit_messages_default(
+ &mut self,
+ level: &Level,
+ message: &[(String, Style)],
+ code: &Option,
+ span: &MultiSpan,
+ children: &[SubDiagnostic],
+ suggestions: &[CodeSuggestion],
+ ) {
let max_line_num_len = if self.ui_testing {
ANONYMIZED_LINE_NUM.len()
} else {
self.get_max_line_num(span, children).to_string().len()
};
- match self.emit_message_default(span,
- message,
- code,
- level,
- max_line_num_len,
- false) {
+ match self.emit_message_default(span, message, code, level, max_line_num_len, false) {
Ok(()) => {
- if !children.is_empty() {
+ if !children.is_empty() || suggestions.iter().any(|s| {
+ s.style != SuggestionStyle::CompletelyHidden
+ }) {
let mut buffer = StyledBuffer::new();
if !self.short_message {
draw_col_separator_no_space(&mut buffer, 0, max_line_num_len + 1);
diff --git a/src/librustc_incremental/persist/README.md b/src/librustc_incremental/persist/README.md
index 95e0940001639..8131d2840b49d 100644
--- a/src/librustc_incremental/persist/README.md
+++ b/src/librustc_incremental/persist/README.md
@@ -1,13 +1,3 @@
-This is the code to load/save the dependency graph. Loading is assumed
-to run early in compilation, and saving at the very end. When loading,
-the basic idea is that we will load up the dependency graph from the
-previous compilation and compare the hashes of our HIR nodes to the
-hashes of the HIR nodes that existed at the time. For each node whose
-hash has changed, or which no longer exists in the new HIR, we can
-remove that node from the old graph along with any nodes that depend
-on it. Then we add what's left to the new graph (if any such nodes or
-edges already exist, then there would be no effect, but since we do
-this first thing, they do not).
-
-
+For info on how the incremental compilation works, see the [rustc guide].
+[rustc guide]: https://rust-lang.github.io/rustc-guide/query.html
diff --git a/src/librustc_typeck/check/generator_interior.rs b/src/librustc_typeck/check/generator_interior.rs
index 619768e018c77..ff9c945eec452 100644
--- a/src/librustc_typeck/check/generator_interior.rs
+++ b/src/librustc_typeck/check/generator_interior.rs
@@ -3,9 +3,10 @@
//! is calculated in `rustc_mir::transform::generator` and may be a subset of the
//! types computed here.
+use rustc::hir::def::{CtorKind, DefKind, Res};
use rustc::hir::def_id::DefId;
use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
-use rustc::hir::{self, Pat, PatKind, Expr};
+use rustc::hir::{self, Pat, PatKind, Expr, ExprKind};
use rustc::middle::region::{self, YieldData};
use rustc::ty::{self, Ty};
use syntax_pos::Span;
@@ -184,7 +185,33 @@ impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> {
}
fn visit_expr(&mut self, expr: &'tcx Expr) {
- intravisit::walk_expr(self, expr);
+ match &expr.kind {
+ ExprKind::Call(callee, args) => match &callee.kind {
+ ExprKind::Path(qpath) => {
+ let res = self.fcx.tables.borrow().qpath_res(qpath, callee.hir_id);
+ match res {
+ // Direct calls never need to keep the callee `ty::FnDef`
+ // ZST in a temporary, so skip its type, just in case it
+ // can significantly complicate the generator type.
+ Res::Def(DefKind::Fn, _) |
+ Res::Def(DefKind::Method, _) |
+ Res::Def(DefKind::Ctor(_, CtorKind::Fn), _) => {
+ // NOTE(eddyb) this assumes a path expression has
+ // no nested expressions to keep track of.
+ self.expr_count += 1;
+
+ // Record the rest of the call expression normally.
+ for arg in args {
+ self.visit_expr(arg);
+ }
+ }
+ _ => intravisit::walk_expr(self, expr),
+ }
+ }
+ _ => intravisit::walk_expr(self, expr),
+ }
+ _ => intravisit::walk_expr(self, expr),
+ }
self.expr_count += 1;
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index 6414241727a72..83793f9d8210d 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -150,6 +150,14 @@ pub fn render(
Search multiple things at once by splitting your query with comma (e.g., \
str,u8
or String,struct:Vec,test
)\
\
+ \
+ You can look for items with an exact name by putting double quotes around \
+ your request: \"string\"
\
+
\
+ \
+ Look for items inside another one by searching for a path: \
+ vec::Vec
\
+
\
\
\
\
diff --git a/src/libstd/keyword_docs.rs b/src/libstd/keyword_docs.rs
index ab8a55660cb0c..d025a7d16f256 100644
--- a/src/libstd/keyword_docs.rs
+++ b/src/libstd/keyword_docs.rs
@@ -159,9 +159,40 @@ mod const_keyword { }
//
/// Skip to the next iteration of a loop.
///
-/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+/// When `continue` is encountered, the current iteration is terminated, returning control to the
+/// loop head, typically continuing with the next iteration.
///
-/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+///```rust
+/// // Printing odd numbers by skipping even ones
+/// for number in 1..=10 {
+/// if number % 2 == 0 {
+/// continue;
+/// }
+/// println!("{}", number);
+/// }
+///```
+///
+/// Like `break`, `continue` is normally associated with the innermost enclosing loop, but labels
+/// may be used to specify the affected loop.
+///
+///```rust
+/// // Print Odd numbers under 30 with unit <= 5
+/// 'tens: for ten in 0..3 {
+/// 'units: for unit in 0..=9 {
+/// if unit % 2 == 0 {
+/// continue;
+/// }
+/// if unit > 5 {
+/// continue 'tens;
+/// }
+/// println!("{}", ten * 10 + unit);
+/// }
+/// }
+///```
+///
+/// See [continue expressions] from the reference for more details.
+///
+/// [continue expressions]: ../reference/expressions/loop-expr.html#continue-expressions
mod continue_keyword { }
#[doc(keyword = "crate")]
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 51a62cd065843..8b96704884851 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -1,33 +1,63 @@
-// The Rust abstract syntax tree.
+//! The Rust abstract syntax tree module.
+//!
+//! This module contains common structures forming the language AST.
+//! Two main entities in the module are [`Item`] (which represents an AST element with
+//! additional metadata), and [`ItemKind`] (which represents a concrete type and contains
+//! information specific to the type of the item).
+//!
+//! Other module items that worth mentioning:
+//! - [`Ty`] and [`TyKind`]: A parsed Rust type.
+//! - [`Expr`] and [`ExprKind`]: A parsed Rust expression.
+//! - [`Pat`] and [`PatKind`]: A parsed Rust pattern. Patterns are often dual to expressions.
+//! - [`Stmt`] and [`StmtKind`]: An executable action that does not return a value.
+//! - [`FnDecl`], [`FnHeader`] and [`Param`]: Metadata associated with a function declaration.
+//! - [`Generics`], [`GenericParam`], [`WhereClause`]: Metadata associated with generic parameters.
+//! - [`EnumDef`] and [`Variant`]: Enum declaration.
+//! - [`Lit`] and [`LitKind`]: Literal expressions.
+//! - [`MacroDef`], [`MacStmtStyle`], [`Mac`], [`MacDelimeter`]: Macro definition and invocation.
+//! - [`Attribute`]: Metadata associated with item.
+//! - [`UnOp`], [`UnOpKind`], [`BinOp`], [`BinOpKind`]: Unary and binary operators.
pub use GenericArgs::*;
pub use UnsafeSource::*;
pub use crate::util::parser::ExprPrecedence;
+pub use rustc_target::abi::FloatTy;
+pub use syntax_pos::symbol::{Ident, Symbol as Name};
+
use crate::parse::token::{self, DelimToken};
use crate::ptr::P;
use crate::source_map::{dummy_spanned, respan, Spanned};
use crate::tokenstream::TokenStream;
-use rustc_target::spec::abi::Abi;
-pub use rustc_target::abi::FloatTy;
-
-use syntax_pos::{Span, DUMMY_SP, ExpnId};
use syntax_pos::symbol::{kw, sym, Symbol};
-pub use syntax_pos::symbol::{Ident, Symbol as Name};
+use syntax_pos::{Span, DUMMY_SP, ExpnId};
-use rustc_index::vec::Idx;
-#[cfg(target_arch = "x86_64")]
-use rustc_data_structures::static_assert_size;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::sync::Lrc;
use rustc_data_structures::thin_vec::ThinVec;
+use rustc_index::vec::Idx;
use rustc_serialize::{self, Decoder, Encoder};
+use rustc_target::spec::abi::Abi;
+
+#[cfg(target_arch = "x86_64")]
+use rustc_data_structures::static_assert_size;
+
use std::fmt;
#[cfg(test)]
mod tests;
+/// A "Label" is an identifier of some point in sources,
+/// e.g. in the following code:
+///
+/// ```rust
+/// 'outer: loop {
+/// break 'outer;
+/// }
+/// ```
+///
+/// `'outer` is a label.
#[derive(Clone, RustcEncodable, RustcDecodable, Copy)]
pub struct Label {
pub ident: Ident,
@@ -39,6 +69,8 @@ impl fmt::Debug for Label {
}
}
+/// A "Lifetime" is an annotation of the scope in which variable
+/// can be used, e.g. `'a` in `&'a i32`.
#[derive(Clone, RustcEncodable, RustcDecodable, Copy)]
pub struct Lifetime {
pub id: NodeId,
@@ -161,10 +193,14 @@ impl GenericArgs {
}
}
+/// Concrete argument in the sequence of generic args.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub enum GenericArg {
+ /// `'a` in `Foo<'a>`
Lifetime(Lifetime),
+ /// `Bar` in `Foo`
Type(P),
+ /// `1` in `Foo<1>`
Const(AnonConst),
}
@@ -549,15 +585,24 @@ impl Pat {
}
match &self.kind {
+ // Walk into the pattern associated with `Ident` (if any).
PatKind::Ident(_, _, Some(p)) => p.walk(it),
+
+ // Walk into each field of struct.
PatKind::Struct(_, fields, _) => fields.iter().for_each(|field| field.pat.walk(it)),
+
+ // Sequence of patterns.
PatKind::TupleStruct(_, s)
| PatKind::Tuple(s)
| PatKind::Slice(s)
| PatKind::Or(s) => s.iter().for_each(|p| p.walk(it)),
+
+ // Trivial wrappers over inner patterns.
PatKind::Box(s)
| PatKind::Ref(s, _)
| PatKind::Paren(s) => s.walk(it),
+
+ // These patterns do not contain subpatterns, skip.
PatKind::Wild
| PatKind::Rest
| PatKind::Lit(_)
@@ -609,7 +654,9 @@ pub enum RangeEnd {
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub enum RangeSyntax {
+ /// `...`
DotDotDot,
+ /// `..=`
DotDotEq,
}
@@ -768,6 +815,8 @@ impl BinOpKind {
pub fn is_comparison(&self) -> bool {
use BinOpKind::*;
+ // Note for developers: please keep this as is;
+ // we want compilation to fail if another variant is added.
match *self {
Eq | Lt | Le | Ne | Gt | Ge => true,
And | Or | Add | Sub | Mul | Div | Rem | BitXor | BitAnd | BitOr | Shl | Shr => false,
@@ -782,6 +831,9 @@ impl BinOpKind {
pub type BinOp = Spanned;
+/// Unary operator.
+///
+/// Note that `&data` is not an operator, it's an `AddrOf` expression.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)]
pub enum UnOp {
/// The `*` operator for dereferencing
@@ -849,10 +901,8 @@ impl Stmt {
pub enum StmtKind {
/// A local (let) binding.
Local(P),
-
/// An item definition.
Item(P- ),
-
/// Expr without trailing semi-colon.
Expr(P
),
/// Expr with a trailing semi-colon.
@@ -899,14 +949,18 @@ pub struct Local {
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct Arm {
pub attrs: Vec,
+ /// Match arm pattern, e.g. `10` in `match foo { 10 => {}, _ => {} }`
pub pat: P,
+ /// Match arm guard, e.g. `n > 10` in `match foo { n if n > 10 => {}, _ => {} }`
pub guard: Option>,
+ /// Match arm body.
pub body: P,
pub span: Span,
pub id: NodeId,
pub is_placeholder: bool,
}
+/// Access of a named (e.g., `obj.foo`) or unnamed (e.g., `obj.0`) struct field.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct Field {
pub ident: Ident,
@@ -989,18 +1043,25 @@ impl Expr {
}
}
+ /// Attempts to reparse as `Ty` (for diagnostic purposes).
pub(super) fn to_ty(&self) -> Option> {
let kind = match &self.kind {
+ // Trivial conversions.
ExprKind::Path(qself, path) => TyKind::Path(qself.clone(), path.clone()),
ExprKind::Mac(mac) => TyKind::Mac(mac.clone()),
+
ExprKind::Paren(expr) => expr.to_ty().map(TyKind::Paren)?,
+
ExprKind::AddrOf(mutbl, expr) => expr
.to_ty()
.map(|ty| TyKind::Rptr(None, MutTy { ty, mutbl: *mutbl }))?,
+
ExprKind::Repeat(expr, expr_len) => {
expr.to_ty().map(|ty| TyKind::Array(ty, expr_len.clone()))?
}
+
ExprKind::Array(exprs) if exprs.len() == 1 => exprs[0].to_ty().map(TyKind::Slice)?,
+
ExprKind::Tup(exprs) => {
let tys = exprs
.iter()
@@ -1008,6 +1069,10 @@ impl Expr {
.collect::>>()?;
TyKind::Tup(tys)
}
+
+ // If binary operator is `Add` and both `lhs` and `rhs` are trait bounds,
+ // then type of result is trait object.
+ // Othewise we don't assume the result type.
ExprKind::Binary(binop, lhs, rhs) if binop.node == BinOpKind::Add => {
if let (Some(lhs), Some(rhs)) = (lhs.to_bound(), rhs.to_bound()) {
TyKind::TraitObject(vec![lhs, rhs], TraitObjectSyntax::None)
@@ -1015,6 +1080,8 @@ impl Expr {
return None;
}
}
+
+ // This expression doesn't look like a type syntactically.
_ => return None,
};
@@ -1241,10 +1308,12 @@ pub struct QSelf {
pub position: usize,
}
-/// A capture clause.
+/// A capture clause used in closures and `async` blocks.
#[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Debug)]
pub enum CaptureBy {
+ /// `move |x| y + x`.
Value,
+ /// `move` keyword was not specified.
Ref,
}
@@ -1293,9 +1362,11 @@ impl MacDelimiter {
}
}
+/// Represents a macro definition.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct MacroDef {
pub tokens: TokenStream,
+ /// `true` if macro was defined with `macro_rules`.
pub legacy: bool,
}
@@ -1329,10 +1400,14 @@ pub struct Lit {
}
// Clippy uses Hash and PartialEq
+/// Type of the integer literal based on provided suffix.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy, Hash, PartialEq)]
pub enum LitIntType {
+ /// e.g. `42_i32`.
Signed(IntTy),
+ /// e.g. `42_u32`.
Unsigned(UintTy),
+ /// e.g. `42`.
Unsuffixed,
}
@@ -1390,7 +1465,16 @@ impl LitKind {
/// Returns `true` if this literal has no suffix.
/// Note: this will return true for literals with prefixes such as raw strings and byte strings.
pub fn is_unsuffixed(&self) -> bool {
+ !self.is_suffixed()
+ }
+
+ /// Returns `true` if this literal has a suffix.
+ pub fn is_suffixed(&self) -> bool {
match *self {
+ // suffixed variants
+ LitKind::Int(_, LitIntType::Signed(..))
+ | LitKind::Int(_, LitIntType::Unsigned(..))
+ | LitKind::Float(..) => true,
// unsuffixed variants
LitKind::Str(..)
| LitKind::ByteStr(..)
@@ -1399,18 +1483,9 @@ impl LitKind {
| LitKind::Int(_, LitIntType::Unsuffixed)
| LitKind::FloatUnsuffixed(..)
| LitKind::Bool(..)
- | LitKind::Err(..) => true,
- // suffixed variants
- LitKind::Int(_, LitIntType::Signed(..))
- | LitKind::Int(_, LitIntType::Unsigned(..))
- | LitKind::Float(..) => false,
+ | LitKind::Err(..) => false,
}
}
-
- /// Returns `true` if this literal has a suffix.
- pub fn is_suffixed(&self) -> bool {
- !self.is_unsuffixed()
- }
}
// N.B., If you change this, you'll probably want to change the corresponding
@@ -1779,6 +1854,7 @@ pub enum SelfKind {
pub type ExplicitSelf = Spanned;
impl Param {
+ /// Attempts to cast parameter to `ExplicitSelf`.
pub fn to_self(&self) -> Option {
if let PatKind::Ident(BindingMode::ByValue(mutbl), ident, _) = self.pat.kind {
if ident.name == kw::SelfLower {
@@ -1797,6 +1873,7 @@ impl Param {
None
}
+ /// Returns `true` if parameter is `self`.
pub fn is_self(&self) -> bool {
if let PatKind::Ident(_, ident, _) = self.pat.kind {
ident.name == kw::SelfLower
@@ -1805,6 +1882,7 @@ impl Param {
}
}
+ /// Builds a `Param` object from `ExplicitSelf`.
pub fn from_self(attrs: ThinVec, eself: ExplicitSelf, eself_ident: Ident) -> Param {
let span = eself.span.to(eself_ident.span);
let infer_ty = P(Ty {
@@ -1845,9 +1923,12 @@ impl Param {
}
}
-/// A header (not the body) of a function declaration.
+/// A signature (not the body) of a function declaration.
///
/// E.g., `fn foo(bar: baz)`.
+///
+/// Please note that it's different from `FnHeader` structure
+/// which contains metadata about function safety, asyncness, constness and ABI.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct FnDecl {
pub inputs: Vec ,
@@ -1859,13 +1940,13 @@ impl FnDecl {
self.inputs.get(0).and_then(Param::to_self)
}
pub fn has_self(&self) -> bool {
- self.inputs.get(0).map(Param::is_self).unwrap_or(false)
+ self.inputs.get(0).map_or(false, Param::is_self)
}
pub fn c_variadic(&self) -> bool {
- self.inputs.last().map(|arg| match arg.ty.kind {
+ self.inputs.last().map_or(false, |arg| match arg.ty.kind {
TyKind::CVarArgs => true,
_ => false,
- }).unwrap_or(false)
+ })
}
}
@@ -1918,6 +1999,8 @@ pub enum Constness {
NotConst,
}
+/// Item defaultness.
+/// For details see the [RFC #2532](https://github.com/rust-lang/rfcs/pull/2532).
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
pub enum Defaultness {
Default,
@@ -2009,6 +2092,7 @@ pub struct EnumDef {
pub variants: Vec,
}
+/// Enum variant.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct Variant {
/// Name of the variant.
@@ -2111,6 +2195,8 @@ pub struct AttrItem {
pub struct Attribute {
pub item: AttrItem,
pub id: AttrId,
+ /// Denotes if the attribute decorates the following construct (outer)
+ /// or the construct this attribute is contained within (inner).
pub style: AttrStyle,
pub is_sugared_doc: bool,
pub span: Span,
diff --git a/src/test/rustdoc-ui/intra-links-ambiguity.stderr b/src/test/rustdoc-ui/intra-links-ambiguity.stderr
index 5d66cc1364c5f..9ee3ff57fb5f0 100644
--- a/src/test/rustdoc-ui/intra-links-ambiguity.stderr
+++ b/src/test/rustdoc-ui/intra-links-ambiguity.stderr
@@ -23,6 +23,7 @@ error: `ambiguous` is both a struct and a function
|
LL | /// [ambiguous] is ambiguous.
| ^^^^^^^^^ ambiguous link
+ |
help: to link to the struct, prefix with the item type
|
LL | /// [struct@ambiguous] is ambiguous.
@@ -37,6 +38,7 @@ error: `multi_conflict` is a struct, a function, and a macro
|
LL | /// [`multi_conflict`] is a three-way conflict.
| ^^^^^^^^^^^^^^^^ ambiguous link
+ |
help: to link to the struct, prefix with the item type
|
LL | /// [`struct@multi_conflict`] is a three-way conflict.
@@ -55,6 +57,7 @@ error: `type_and_value` is both a module and a constant
|
LL | /// Ambiguous [type_and_value].
| ^^^^^^^^^^^^^^ ambiguous link
+ |
help: to link to the module, prefix with the item type
|
LL | /// Ambiguous [module@type_and_value].
@@ -69,6 +72,7 @@ error: `foo::bar` is both an enum and a function
|
LL | /// Ambiguous non-implied shortcut link [`foo::bar`].
| ^^^^^^^^^^ ambiguous link
+ |
help: to link to the enum, prefix with the item type
|
LL | /// Ambiguous non-implied shortcut link [`enum@foo::bar`].
diff --git a/src/test/rustdoc-ui/invalid-syntax.stderr b/src/test/rustdoc-ui/invalid-syntax.stderr
index 6f50edae65034..8ec4338e13f96 100644
--- a/src/test/rustdoc-ui/invalid-syntax.stderr
+++ b/src/test/rustdoc-ui/invalid-syntax.stderr
@@ -24,6 +24,7 @@ LL | /// ```
LL | | /// \__________pkt->size___________/ \_result->size_/ \__pkt->size__/
LL | | /// ```
| |_______^
+ |
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
@@ -34,6 +35,7 @@ error: unknown start of token: `
|
3 | | ^^^^^^ did you mean `baz::foobar`?
| ^
+ |
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
3 | | ^^^^^^ did you mean 'baz::foobar`?
@@ -44,6 +46,7 @@ error: unknown start of token: `
|
3 | | ^^^^^^ did you mean `baz::foobar`?
| ^
+ |
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
3 | | ^^^^^^ did you mean `baz::foobar'?
@@ -59,6 +62,7 @@ LL | | /// LL | use foobar::Baz;
LL | | /// | ^^^^^^ did you mean `baz::foobar`?
LL | | /// ```
| |_______^
+ |
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
@@ -78,6 +82,7 @@ LL | /// ```
LL | | /// \_
LL | | /// ```
| |_______^
+ |
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
@@ -117,6 +122,7 @@ error: unknown start of token: `
|
1 | ```
| ^
+ |
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
1 | '``
@@ -127,6 +133,7 @@ error: unknown start of token: `
|
1 | ```
| ^
+ |
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
1 | `'`
@@ -137,6 +144,7 @@ error: unknown start of token: `
|
1 | ```
| ^
+ |
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
1 | ``'
@@ -196,6 +204,7 @@ LL | | ///
LL | | ///
LL | | /// ```
| |_______^
+ |
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
@@ -236,6 +245,7 @@ error: unknown start of token: `
|
1 | ```
| ^
+ |
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
1 | '``
@@ -264,6 +274,7 @@ error: unknown start of token: `
|
3 | | ^^^^^^ did you mean `baz::foobar`?
| ^
+ |
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
3 | | ^^^^^^ did you mean 'baz::foobar`?
diff --git a/src/test/ui/associated-types/associated-types-path-2.stderr b/src/test/ui/associated-types/associated-types-path-2.stderr
index bb2e7251849d3..246c745cd3385 100644
--- a/src/test/ui/associated-types/associated-types-path-2.stderr
+++ b/src/test/ui/associated-types/associated-types-path-2.stderr
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
|
LL | f1(2i32, 4i32);
| ^^^^ expected u32, found i32
+ |
help: change the type of the numeric literal from `i32` to `u32`
|
LL | f1(2i32, 4u32);
@@ -43,6 +44,7 @@ error[E0308]: mismatched types
|
LL | let _: i32 = f2(2i32);
| ^^^^^^^^ expected i32, found u32
+ |
help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit
|
LL | let _: i32 = f2(2i32).try_into().unwrap();
diff --git a/src/test/ui/async-await/async-fn-nonsend.stderr b/src/test/ui/async-await/async-fn-nonsend.stderr
index 696bd5c39d283..6e89deb407e92 100644
--- a/src/test/ui/async-await/async-fn-nonsend.stderr
+++ b/src/test/ui/async-await/async-fn-nonsend.stderr
@@ -9,9 +9,9 @@ LL | assert_send(local_dropped_before_await());
|
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>`
= note: required because it appears within the type `impl std::fmt::Debug`
- = note: required because it appears within the type `{impl std::fmt::Debug, fn() -> impl std::future::Future {fut}, impl std::future::Future, impl std::future::Future, ()}`
- = note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:21:39: 26:2 {impl std::fmt::Debug, fn() -> impl std::future::Future {fut}, impl std::future::Future, impl std::future::Future, ()}]`
- = note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:21:39: 26:2 {impl std::fmt::Debug, fn() -> impl std::future::Future {fut}, impl std::future::Future, impl std::future::Future, ()}]>`
+ = note: required because it appears within the type `{impl std::fmt::Debug, impl std::future::Future, impl std::future::Future, ()}`
+ = note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:21:39: 26:2 {impl std::fmt::Debug, impl std::future::Future, impl std::future::Future, ()}]`
+ = note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:21:39: 26:2 {impl std::fmt::Debug, impl std::future::Future, impl std::future::Future, ()}]>`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `impl std::future::Future`
@@ -26,9 +26,9 @@ LL | assert_send(non_send_temporary_in_match());
|
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>`
= note: required because it appears within the type `impl std::fmt::Debug`
- = note: required because it appears within the type `{fn(impl std::fmt::Debug) -> std::option::Option {std::option::Option::::Some}, fn() -> impl std::fmt::Debug {non_send}, impl std::fmt::Debug, std::option::Option, fn() -> impl std::future::Future {fut}, impl std::future::Future, impl std::future::Future, ()}`
- = note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:28:40: 37:2 {fn(impl std::fmt::Debug) -> std::option::Option {std::option::Option::::Some}, fn() -> impl std::fmt::Debug {non_send}, impl std::fmt::Debug, std::option::Option, fn() -> impl std::future::Future {fut}, impl std::future::Future, impl std::future::Future, ()}]`
- = note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:28:40: 37:2 {fn(impl std::fmt::Debug) -> std::option::Option {std::option::Option::::Some}, fn() -> impl std::fmt::Debug {non_send}, impl std::fmt::Debug, std::option::Option, fn() -> impl std::future::Future {fut}, impl std::future::Future, impl std::future::Future, ()}]>`
+ = note: required because it appears within the type `{impl std::fmt::Debug, std::option::Option, impl std::future::Future, impl std::future::Future, ()}`
+ = note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:28:40: 37:2 {impl std::fmt::Debug, std::option::Option, impl std::future::Future, impl std::future::Future, ()}]`
+ = note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:28:40: 37:2 {impl std::fmt::Debug, std::option::Option, impl std::future::Future, impl std::future::Future, ()}]>`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `impl std::future::Future`
@@ -45,9 +45,9 @@ LL | assert_send(non_sync_with_method_call());
= note: required because of the requirements on the impl of `std::marker::Send` for `&mut dyn std::fmt::Write`
= note: required because it appears within the type `std::fmt::Formatter<'_>`
= note: required because of the requirements on the impl of `std::marker::Send` for `&mut std::fmt::Formatter<'_>`
- = note: required because it appears within the type `for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, fn() -> impl std::future::Future {fut}, impl std::future::Future, impl std::future::Future, ()}`
- = note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, fn() -> impl std::future::Future {fut}, impl std::future::Future, impl std::future::Future, ()}]`
- = note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, fn() -> impl std::future::Future {fut}, impl std::future::Future, impl std::future::Future, ()}]>`
+ = note: required because it appears within the type `for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, impl std::future::Future, impl std::future::Future, ()}`
+ = note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, impl std::future::Future, impl std::future::Future, ()}]`
+ = note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, impl std::future::Future, impl std::future::Future, ()}]>`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `impl std::future::Future`
@@ -68,9 +68,9 @@ LL | assert_send(non_sync_with_method_call());
= note: required because of the requirements on the impl of `std::marker::Send` for `std::slice::Iter<'_, std::fmt::ArgumentV1<'_>>`
= note: required because it appears within the type `std::fmt::Formatter<'_>`
= note: required because of the requirements on the impl of `std::marker::Send` for `&mut std::fmt::Formatter<'_>`
- = note: required because it appears within the type `for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, fn() -> impl std::future::Future {fut}, impl std::future::Future, impl std::future::Future, ()}`
- = note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, fn() -> impl std::future::Future {fut}, impl std::future::Future, impl std::future::Future, ()}]`
- = note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, fn() -> impl std::future::Future {fut}, impl std::future::Future, impl std::future::Future, ()}]>`
+ = note: required because it appears within the type `for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, impl std::future::Future, impl std::future::Future, ()}`
+ = note: required because it appears within the type `[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, impl std::future::Future, impl std::future::Future, ()}]`
+ = note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/async-fn-nonsend.rs:39:38: 45:2 for<'r, 's> {&'r mut std::fmt::Formatter<'s>, bool, bool, impl std::future::Future, impl std::future::Future, ()}]>`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `impl std::future::Future`
diff --git a/src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.stderr b/src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.stderr
index 0e859466322c0..05d543a7e486d 100644
--- a/src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.stderr
+++ b/src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.stderr
@@ -3,6 +3,7 @@ error: expected identifier, found keyword `await`
|
LL | pub mod await {
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | pub mod r#await {
@@ -13,6 +14,7 @@ error: expected identifier, found keyword `await`
|
LL | pub struct await;
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | pub struct r#await;
@@ -23,6 +25,7 @@ error: expected identifier, found keyword `await`
|
LL | use self::outer_mod::await::await;
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | use self::outer_mod::r#await::await;
@@ -33,6 +36,7 @@ error: expected identifier, found keyword `await`
|
LL | use self::outer_mod::await::await;
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | use self::outer_mod::await::r#await;
@@ -43,6 +47,7 @@ error: expected identifier, found keyword `await`
|
LL | struct Foo { await: () }
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | struct Foo { r#await: () }
@@ -53,6 +58,7 @@ error: expected identifier, found keyword `await`
|
LL | impl Foo { fn await() {} }
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | impl Foo { fn r#await() {} }
@@ -63,6 +69,7 @@ error: expected identifier, found keyword `await`
|
LL | macro_rules! await {
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | macro_rules! r#await {
diff --git a/src/test/ui/async-await/await-keyword/2018-edition-error.stderr b/src/test/ui/async-await/await-keyword/2018-edition-error.stderr
index 71f403f278eb3..d44d51b8fd15d 100644
--- a/src/test/ui/async-await/await-keyword/2018-edition-error.stderr
+++ b/src/test/ui/async-await/await-keyword/2018-edition-error.stderr
@@ -3,6 +3,7 @@ error: expected identifier, found keyword `await`
|
LL | pub mod await {
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | pub mod r#await {
@@ -13,6 +14,7 @@ error: expected identifier, found keyword `await`
|
LL | pub struct await;
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | pub struct r#await;
@@ -23,6 +25,7 @@ error: expected identifier, found keyword `await`
|
LL | use self::outer_mod::await::await;
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | use self::outer_mod::r#await::await;
@@ -33,6 +36,7 @@ error: expected identifier, found keyword `await`
|
LL | use self::outer_mod::await::await;
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | use self::outer_mod::await::r#await;
@@ -43,6 +47,7 @@ error: expected identifier, found keyword `await`
|
LL | macro_rules! await { () => {}; }
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | macro_rules! r#await { () => {}; }
diff --git a/src/test/ui/async-await/no-const-async.stderr b/src/test/ui/async-await/no-const-async.stderr
index fe0591457853e..95ded537ab35b 100644
--- a/src/test/ui/async-await/no-const-async.stderr
+++ b/src/test/ui/async-await/no-const-async.stderr
@@ -3,6 +3,7 @@ error: expected identifier, found keyword `async`
|
LL | pub const async fn x() {}
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | pub const r#async fn x() {}
diff --git a/src/test/ui/bad/bad-crate-name.stderr b/src/test/ui/bad/bad-crate-name.stderr
index a08535a77571a..e015010da1396 100644
--- a/src/test/ui/bad/bad-crate-name.stderr
+++ b/src/test/ui/bad/bad-crate-name.stderr
@@ -3,6 +3,7 @@ error: crate name using dashes are not valid in `extern crate` statements
|
LL | extern crate krate-name-here;
| ^^^^^^^^^^^^^^^ dash-separated idents are not valid
+ |
help: if the original crate name uses dashes you need to use underscores in the code
|
LL | extern crate krate_name_here;
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
index f54a3a4072cd2..ad5e206a9a1be 100644
--- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
@@ -33,6 +33,7 @@ LL | &mut [_a,
| |
| data moved here
| move occurs because `_a` has type `std::boxed::Box`, which does not implement the `Copy` trait
+ |
help: consider removing the `&mut`
|
LL | [_a,
@@ -64,6 +65,7 @@ LL | _b] => {}
| |
| data moved here
| move occurs because `_b` has type `std::boxed::Box`, which does not implement the `Copy` trait
+ |
help: consider removing the `&mut`
|
LL | [
diff --git a/src/test/ui/class-missing-self.stderr b/src/test/ui/class-missing-self.stderr
index 25cb85dadb903..681d0ffea8be8 100644
--- a/src/test/ui/class-missing-self.stderr
+++ b/src/test/ui/class-missing-self.stderr
@@ -9,6 +9,7 @@ error[E0425]: cannot find function `sleep` in this scope
|
LL | sleep();
| ^^^^^ not found in this scope
+ |
help: possible candidate is found in another module, you can import it into scope
|
LL | use std::thread::sleep;
diff --git a/src/test/ui/confuse-field-and-method/issue-18343.stderr b/src/test/ui/confuse-field-and-method/issue-18343.stderr
index 03f9d990dbb23..79ba93130a73a 100644
--- a/src/test/ui/confuse-field-and-method/issue-18343.stderr
+++ b/src/test/ui/confuse-field-and-method/issue-18343.stderr
@@ -6,6 +6,7 @@ LL | struct Obj where F: FnMut() -> u32 {
...
LL | o.closure();
| ^^^^^^^ field, not a method
+ |
help: to call the function stored in `closure`, surround the field access with parentheses
|
LL | (o.closure)();
diff --git a/src/test/ui/confuse-field-and-method/issue-2392.stderr b/src/test/ui/confuse-field-and-method/issue-2392.stderr
index 351cfef1b53ea..a44b971841538 100644
--- a/src/test/ui/confuse-field-and-method/issue-2392.stderr
+++ b/src/test/ui/confuse-field-and-method/issue-2392.stderr
@@ -6,6 +6,7 @@ LL | struct Obj where F: FnOnce() -> u32 {
...
LL | o_closure.closure();
| ^^^^^^^ field, not a method
+ |
help: to call the function stored in `closure`, surround the field access with parentheses
|
LL | (o_closure.closure)();
@@ -30,6 +31,7 @@ LL | struct Obj where F: FnOnce() -> u32 {
...
LL | o_func.closure();
| ^^^^^^^ field, not a method
+ |
help: to call the function stored in `closure`, surround the field access with parentheses
|
LL | (o_func.closure)();
@@ -43,6 +45,7 @@ LL | struct BoxedObj {
...
LL | boxed_fn.boxed_closure();
| ^^^^^^^^^^^^^ field, not a method
+ |
help: to call the function stored in `boxed_closure`, surround the field access with parentheses
|
LL | (boxed_fn.boxed_closure)();
@@ -56,6 +59,7 @@ LL | struct BoxedObj {
...
LL | boxed_closure.boxed_closure();
| ^^^^^^^^^^^^^ field, not a method
+ |
help: to call the function stored in `boxed_closure`, surround the field access with parentheses
|
LL | (boxed_closure.boxed_closure)();
@@ -69,6 +73,7 @@ LL | struct Obj where F: FnOnce() -> u32 {
...
LL | w.wrap.closure();
| ^^^^^^^ field, not a method
+ |
help: to call the function stored in `closure`, surround the field access with parentheses
|
LL | (w.wrap.closure)();
@@ -93,6 +98,7 @@ LL | struct Obj where F: FnOnce() -> u32 {
...
LL | check_expression().closure();
| ^^^^^^^ field, not a method
+ |
help: to call the function stored in `closure`, surround the field access with parentheses
|
LL | (check_expression().closure)();
@@ -106,6 +112,7 @@ LL | struct FuncContainer {
...
LL | (*self.container).f1(1);
| ^^ field, not a method
+ |
help: to call the function stored in `f1`, surround the field access with parentheses
|
LL | ((*self.container).f1)(1);
@@ -119,6 +126,7 @@ LL | struct FuncContainer {
...
LL | (*self.container).f2(1);
| ^^ field, not a method
+ |
help: to call the function stored in `f2`, surround the field access with parentheses
|
LL | ((*self.container).f2)(1);
@@ -132,6 +140,7 @@ LL | struct FuncContainer {
...
LL | (*self.container).f3(1);
| ^^ field, not a method
+ |
help: to call the function stored in `f3`, surround the field access with parentheses
|
LL | ((*self.container).f3)(1);
diff --git a/src/test/ui/confuse-field-and-method/issue-32128.stderr b/src/test/ui/confuse-field-and-method/issue-32128.stderr
index fbabb3a88cc6c..b2f7894ba0560 100644
--- a/src/test/ui/confuse-field-and-method/issue-32128.stderr
+++ b/src/test/ui/confuse-field-and-method/issue-32128.stderr
@@ -6,6 +6,7 @@ LL | struct Example {
...
LL | demo.example(1);
| ^^^^^^^ field, not a method
+ |
help: to call the function stored in `example`, surround the field access with parentheses
|
LL | (demo.example)(1);
diff --git a/src/test/ui/confuse-field-and-method/issue-33784.stderr b/src/test/ui/confuse-field-and-method/issue-33784.stderr
index 60f1a932f4442..af29a9963e1f2 100644
--- a/src/test/ui/confuse-field-and-method/issue-33784.stderr
+++ b/src/test/ui/confuse-field-and-method/issue-33784.stderr
@@ -3,6 +3,7 @@ error[E0599]: no method named `closure` found for type `&Obj<[closure@$DIR/issue
|
LL | p.closure();
| ^^^^^^^ field, not a method
+ |
help: to call the function stored in `closure`, surround the field access with parentheses
|
LL | (p.closure)();
@@ -13,6 +14,7 @@ error[E0599]: no method named `fn_ptr` found for type `&&Obj<[closure@$DIR/issue
|
LL | q.fn_ptr();
| ^^^^^^ field, not a method
+ |
help: to call the function stored in `fn_ptr`, surround the field access with parentheses
|
LL | (q.fn_ptr)();
@@ -23,6 +25,7 @@ error[E0599]: no method named `c_fn_ptr` found for type `&D` in the current scop
|
LL | s.c_fn_ptr();
| ^^^^^^^^ field, not a method
+ |
help: to call the function stored in `c_fn_ptr`, surround the field access with parentheses
|
LL | (s.c_fn_ptr)();
diff --git a/src/test/ui/consts/enum-discr-type-err.stderr b/src/test/ui/consts/enum-discr-type-err.stderr
index 3c4fac7327d40..a2545c8b6f2ac 100644
--- a/src/test/ui/consts/enum-discr-type-err.stderr
+++ b/src/test/ui/consts/enum-discr-type-err.stderr
@@ -9,6 +9,7 @@ LL | | A = F,
LL | | B = T,
LL | | }
| |_- in this macro invocation
+ |
help: you can convert an `i32` to `isize` and panic if the converted value wouldn't fit
|
LL | $( $v = $s::V.try_into().unwrap(), )*
diff --git a/src/test/ui/crate-in-paths.stderr b/src/test/ui/crate-in-paths.stderr
index c67fd4ac13cbe..38d222f980d2d 100644
--- a/src/test/ui/crate-in-paths.stderr
+++ b/src/test/ui/crate-in-paths.stderr
@@ -3,6 +3,7 @@ error[E0425]: cannot find value `Foo` in this scope
|
LL | Foo;
| ^^^ not found in this scope
+ |
help: possible candidate is found in another module, you can import it into scope
|
LL | use crate::bar::Foo;
diff --git a/src/test/ui/deprecation/invalid-literal.stderr b/src/test/ui/deprecation/invalid-literal.stderr
index a82eed24814cf..a5088a3ee3316 100644
--- a/src/test/ui/deprecation/invalid-literal.stderr
+++ b/src/test/ui/deprecation/invalid-literal.stderr
@@ -3,6 +3,7 @@ error: malformed `deprecated` attribute input
|
LL | #[deprecated = b"test"]
| ^^^^^^^^^^^^^^^^^^^^^^^
+ |
help: the following are the possible correct uses
|
LL | #[deprecated]
diff --git a/src/test/ui/did_you_mean/issue-40396.stderr b/src/test/ui/did_you_mean/issue-40396.stderr
index 7fc7c2628c472..749d1093ccab8 100644
--- a/src/test/ui/did_you_mean/issue-40396.stderr
+++ b/src/test/ui/did_you_mean/issue-40396.stderr
@@ -3,6 +3,7 @@ error: chained comparison operators require parentheses
|
LL | (0..13).collect>();
| ^^^^^
+ |
help: use `::<...>` instead of `<...>` to specify type arguments
|
LL | (0..13).collect::>();
@@ -13,6 +14,7 @@ error: chained comparison operators require parentheses
|
LL | Vec::new();
| ^^^^^
+ |
help: use `::<...>` instead of `<...>` to specify type arguments
|
LL | Vec::::new();
@@ -23,6 +25,7 @@ error: chained comparison operators require parentheses
|
LL | (0..13).collect();
| ^^^^^
+ |
help: use `::<...>` instead of `<...>` to specify type arguments
|
LL | (0..13).collect::();
diff --git a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr
index ef68bf52cf3bd..0a2fbe4918f15 100644
--- a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr
+++ b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr
@@ -3,6 +3,7 @@ error[E0423]: expected function, found enum `Option`
|
LL | let x = Option(1);
| ^^^^^^
+ |
help: try using one of the enum's variants
|
LL | let x = std::option::Option::None(1);
@@ -15,6 +16,7 @@ error[E0532]: expected tuple struct/variant, found enum `Option`
|
LL | if let Option(_) = x {
| ^^^^^^
+ |
help: try using one of the enum's variants
|
LL | if let std::option::Option::None(_) = x {
@@ -27,6 +29,7 @@ error[E0532]: expected tuple struct/variant, found enum `Example`
|
LL | if let Example(_) = y {
| ^^^^^^^
+ |
help: try using one of the enum's variants
|
LL | if let Example::Ex(_) = y {
@@ -45,6 +48,7 @@ error[E0423]: expected function, found enum `ManyVariants`
|
LL | let z = ManyVariants();
| ^^^^^^^^^^^^
+ |
help: try using one of the enum's variants
|
LL | let z = ManyVariants::One();
diff --git a/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr b/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr
index 8099c3c0584fc..705c90985d547 100644
--- a/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr
+++ b/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr
@@ -3,6 +3,7 @@ error: unexpected `,` in pattern
|
LL | while let b1, b2, b3 = reading_frame.next().expect("there should be a start codon") {
| ^
+ |
help: try adding parentheses to match on a tuple..
|
LL | while let (b1, b2, b3) = reading_frame.next().expect("there should be a start codon") {
@@ -17,6 +18,7 @@ error: unexpected `,` in pattern
|
LL | if let b1, b2, b3 = reading_frame.next().unwrap() {
| ^
+ |
help: try adding parentheses to match on a tuple..
|
LL | if let (b1, b2, b3) = reading_frame.next().unwrap() {
@@ -31,6 +33,7 @@ error: unexpected `,` in pattern
|
LL | Nucleotide::Adenine, Nucleotide::Cytosine, _ => true
| ^
+ |
help: try adding parentheses to match on a tuple..
|
LL | (Nucleotide::Adenine, Nucleotide::Cytosine, _) => true
@@ -45,6 +48,7 @@ error: unexpected `,` in pattern
|
LL | for x, _barr_body in women.iter().map(|woman| woman.allosomes.clone()) {
| ^
+ |
help: try adding parentheses to match on a tuple..
|
LL | for (x, _barr_body) in women.iter().map(|woman| woman.allosomes.clone()) {
@@ -59,6 +63,7 @@ error: unexpected `,` in pattern
|
LL | for x, y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) {
| ^
+ |
help: try adding parentheses to match on a tuple..
|
LL | for (x, y @ Allosome::Y(_)) in men.iter().map(|man| man.allosomes.clone()) {
@@ -73,6 +78,7 @@ error: unexpected `,` in pattern
|
LL | let women, men: (Vec, Vec) = genomes.iter().cloned()
| ^
+ |
help: try adding parentheses to match on a tuple..
|
LL | let (women, men): (Vec, Vec) = genomes.iter().cloned()
diff --git a/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr b/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr
index 9ee86adec52d9..f194b335fdebd 100644
--- a/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr
+++ b/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr
@@ -9,6 +9,7 @@ error: unknown start of token: \u{2212}
|
LL | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e−11; // m³⋅kg⁻¹⋅s⁻²
| ^
+ |
help: Unicode character '−' (Minus Sign) looks like '-' (Minus/Hyphen), but it is not
|
LL | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e-11; // m³⋅kg⁻¹⋅s⁻²
diff --git a/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr b/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr
index cb350a1faeed2..792b36e00bbfe 100644
--- a/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr
+++ b/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr
@@ -3,6 +3,7 @@ error[E0412]: cannot find type `Set` in this scope
|
LL | fn setup() -> Set { Set }
| ^^^ not found in this scope
+ |
help: there is an enum variant `AffixHeart::Set` and 7 others; try using the variant's enum
|
LL | fn setup() -> AffixHeart { Set }
@@ -20,6 +21,7 @@ error[E0425]: cannot find value `Set` in this scope
|
LL | fn setup() -> Set { Set }
| ^^^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use AffixHeart::Set;
diff --git a/src/test/ui/discrim/discrim-ill-typed.stderr b/src/test/ui/discrim/discrim-ill-typed.stderr
index 543fecb249f98..d9675d65a2a84 100644
--- a/src/test/ui/discrim/discrim-ill-typed.stderr
+++ b/src/test/ui/discrim/discrim-ill-typed.stderr
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
|
LL | OhNo = 0_u8,
| ^^^^ expected i8, found u8
+ |
help: change the type of the numeric literal from `u8` to `i8`
|
LL | OhNo = 0_i8,
@@ -13,6 +14,7 @@ error[E0308]: mismatched types
|
LL | OhNo = 0_i8,
| ^^^^ expected u8, found i8
+ |
help: change the type of the numeric literal from `i8` to `u8`
|
LL | OhNo = 0_u8,
@@ -23,6 +25,7 @@ error[E0308]: mismatched types
|
LL | OhNo = 0_u16,
| ^^^^^ expected i16, found u16
+ |
help: change the type of the numeric literal from `u16` to `i16`
|
LL | OhNo = 0_i16,
@@ -33,6 +36,7 @@ error[E0308]: mismatched types
|
LL | OhNo = 0_i16,
| ^^^^^ expected u16, found i16
+ |
help: change the type of the numeric literal from `i16` to `u16`
|
LL | OhNo = 0_u16,
@@ -43,6 +47,7 @@ error[E0308]: mismatched types
|
LL | OhNo = 0_u32,
| ^^^^^ expected i32, found u32
+ |
help: change the type of the numeric literal from `u32` to `i32`
|
LL | OhNo = 0_i32,
@@ -53,6 +58,7 @@ error[E0308]: mismatched types
|
LL | OhNo = 0_i32,
| ^^^^^ expected u32, found i32
+ |
help: change the type of the numeric literal from `i32` to `u32`
|
LL | OhNo = 0_u32,
@@ -63,6 +69,7 @@ error[E0308]: mismatched types
|
LL | OhNo = 0_u64,
| ^^^^^ expected i64, found u64
+ |
help: change the type of the numeric literal from `u64` to `i64`
|
LL | OhNo = 0_i64,
@@ -73,6 +80,7 @@ error[E0308]: mismatched types
|
LL | OhNo = 0_i64,
| ^^^^^ expected u64, found i64
+ |
help: change the type of the numeric literal from `i64` to `u64`
|
LL | OhNo = 0_u64,
diff --git a/src/test/ui/dotdotdot-expr.stderr b/src/test/ui/dotdotdot-expr.stderr
index a5ef7b6504897..ec1335cfdb072 100644
--- a/src/test/ui/dotdotdot-expr.stderr
+++ b/src/test/ui/dotdotdot-expr.stderr
@@ -3,6 +3,7 @@ error: unexpected token: `...`
|
LL | let _redemptive = 1...21;
| ^^^
+ |
help: use `..` for an exclusive range
|
LL | let _redemptive = 1..21;
diff --git a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr
index be991cd0c8128..77eb44c20653f 100644
--- a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr
+++ b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr
@@ -3,6 +3,7 @@ error: expected identifier, found keyword `async`
|
LL | let mut async = 1;
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | let mut r#async = 1;
@@ -13,6 +14,7 @@ error: expected identifier, found keyword `async`
|
LL | module::async();
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | module::r#async();
diff --git a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr
index 93a7627f88713..01f9f00e91cf5 100644
--- a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr
+++ b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr
@@ -3,6 +3,7 @@ error: expected identifier, found keyword `async`
|
LL | let mut async = 1;
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | let mut r#async = 1;
@@ -13,6 +14,7 @@ error: expected identifier, found keyword `async`
|
LL | module::async();
| ^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | module::r#async();
diff --git a/src/test/ui/empty/empty-struct-unit-expr.stderr b/src/test/ui/empty/empty-struct-unit-expr.stderr
index 696eabe99cffb..50b0e19133e3c 100644
--- a/src/test/ui/empty/empty-struct-unit-expr.stderr
+++ b/src/test/ui/empty/empty-struct-unit-expr.stderr
@@ -19,6 +19,7 @@ LL | let e4 = E::Empty4();
| ^^^^^^^^^--
| |
| call expression requires function
+ |
help: `E::Empty4` is a unit variant, you need to write it without the parenthesis
|
LL | let e4 = E::Empty4;
@@ -39,6 +40,7 @@ LL | let xe4 = XE::XEmpty4();
| ^^^^^^^^^^^--
| |
| call expression requires function
+ |
help: `XE::XEmpty4` is a unit variant, you need to write it without the parenthesis
|
LL | let xe4 = XE::XEmpty4;
diff --git a/src/test/ui/error-codes/E0023.stderr b/src/test/ui/error-codes/E0023.stderr
index dbce6003a2bad..a3610099294da 100644
--- a/src/test/ui/error-codes/E0023.stderr
+++ b/src/test/ui/error-codes/E0023.stderr
@@ -33,6 +33,7 @@ LL | Orange((String, String)),
...
LL | Fruit::Orange(a, b) => {},
| ^^^^^^^^^^^^^^^^^^^ expected 1 field, found 2
+ |
help: missing parenthesis
|
LL | Fruit::Orange((a, b)) => {},
@@ -46,6 +47,7 @@ LL | Banana(()),
...
LL | Fruit::Banana() => {},
| ^^^^^^^^^^^^^^^ expected 1 field, found 0
+ |
help: missing parenthesis
|
LL | Fruit::Banana(()) => {},
diff --git a/src/test/ui/error-codes/E0423.stderr b/src/test/ui/error-codes/E0423.stderr
index 754006bc217ee..4e016dbd1c029 100644
--- a/src/test/ui/error-codes/E0423.stderr
+++ b/src/test/ui/error-codes/E0423.stderr
@@ -3,6 +3,7 @@ error: struct literals are not allowed here
|
LL | if let S { x: _x, y: 2 } = S { x: 1, y: 2 } { println!("Ok"); }
| ^^^^^^^^^^^^^^^^
+ |
help: surround the struct literal with parentheses
|
LL | if let S { x: _x, y: 2 } = (S { x: 1, y: 2 }) { println!("Ok"); }
@@ -19,6 +20,7 @@ error: struct literals are not allowed here
|
LL | for _ in std::ops::Range { start: 0, end: 10 } {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
help: surround the struct literal with parentheses
|
LL | for _ in (std::ops::Range { start: 0, end: 10 }) {}
diff --git a/src/test/ui/error-codes/E0617.stderr b/src/test/ui/error-codes/E0617.stderr
index 7c4df099d0dd1..c029060c3fbe1 100644
--- a/src/test/ui/error-codes/E0617.stderr
+++ b/src/test/ui/error-codes/E0617.stderr
@@ -33,6 +33,7 @@ error[E0617]: can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to vari
|
LL | printf(::std::ptr::null(), printf);
| ^^^^^^
+ |
help: cast the value to `unsafe extern "C" fn(*const i8, ...)`
|
LL | printf(::std::ptr::null(), printf as unsafe extern "C" fn(*const i8, ...));
diff --git a/src/test/ui/error-codes/E0618.stderr b/src/test/ui/error-codes/E0618.stderr
index b691f09ad7a10..6ddda3bf8b528 100644
--- a/src/test/ui/error-codes/E0618.stderr
+++ b/src/test/ui/error-codes/E0618.stderr
@@ -8,6 +8,7 @@ LL | X::Entry();
| ^^^^^^^^--
| |
| call expression requires function
+ |
help: `X::Entry` is a unit variant, you need to write it without the parenthesis
|
LL | X::Entry;
diff --git a/src/test/ui/error-codes/E0642.stderr b/src/test/ui/error-codes/E0642.stderr
index da255143494d6..45486a5d632be 100644
--- a/src/test/ui/error-codes/E0642.stderr
+++ b/src/test/ui/error-codes/E0642.stderr
@@ -3,6 +3,7 @@ error[E0642]: patterns aren't allowed in methods without bodies
|
LL | fn foo((x, y): (i32, i32));
| ^^^^^^
+ |
help: give this argument a name or use an underscore to ignore it
|
LL | fn foo(_: (i32, i32));
@@ -13,6 +14,7 @@ error[E0642]: patterns aren't allowed in methods without bodies
|
LL | fn bar((x, y): (i32, i32)) {}
| ^^^^^^
+ |
help: give this argument a name or use an underscore to ignore it
|
LL | fn bar(_: (i32, i32)) {}
@@ -23,6 +25,7 @@ error[E0642]: patterns aren't allowed in methods without bodies
|
LL | fn method(S { .. }: S) {}
| ^^^^^^^^
+ |
help: give this argument a name or use an underscore to ignore it
|
LL | fn method(_: S) {}
diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr
index 665fe2880871e..3181d62298cad 100644
--- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr
+++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr
@@ -21,6 +21,7 @@ error: malformed `macro_use` attribute input
|
LL | #[macro_use = "2700"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^
+ |
help: the following are the possible correct uses
|
LL | #[macro_use] struct S;
diff --git a/src/test/ui/float-literal-inference-restrictions.stderr b/src/test/ui/float-literal-inference-restrictions.stderr
index 839ca57ce5562..08513507ecf96 100644
--- a/src/test/ui/float-literal-inference-restrictions.stderr
+++ b/src/test/ui/float-literal-inference-restrictions.stderr
@@ -15,6 +15,7 @@ error[E0308]: mismatched types
|
LL | let y: f32 = 1f64;
| ^^^^ expected f32, found f64
+ |
help: change the type of the numeric literal from `f64` to `f32`
|
LL | let y: f32 = 1f32;
diff --git a/src/test/ui/fn/fn-compare-mismatch.stderr b/src/test/ui/fn/fn-compare-mismatch.stderr
index b2f6510d5a084..8915b747b73dd 100644
--- a/src/test/ui/fn/fn-compare-mismatch.stderr
+++ b/src/test/ui/fn/fn-compare-mismatch.stderr
@@ -5,6 +5,7 @@ LL | let x = f == g;
| - ^^ - fn() {main::g}
| |
| fn() {main::f}
+ |
help: you might have forgotten to call this function
|
LL | let x = f() == g;
diff --git a/src/test/ui/glob-resolve1.stderr b/src/test/ui/glob-resolve1.stderr
index 4958099ca7405..ddd1e0954893f 100644
--- a/src/test/ui/glob-resolve1.stderr
+++ b/src/test/ui/glob-resolve1.stderr
@@ -3,6 +3,7 @@ error[E0425]: cannot find function `fpriv` in this scope
|
LL | fpriv();
| ^^^^^ not found in this scope
+ |
help: possible candidate is found in another module, you can import it into scope
|
LL | use bar::fpriv;
@@ -13,6 +14,7 @@ error[E0425]: cannot find function `epriv` in this scope
|
LL | epriv();
| ^^^^^ not found in this scope
+ |
help: possible candidate is found in another module, you can import it into scope
|
LL | use bar::epriv;
@@ -29,6 +31,7 @@ error[E0425]: cannot find value `C` in this scope
|
LL | C;
| ^ not found in this scope
+ |
help: possible candidate is found in another module, you can import it into scope
|
LL | use bar::C;
@@ -45,6 +48,7 @@ error[E0412]: cannot find type `A` in this scope
|
LL | foo::();
| ^
+ |
help: an enum with a similar name exists
|
LL | foo::();
@@ -59,6 +63,7 @@ error[E0412]: cannot find type `C` in this scope
|
LL | foo::();
| ^
+ |
help: an enum with a similar name exists
|
LL | foo::();
@@ -73,6 +78,7 @@ error[E0412]: cannot find type `D` in this scope
|
LL | foo::();
| ^
+ |
help: an enum with a similar name exists
|
LL | foo::();
diff --git a/src/test/ui/hygiene/expansion-info-reset.stderr b/src/test/ui/hygiene/expansion-info-reset.stderr
index d8b602ce1c63b..216f7a24a1e3a 100644
--- a/src/test/ui/hygiene/expansion-info-reset.stderr
+++ b/src/test/ui/hygiene/expansion-info-reset.stderr
@@ -3,6 +3,7 @@ error: format argument must be a string literal
|
LL | format_args!({ #[derive(Clone)] struct S; });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
help: you might be missing a string literal to format with
|
LL | format_args!("{}", { #[derive(Clone)] struct S; });
diff --git a/src/test/ui/hygiene/globs.stderr b/src/test/ui/hygiene/globs.stderr
index 7acb266f49c0b..4b382a2b20960 100644
--- a/src/test/ui/hygiene/globs.stderr
+++ b/src/test/ui/hygiene/globs.stderr
@@ -3,6 +3,7 @@ error[E0425]: cannot find function `f` in this scope
|
LL | f();
| ^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use foo::f;
@@ -24,6 +25,7 @@ LL | | g();
LL | | f();
LL | | }
| |_____- in this macro invocation
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use bar::g;
diff --git a/src/test/ui/if/ifmt-bad-format-args.stderr b/src/test/ui/if/ifmt-bad-format-args.stderr
index 9dc2b8f9a7397..23252b6b5f4fc 100644
--- a/src/test/ui/if/ifmt-bad-format-args.stderr
+++ b/src/test/ui/if/ifmt-bad-format-args.stderr
@@ -9,6 +9,7 @@ error: format argument must be a string literal
|
LL | format_args!(|| {});
| ^^^^^
+ |
help: you might be missing a string literal to format with
|
LL | format_args!("{}", || {});
diff --git a/src/test/ui/impl-trait/impl-generic-mismatch.stderr b/src/test/ui/impl-trait/impl-generic-mismatch.stderr
index fae8da9861f9d..bfe94119a02f6 100644
--- a/src/test/ui/impl-trait/impl-generic-mismatch.stderr
+++ b/src/test/ui/impl-trait/impl-generic-mismatch.stderr
@@ -6,6 +6,7 @@ LL | fn foo(&self, _: &impl Debug);
...
LL | fn foo(&self, _: &U) { }
| ^ expected `impl Trait`, found generic parameter
+ |
help: try removing the generic parameter and using `impl Trait` instead
|
LL | fn foo(&self, _: &impl Debug) { }
@@ -19,6 +20,7 @@ LL | fn bar(&self, _: &U);
...
LL | fn bar(&self, _: &impl Debug) { }
| ^^^^^^^^^^ expected generic parameter, found `impl Trait`
+ |
help: try changing the `impl Trait` argument to a generic parameter
|
LL | fn bar(&self, _: &U) { }
diff --git a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr
index f27e6ff44a65c..82e280b9fb2e1 100644
--- a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr
+++ b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr
@@ -3,6 +3,7 @@ error: lifetime may not live long enough
|
LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
| -- lifetime `'a` defined here ^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
+ |
help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a constraint
|
LL | type E<'a, 'b> = impl Sized; + 'a
diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr
index b1e4edd998094..097f003575eab 100644
--- a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr
+++ b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr
@@ -5,6 +5,7 @@ LL | fn elided(x: &i32) -> impl Copy { x }
| - ^^^^^^^^^ opaque type requires that `'1` must outlive `'static`
| |
| let's call the lifetime of this reference `'1`
+ |
help: to allow this `impl Trait` to capture borrowed data with lifetime `'1`, add `'_` as a constraint
|
LL | fn elided(x: &i32) -> impl Copy + '_ { x }
@@ -17,6 +18,7 @@ LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
| -- ^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
| |
| lifetime `'a` defined here
+ |
help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a constraint
|
LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
diff --git a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr
index 0736f25cb51bd..423cfcc498980 100644
--- a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr
+++ b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr
@@ -5,6 +5,7 @@ LL | fn iter_values_anon(&self) -> impl Iterator- {
| - ^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'1` must outlive `'static`
| |
| let's call the lifetime of this reference `'1`
+ |
help: to allow this `impl Trait` to capture borrowed data with lifetime `'1`, add `'_` as a constraint
|
LL | fn iter_values_anon(&self) -> impl Iterator
- + '_ {
@@ -17,6 +18,7 @@ LL | fn iter_values<'a>(&'a self) -> impl Iterator
- {
| -- ^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
| |
| lifetime `'a` defined here
+ |
help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a constraint
|
LL | fn iter_values<'a>(&'a self) -> impl Iterator
- + 'a {
diff --git a/src/test/ui/impl-trait/universal_wrong_bounds.stderr b/src/test/ui/impl-trait/universal_wrong_bounds.stderr
index f530792955bc2..32b638dc465c5 100644
--- a/src/test/ui/impl-trait/universal_wrong_bounds.stderr
+++ b/src/test/ui/impl-trait/universal_wrong_bounds.stderr
@@ -3,6 +3,7 @@ error[E0404]: expected trait, found derive macro `Debug`
|
LL | fn wants_debug(g: impl Debug) { }
| ^^^^^ not a trait
+ |
help: possible better candidate is found in another module, you can import it into scope
|
LL | use std::fmt::Debug;
@@ -13,6 +14,7 @@ error[E0404]: expected trait, found derive macro `Debug`
|
LL | fn wants_display(g: impl Debug) { }
| ^^^^^ not a trait
+ |
help: possible better candidate is found in another module, you can import it into scope
|
LL | use std::fmt::Debug;
diff --git a/src/test/ui/indexing-requires-a-uint.stderr b/src/test/ui/indexing-requires-a-uint.stderr
index 3300db58d44c3..7010a3ccbea83 100644
--- a/src/test/ui/indexing-requires-a-uint.stderr
+++ b/src/test/ui/indexing-requires-a-uint.stderr
@@ -12,6 +12,7 @@ error[E0308]: mismatched types
|
LL | bar::
(i); // i should not be re-coerced back to an isize
| ^ expected isize, found usize
+ |
help: you can convert an `usize` to `isize` and panic if the converted value wouldn't fit
|
LL | bar::(i.try_into().unwrap()); // i should not be re-coerced back to an isize
diff --git a/src/test/ui/inference/cannot-infer-closure.stderr b/src/test/ui/inference/cannot-infer-closure.stderr
index 5f30b5d993c1e..c26c24f1dc573 100644
--- a/src/test/ui/inference/cannot-infer-closure.stderr
+++ b/src/test/ui/inference/cannot-infer-closure.stderr
@@ -3,6 +3,7 @@ error[E0282]: type annotations needed for the closure `fn((), ()) -> std::result
|
LL | Err(a)?;
| ^^^^^^^ cannot infer type
+ |
help: give this closure an explicit return type without `_` placeholders
|
LL | let x = |a: (), b: ()| -> std::result::Result<(), _> {
diff --git a/src/test/ui/integer-literal-suffix-inference.stderr b/src/test/ui/integer-literal-suffix-inference.stderr
index 80b601dc4394b..bbb57d97c39f4 100644
--- a/src/test/ui/integer-literal-suffix-inference.stderr
+++ b/src/test/ui/integer-literal-suffix-inference.stderr
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
|
LL | id_i8(a16);
| ^^^ expected i8, found i16
+ |
help: you can convert an `i16` to `i8` and panic if the converted value wouldn't fit
|
LL | id_i8(a16.try_into().unwrap());
@@ -13,6 +14,7 @@ error[E0308]: mismatched types
|
LL | id_i8(a32);
| ^^^ expected i8, found i32
+ |
help: you can convert an `i32` to `i8` and panic if the converted value wouldn't fit
|
LL | id_i8(a32.try_into().unwrap());
@@ -23,6 +25,7 @@ error[E0308]: mismatched types
|
LL | id_i8(a64);
| ^^^ expected i8, found i64
+ |
help: you can convert an `i64` to `i8` and panic if the converted value wouldn't fit
|
LL | id_i8(a64.try_into().unwrap());
@@ -42,6 +45,7 @@ error[E0308]: mismatched types
|
LL | id_i16(a32);
| ^^^ expected i16, found i32
+ |
help: you can convert an `i32` to `i16` and panic if the converted value wouldn't fit
|
LL | id_i16(a32.try_into().unwrap());
@@ -52,6 +56,7 @@ error[E0308]: mismatched types
|
LL | id_i16(a64);
| ^^^ expected i16, found i64
+ |
help: you can convert an `i64` to `i16` and panic if the converted value wouldn't fit
|
LL | id_i16(a64.try_into().unwrap());
@@ -80,6 +85,7 @@ error[E0308]: mismatched types
|
LL | id_i32(a64);
| ^^^ expected i32, found i64
+ |
help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
|
LL | id_i32(a64.try_into().unwrap());
@@ -117,6 +123,7 @@ error[E0308]: mismatched types
|
LL | id_i8(c16);
| ^^^ expected i8, found i16
+ |
help: you can convert an `i16` to `i8` and panic if the converted value wouldn't fit
|
LL | id_i8(c16.try_into().unwrap());
@@ -127,6 +134,7 @@ error[E0308]: mismatched types
|
LL | id_i8(c32);
| ^^^ expected i8, found i32
+ |
help: you can convert an `i32` to `i8` and panic if the converted value wouldn't fit
|
LL | id_i8(c32.try_into().unwrap());
@@ -137,6 +145,7 @@ error[E0308]: mismatched types
|
LL | id_i8(c64);
| ^^^ expected i8, found i64
+ |
help: you can convert an `i64` to `i8` and panic if the converted value wouldn't fit
|
LL | id_i8(c64.try_into().unwrap());
@@ -156,6 +165,7 @@ error[E0308]: mismatched types
|
LL | id_i16(c32);
| ^^^ expected i16, found i32
+ |
help: you can convert an `i32` to `i16` and panic if the converted value wouldn't fit
|
LL | id_i16(c32.try_into().unwrap());
@@ -166,6 +176,7 @@ error[E0308]: mismatched types
|
LL | id_i16(c64);
| ^^^ expected i16, found i64
+ |
help: you can convert an `i64` to `i16` and panic if the converted value wouldn't fit
|
LL | id_i16(c64.try_into().unwrap());
@@ -194,6 +205,7 @@ error[E0308]: mismatched types
|
LL | id_i32(c64);
| ^^^ expected i32, found i64
+ |
help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
|
LL | id_i32(c64.try_into().unwrap());
@@ -231,6 +243,7 @@ error[E0308]: mismatched types
|
LL | id_u8(b16);
| ^^^ expected u8, found u16
+ |
help: you can convert an `u16` to `u8` and panic if the converted value wouldn't fit
|
LL | id_u8(b16.try_into().unwrap());
@@ -241,6 +254,7 @@ error[E0308]: mismatched types
|
LL | id_u8(b32);
| ^^^ expected u8, found u32
+ |
help: you can convert an `u32` to `u8` and panic if the converted value wouldn't fit
|
LL | id_u8(b32.try_into().unwrap());
@@ -251,6 +265,7 @@ error[E0308]: mismatched types
|
LL | id_u8(b64);
| ^^^ expected u8, found u64
+ |
help: you can convert an `u64` to `u8` and panic if the converted value wouldn't fit
|
LL | id_u8(b64.try_into().unwrap());
@@ -270,6 +285,7 @@ error[E0308]: mismatched types
|
LL | id_u16(b32);
| ^^^ expected u16, found u32
+ |
help: you can convert an `u32` to `u16` and panic if the converted value wouldn't fit
|
LL | id_u16(b32.try_into().unwrap());
@@ -280,6 +296,7 @@ error[E0308]: mismatched types
|
LL | id_u16(b64);
| ^^^ expected u16, found u64
+ |
help: you can convert an `u64` to `u16` and panic if the converted value wouldn't fit
|
LL | id_u16(b64.try_into().unwrap());
@@ -308,6 +325,7 @@ error[E0308]: mismatched types
|
LL | id_u32(b64);
| ^^^ expected u32, found u64
+ |
help: you can convert an `u64` to `u32` and panic if the converted value wouldn't fit
|
LL | id_u32(b64.try_into().unwrap());
diff --git a/src/test/ui/issues/issue-13359.stderr b/src/test/ui/issues/issue-13359.stderr
index 7cfd754f72d8e..76c5f39fe1094 100644
--- a/src/test/ui/issues/issue-13359.stderr
+++ b/src/test/ui/issues/issue-13359.stderr
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
|
LL | foo(1*(1 as isize));
| ^^^^^^^^^^^^^^ expected i16, found isize
+ |
help: you can convert an `isize` to `i16` and panic if the converted value wouldn't fit
|
LL | foo((1*(1 as isize)).try_into().unwrap());
@@ -13,6 +14,7 @@ error[E0308]: mismatched types
|
LL | bar(1*(1 as usize));
| ^^^^^^^^^^^^^^ expected u32, found usize
+ |
help: you can convert an `usize` to `u32` and panic if the converted value wouldn't fit
|
LL | bar((1*(1 as usize)).try_into().unwrap());
diff --git a/src/test/ui/issues/issue-1362.stderr b/src/test/ui/issues/issue-1362.stderr
index 3f4fdee50fdde..7ffbbbce7a83b 100644
--- a/src/test/ui/issues/issue-1362.stderr
+++ b/src/test/ui/issues/issue-1362.stderr
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
|
LL | let x: u32 = 20i32;
| ^^^^^ expected u32, found i32
+ |
help: change the type of the numeric literal from `i32` to `u32`
|
LL | let x: u32 = 20u32;
diff --git a/src/test/ui/issues/issue-1448-2.stderr b/src/test/ui/issues/issue-1448-2.stderr
index a9fabca50a683..28c561462d410 100644
--- a/src/test/ui/issues/issue-1448-2.stderr
+++ b/src/test/ui/issues/issue-1448-2.stderr
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
|
LL | println!("{}", foo(10i32));
| ^^^^^ expected u32, found i32
+ |
help: change the type of the numeric literal from `i32` to `u32`
|
LL | println!("{}", foo(10u32));
diff --git a/src/test/ui/issues/issue-17546.stderr b/src/test/ui/issues/issue-17546.stderr
index 291086d4f694e..f3242919e0105 100644
--- a/src/test/ui/issues/issue-17546.stderr
+++ b/src/test/ui/issues/issue-17546.stderr
@@ -3,6 +3,7 @@ error[E0573]: expected type, found variant `NoResult`
|
LL | fn new() -> NoResult {
| ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
help: try using the variant's enum
|
LL | fn new() -> foo::MyEnum {
@@ -17,6 +18,7 @@ error[E0573]: expected type, found variant `Result`
|
LL | fn new() -> Result {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a type
+ |
help: possible better candidates are found in other modules, you can import them into scope
|
LL | use std::fmt::Result;
@@ -34,6 +36,7 @@ error[E0573]: expected type, found variant `Result`
|
LL | fn new() -> Result {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a type
+ |
help: possible better candidates are found in other modules, you can import them into scope
|
LL | use std::fmt::Result;
@@ -51,6 +54,7 @@ error[E0573]: expected type, found variant `NoResult`
|
LL | fn newer() -> NoResult {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
help: try using the variant's enum
|
LL | fn newer() -> foo::MyEnum {
diff --git a/src/test/ui/issues/issue-22644.stderr b/src/test/ui/issues/issue-22644.stderr
index 0fe167963c3f4..2bddcc2ba56ce 100644
--- a/src/test/ui/issues/issue-22644.stderr
+++ b/src/test/ui/issues/issue-22644.stderr
@@ -50,6 +50,7 @@ LL | <
| ^ not interpreted as comparison
LL | 4);
| - interpreted as generic arguments
+ |
help: try comparing the cast value
|
LL | println!("{}", (a
@@ -64,6 +65,7 @@ LL | <
| ^ not interpreted as comparison
LL | 5);
| - interpreted as generic arguments
+ |
help: try comparing the cast value
|
LL | println!("{}", (a
diff --git a/src/test/ui/issues/issue-22933-3.stderr b/src/test/ui/issues/issue-22933-3.stderr
index e0e8b5e18a42d..72bca3b040839 100644
--- a/src/test/ui/issues/issue-22933-3.stderr
+++ b/src/test/ui/issues/issue-22933-3.stderr
@@ -3,6 +3,7 @@ error[E0599]: no associated item named `MIN` found for type `u8` in the current
|
LL | const FOO: [u32; u8::MIN as usize] = [];
| ^^^ associated item not found in `u8`
+ |
help: you are looking for the module in `std`, not the primitive type
|
LL | const FOO: [u32; std::u8::MIN as usize] = [];
diff --git a/src/test/ui/issues/issue-31910.stderr b/src/test/ui/issues/issue-31910.stderr
index e7555b958a3d4..19b67ef2a72cb 100644
--- a/src/test/ui/issues/issue-31910.stderr
+++ b/src/test/ui/issues/issue-31910.stderr
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
|
LL | X = Trait::Number,
| ^^^^^^^^^^^^^ expected isize, found i32
+ |
help: you can convert an `i32` to `isize` and panic if the converted value wouldn't fit
|
LL | X = Trait::Number.try_into().unwrap(),
diff --git a/src/test/ui/issues/issue-35075.stderr b/src/test/ui/issues/issue-35075.stderr
index 2aeb6b1522424..85acbfb8de4be 100644
--- a/src/test/ui/issues/issue-35075.stderr
+++ b/src/test/ui/issues/issue-35075.stderr
@@ -3,6 +3,7 @@ error[E0412]: cannot find type `Foo` in this scope
|
LL | inner: Foo
| ^^^ not found in this scope
+ |
help: there is an enum variant `Baz::Foo`; try using the variant's enum
|
LL | inner: Baz
@@ -13,6 +14,7 @@ error[E0412]: cannot find type `Foo` in this scope
|
LL | Foo(Foo)
| ^^^ not found in this scope
+ |
help: there is an enum variant `Baz::Foo`; try using the variant's enum
|
LL | Foo(Baz)
diff --git a/src/test/ui/issues/issue-35675.stderr b/src/test/ui/issues/issue-35675.stderr
index 91814d9496376..8072141aefd20 100644
--- a/src/test/ui/issues/issue-35675.stderr
+++ b/src/test/ui/issues/issue-35675.stderr
@@ -3,6 +3,7 @@ error[E0412]: cannot find type `Apple` in this scope
|
LL | fn should_return_fruit() -> Apple {
| ^^^^^ not found in this scope
+ |
help: there is an enum variant `Fruit::Apple`; try using the variant's enum
|
LL | fn should_return_fruit() -> Fruit {
@@ -13,6 +14,7 @@ error[E0425]: cannot find function `Apple` in this scope
|
LL | Apple(5)
| ^^^^^ not found in this scope
+ |
help: possible candidate is found in another module, you can import it into scope
|
LL | use Fruit::Apple;
@@ -32,6 +34,7 @@ error[E0425]: cannot find function `Apple` in this scope
|
LL | Apple(5)
| ^^^^^ not found in this scope
+ |
help: possible candidate is found in another module, you can import it into scope
|
LL | use Fruit::Apple;
@@ -51,6 +54,7 @@ error[E0412]: cannot find type `Variant3` in this scope
|
LL | fn bar() -> Variant3 {
| ^^^^^^^^ not found in this scope
+ |
help: there is an enum variant `x::Enum::Variant3`; try using the variant's enum
|
LL | fn bar() -> x::Enum {
diff --git a/src/test/ui/issues/issue-35976.stderr b/src/test/ui/issues/issue-35976.stderr
index d12198de5e114..99b243a077792 100644
--- a/src/test/ui/issues/issue-35976.stderr
+++ b/src/test/ui/issues/issue-35976.stderr
@@ -3,6 +3,7 @@ error: the `wait` method cannot be invoked on a trait object
|
LL | arg.wait();
| ^^^^
+ |
help: another candidate was found in the following trait, perhaps add a `use` for it:
|
LL | use private::Future;
diff --git a/src/test/ui/issues/issue-37534.stderr b/src/test/ui/issues/issue-37534.stderr
index fadb9cdd1a3d1..1a05c7ab42028 100644
--- a/src/test/ui/issues/issue-37534.stderr
+++ b/src/test/ui/issues/issue-37534.stderr
@@ -3,6 +3,7 @@ error[E0404]: expected trait, found derive macro `Hash`
|
LL | struct Foo { }
| ^^^^ not a trait
+ |
help: possible better candidate is found in another module, you can import it into scope
|
LL | use std::hash::Hash;
diff --git a/src/test/ui/issues/issue-38293.stderr b/src/test/ui/issues/issue-38293.stderr
index d16d45277c038..cc3c72b496f5f 100644
--- a/src/test/ui/issues/issue-38293.stderr
+++ b/src/test/ui/issues/issue-38293.stderr
@@ -9,6 +9,7 @@ error[E0423]: expected function, found module `baz`
|
LL | baz();
| ^^^ not a function
+ |
help: possible better candidate is found in another module, you can import it into scope
|
LL | use bar::baz;
diff --git a/src/test/ui/issues/issue-41652/issue-41652.stderr b/src/test/ui/issues/issue-41652/issue-41652.stderr
index 3c71536de2ea7..f7107d61ac3e2 100644
--- a/src/test/ui/issues/issue-41652/issue-41652.stderr
+++ b/src/test/ui/issues/issue-41652/issue-41652.stderr
@@ -3,6 +3,7 @@ error[E0689]: can't call method `f` on ambiguous numeric type `{integer}`
|
LL | 3.f()
| ^
+ |
help: you must specify a concrete type for this numeric value, like `i32`
|
LL | 3_i32.f()
diff --git a/src/test/ui/issues/issue-42944.stderr b/src/test/ui/issues/issue-42944.stderr
index ba285953dbdbd..4ab272b9e9b3b 100644
--- a/src/test/ui/issues/issue-42944.stderr
+++ b/src/test/ui/issues/issue-42944.stderr
@@ -9,6 +9,7 @@ error[E0425]: cannot find function `B` in this scope
|
LL | B(());
| ^ not found in this scope
+ |
help: possible candidate is found in another module, you can import it into scope
|
LL | use foo::B;
diff --git a/src/test/ui/issues/issue-4366-2.stderr b/src/test/ui/issues/issue-4366-2.stderr
index 63013a6523ab0..60a1155c614f6 100644
--- a/src/test/ui/issues/issue-4366-2.stderr
+++ b/src/test/ui/issues/issue-4366-2.stderr
@@ -3,6 +3,7 @@ error[E0412]: cannot find type `Bar` in this scope
|
LL | fn sub() -> Bar { 1 }
| ^^^ not found in this scope
+ |
help: possible candidate is found in another module, you can import it into scope
|
LL | use a::b::Bar;
@@ -13,6 +14,7 @@ error[E0423]: expected function, found module `foo`
|
LL | foo();
| ^^^ not a function
+ |
help: possible better candidates are found in other modules, you can import them into scope
|
LL | use foo::foo;
diff --git a/src/test/ui/issues/issue-4366.stderr b/src/test/ui/issues/issue-4366.stderr
index c59ab00455709..d931d51911756 100644
--- a/src/test/ui/issues/issue-4366.stderr
+++ b/src/test/ui/issues/issue-4366.stderr
@@ -3,6 +3,7 @@ error[E0425]: cannot find function `foo` in this scope
|
LL | fn sub() -> isize { foo(); 1 }
| ^^^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use foo::foo;
diff --git a/src/test/ui/issues/issue-44406.stderr b/src/test/ui/issues/issue-44406.stderr
index 108542c9b6f13..a98d833969e80 100644
--- a/src/test/ui/issues/issue-44406.stderr
+++ b/src/test/ui/issues/issue-44406.stderr
@@ -3,6 +3,7 @@ error: expected identifier, found keyword `true`
|
LL | foo!(true);
| ^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | foo!(r#true);
diff --git a/src/test/ui/issues/issue-47377.stderr b/src/test/ui/issues/issue-47377.stderr
index 7d11a8c802128..3460c1dae2299 100644
--- a/src/test/ui/issues/issue-47377.stderr
+++ b/src/test/ui/issues/issue-47377.stderr
@@ -6,6 +6,7 @@ LL | let _a = b + ", World!";
| | |
| | `+` cannot be used to concatenate two `&str` strings
| &str
+ |
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
|
LL | let _a = b.to_owned() + ", World!";
diff --git a/src/test/ui/issues/issue-47380.stderr b/src/test/ui/issues/issue-47380.stderr
index 89a154c5109d8..f334dcbd916ac 100644
--- a/src/test/ui/issues/issue-47380.stderr
+++ b/src/test/ui/issues/issue-47380.stderr
@@ -6,6 +6,7 @@ LL | println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!";
| | |
| | `+` cannot be used to concatenate two `&str` strings
| &str
+ |
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
|
LL | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!";
diff --git a/src/test/ui/issues/issue-49257.stderr b/src/test/ui/issues/issue-49257.stderr
index 43a505cfe85f8..b9d96dc79075a 100644
--- a/src/test/ui/issues/issue-49257.stderr
+++ b/src/test/ui/issues/issue-49257.stderr
@@ -6,6 +6,7 @@ LL | let Point { .., y, } = p;
| | |
| | expected `}`
| `..` must be at the end and cannot have a trailing comma
+ |
help: move the `..` to the end of the field list
|
LL | let Point { y, .. } = p;
@@ -19,6 +20,7 @@ LL | let Point { .., y } = p;
| | |
| | expected `}`
| `..` must be at the end and cannot have a trailing comma
+ |
help: move the `..` to the end of the field list
|
LL | let Point { y , .. } = p;
diff --git a/src/test/ui/issues/issue-50571.stderr b/src/test/ui/issues/issue-50571.stderr
index 834635388a066..df9d10b39507b 100644
--- a/src/test/ui/issues/issue-50571.stderr
+++ b/src/test/ui/issues/issue-50571.stderr
@@ -3,6 +3,7 @@ error[E0642]: patterns aren't allowed in methods without bodies
|
LL | fn foo([a, b]: [i32; 2]) {}
| ^^^^^^
+ |
help: give this argument a name or use an underscore to ignore it
|
LL | fn foo(_: [i32; 2]) {}
diff --git a/src/test/ui/issues/issue-50599.stderr b/src/test/ui/issues/issue-50599.stderr
index 4bd74c3c785fe..5c8cac444387d 100644
--- a/src/test/ui/issues/issue-50599.stderr
+++ b/src/test/ui/issues/issue-50599.stderr
@@ -3,6 +3,7 @@ error[E0425]: cannot find value `LOG10_2` in module `std::f64`
|
LL | const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize;
| ^^^^^^^ not found in `std::f64`
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use std::f32::consts::LOG10_2;
diff --git a/src/test/ui/issues/issue-51874.stderr b/src/test/ui/issues/issue-51874.stderr
index 9b1a6bf2e12d6..c7c4843a0fa80 100644
--- a/src/test/ui/issues/issue-51874.stderr
+++ b/src/test/ui/issues/issue-51874.stderr
@@ -3,6 +3,7 @@ error[E0689]: can't call method `pow` on ambiguous numeric type `{float}`
|
LL | let a = (1.0).pow(1.0);
| ^^^
+ |
help: you must specify a concrete type for this numeric value, like `f32`
|
LL | let a = (1.0_f32).pow(1.0);
diff --git a/src/test/ui/issues/issue-5239-1.stderr b/src/test/ui/issues/issue-5239-1.stderr
index a95014fb12de7..f4f0f17d00199 100644
--- a/src/test/ui/issues/issue-5239-1.stderr
+++ b/src/test/ui/issues/issue-5239-1.stderr
@@ -5,6 +5,7 @@ LL | let x = |ref x: isize| { x += 1; };
| -^^^^^
| |
| cannot use `+=` on type `&isize`
+ |
help: `+=` can be used on 'isize', you can dereference `x`
|
LL | let x = |ref x: isize| { *x += 1; };
diff --git a/src/test/ui/issues/issue-56685.stderr b/src/test/ui/issues/issue-56685.stderr
index 4a461c72b2417..30fedbe1653c4 100644
--- a/src/test/ui/issues/issue-56685.stderr
+++ b/src/test/ui/issues/issue-56685.stderr
@@ -19,6 +19,7 @@ error: unused variable: `x`
|
LL | F::A(x, y) | F::B(x, y) => { y },
| ^ ^
+ |
help: consider prefixing with an underscore
|
LL | F::A(_x, y) | F::B(_x, y) => { y },
@@ -41,6 +42,7 @@ error: unused variable: `x`
|
LL | let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) {
| ^ ^
+ |
help: consider prefixing with an underscore
|
LL | let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) {
@@ -51,6 +53,7 @@ error: unused variable: `x`
|
LL | while let F::A(x, y) | F::B(x, y) = F::A(1, 2) {
| ^ ^
+ |
help: consider prefixing with an underscore
|
LL | while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) {
diff --git a/src/test/ui/issues/issue-57198.stderr b/src/test/ui/issues/issue-57198.stderr
index 2ab552ccbd3c8..197c4cc967d4d 100644
--- a/src/test/ui/issues/issue-57198.stderr
+++ b/src/test/ui/issues/issue-57198.stderr
@@ -3,6 +3,7 @@ error: expected identifier, found keyword `for`
|
LL | m::for();
| ^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | m::r#for();
diff --git a/src/test/ui/issues/issue-58857.stderr b/src/test/ui/issues/issue-58857.stderr
index 56e87215a800c..ab9a0130c00b0 100644
--- a/src/test/ui/issues/issue-58857.stderr
+++ b/src/test/ui/issues/issue-58857.stderr
@@ -3,6 +3,7 @@ error: negative trait bounds are not supported
|
LL | impl Conj{}
| ^^^^^^^^ negative trait bounds are not supported
+ |
= help: remove the trait bound
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-59488.stderr b/src/test/ui/issues/issue-59488.stderr
index e0cb1f7b96df8..2397d583488e6 100644
--- a/src/test/ui/issues/issue-59488.stderr
+++ b/src/test/ui/issues/issue-59488.stderr
@@ -41,6 +41,7 @@ LL | foo > foo;
| --- ^ --- fn() -> i32 {foo}
| |
| fn() -> i32 {foo}
+ |
help: you might have forgotten to call this function
|
LL | foo() > foo;
diff --git a/src/test/ui/issues/issue-62554.stderr b/src/test/ui/issues/issue-62554.stderr
index 9675d540e7299..87aaa03661321 100644
--- a/src/test/ui/issues/issue-62554.stderr
+++ b/src/test/ui/issues/issue-62554.stderr
@@ -18,6 +18,7 @@ LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s
| -- ^^^^^^^^^^^ expected `{`
| |
| this `if` statement has a condition, but no block
+ |
help: try placing this code inside a block
|
LL | fn foo(u: u8) { if u8 { macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
diff --git a/src/test/ui/issues/issue-64732.stderr b/src/test/ui/issues/issue-64732.stderr
index fc0e8e3bdb20f..3b00ffc8f6c8d 100644
--- a/src/test/ui/issues/issue-64732.stderr
+++ b/src/test/ui/issues/issue-64732.stderr
@@ -3,6 +3,7 @@ error: character literal may only contain one codepoint
|
LL | let _foo = b'hello\0';
| ^^^^^^^^^
+ |
help: if you meant to write a byte string literal, use double quotes
|
LL | let _foo = b"hello\0";
@@ -13,6 +14,7 @@ error: character literal may only contain one codepoint
|
LL | let _bar = 'hello';
| ^^^^^^^
+ |
help: if you meant to write a `str` literal, use double quotes
|
LL | let _bar = "hello";
diff --git a/src/test/ui/issues/issue-8761.stderr b/src/test/ui/issues/issue-8761.stderr
index 28847c5a82a07..5a657575c1dbf 100644
--- a/src/test/ui/issues/issue-8761.stderr
+++ b/src/test/ui/issues/issue-8761.stderr
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
|
LL | A = 1i64,
| ^^^^ expected isize, found i64
+ |
help: change the type of the numeric literal from `i64` to `isize`
|
LL | A = 1isize,
@@ -13,6 +14,7 @@ error[E0308]: mismatched types
|
LL | B = 2u8
| ^^^ expected isize, found u8
+ |
help: change the type of the numeric literal from `u8` to `isize`
|
LL | B = 2isize
diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr
index 73ac113f1b1e0..5f5297be42ac9 100644
--- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr
+++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr
@@ -3,6 +3,7 @@ error: expected identifier, found keyword `extern`
|
LL | let extern = 0;
| ^^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | let r#extern = 0;
diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr
index 4b833f8068195..05802f2d36710 100644
--- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr
+++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr
@@ -3,6 +3,7 @@ error: expected identifier, found keyword `extern`
|
LL | use extern::foo;
| ^^^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | use r#extern::foo;
diff --git a/src/test/ui/lexical-scopes.stderr b/src/test/ui/lexical-scopes.stderr
index 38c7393e136a6..a7843a930119a 100644
--- a/src/test/ui/lexical-scopes.stderr
+++ b/src/test/ui/lexical-scopes.stderr
@@ -3,6 +3,7 @@ error[E0574]: expected struct, variant or union type, found type parameter `T`
|
LL | let t = T { i: 0 };
| ^ not a struct, variant or union type
+ |
help: possible better candidate is found in another module, you can import it into scope
|
LL | use T;
diff --git a/src/test/ui/lifetime_starts_expressions.stderr b/src/test/ui/lifetime_starts_expressions.stderr
index bacba10b55fba..a2b4f114b95b9 100644
--- a/src/test/ui/lifetime_starts_expressions.stderr
+++ b/src/test/ui/lifetime_starts_expressions.stderr
@@ -3,6 +3,7 @@ error: expected identifier, found keyword `loop`
|
LL | loop { break 'label: loop { break 'label 42; }; }
| ^^^^ expected identifier, found keyword
+ |
help: you can escape reserved keywords to use them as identifiers
|
LL | loop { break 'label: r#loop { break 'label 42; }; }
diff --git a/src/test/ui/lint/use_suggestion_json.stderr b/src/test/ui/lint/use_suggestion_json.stderr
index 1da5acc966163..3e77d193fa477 100644
--- a/src/test/ui/lint/use_suggestion_json.stderr
+++ b/src/test/ui/lint/use_suggestion_json.stderr
@@ -385,6 +385,7 @@ mod foo {
\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m
\u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m let x: Iter;\u001b[0m
\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mnot found in this scope\u001b[0m
+\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m
\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: possible candidates are found in other modules, you can import them into scope\u001b[0m
\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m
\u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0muse std::collections::binary_heap::Iter;\u001b[0m
diff --git a/src/test/ui/loops/loop-break-value-no-repeat.stderr b/src/test/ui/loops/loop-break-value-no-repeat.stderr
index 066dce531a54f..ff93e9220e986 100644
--- a/src/test/ui/loops/loop-break-value-no-repeat.stderr
+++ b/src/test/ui/loops/loop-break-value-no-repeat.stderr
@@ -3,6 +3,7 @@ error[E0571]: `break` with value from a `for` loop
|
LL | break 22
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
+ |
help: instead, use `break` on its own without a value inside this `for` loop
|
LL | break
diff --git a/src/test/ui/loops/loop-break-value.stderr b/src/test/ui/loops/loop-break-value.stderr
index fef5b5873068f..b2e3ebc53ad8e 100644
--- a/src/test/ui/loops/loop-break-value.stderr
+++ b/src/test/ui/loops/loop-break-value.stderr
@@ -11,6 +11,7 @@ error[E0571]: `break` with value from a `while` loop
|
LL | break ();
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
+ |
help: instead, use `break` on its own without a value inside this `while` loop
|
LL | break;
@@ -21,6 +22,7 @@ error[E0571]: `break` with value from a `while` loop
|
LL | break 'while_loop 123;
| ^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
+ |
help: instead, use `break` on its own without a value inside this `while` loop
|
LL | break;
@@ -31,6 +33,7 @@ error[E0571]: `break` with value from a `while let` loop
|
LL | if break () {
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
+ |
help: instead, use `break` on its own without a value inside this `while let` loop
|
LL | if break {
@@ -41,6 +44,7 @@ error[E0571]: `break` with value from a `while let` loop
|
LL | break None;
| ^^^^^^^^^^ can only break with a value inside `loop` or breakable block
+ |
help: instead, use `break` on its own without a value inside this `while let` loop
|
LL | break;
@@ -51,6 +55,7 @@ error[E0571]: `break` with value from a `while let` loop
|
LL | break 'while_let_loop "nope";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
+ |
help: instead, use `break` on its own without a value inside this `while let` loop
|
LL | break;
@@ -61,6 +66,7 @@ error[E0571]: `break` with value from a `for` loop
|
LL | break ();
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
+ |
help: instead, use `break` on its own without a value inside this `for` loop
|
LL | break;
@@ -71,6 +77,7 @@ error[E0571]: `break` with value from a `for` loop
|
LL | break [()];
| ^^^^^^^^^^ can only break with a value inside `loop` or breakable block
+ |
help: instead, use `break` on its own without a value inside this `for` loop
|
LL | break;
@@ -81,6 +88,7 @@ error[E0571]: `break` with value from a `for` loop
|
LL | break 'for_loop Some(17);
| ^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
+ |
help: instead, use `break` on its own without a value inside this `for` loop
|
LL | break;
diff --git a/src/test/ui/macros/bad_hello.stderr b/src/test/ui/macros/bad_hello.stderr
index ab3cbf058baa5..6ef4cdcb0200e 100644
--- a/src/test/ui/macros/bad_hello.stderr
+++ b/src/test/ui/macros/bad_hello.stderr
@@ -3,6 +3,7 @@ error: format argument must be a string literal
|
LL | println!(3 + 4);
| ^^^^^
+ |
help: you might be missing a string literal to format with
|
LL | println!("{}", 3 + 4);
@@ -13,6 +14,7 @@ error: format argument must be a string literal
|
LL | println!(3, 4);
| ^
+ |
help: you might be missing a string literal to format with
|
LL | println!("{} {}", 3, 4);
diff --git a/src/test/ui/macros/derive-in-eager-expansion-hang.stderr b/src/test/ui/macros/derive-in-eager-expansion-hang.stderr
index 5ca4088e585db..0e2fb4c8af513 100644
--- a/src/test/ui/macros/derive-in-eager-expansion-hang.stderr
+++ b/src/test/ui/macros/derive-in-eager-expansion-hang.stderr
@@ -11,6 +11,7 @@ LL | | }
...
LL | format_args!(hang!());
| ------- in this macro invocation
+ |
help: you might be missing a string literal to format with
|
LL | format_args!("{}", hang!());
diff --git a/src/test/ui/macros/format-parse-errors.stderr b/src/test/ui/macros/format-parse-errors.stderr
index 906738d738232..02b704299ff05 100644
--- a/src/test/ui/macros/format-parse-errors.stderr
+++ b/src/test/ui/macros/format-parse-errors.stderr
@@ -43,6 +43,7 @@ error: format argument must be a string literal
|
LL | format!(123);
| ^^^
+ |
help: you might be missing a string literal to format with
|
LL | format!("{}", 123);
diff --git a/src/test/ui/macros/issue-30143.stderr b/src/test/ui/macros/issue-30143.stderr
index f0c604a23ffa4..19d977f69a210 100644
--- a/src/test/ui/macros/issue-30143.stderr
+++ b/src/test/ui/macros/issue-30143.stderr
@@ -3,6 +3,7 @@ error: format argument must be a string literal
|
LL | println!(0);
| ^
+ |
help: you might be missing a string literal to format with
|
LL | println!("{}", 0);
@@ -13,6 +14,7 @@ error: format argument must be a string literal
|
LL | eprintln!('a');
| ^^^
+ |
help: you might be missing a string literal to format with
|
LL | eprintln!("{}", 'a');
@@ -23,6 +25,7 @@ error: format argument must be a string literal
|
LL | writeln!(s, true).unwrap();
| ^^^^
+ |
help: you might be missing a string literal to format with
|
LL | writeln!(s, "{}", true).unwrap();
diff --git a/src/test/ui/macros/macro-backtrace-invalid-internals.stderr b/src/test/ui/macros/macro-backtrace-invalid-internals.stderr
index 96054de801c1f..85dee9f24fe2f 100644
--- a/src/test/ui/macros/macro-backtrace-invalid-internals.stderr
+++ b/src/test/ui/macros/macro-backtrace-invalid-internals.stderr
@@ -33,6 +33,7 @@ LL | 2.0.neg()
...
LL | real_method_stmt!();
| -------------------- in this macro invocation
+ |
help: you must specify a concrete type for this numeric value, like `f32`
|
LL | 2.0_f32.neg()
@@ -73,6 +74,7 @@ LL | 2.0.neg()
...
LL | let _ = real_method_expr!();
| ------------------- in this macro invocation
+ |
help: you must specify a concrete type for this numeric value, like `f32`
|
LL | 2.0_f32.neg()
diff --git a/src/test/ui/macros/macro-outer-attributes.stderr b/src/test/ui/macros/macro-outer-attributes.stderr
index 838333b95c0d5..86a6baca05324 100644
--- a/src/test/ui/macros/macro-outer-attributes.stderr
+++ b/src/test/ui/macros/macro-outer-attributes.stderr
@@ -3,6 +3,7 @@ error[E0425]: cannot find function `bar` in module `a`
|
LL | a::bar();
| ^^^ not found in `a`
+ |
help: possible candidate is found in another module, you can import it into scope
|
LL | use b::bar;
diff --git a/src/test/ui/macros/macros-nonfatal-errors.stderr b/src/test/ui/macros/macros-nonfatal-errors.stderr
index f0ea5761bc8db..b2fdbb736c8fc 100644
--- a/src/test/ui/macros/macros-nonfatal-errors.stderr
+++ b/src/test/ui/macros/macros-nonfatal-errors.stderr
@@ -45,6 +45,7 @@ error: format argument must be a string literal
|
LL | format!(invalid);
| ^^^^^^^
+ |
help: you might be missing a string literal to format with
|
LL | format!("{}", invalid);
diff --git a/src/test/ui/malformed/malformed-unwind-2.stderr b/src/test/ui/malformed/malformed-unwind-2.stderr
index ed88b9afd8758..28512bf9ef10f 100644
--- a/src/test/ui/malformed/malformed-unwind-2.stderr
+++ b/src/test/ui/malformed/malformed-unwind-2.stderr
@@ -3,6 +3,7 @@ error[E0633]: malformed `unwind` attribute input
|
LL | #[unwind(allowed, aborts)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid argument
+ |
help: the allowed arguments are `allowed` and `aborts`
|
LL | #[unwind(allowed)]
@@ -15,6 +16,7 @@ error[E0633]: malformed `unwind` attribute input
|
LL | #[unwind(unsupported)]
| ^^^^^^^^^^^^^^^^^^^^^^ invalid argument
+ |
help: the allowed arguments are `allowed` and `aborts`
|
LL | #[unwind(allowed)]
diff --git a/src/test/ui/meta-expected-error-correct-rev.a.stderr b/src/test/ui/meta-expected-error-correct-rev.a.stderr
index db1d5070e7fa1..968b87288c015 100644
--- a/src/test/ui/meta-expected-error-correct-rev.a.stderr
+++ b/src/test/ui/meta-expected-error-correct-rev.a.stderr
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
|
LL | let x: u32 = 22_usize;
| ^^^^^^^^ expected u32, found usize
+ |
help: change the type of the numeric literal from `usize` to `u32`
|
LL | let x: u32 = 22_u32;
diff --git a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
index b1bd749bef4a2..8dfbde92f646b 100644
--- a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
+++ b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
@@ -11,6 +11,7 @@ error[E0308]: mismatched types
|
LL | let y: usize = x.foo();
| ^^^^^^^ expected usize, found isize
+ |
help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
|
LL | let y: usize = x.foo().try_into().unwrap();
diff --git a/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr b/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr
index 40e765abe2784..d9e250882e1c1 100644
--- a/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr
+++ b/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr
@@ -3,6 +3,7 @@ error[E0689]: can't call method `neg` on ambiguous numeric type `{float}`
|
LL | let x = 2.0.neg();
| ^^^
+ |
help: you must specify a concrete type for this numeric value, like `f32`
|
LL | let x = 2.0_f32.neg();
@@ -13,6 +14,7 @@ error[E0689]: can't call method `neg` on ambiguous numeric type `{float}`
|
LL | let x = y.neg();
| ^^^
+ |
help: you must specify a type for this binding, like `f32`
|
LL | let y: f32 = 2.0;
@@ -31,6 +33,7 @@ error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}`
|
LL | local_bar.pow(2);
| ^^^
+ |
help: you must specify a type for this binding, like `i32`
|
LL | ($ident:ident) => { let $ident: i32 = 42; }
diff --git a/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr b/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr
index 00a4f9d48ffe5..a8da87d60bf94 100644
--- a/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr
+++ b/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr
@@ -5,6 +5,7 @@ LL | let _n = m.iter().map(|_, b| {
| ^^^ ------ takes 2 distinct arguments
| |
| expected closure that takes a single 2-tuple as argument
+ |
help: change the closure to accept a tuple instead of individual arguments
|
LL | let _n = m.iter().map(|(_, b)| {
diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr
index ed2b3f0c3ce6c..13954343246fa 100644
--- a/src/test/ui/mismatched_types/closure-arg-count.stderr
+++ b/src/test/ui/mismatched_types/closure-arg-count.stderr
@@ -5,6 +5,7 @@ LL | [1, 2, 3].sort_by(|| panic!());
| ^^^^^^^ -- takes 0 arguments
| |
| expected closure that takes 2 arguments
+ |
help: consider changing the closure to take and ignore the expected arguments
|
LL | [1, 2, 3].sort_by(|_, _| panic!());
@@ -25,6 +26,7 @@ LL | [1, 2, 3].sort_by(|(tuple, tuple2)| panic!());
| ^^^^^^^ ----------------- takes a single 2-tuple as argument
| |
| expected closure that takes 2 distinct arguments
+ |
help: change the closure to take multiple arguments instead of a single tuple
|
LL | [1, 2, 3].sort_by(|tuple, tuple2| panic!());
@@ -37,6 +39,7 @@ LL | [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!());
| ^^^^^^^ ----------------------------- takes a single 2-tuple as argument
| |
| expected closure that takes 2 distinct arguments
+ |
help: change the closure to take multiple arguments instead of a single tuple
|
LL | [1, 2, 3].sort_by(|tuple, tuple2| panic!());
@@ -52,6 +55,7 @@ LL | f(|| panic!());
| ^ -- takes 0 arguments
| |
| expected closure that takes 1 argument
+ |
help: consider changing the closure to take and ignore the expected argument
|
LL | f(|_| panic!());
@@ -67,6 +71,7 @@ LL | f( move || panic!());
| ^ ---------- takes 0 arguments
| |
| expected closure that takes 1 argument
+ |
help: consider changing the closure to take and ignore the expected argument
|
LL | f( move |_| panic!());
@@ -79,6 +84,7 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
| ^^^ ------ takes 2 distinct arguments
| |
| expected closure that takes a single 2-tuple as argument
+ |
help: change the closure to accept a tuple instead of individual arguments
|
LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
@@ -91,6 +97,7 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i);
| ^^^ ------------- takes 2 distinct arguments
| |
| expected closure that takes a single 2-tuple as argument
+ |
help: change the closure to accept a tuple instead of individual arguments
|
LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i);
diff --git a/src/test/ui/mismatched_types/issue-26480.stderr b/src/test/ui/mismatched_types/issue-26480.stderr
index 881d9fd32029e..9d5cd6eeb556c 100644
--- a/src/test/ui/mismatched_types/issue-26480.stderr
+++ b/src/test/ui/mismatched_types/issue-26480.stderr
@@ -6,6 +6,7 @@ LL | $arr.len() * size_of($arr[0]));
...
LL | write!(hello);
| -------------- in this macro invocation
+ |
help: you can convert an `usize` to `u64` and panic if the converted value wouldn't fit
|
LL | ($arr.len() * size_of($arr[0])).try_into().unwrap());
diff --git a/src/test/ui/mismatched_types/numeric-literal-cast.stderr b/src/test/ui/mismatched_types/numeric-literal-cast.stderr
index ec53f1f0ecc8d..47ba1d26be50b 100644
--- a/src/test/ui/mismatched_types/numeric-literal-cast.stderr
+++ b/src/test/ui/mismatched_types/numeric-literal-cast.stderr
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
|
LL | foo(1u8);
| ^^^ expected u16, found u8
+ |
help: change the type of the numeric literal from `u8` to `u16`
|
LL | foo(1u16);
@@ -13,6 +14,7 @@ error[E0308]: mismatched types
|
LL | foo1(2f32);
| ^^^^ expected f64, found f32
+ |
help: change the type of the numeric literal from `f32` to `f64`
|
LL | foo1(2f64);
@@ -23,6 +25,7 @@ error[E0308]: mismatched types
|
LL | foo2(3i16);
| ^^^^ expected i32, found i16
+ |
help: change the type of the numeric literal from `i16` to `i32`
|
LL | foo2(3i32);
diff --git a/src/test/ui/mismatched_types/recovered-block.stderr b/src/test/ui/mismatched_types/recovered-block.stderr
index 7834750630bf3..207dc78a4b967 100644
--- a/src/test/ui/mismatched_types/recovered-block.stderr
+++ b/src/test/ui/mismatched_types/recovered-block.stderr
@@ -3,6 +3,7 @@ error: missing `struct` for struct definition
|
LL | pub Foo { text }
| ^
+ |
help: add `struct` here to parse `Foo` as a public struct
|
LL | pub struct Foo { text }
diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr
index 77da07f40d536..c3f2c79fdd21e 100644
--- a/src/test/ui/namespace/namespace-mix.stderr
+++ b/src/test/ui/namespace/namespace-mix.stderr
@@ -42,6 +42,7 @@ LL | V {},
...
LL | check(m7::V);
| ^^^^^ did you mean `m7::V { /* fields */ }`?
+ |
help: a tuple variant with a similar name exists
|
LL | check(m7::TV);
@@ -58,6 +59,7 @@ error[E0423]: expected value, found struct variant `xm7::V`
|
LL | check(xm7::V);
| ^^^^^^ did you mean `xm7::V { /* fields */ }`?
+ |
help: a tuple variant with a similar name exists
|
LL | check(xm7::TV);
diff --git a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr
index 3a1e3ce3ad1a0..f6a86aa43b534 100644
--- a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr
+++ b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr
@@ -3,6 +3,7 @@ error[E0621]: explicit lifetime required in the type of `x`
|
LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> {
| ^^^^^^^^^^^^ lifetime `ReEarlyBound(0, 'a)` required
+ |
help: add explicit lifetime `ReEarlyBound(0, 'a)` to the type of `x`
|
LL | fn foo<'a, T>(x: &ReEarlyBound(0, 'a) T) -> impl Foo<'a> {
diff --git a/src/test/ui/no-implicit-prelude-nested.stderr b/src/test/ui/no-implicit-prelude-nested.stderr
index 8d695e45da457..e57d8af5f99b9 100644
--- a/src/test/ui/no-implicit-prelude-nested.stderr
+++ b/src/test/ui/no-implicit-prelude-nested.stderr
@@ -3,6 +3,7 @@ error[E0405]: cannot find trait `Add` in this scope
|
LL | impl Add for Test {}
| ^^^ not found in this scope
+ |
help: possible candidate is found in another module, you can import it into scope
|
LL | use std::ops::Add;
@@ -13,6 +14,7 @@ error[E0404]: expected trait, found derive macro `Clone`
|
LL | impl Clone for Test {}
| ^^^^^ not a trait
+ |
help: possible better candidates are found in other modules, you can import them into scope
|
LL | use std::clone::Clone;
@@ -25,6 +27,7 @@ error[E0405]: cannot find trait `Iterator` in this scope
|
LL | impl Iterator for Test {}
| ^^^^^^^^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use std::iter::Iterator;
@@ -37,6 +40,7 @@ error[E0405]: cannot find trait `ToString` in this scope
|
LL | impl ToString for Test {}
| ^^^^^^^^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use std::prelude::v1::ToString;
@@ -55,6 +59,7 @@ error[E0425]: cannot find function `drop` in this scope
|
LL | drop(2)
| ^^^^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use std::mem::drop;
@@ -67,6 +72,7 @@ error[E0405]: cannot find trait `Add` in this scope
|
LL | impl Add for Test {}
| ^^^ not found in this scope
+ |
help: possible candidate is found in another module, you can import it into scope
|
LL | use std::ops::Add;
@@ -77,6 +83,7 @@ error[E0404]: expected trait, found derive macro `Clone`
|
LL | impl Clone for Test {}
| ^^^^^ not a trait
+ |
help: possible better candidates are found in other modules, you can import them into scope
|
LL | use std::clone::Clone;
@@ -89,6 +96,7 @@ error[E0405]: cannot find trait `Iterator` in this scope
|
LL | impl Iterator for Test {}
| ^^^^^^^^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use std::iter::Iterator;
@@ -101,6 +109,7 @@ error[E0405]: cannot find trait `ToString` in this scope
|
LL | impl ToString for Test {}
| ^^^^^^^^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use std::prelude::v1::ToString;
@@ -119,6 +128,7 @@ error[E0425]: cannot find function `drop` in this scope
|
LL | drop(2)
| ^^^^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use std::mem::drop;
@@ -131,6 +141,7 @@ error[E0405]: cannot find trait `Add` in this scope
|
LL | impl Add for Test {}
| ^^^ not found in this scope
+ |
help: possible candidate is found in another module, you can import it into scope
|
LL | use std::ops::Add;
@@ -141,6 +152,7 @@ error[E0404]: expected trait, found derive macro `Clone`
|
LL | impl Clone for Test {}
| ^^^^^ not a trait
+ |
help: possible better candidates are found in other modules, you can import them into scope
|
LL | use std::clone::Clone;
@@ -153,6 +165,7 @@ error[E0405]: cannot find trait `Iterator` in this scope
|
LL | impl Iterator for Test {}
| ^^^^^^^^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use std::iter::Iterator;
@@ -165,6 +178,7 @@ error[E0405]: cannot find trait `ToString` in this scope
|
LL | impl ToString for Test {}
| ^^^^^^^^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use std::prelude::v1::ToString;
@@ -183,6 +197,7 @@ error[E0425]: cannot find function `drop` in this scope
|
LL | drop(2)
| ^^^^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use std::mem::drop;
diff --git a/src/test/ui/no-implicit-prelude.stderr b/src/test/ui/no-implicit-prelude.stderr
index 6ae889df602d7..8b99529f4dd7c 100644
--- a/src/test/ui/no-implicit-prelude.stderr
+++ b/src/test/ui/no-implicit-prelude.stderr
@@ -3,6 +3,7 @@ error[E0405]: cannot find trait `Add` in this scope
|
LL | impl Add for Test {}
| ^^^ not found in this scope
+ |
help: possible candidate is found in another module, you can import it into scope
|
LL | use std::ops::Add;
@@ -13,6 +14,7 @@ error[E0404]: expected trait, found derive macro `Clone`
|
LL | impl Clone for Test {}
| ^^^^^ not a trait
+ |
help: possible better candidates are found in other modules, you can import them into scope
|
LL | use std::clone::Clone;
@@ -25,6 +27,7 @@ error[E0405]: cannot find trait `Iterator` in this scope
|
LL | impl Iterator for Test {}
| ^^^^^^^^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use std::iter::Iterator;
@@ -37,6 +40,7 @@ error[E0405]: cannot find trait `ToString` in this scope
|
LL | impl ToString for Test {}
| ^^^^^^^^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use std::prelude::v1::ToString;
@@ -55,6 +59,7 @@ error[E0425]: cannot find function `drop` in this scope
|
LL | drop(2)
| ^^^^ not found in this scope
+ |
help: possible candidates are found in other modules, you can import them into scope
|
LL | use std::mem::drop;
diff --git a/src/test/ui/numeric/const-scope.stderr b/src/test/ui/numeric/const-scope.stderr
index 3f69bcc7d4a2f..c88495059224b 100644
--- a/src/test/ui/numeric/const-scope.stderr
+++ b/src/test/ui/numeric/const-scope.stderr
@@ -27,6 +27,7 @@ error[E0308]: mismatched types
|
LL | let c: i32 = 1i8;
| ^^^ expected i32, found i8
+ |
help: change the type of the numeric literal from `i8` to `i32`
|
LL | let c: i32 = 1i32;
@@ -37,6 +38,7 @@ error[E0308]: mismatched types
|
LL | let d: i8 = c;
| ^ expected i8, found i32
+ |
help: you can convert an `i32` to `i8` and panic if the converted value wouldn't fit
|
LL | let d: i8 = c.try_into().unwrap();
diff --git a/src/test/ui/numeric/len.stderr b/src/test/ui/numeric/len.stderr
index c767bdd9bd5a5..1e8bff7f04aab 100644
--- a/src/test/ui/numeric/len.stderr
+++ b/src/test/ui/numeric/len.stderr
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
|
LL | test(array.len());
| ^^^^^^^^^^^ expected u32, found usize
+ |
help: you can convert an `usize` to `u32` and panic if the converted value wouldn't fit
|
LL | test(array.len().try_into().unwrap());
diff --git a/src/test/ui/numeric/numeric-cast-2.stderr b/src/test/ui/numeric/numeric-cast-2.stderr
index f58389ce96c3b..9f08985bdb3c6 100644
--- a/src/test/ui/numeric/numeric-cast-2.stderr
+++ b/src/test/ui/numeric/numeric-cast-2.stderr
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
|
LL | let x: u16 = foo();
| ^^^^^ expected u16, found i32
+ |
help: you can convert an `i32` to `u16` and panic if the converted value wouldn't fit
|
LL | let x: u16 = foo().try_into().unwrap();
@@ -13,6 +14,7 @@ error[E0308]: mismatched types
|
LL | let y: i64 = x + x;
| ^^^^^ expected i64, found u16
+ |
help: you can convert an `u16` to `i64` and panic if the converted value wouldn't fit
|
LL | let y: i64 = (x + x).try_into().unwrap();
@@ -23,6 +25,7 @@ error[E0308]: mismatched types
|
LL | let z: i32 = x + x;
| ^^^^^ expected i32, found u16
+ |
help: you can convert an `u16` to `i32` and panic if the converted value wouldn't fit
|
LL | let z: i32 = (x + x).try_into().unwrap();
diff --git a/src/test/ui/numeric/numeric-cast.stderr b/src/test/ui/numeric/numeric-cast.stderr
index e66b83f2b39f5..983ea08402503 100644
--- a/src/test/ui/numeric/numeric-cast.stderr
+++ b/src/test/ui/numeric/numeric-cast.stderr
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u64);
| ^^^^^ expected usize, found u64
+ |
help: you can convert an `u64` to `usize` and panic if the converted value wouldn't fit
|
LL | foo::(x_u64.try_into().unwrap());
@@ -13,6 +14,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u32);
| ^^^^^ expected usize, found u32
+ |
help: you can convert an `u32` to `usize` and panic if the converted value wouldn't fit
|
LL | foo::(x_u32.try_into().unwrap());
@@ -23,6 +25,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u16);
| ^^^^^ expected usize, found u16
+ |
help: you can convert an `u16` to `usize` and panic if the converted value wouldn't fit
|
LL | foo::(x_u16.try_into().unwrap());
@@ -33,6 +36,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u8);
| ^^^^ expected usize, found u8
+ |
help: you can convert an `u8` to `usize` and panic if the converted value wouldn't fit
|
LL | foo::(x_u8.try_into().unwrap());
@@ -43,6 +47,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_isize);
| ^^^^^^^ expected usize, found isize
+ |
help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
|
LL | foo::(x_isize.try_into().unwrap());
@@ -53,6 +58,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i64);
| ^^^^^ expected usize, found i64
+ |
help: you can convert an `i64` to `usize` and panic if the converted value wouldn't fit
|
LL | foo::(x_i64.try_into().unwrap());
@@ -63,6 +69,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i32);
| ^^^^^ expected usize, found i32
+ |
help: you can convert an `i32` to `usize` and panic if the converted value wouldn't fit
|
LL | foo::(x_i32.try_into().unwrap());
@@ -73,6 +80,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i16);
| ^^^^^ expected usize, found i16
+ |
help: you can convert an `i16` to `usize` and panic if the converted value wouldn't fit
|
LL | foo::(x_i16.try_into().unwrap());
@@ -83,6 +91,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i8);
| ^^^^ expected usize, found i8
+ |
help: you can convert an `i8` to `usize` and panic if the converted value wouldn't fit
|
LL | foo::(x_i8.try_into().unwrap());
@@ -93,6 +102,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_usize);
| ^^^^^^^ expected isize, found usize
+ |
help: you can convert an `usize` to `isize` and panic if the converted value wouldn't fit
|
LL | foo::(x_usize.try_into().unwrap());
@@ -103,6 +113,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u64);
| ^^^^^ expected isize, found u64
+ |
help: you can convert an `u64` to `isize` and panic if the converted value wouldn't fit
|
LL | foo::(x_u64.try_into().unwrap());
@@ -113,6 +124,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u32);
| ^^^^^ expected isize, found u32
+ |
help: you can convert an `u32` to `isize` and panic if the converted value wouldn't fit
|
LL | foo::(x_u32.try_into().unwrap());
@@ -123,6 +135,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u16);
| ^^^^^ expected isize, found u16
+ |
help: you can convert an `u16` to `isize` and panic if the converted value wouldn't fit
|
LL | foo::(x_u16.try_into().unwrap());
@@ -133,6 +146,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u8);
| ^^^^ expected isize, found u8
+ |
help: you can convert an `u8` to `isize` and panic if the converted value wouldn't fit
|
LL | foo::(x_u8.try_into().unwrap());
@@ -143,6 +157,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i64);
| ^^^^^ expected isize, found i64
+ |
help: you can convert an `i64` to `isize` and panic if the converted value wouldn't fit
|
LL | foo::(x_i64.try_into().unwrap());
@@ -153,6 +168,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i32);
| ^^^^^ expected isize, found i32
+ |
help: you can convert an `i32` to `isize` and panic if the converted value wouldn't fit
|
LL | foo::(x_i32.try_into().unwrap());
@@ -163,6 +179,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i16);
| ^^^^^ expected isize, found i16
+ |
help: you can convert an `i16` to `isize` and panic if the converted value wouldn't fit
|
LL | foo::(x_i16.try_into().unwrap());
@@ -173,6 +190,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i8);
| ^^^^ expected isize, found i8
+ |
help: you can convert an `i8` to `isize` and panic if the converted value wouldn't fit
|
LL | foo::(x_i8.try_into().unwrap());
@@ -183,6 +201,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_usize);
| ^^^^^^^ expected u64, found usize
+ |
help: you can convert an `usize` to `u64` and panic if the converted value wouldn't fit
|
LL | foo::(x_usize.try_into().unwrap());
@@ -220,6 +239,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_isize);
| ^^^^^^^ expected u64, found isize
+ |
help: you can convert an `isize` to `u64` and panic if the converted value wouldn't fit
|
LL | foo::(x_isize.try_into().unwrap());
@@ -230,6 +250,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i64);
| ^^^^^ expected u64, found i64
+ |
help: you can convert an `i64` to `u64` and panic if the converted value wouldn't fit
|
LL | foo::(x_i64.try_into().unwrap());
@@ -240,6 +261,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i32);
| ^^^^^ expected u64, found i32
+ |
help: you can convert an `i32` to `u64` and panic if the converted value wouldn't fit
|
LL | foo::(x_i32.try_into().unwrap());
@@ -250,6 +272,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i16);
| ^^^^^ expected u64, found i16
+ |
help: you can convert an `i16` to `u64` and panic if the converted value wouldn't fit
|
LL | foo::(x_i16.try_into().unwrap());
@@ -260,6 +283,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i8);
| ^^^^ expected u64, found i8
+ |
help: you can convert an `i8` to `u64` and panic if the converted value wouldn't fit
|
LL | foo::(x_i8.try_into().unwrap());
@@ -270,6 +294,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_usize);
| ^^^^^^^ expected i64, found usize
+ |
help: you can convert an `usize` to `i64` and panic if the converted value wouldn't fit
|
LL | foo::(x_usize.try_into().unwrap());
@@ -280,6 +305,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u64);
| ^^^^^ expected i64, found u64
+ |
help: you can convert an `u64` to `i64` and panic if the converted value wouldn't fit
|
LL | foo::(x_u64.try_into().unwrap());
@@ -290,6 +316,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u32);
| ^^^^^ expected i64, found u32
+ |
help: you can convert an `u32` to `i64` and panic if the converted value wouldn't fit
|
LL | foo::(x_u32.try_into().unwrap());
@@ -300,6 +327,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u16);
| ^^^^^ expected i64, found u16
+ |
help: you can convert an `u16` to `i64` and panic if the converted value wouldn't fit
|
LL | foo::(x_u16.try_into().unwrap());
@@ -310,6 +338,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u8);
| ^^^^ expected i64, found u8
+ |
help: you can convert an `u8` to `i64` and panic if the converted value wouldn't fit
|
LL | foo::(x_u8.try_into().unwrap());
@@ -320,6 +349,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_isize);
| ^^^^^^^ expected i64, found isize
+ |
help: you can convert an `isize` to `i64` and panic if the converted value wouldn't fit
|
LL | foo::(x_isize.try_into().unwrap());
@@ -357,6 +387,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_usize);
| ^^^^^^^ expected u32, found usize
+ |
help: you can convert an `usize` to `u32` and panic if the converted value wouldn't fit
|
LL | foo::(x_usize.try_into().unwrap());
@@ -367,6 +398,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u64);
| ^^^^^ expected u32, found u64
+ |
help: you can convert an `u64` to `u32` and panic if the converted value wouldn't fit
|
LL | foo::(x_u64.try_into().unwrap());
@@ -395,6 +427,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_isize);
| ^^^^^^^ expected u32, found isize
+ |
help: you can convert an `isize` to `u32` and panic if the converted value wouldn't fit
|
LL | foo::(x_isize.try_into().unwrap());
@@ -405,6 +438,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i64);
| ^^^^^ expected u32, found i64
+ |
help: you can convert an `i64` to `u32` and panic if the converted value wouldn't fit
|
LL | foo::(x_i64.try_into().unwrap());
@@ -415,6 +449,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i32);
| ^^^^^ expected u32, found i32
+ |
help: you can convert an `i32` to `u32` and panic if the converted value wouldn't fit
|
LL | foo::(x_i32.try_into().unwrap());
@@ -425,6 +460,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i16);
| ^^^^^ expected u32, found i16
+ |
help: you can convert an `i16` to `u32` and panic if the converted value wouldn't fit
|
LL | foo::(x_i16.try_into().unwrap());
@@ -435,6 +471,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i8);
| ^^^^ expected u32, found i8
+ |
help: you can convert an `i8` to `u32` and panic if the converted value wouldn't fit
|
LL | foo::(x_i8.try_into().unwrap());
@@ -445,6 +482,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_usize);
| ^^^^^^^ expected i32, found usize
+ |
help: you can convert an `usize` to `i32` and panic if the converted value wouldn't fit
|
LL | foo::(x_usize.try_into().unwrap());
@@ -455,6 +493,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u64);
| ^^^^^ expected i32, found u64
+ |
help: you can convert an `u64` to `i32` and panic if the converted value wouldn't fit
|
LL | foo::(x_u64.try_into().unwrap());
@@ -465,6 +504,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u32);
| ^^^^^ expected i32, found u32
+ |
help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit
|
LL | foo::(x_u32.try_into().unwrap());
@@ -475,6 +515,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u16);
| ^^^^^ expected i32, found u16
+ |
help: you can convert an `u16` to `i32` and panic if the converted value wouldn't fit
|
LL | foo::(x_u16.try_into().unwrap());
@@ -485,6 +526,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u8);
| ^^^^ expected i32, found u8
+ |
help: you can convert an `u8` to `i32` and panic if the converted value wouldn't fit
|
LL | foo::(x_u8.try_into().unwrap());
@@ -495,6 +537,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_isize);
| ^^^^^^^ expected i32, found isize
+ |
help: you can convert an `isize` to `i32` and panic if the converted value wouldn't fit
|
LL | foo::(x_isize.try_into().unwrap());
@@ -505,6 +548,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i64);
| ^^^^^ expected i32, found i64
+ |
help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit
|
LL | foo::(x_i64.try_into().unwrap());
@@ -533,6 +577,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_usize);
| ^^^^^^^ expected u16, found usize
+ |
help: you can convert an `usize` to `u16` and panic if the converted value wouldn't fit
|
LL | foo::(x_usize.try_into().unwrap());
@@ -543,6 +588,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u64);
| ^^^^^ expected u16, found u64
+ |
help: you can convert an `u64` to `u16` and panic if the converted value wouldn't fit
|
LL | foo::(x_u64.try_into().unwrap());
@@ -553,6 +599,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u32);
| ^^^^^ expected u16, found u32
+ |
help: you can convert an `u32` to `u16` and panic if the converted value wouldn't fit
|
LL | foo::(x_u32.try_into().unwrap());
@@ -572,6 +619,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_isize);
| ^^^^^^^ expected u16, found isize
+ |
help: you can convert an `isize` to `u16` and panic if the converted value wouldn't fit
|
LL | foo::(x_isize.try_into().unwrap());
@@ -582,6 +630,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i64);
| ^^^^^ expected u16, found i64
+ |
help: you can convert an `i64` to `u16` and panic if the converted value wouldn't fit
|
LL | foo::(x_i64.try_into().unwrap());
@@ -592,6 +641,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i32);
| ^^^^^ expected u16, found i32
+ |
help: you can convert an `i32` to `u16` and panic if the converted value wouldn't fit
|
LL | foo::(x_i32.try_into().unwrap());
@@ -602,6 +652,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i16);
| ^^^^^ expected u16, found i16
+ |
help: you can convert an `i16` to `u16` and panic if the converted value wouldn't fit
|
LL | foo::(x_i16.try_into().unwrap());
@@ -612,6 +663,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i8);
| ^^^^ expected u16, found i8
+ |
help: you can convert an `i8` to `u16` and panic if the converted value wouldn't fit
|
LL | foo::(x_i8.try_into().unwrap());
@@ -622,6 +674,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_usize);
| ^^^^^^^ expected i16, found usize
+ |
help: you can convert an `usize` to `i16` and panic if the converted value wouldn't fit
|
LL | foo::(x_usize.try_into().unwrap());
@@ -632,6 +685,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u64);
| ^^^^^ expected i16, found u64
+ |
help: you can convert an `u64` to `i16` and panic if the converted value wouldn't fit
|
LL | foo::(x_u64.try_into().unwrap());
@@ -642,6 +696,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u32);
| ^^^^^ expected i16, found u32
+ |
help: you can convert an `u32` to `i16` and panic if the converted value wouldn't fit
|
LL | foo::(x_u32.try_into().unwrap());
@@ -652,6 +707,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u16);
| ^^^^^ expected i16, found u16
+ |
help: you can convert an `u16` to `i16` and panic if the converted value wouldn't fit
|
LL | foo::(x_u16.try_into().unwrap());
@@ -662,6 +718,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u8);
| ^^^^ expected i16, found u8
+ |
help: you can convert an `u8` to `i16` and panic if the converted value wouldn't fit
|
LL | foo::(x_u8.try_into().unwrap());
@@ -672,6 +729,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_isize);
| ^^^^^^^ expected i16, found isize
+ |
help: you can convert an `isize` to `i16` and panic if the converted value wouldn't fit
|
LL | foo::(x_isize.try_into().unwrap());
@@ -682,6 +740,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i64);
| ^^^^^ expected i16, found i64
+ |
help: you can convert an `i64` to `i16` and panic if the converted value wouldn't fit
|
LL | foo::(x_i64.try_into().unwrap());
@@ -692,6 +751,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i32);
| ^^^^^ expected i16, found i32
+ |
help: you can convert an `i32` to `i16` and panic if the converted value wouldn't fit
|
LL | foo::(x_i32.try_into().unwrap());
@@ -711,6 +771,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_usize);
| ^^^^^^^ expected u8, found usize
+ |
help: you can convert an `usize` to `u8` and panic if the converted value wouldn't fit
|
LL | foo::(x_usize.try_into().unwrap());
@@ -721,6 +782,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u64);
| ^^^^^ expected u8, found u64
+ |
help: you can convert an `u64` to `u8` and panic if the converted value wouldn't fit
|
LL | foo::(x_u64.try_into().unwrap());
@@ -731,6 +793,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u32);
| ^^^^^ expected u8, found u32
+ |
help: you can convert an `u32` to `u8` and panic if the converted value wouldn't fit
|
LL | foo::(x_u32.try_into().unwrap());
@@ -741,6 +804,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u16);
| ^^^^^ expected u8, found u16
+ |
help: you can convert an `u16` to `u8` and panic if the converted value wouldn't fit
|
LL | foo::(x_u16.try_into().unwrap());
@@ -751,6 +815,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_isize);
| ^^^^^^^ expected u8, found isize
+ |
help: you can convert an `isize` to `u8` and panic if the converted value wouldn't fit
|
LL | foo::(x_isize.try_into().unwrap());
@@ -761,6 +826,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i64);
| ^^^^^ expected u8, found i64
+ |
help: you can convert an `i64` to `u8` and panic if the converted value wouldn't fit
|
LL | foo::(x_i64.try_into().unwrap());
@@ -771,6 +837,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i32);
| ^^^^^ expected u8, found i32
+ |
help: you can convert an `i32` to `u8` and panic if the converted value wouldn't fit
|
LL | foo::(x_i32.try_into().unwrap());
@@ -781,6 +848,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i16);
| ^^^^^ expected u8, found i16
+ |
help: you can convert an `i16` to `u8` and panic if the converted value wouldn't fit
|
LL | foo::(x_i16.try_into().unwrap());
@@ -791,6 +859,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i8);
| ^^^^ expected u8, found i8
+ |
help: you can convert an `i8` to `u8` and panic if the converted value wouldn't fit
|
LL | foo::(x_i8.try_into().unwrap());
@@ -801,6 +870,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_usize);
| ^^^^^^^ expected i8, found usize
+ |
help: you can convert an `usize` to `i8` and panic if the converted value wouldn't fit
|
LL | foo::(x_usize.try_into().unwrap());
@@ -811,6 +881,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u64);
| ^^^^^ expected i8, found u64
+ |
help: you can convert an `u64` to `i8` and panic if the converted value wouldn't fit
|
LL | foo::(x_u64.try_into().unwrap());
@@ -821,6 +892,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u32);
| ^^^^^ expected i8, found u32
+ |
help: you can convert an `u32` to `i8` and panic if the converted value wouldn't fit
|
LL | foo::(x_u32.try_into().unwrap());
@@ -831,6 +903,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u16);
| ^^^^^ expected i8, found u16
+ |
help: you can convert an `u16` to `i8` and panic if the converted value wouldn't fit
|
LL | foo::(x_u16.try_into().unwrap());
@@ -841,6 +914,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u8);
| ^^^^ expected i8, found u8
+ |
help: you can convert an `u8` to `i8` and panic if the converted value wouldn't fit
|
LL | foo::(x_u8.try_into().unwrap());
@@ -851,6 +925,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_isize);
| ^^^^^^^ expected i8, found isize
+ |
help: you can convert an `isize` to `i8` and panic if the converted value wouldn't fit
|
LL | foo::(x_isize.try_into().unwrap());
@@ -861,6 +936,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i64);
| ^^^^^ expected i8, found i64
+ |
help: you can convert an `i64` to `i8` and panic if the converted value wouldn't fit
|
LL | foo::(x_i64.try_into().unwrap());
@@ -871,6 +947,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i32);
| ^^^^^ expected i8, found i32
+ |
help: you can convert an `i32` to `i8` and panic if the converted value wouldn't fit
|
LL | foo::(x_i32.try_into().unwrap());
@@ -881,6 +958,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i16);
| ^^^^^ expected i8, found i16
+ |
help: you can convert an `i16` to `i8` and panic if the converted value wouldn't fit
|
LL | foo::(x_i16.try_into().unwrap());
@@ -891,6 +969,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_usize);
| ^^^^^^^ expected f64, found usize
+ |
help: you can cast an `usize to `f64`, producing the floating point representation of the integer,
| rounded if necessary
LL | foo::(x_usize as f64);
@@ -901,6 +980,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u64);
| ^^^^^ expected f64, found u64
+ |
help: you can cast an `u64 to `f64`, producing the floating point representation of the integer,
| rounded if necessary
LL | foo::(x_u64 as f64);
@@ -911,6 +991,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u32);
| ^^^^^ expected f64, found u32
+ |
help: you can convert an `u32` to `f64`, producing the floating point representation of the integer
|
LL | foo::(x_u32.into());
@@ -921,6 +1002,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u16);
| ^^^^^ expected f64, found u16
+ |
help: you can convert an `u16` to `f64`, producing the floating point representation of the integer
|
LL | foo::(x_u16.into());
@@ -931,6 +1013,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u8);
| ^^^^ expected f64, found u8
+ |
help: you can convert an `u8` to `f64`, producing the floating point representation of the integer
|
LL | foo::(x_u8.into());
@@ -941,6 +1024,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_isize);
| ^^^^^^^ expected f64, found isize
+ |
help: you can convert an `isize` to `f64`, producing the floating point representation of the integer, rounded if necessary
|
LL | foo::(x_isize as f64);
@@ -951,6 +1035,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i64);
| ^^^^^ expected f64, found i64
+ |
help: you can convert an `i64` to `f64`, producing the floating point representation of the integer, rounded if necessary
|
LL | foo::(x_i64 as f64);
@@ -961,6 +1046,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i32);
| ^^^^^ expected f64, found i32
+ |
help: you can convert an `i32` to `f64`, producing the floating point representation of the integer
|
LL | foo::(x_i32.into());
@@ -971,6 +1057,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i16);
| ^^^^^ expected f64, found i16
+ |
help: you can convert an `i16` to `f64`, producing the floating point representation of the integer
|
LL | foo::(x_i16.into());
@@ -981,6 +1068,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_i8);
| ^^^^ expected f64, found i8
+ |
help: you can convert an `i8` to `f64`, producing the floating point representation of the integer
|
LL | foo::(x_i8.into());
@@ -1000,6 +1088,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_usize);
| ^^^^^^^ expected f32, found usize
+ |
help: you can cast an `usize to `f32`, producing the floating point representation of the integer,
| rounded if necessary
LL | foo::(x_usize as f32);
@@ -1010,6 +1099,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u64);
| ^^^^^ expected f32, found u64
+ |
help: you can cast an `u64 to `f32`, producing the floating point representation of the integer,
| rounded if necessary
LL | foo::(x_u64 as f32);
@@ -1020,6 +1110,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u32);
| ^^^^^ expected f32, found u32
+ |
help: you can cast an `u32 to `f32`, producing the floating point representation of the integer,
| rounded if necessary
LL | foo::(x_u32 as f32);
@@ -1030,6 +1121,7 @@ error[E0308]: mismatched types
|
LL | foo::(x_u16);
| ^^^^^ expected f32, found u16
+ |
help: you can convert an `u16` to `f32`, producing the floating point representation of the integer
|
LL | foo::(x_u16.into());
@@ -1040,6 +1132,7 @@ error[E0308]: mismatched types
|
LL | foo::