From d717806363e71332c1563d33ffa0aed97cbbcdbd Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Thu, 24 Oct 2019 01:58:25 +0300 Subject: [PATCH 01/10] rustc_typeck: don't record direct callees in generator_interior. --- .../check/generator_interior.rs | 31 +++++++++++++++++-- .../ui/async-await/async-fn-nonsend.stderr | 24 +++++++------- 2 files changed, 41 insertions(+), 14 deletions(-) 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/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` From 1a93bc5c35126f318dd53ac5104879ca673f61b3 Mon Sep 17 00:00:00 2001 From: Mark Mansi Date: Thu, 24 Oct 2019 13:32:54 -0500 Subject: [PATCH 02/10] remove the last remaining READMEs --- src/README.md | 3 - .../infer/lexical_region_resolve/README.md | 269 +----------------- src/librustc_codegen_ssa/README.md | 122 +------- src/librustc_incremental/persist/README.md | 14 +- 4 files changed, 8 insertions(+), 400 deletions(-) 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/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_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_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 From 0baf61bfdb95980c69fbfcc0fc95ce82e8d81ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 23 Oct 2019 22:20:58 -0700 Subject: [PATCH 03/10] Increase spacing for suggestions in diagnostics Make the spacing between the code snippet and verbose structured suggestions consistent with note and help messages. --- src/librustc_errors/emitter.rs | 13 ++ .../rustdoc-ui/intra-links-ambiguity.stderr | 4 + src/test/rustdoc-ui/invalid-syntax.stderr | 11 ++ .../associated-types-path-2.stderr | 2 + ...edition-error-in-non-macro-position.stderr | 7 + .../await-keyword/2018-edition-error.stderr | 5 + src/test/ui/async-await/no-const-async.stderr | 1 + src/test/ui/bad/bad-crate-name.stderr | 1 + .../borrowck-vec-pattern-nesting.stderr | 2 + src/test/ui/class-missing-self.stderr | 1 + .../issue-18343.stderr | 1 + .../issue-2392.stderr | 9 ++ .../issue-32128.stderr | 1 + .../issue-33784.stderr | 3 + src/test/ui/consts/enum-discr-type-err.stderr | 1 + src/test/ui/crate-in-paths.stderr | 1 + .../ui/deprecation/invalid-literal.stderr | 1 + src/test/ui/did_you_mean/issue-40396.stderr | 3 + ...issue-43871-enum-instead-of-variant.stderr | 4 + ...92-tuple-destructure-missing-parens.stderr | 6 + ...de-confusable-in-float-literal-expt.stderr | 1 + ...ssue-56028-there-is-an-enum-variant.stderr | 2 + src/test/ui/discrim/discrim-ill-typed.stderr | 8 ++ src/test/ui/dotdotdot-expr.stderr | 1 + .../edition-keywords-2018-2015-parsing.stderr | 2 + .../edition-keywords-2018-2018-parsing.stderr | 2 + .../ui/empty/empty-struct-unit-expr.stderr | 2 + src/test/ui/error-codes/E0023.stderr | 2 + src/test/ui/error-codes/E0423.stderr | 2 + src/test/ui/error-codes/E0617.stderr | 1 + src/test/ui/error-codes/E0618.stderr | 1 + src/test/ui/error-codes/E0642.stderr | 3 + .../issue-43106-gating-of-macro_use.stderr | 1 + ...loat-literal-inference-restrictions.stderr | 1 + src/test/ui/fn/fn-compare-mismatch.stderr | 1 + src/test/ui/glob-resolve1.stderr | 6 + .../ui/hygiene/expansion-info-reset.stderr | 1 + src/test/ui/hygiene/globs.stderr | 2 + src/test/ui/if/ifmt-bad-format-args.stderr | 1 + .../impl-trait/impl-generic-mismatch.stderr | 2 + .../multiple-lifetimes/error-handling.stderr | 1 + ...t_outlive_least_region_or_bound.nll.stderr | 2 + .../static-return-lifetime-infered.nll.stderr | 2 + .../impl-trait/universal_wrong_bounds.stderr | 2 + src/test/ui/indexing-requires-a-uint.stderr | 1 + .../ui/inference/cannot-infer-closure.stderr | 1 + .../integer-literal-suffix-inference.stderr | 18 +++ src/test/ui/issues/issue-13359.stderr | 2 + src/test/ui/issues/issue-1362.stderr | 1 + src/test/ui/issues/issue-1448-2.stderr | 1 + src/test/ui/issues/issue-17546.stderr | 4 + src/test/ui/issues/issue-22644.stderr | 2 + src/test/ui/issues/issue-22933-3.stderr | 1 + src/test/ui/issues/issue-31910.stderr | 1 + src/test/ui/issues/issue-35075.stderr | 2 + src/test/ui/issues/issue-35675.stderr | 4 + src/test/ui/issues/issue-35976.stderr | 1 + src/test/ui/issues/issue-37534.stderr | 1 + src/test/ui/issues/issue-38293.stderr | 1 + .../ui/issues/issue-41652/issue-41652.stderr | 1 + src/test/ui/issues/issue-42944.stderr | 1 + src/test/ui/issues/issue-4366-2.stderr | 2 + src/test/ui/issues/issue-4366.stderr | 1 + src/test/ui/issues/issue-44406.stderr | 1 + src/test/ui/issues/issue-47377.stderr | 1 + src/test/ui/issues/issue-47380.stderr | 1 + src/test/ui/issues/issue-49257.stderr | 2 + src/test/ui/issues/issue-50571.stderr | 1 + src/test/ui/issues/issue-50599.stderr | 1 + src/test/ui/issues/issue-51874.stderr | 1 + src/test/ui/issues/issue-5239-1.stderr | 1 + src/test/ui/issues/issue-56685.stderr | 3 + src/test/ui/issues/issue-57198.stderr | 1 + src/test/ui/issues/issue-58857.stderr | 1 + src/test/ui/issues/issue-59488.stderr | 1 + src/test/ui/issues/issue-62554.stderr | 1 + src/test/ui/issues/issue-64732.stderr | 2 + src/test/ui/issues/issue-8761.stderr | 2 + .../keyword-extern-as-identifier-pat.stderr | 1 + .../keyword-extern-as-identifier-use.stderr | 1 + src/test/ui/lexical-scopes.stderr | 1 + .../ui/lifetime_starts_expressions.stderr | 1 + src/test/ui/lint/use_suggestion_json.stderr | 1 + .../loops/loop-break-value-no-repeat.stderr | 1 + src/test/ui/loops/loop-break-value.stderr | 8 ++ src/test/ui/macros/bad_hello.stderr | 2 + .../derive-in-eager-expansion-hang.stderr | 1 + src/test/ui/macros/format-parse-errors.stderr | 1 + src/test/ui/macros/issue-30143.stderr | 3 + .../macro-backtrace-invalid-internals.stderr | 2 + .../ui/macros/macro-outer-attributes.stderr | 1 + .../ui/macros/macros-nonfatal-errors.stderr | 1 + .../ui/malformed/malformed-unwind-2.stderr | 2 + .../meta-expected-error-correct-rev.a.stderr | 1 + ...od-ambig-one-trait-unknown-int-type.stderr | 1 + .../method-on-ambiguous-numeric-type.stderr | 3 + ...arg-count-expected-type-issue-47244.stderr | 1 + .../mismatched_types/closure-arg-count.stderr | 7 + .../ui/mismatched_types/issue-26480.stderr | 1 + .../numeric-literal-cast.stderr | 3 + .../mismatched_types/recovered-block.stderr | 1 + src/test/ui/namespace/namespace-mix.stderr | 2 + .../ty-outlives/impl-trait-captures.stderr | 1 + src/test/ui/no-implicit-prelude-nested.stderr | 15 ++ src/test/ui/no-implicit-prelude.stderr | 5 + src/test/ui/numeric/const-scope.stderr | 2 + src/test/ui/numeric/len.stderr | 1 + src/test/ui/numeric/numeric-cast-2.stderr | 3 + src/test/ui/numeric/numeric-cast.stderr | 98 +++++++++++++ src/test/ui/numeric/numeric-suffix.stderr | 132 ++++++++++++++++++ src/test/ui/obsolete-in-place/bad.stderr | 1 + .../ui/on-unimplemented/bad-annotation.stderr | 1 + .../ui/parenthesized-deref-suggestion.stderr | 1 + ...ed-types-project-from-hrtb-explicit.stderr | 1 + .../ui/parser/bad-value-ident-false.stderr | 1 + .../ui/parser/bad-value-ident-true.stderr | 1 + src/test/ui/parser/expr-as-stmt.stderr | 1 + src/test/ui/parser/issue-15980.stderr | 1 + src/test/ui/parser/issue-33418.stderr | 5 + src/test/ui/parser/issue-62895.stderr | 1 + src/test/ui/parser/issue-62973.stderr | 1 + src/test/ui/parser/keyword-abstract.stderr | 1 + .../ui/parser/keyword-as-as-identifier.stderr | 1 + .../parser/keyword-break-as-identifier.stderr | 1 + .../parser/keyword-const-as-identifier.stderr | 1 + .../keyword-continue-as-identifier.stderr | 1 + .../parser/keyword-else-as-identifier.stderr | 1 + .../parser/keyword-enum-as-identifier.stderr | 1 + src/test/ui/parser/keyword-final.stderr | 1 + .../ui/parser/keyword-fn-as-identifier.stderr | 1 + .../parser/keyword-for-as-identifier.stderr | 1 + .../ui/parser/keyword-if-as-identifier.stderr | 1 + .../parser/keyword-impl-as-identifier.stderr | 1 + .../parser/keyword-let-as-identifier.stderr | 1 + .../parser/keyword-loop-as-identifier.stderr | 1 + .../parser/keyword-match-as-identifier.stderr | 1 + .../parser/keyword-mod-as-identifier.stderr | 1 + .../parser/keyword-move-as-identifier.stderr | 1 + src/test/ui/parser/keyword-override.stderr | 1 + .../parser/keyword-pub-as-identifier.stderr | 1 + .../keyword-return-as-identifier.stderr | 1 + .../keyword-static-as-identifier.stderr | 1 + .../keyword-struct-as-identifier.stderr | 1 + .../parser/keyword-trait-as-identifier.stderr | 1 + ...yword-try-as-identifier-edition2018.stderr | 1 + .../parser/keyword-type-as-identifier.stderr | 1 + src/test/ui/parser/keyword-typeof.stderr | 1 + .../keyword-unsafe-as-identifier.stderr | 1 + .../parser/keyword-use-as-identifier.stderr | 1 + .../parser/keyword-where-as-identifier.stderr | 1 + .../parser/keyword-while-as-identifier.stderr | 1 + src/test/ui/parser/keyword.stderr | 1 + .../ui/parser/lex-bad-char-literals-2.stderr | 1 + .../ui/parser/lex-bad-char-literals-3.stderr | 2 + .../ui/parser/lex-bad-char-literals-5.stderr | 2 + .../ui/parser/lex-bad-char-literals-6.stderr | 3 + src/test/ui/parser/macro-keyword.stderr | 1 + .../parser/macros-no-semicolon-items.stderr | 2 + .../match-arrows-block-then-binop.stderr | 1 + src/test/ui/parser/mut-patterns.stderr | 3 + .../parser/range_inclusive_dotdotdot.stderr | 4 + .../ui/parser/recover-from-homoglyph.stderr | 1 + .../ui/parser/removed-syntax-field-let.stderr | 1 + ...quire-parens-for-chained-comparison.stderr | 2 + .../ui/parser/struct-literal-in-for.stderr | 1 + .../ui/parser/struct-literal-in-if.stderr | 1 + ...truct-literal-in-match-discriminant.stderr | 1 + .../ui/parser/struct-literal-in-while.stderr | 1 + ...truct-literal-restrictions-in-lamda.stderr | 1 + src/test/ui/parser/unicode-chars.stderr | 1 + src/test/ui/parser/unicode-quote-chars.stderr | 2 + .../use-as-where-use-ends-with-mod-sep.stderr | 1 + src/test/ui/placement-syntax.stderr | 1 + src/test/ui/pptypedef.stderr | 2 + src/test/ui/privacy/privacy-ns1.stderr | 4 + src/test/ui/privacy/privacy-ns2.stderr | 4 + src/test/ui/proc-macro/mixed-site-span.stderr | 1 + src/test/ui/pub/pub-ident-fn-2.stderr | 1 + .../pub/pub-ident-fn-with-lifetime-2.stderr | 1 + .../ui/pub/pub-ident-fn-with-lifetime.stderr | 1 + src/test/ui/pub/pub-ident-fn.stderr | 1 + .../pub/pub-ident-struct-with-lifetime.stderr | 1 + src/test/ui/pub/pub-ident-struct.stderr | 1 + src/test/ui/repeat_count.stderr | 2 + src/test/ui/reserved/reserved-become.stderr | 1 + .../ui/resolve/enums-are-namespaced-xc.stderr | 3 + src/test/ui/resolve/issue-16058.stderr | 1 + src/test/ui/resolve/issue-17518.stderr | 1 + src/test/ui/resolve/issue-21221-1.stderr | 3 + src/test/ui/resolve/issue-21221-2.stderr | 1 + src/test/ui/resolve/issue-21221-3.stderr | 1 + src/test/ui/resolve/issue-21221-4.stderr | 1 + src/test/ui/resolve/privacy-enum-ctor.stderr | 12 ++ .../ui/resolve/privacy-struct-ctor.stderr | 1 + ...uggest-path-instead-of-mod-dot-item.stderr | 2 + .../resolve/use_suggestion_placement.stderr | 3 + .../rust-2018/dyn-trait-compatibility.stderr | 1 + ...ition-lint-infer-outlives-multispan.stderr | 67 +++++++++ .../issue-52202-use-suggestions.stderr | 1 + ...s_pin_lifetime_impl_trait-async.nll.stderr | 1 + ...f_types_pin_lifetime_impl_trait.nll.stderr | 1 + src/test/ui/self/self_type_keyword.stderr | 1 + src/test/ui/shift-various-bad-types.stderr | 1 + .../one-use-in-fn-argument.stderr | 3 + src/test/ui/span/issue-35987.stderr | 1 + src/test/ui/span/issue-39018.stderr | 10 ++ src/test/ui/span/missing-unit-argument.stderr | 4 + src/test/ui/str/str-as-char.stderr | 1 + .../ui/str/str-concat-on-double-ref.stderr | 1 + .../ui/struct-literal-variant-in-if.stderr | 4 + .../no-extern-crate-in-type.stderr | 1 + .../suggest-closure-return-type-1.stderr | 1 + .../suggest-closure-return-type-2.stderr | 1 + .../suggest-closure-return-type-3.stderr | 1 + src/test/ui/suggestions/suggest-labels.stderr | 3 + .../suggest-on-bare-closure-call.stderr | 1 + .../suggest-std-when-using-type.stderr | 2 + ...type-argument-instead-of-assoc-type.stderr | 1 + .../ui/traits/traits-multidispatch-bad.stderr | 1 + ...ounds-inconsistent-projection-error.stderr | 1 + .../try-block/try-block-in-edition2015.stderr | 1 + .../ui/tutorial-suffix-inference-test.stderr | 2 + ...t-variant-form-through-alias-caught.stderr | 1 + .../ui/ufcs/ufcs-qpath-self-mismatch.stderr | 2 + .../unboxed-closures-type-mismatch.stderr | 1 + src/test/ui/use/use-super-global-path.stderr | 1 + .../ui/variants/variant-used-as-type.stderr | 2 + 227 files changed, 744 insertions(+) diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index e3b55a141338a..e59d6c5675094 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -1629,6 +1629,19 @@ impl EmitterWriter { _ => () } } + 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); + } + match emit_to_destination(&buffer.render(), level, &mut self.dst, + self.short_message) { + Ok(()) => (), + Err(e) => panic!("failed to emit error: {}", e) + } + } for sugg in suggestions { if sugg.style == SuggestionStyle::CompletelyHidden { // do not display this suggestion, it is meant only for tools 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/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::(x_u8); | ^^^^ expected f32, found u8 + | help: you can convert an `u8` to `f32`, producing the floating point representation of the integer | LL | foo::(x_u8.into()); @@ -1050,6 +1143,7 @@ error[E0308]: mismatched types | LL | foo::(x_isize); | ^^^^^^^ expected f32, found isize + | help: you can convert an `isize` to `f32`, producing the floating point representation of the integer, rounded if necessary | LL | foo::(x_isize as f32); @@ -1060,6 +1154,7 @@ error[E0308]: mismatched types | LL | foo::(x_i64); | ^^^^^ expected f32, found i64 + | help: you can convert an `i64` to `f32`, producing the floating point representation of the integer, rounded if necessary | LL | foo::(x_i64 as f32); @@ -1070,6 +1165,7 @@ error[E0308]: mismatched types | LL | foo::(x_i32); | ^^^^^ expected f32, found i32 + | help: you can convert an `i32` to `f32`, producing the floating point representation of the integer, rounded if necessary | LL | foo::(x_i32 as f32); @@ -1080,6 +1176,7 @@ error[E0308]: mismatched types | LL | foo::(x_i16); | ^^^^^ expected f32, found i16 + | help: you can convert an `i16` to `f32`, producing the floating point representation of the integer | LL | foo::(x_i16.into()); @@ -1090,6 +1187,7 @@ error[E0308]: mismatched types | LL | foo::(x_i8); | ^^^^ expected f32, found i8 + | help: you can convert an `i8` to `f32`, producing the floating point representation of the integer | LL | foo::(x_i8.into()); diff --git a/src/test/ui/numeric/numeric-suffix.stderr b/src/test/ui/numeric/numeric-suffix.stderr index c88eeeb9f70b2..9bcae4a1888e6 100644 --- a/src/test/ui/numeric/numeric-suffix.stderr +++ b/src/test/ui/numeric/numeric-suffix.stderr @@ -3,6 +3,7 @@ error[E0308]: mismatched types | LL | foo::(42_u64); | ^^^^^^ expected usize, found u64 + | help: change the type of the numeric literal from `u64` to `usize` | LL | foo::(42_usize); @@ -13,6 +14,7 @@ error[E0308]: mismatched types | LL | foo::(42_u32); | ^^^^^^ expected usize, found u32 + | help: change the type of the numeric literal from `u32` to `usize` | LL | foo::(42_usize); @@ -23,6 +25,7 @@ error[E0308]: mismatched types | LL | foo::(42_u16); | ^^^^^^ expected usize, found u16 + | help: change the type of the numeric literal from `u16` to `usize` | LL | foo::(42_usize); @@ -33,6 +36,7 @@ error[E0308]: mismatched types | LL | foo::(42_u8); | ^^^^^ expected usize, found u8 + | help: change the type of the numeric literal from `u8` to `usize` | LL | foo::(42_usize); @@ -43,6 +47,7 @@ error[E0308]: mismatched types | LL | foo::(42_isize); | ^^^^^^^^ expected usize, found isize + | help: change the type of the numeric literal from `isize` to `usize` | LL | foo::(42_usize); @@ -53,6 +58,7 @@ error[E0308]: mismatched types | LL | foo::(42_i64); | ^^^^^^ expected usize, found i64 + | help: change the type of the numeric literal from `i64` to `usize` | LL | foo::(42_usize); @@ -63,6 +69,7 @@ error[E0308]: mismatched types | LL | foo::(42_i32); | ^^^^^^ expected usize, found i32 + | help: change the type of the numeric literal from `i32` to `usize` | LL | foo::(42_usize); @@ -73,6 +80,7 @@ error[E0308]: mismatched types | LL | foo::(42_i16); | ^^^^^^ expected usize, found i16 + | help: change the type of the numeric literal from `i16` to `usize` | LL | foo::(42_usize); @@ -83,6 +91,7 @@ error[E0308]: mismatched types | LL | foo::(42_i8); | ^^^^^ expected usize, found i8 + | help: change the type of the numeric literal from `i8` to `usize` | LL | foo::(42_usize); @@ -93,6 +102,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f64); | ^^^^^^^^ expected usize, found f64 + | help: change the type of the numeric literal from `f64` to `usize` | LL | foo::(42usize); @@ -103,6 +113,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f32); | ^^^^^^^^ expected usize, found f32 + | help: change the type of the numeric literal from `f32` to `usize` | LL | foo::(42usize); @@ -113,6 +124,7 @@ error[E0308]: mismatched types | LL | foo::(42_usize); | ^^^^^^^^ expected isize, found usize + | help: change the type of the numeric literal from `usize` to `isize` | LL | foo::(42_isize); @@ -123,6 +135,7 @@ error[E0308]: mismatched types | LL | foo::(42_u64); | ^^^^^^ expected isize, found u64 + | help: change the type of the numeric literal from `u64` to `isize` | LL | foo::(42_isize); @@ -133,6 +146,7 @@ error[E0308]: mismatched types | LL | foo::(42_u32); | ^^^^^^ expected isize, found u32 + | help: change the type of the numeric literal from `u32` to `isize` | LL | foo::(42_isize); @@ -143,6 +157,7 @@ error[E0308]: mismatched types | LL | foo::(42_u16); | ^^^^^^ expected isize, found u16 + | help: change the type of the numeric literal from `u16` to `isize` | LL | foo::(42_isize); @@ -153,6 +168,7 @@ error[E0308]: mismatched types | LL | foo::(42_u8); | ^^^^^ expected isize, found u8 + | help: change the type of the numeric literal from `u8` to `isize` | LL | foo::(42_isize); @@ -163,6 +179,7 @@ error[E0308]: mismatched types | LL | foo::(42_i64); | ^^^^^^ expected isize, found i64 + | help: change the type of the numeric literal from `i64` to `isize` | LL | foo::(42_isize); @@ -173,6 +190,7 @@ error[E0308]: mismatched types | LL | foo::(42_i32); | ^^^^^^ expected isize, found i32 + | help: change the type of the numeric literal from `i32` to `isize` | LL | foo::(42_isize); @@ -183,6 +201,7 @@ error[E0308]: mismatched types | LL | foo::(42_i16); | ^^^^^^ expected isize, found i16 + | help: change the type of the numeric literal from `i16` to `isize` | LL | foo::(42_isize); @@ -193,6 +212,7 @@ error[E0308]: mismatched types | LL | foo::(42_i8); | ^^^^^ expected isize, found i8 + | help: change the type of the numeric literal from `i8` to `isize` | LL | foo::(42_isize); @@ -203,6 +223,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f64); | ^^^^^^^^ expected isize, found f64 + | help: change the type of the numeric literal from `f64` to `isize` | LL | foo::(42isize); @@ -213,6 +234,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f32); | ^^^^^^^^ expected isize, found f32 + | help: change the type of the numeric literal from `f32` to `isize` | LL | foo::(42isize); @@ -223,6 +245,7 @@ error[E0308]: mismatched types | LL | foo::(42_usize); | ^^^^^^^^ expected u64, found usize + | help: change the type of the numeric literal from `usize` to `u64` | LL | foo::(42_u64); @@ -233,6 +256,7 @@ error[E0308]: mismatched types | LL | foo::(42_u32); | ^^^^^^ expected u64, found u32 + | help: change the type of the numeric literal from `u32` to `u64` | LL | foo::(42_u64); @@ -243,6 +267,7 @@ error[E0308]: mismatched types | LL | foo::(42_u16); | ^^^^^^ expected u64, found u16 + | help: change the type of the numeric literal from `u16` to `u64` | LL | foo::(42_u64); @@ -253,6 +278,7 @@ error[E0308]: mismatched types | LL | foo::(42_u8); | ^^^^^ expected u64, found u8 + | help: change the type of the numeric literal from `u8` to `u64` | LL | foo::(42_u64); @@ -263,6 +289,7 @@ error[E0308]: mismatched types | LL | foo::(42_isize); | ^^^^^^^^ expected u64, found isize + | help: change the type of the numeric literal from `isize` to `u64` | LL | foo::(42_u64); @@ -273,6 +300,7 @@ error[E0308]: mismatched types | LL | foo::(42_i64); | ^^^^^^ expected u64, found i64 + | help: change the type of the numeric literal from `i64` to `u64` | LL | foo::(42_u64); @@ -283,6 +311,7 @@ error[E0308]: mismatched types | LL | foo::(42_i32); | ^^^^^^ expected u64, found i32 + | help: change the type of the numeric literal from `i32` to `u64` | LL | foo::(42_u64); @@ -293,6 +322,7 @@ error[E0308]: mismatched types | LL | foo::(42_i16); | ^^^^^^ expected u64, found i16 + | help: change the type of the numeric literal from `i16` to `u64` | LL | foo::(42_u64); @@ -303,6 +333,7 @@ error[E0308]: mismatched types | LL | foo::(42_i8); | ^^^^^ expected u64, found i8 + | help: change the type of the numeric literal from `i8` to `u64` | LL | foo::(42_u64); @@ -313,6 +344,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f64); | ^^^^^^^^ expected u64, found f64 + | help: change the type of the numeric literal from `f64` to `u64` | LL | foo::(42u64); @@ -323,6 +355,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f32); | ^^^^^^^^ expected u64, found f32 + | help: change the type of the numeric literal from `f32` to `u64` | LL | foo::(42u64); @@ -333,6 +366,7 @@ error[E0308]: mismatched types | LL | foo::(42_usize); | ^^^^^^^^ expected i64, found usize + | help: change the type of the numeric literal from `usize` to `i64` | LL | foo::(42_i64); @@ -343,6 +377,7 @@ error[E0308]: mismatched types | LL | foo::(42_u64); | ^^^^^^ expected i64, found u64 + | help: change the type of the numeric literal from `u64` to `i64` | LL | foo::(42_i64); @@ -353,6 +388,7 @@ error[E0308]: mismatched types | LL | foo::(42_u32); | ^^^^^^ expected i64, found u32 + | help: change the type of the numeric literal from `u32` to `i64` | LL | foo::(42_i64); @@ -363,6 +399,7 @@ error[E0308]: mismatched types | LL | foo::(42_u16); | ^^^^^^ expected i64, found u16 + | help: change the type of the numeric literal from `u16` to `i64` | LL | foo::(42_i64); @@ -373,6 +410,7 @@ error[E0308]: mismatched types | LL | foo::(42_u8); | ^^^^^ expected i64, found u8 + | help: change the type of the numeric literal from `u8` to `i64` | LL | foo::(42_i64); @@ -383,6 +421,7 @@ error[E0308]: mismatched types | LL | foo::(42_isize); | ^^^^^^^^ expected i64, found isize + | help: change the type of the numeric literal from `isize` to `i64` | LL | foo::(42_i64); @@ -393,6 +432,7 @@ error[E0308]: mismatched types | LL | foo::(42_i32); | ^^^^^^ expected i64, found i32 + | help: change the type of the numeric literal from `i32` to `i64` | LL | foo::(42_i64); @@ -403,6 +443,7 @@ error[E0308]: mismatched types | LL | foo::(42_i16); | ^^^^^^ expected i64, found i16 + | help: change the type of the numeric literal from `i16` to `i64` | LL | foo::(42_i64); @@ -413,6 +454,7 @@ error[E0308]: mismatched types | LL | foo::(42_i8); | ^^^^^ expected i64, found i8 + | help: change the type of the numeric literal from `i8` to `i64` | LL | foo::(42_i64); @@ -423,6 +465,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f64); | ^^^^^^^^ expected i64, found f64 + | help: change the type of the numeric literal from `f64` to `i64` | LL | foo::(42i64); @@ -433,6 +476,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f32); | ^^^^^^^^ expected i64, found f32 + | help: change the type of the numeric literal from `f32` to `i64` | LL | foo::(42i64); @@ -443,6 +487,7 @@ error[E0308]: mismatched types | LL | foo::(42_usize); | ^^^^^^^^ expected u32, found usize + | help: change the type of the numeric literal from `usize` to `u32` | LL | foo::(42_u32); @@ -453,6 +498,7 @@ error[E0308]: mismatched types | LL | foo::(42_u64); | ^^^^^^ expected u32, found u64 + | help: change the type of the numeric literal from `u64` to `u32` | LL | foo::(42_u32); @@ -463,6 +509,7 @@ error[E0308]: mismatched types | LL | foo::(42_u16); | ^^^^^^ expected u32, found u16 + | help: change the type of the numeric literal from `u16` to `u32` | LL | foo::(42_u32); @@ -473,6 +520,7 @@ error[E0308]: mismatched types | LL | foo::(42_u8); | ^^^^^ expected u32, found u8 + | help: change the type of the numeric literal from `u8` to `u32` | LL | foo::(42_u32); @@ -483,6 +531,7 @@ error[E0308]: mismatched types | LL | foo::(42_isize); | ^^^^^^^^ expected u32, found isize + | help: change the type of the numeric literal from `isize` to `u32` | LL | foo::(42_u32); @@ -493,6 +542,7 @@ error[E0308]: mismatched types | LL | foo::(42_i64); | ^^^^^^ expected u32, found i64 + | help: change the type of the numeric literal from `i64` to `u32` | LL | foo::(42_u32); @@ -503,6 +553,7 @@ error[E0308]: mismatched types | LL | foo::(42_i32); | ^^^^^^ expected u32, found i32 + | help: change the type of the numeric literal from `i32` to `u32` | LL | foo::(42_u32); @@ -513,6 +564,7 @@ error[E0308]: mismatched types | LL | foo::(42_i16); | ^^^^^^ expected u32, found i16 + | help: change the type of the numeric literal from `i16` to `u32` | LL | foo::(42_u32); @@ -523,6 +575,7 @@ error[E0308]: mismatched types | LL | foo::(42_i8); | ^^^^^ expected u32, found i8 + | help: change the type of the numeric literal from `i8` to `u32` | LL | foo::(42_u32); @@ -533,6 +586,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f64); | ^^^^^^^^ expected u32, found f64 + | help: change the type of the numeric literal from `f64` to `u32` | LL | foo::(42u32); @@ -543,6 +597,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f32); | ^^^^^^^^ expected u32, found f32 + | help: change the type of the numeric literal from `f32` to `u32` | LL | foo::(42u32); @@ -553,6 +608,7 @@ error[E0308]: mismatched types | LL | foo::(42_usize); | ^^^^^^^^ expected i32, found usize + | help: change the type of the numeric literal from `usize` to `i32` | LL | foo::(42_i32); @@ -563,6 +619,7 @@ error[E0308]: mismatched types | LL | foo::(42_u64); | ^^^^^^ expected i32, found u64 + | help: change the type of the numeric literal from `u64` to `i32` | LL | foo::(42_i32); @@ -573,6 +630,7 @@ error[E0308]: mismatched types | LL | foo::(42_u32); | ^^^^^^ expected i32, found u32 + | help: change the type of the numeric literal from `u32` to `i32` | LL | foo::(42_i32); @@ -583,6 +641,7 @@ error[E0308]: mismatched types | LL | foo::(42_u16); | ^^^^^^ expected i32, found u16 + | help: change the type of the numeric literal from `u16` to `i32` | LL | foo::(42_i32); @@ -593,6 +652,7 @@ error[E0308]: mismatched types | LL | foo::(42_u8); | ^^^^^ expected i32, found u8 + | help: change the type of the numeric literal from `u8` to `i32` | LL | foo::(42_i32); @@ -603,6 +663,7 @@ error[E0308]: mismatched types | LL | foo::(42_isize); | ^^^^^^^^ expected i32, found isize + | help: change the type of the numeric literal from `isize` to `i32` | LL | foo::(42_i32); @@ -613,6 +674,7 @@ error[E0308]: mismatched types | LL | foo::(42_i64); | ^^^^^^ expected i32, found i64 + | help: change the type of the numeric literal from `i64` to `i32` | LL | foo::(42_i32); @@ -623,6 +685,7 @@ error[E0308]: mismatched types | LL | foo::(42_i16); | ^^^^^^ expected i32, found i16 + | help: change the type of the numeric literal from `i16` to `i32` | LL | foo::(42_i32); @@ -633,6 +696,7 @@ error[E0308]: mismatched types | LL | foo::(42_i8); | ^^^^^ expected i32, found i8 + | help: change the type of the numeric literal from `i8` to `i32` | LL | foo::(42_i32); @@ -643,6 +707,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f64); | ^^^^^^^^ expected i32, found f64 + | help: change the type of the numeric literal from `f64` to `i32` | LL | foo::(42i32); @@ -653,6 +718,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f32); | ^^^^^^^^ expected i32, found f32 + | help: change the type of the numeric literal from `f32` to `i32` | LL | foo::(42i32); @@ -663,6 +729,7 @@ error[E0308]: mismatched types | LL | foo::(42_usize); | ^^^^^^^^ expected u16, found usize + | help: change the type of the numeric literal from `usize` to `u16` | LL | foo::(42_u16); @@ -673,6 +740,7 @@ error[E0308]: mismatched types | LL | foo::(42_u64); | ^^^^^^ expected u16, found u64 + | help: change the type of the numeric literal from `u64` to `u16` | LL | foo::(42_u16); @@ -683,6 +751,7 @@ error[E0308]: mismatched types | LL | foo::(42_u32); | ^^^^^^ expected u16, found u32 + | help: change the type of the numeric literal from `u32` to `u16` | LL | foo::(42_u16); @@ -693,6 +762,7 @@ error[E0308]: mismatched types | LL | foo::(42_u8); | ^^^^^ expected u16, found u8 + | help: change the type of the numeric literal from `u8` to `u16` | LL | foo::(42_u16); @@ -703,6 +773,7 @@ error[E0308]: mismatched types | LL | foo::(42_isize); | ^^^^^^^^ expected u16, found isize + | help: change the type of the numeric literal from `isize` to `u16` | LL | foo::(42_u16); @@ -713,6 +784,7 @@ error[E0308]: mismatched types | LL | foo::(42_i64); | ^^^^^^ expected u16, found i64 + | help: change the type of the numeric literal from `i64` to `u16` | LL | foo::(42_u16); @@ -723,6 +795,7 @@ error[E0308]: mismatched types | LL | foo::(42_i32); | ^^^^^^ expected u16, found i32 + | help: change the type of the numeric literal from `i32` to `u16` | LL | foo::(42_u16); @@ -733,6 +806,7 @@ error[E0308]: mismatched types | LL | foo::(42_i16); | ^^^^^^ expected u16, found i16 + | help: change the type of the numeric literal from `i16` to `u16` | LL | foo::(42_u16); @@ -743,6 +817,7 @@ error[E0308]: mismatched types | LL | foo::(42_i8); | ^^^^^ expected u16, found i8 + | help: change the type of the numeric literal from `i8` to `u16` | LL | foo::(42_u16); @@ -753,6 +828,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f64); | ^^^^^^^^ expected u16, found f64 + | help: change the type of the numeric literal from `f64` to `u16` | LL | foo::(42u16); @@ -763,6 +839,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f32); | ^^^^^^^^ expected u16, found f32 + | help: change the type of the numeric literal from `f32` to `u16` | LL | foo::(42u16); @@ -773,6 +850,7 @@ error[E0308]: mismatched types | LL | foo::(42_usize); | ^^^^^^^^ expected i16, found usize + | help: change the type of the numeric literal from `usize` to `i16` | LL | foo::(42_i16); @@ -783,6 +861,7 @@ error[E0308]: mismatched types | LL | foo::(42_u64); | ^^^^^^ expected i16, found u64 + | help: change the type of the numeric literal from `u64` to `i16` | LL | foo::(42_i16); @@ -793,6 +872,7 @@ error[E0308]: mismatched types | LL | foo::(42_u32); | ^^^^^^ expected i16, found u32 + | help: change the type of the numeric literal from `u32` to `i16` | LL | foo::(42_i16); @@ -803,6 +883,7 @@ error[E0308]: mismatched types | LL | foo::(42_u16); | ^^^^^^ expected i16, found u16 + | help: change the type of the numeric literal from `u16` to `i16` | LL | foo::(42_i16); @@ -813,6 +894,7 @@ error[E0308]: mismatched types | LL | foo::(42_u8); | ^^^^^ expected i16, found u8 + | help: change the type of the numeric literal from `u8` to `i16` | LL | foo::(42_i16); @@ -823,6 +905,7 @@ error[E0308]: mismatched types | LL | foo::(42_isize); | ^^^^^^^^ expected i16, found isize + | help: change the type of the numeric literal from `isize` to `i16` | LL | foo::(42_i16); @@ -833,6 +916,7 @@ error[E0308]: mismatched types | LL | foo::(42_i64); | ^^^^^^ expected i16, found i64 + | help: change the type of the numeric literal from `i64` to `i16` | LL | foo::(42_i16); @@ -843,6 +927,7 @@ error[E0308]: mismatched types | LL | foo::(42_i32); | ^^^^^^ expected i16, found i32 + | help: change the type of the numeric literal from `i32` to `i16` | LL | foo::(42_i16); @@ -853,6 +938,7 @@ error[E0308]: mismatched types | LL | foo::(42_i8); | ^^^^^ expected i16, found i8 + | help: change the type of the numeric literal from `i8` to `i16` | LL | foo::(42_i16); @@ -863,6 +949,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f64); | ^^^^^^^^ expected i16, found f64 + | help: change the type of the numeric literal from `f64` to `i16` | LL | foo::(42i16); @@ -873,6 +960,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f32); | ^^^^^^^^ expected i16, found f32 + | help: change the type of the numeric literal from `f32` to `i16` | LL | foo::(42i16); @@ -883,6 +971,7 @@ error[E0308]: mismatched types | LL | foo::(42_usize); | ^^^^^^^^ expected u8, found usize + | help: change the type of the numeric literal from `usize` to `u8` | LL | foo::(42_u8); @@ -893,6 +982,7 @@ error[E0308]: mismatched types | LL | foo::(42_u64); | ^^^^^^ expected u8, found u64 + | help: change the type of the numeric literal from `u64` to `u8` | LL | foo::(42_u8); @@ -903,6 +993,7 @@ error[E0308]: mismatched types | LL | foo::(42_u32); | ^^^^^^ expected u8, found u32 + | help: change the type of the numeric literal from `u32` to `u8` | LL | foo::(42_u8); @@ -913,6 +1004,7 @@ error[E0308]: mismatched types | LL | foo::(42_u16); | ^^^^^^ expected u8, found u16 + | help: change the type of the numeric literal from `u16` to `u8` | LL | foo::(42_u8); @@ -923,6 +1015,7 @@ error[E0308]: mismatched types | LL | foo::(42_isize); | ^^^^^^^^ expected u8, found isize + | help: change the type of the numeric literal from `isize` to `u8` | LL | foo::(42_u8); @@ -933,6 +1026,7 @@ error[E0308]: mismatched types | LL | foo::(42_i64); | ^^^^^^ expected u8, found i64 + | help: change the type of the numeric literal from `i64` to `u8` | LL | foo::(42_u8); @@ -943,6 +1037,7 @@ error[E0308]: mismatched types | LL | foo::(42_i32); | ^^^^^^ expected u8, found i32 + | help: change the type of the numeric literal from `i32` to `u8` | LL | foo::(42_u8); @@ -953,6 +1048,7 @@ error[E0308]: mismatched types | LL | foo::(42_i16); | ^^^^^^ expected u8, found i16 + | help: change the type of the numeric literal from `i16` to `u8` | LL | foo::(42_u8); @@ -963,6 +1059,7 @@ error[E0308]: mismatched types | LL | foo::(42_i8); | ^^^^^ expected u8, found i8 + | help: change the type of the numeric literal from `i8` to `u8` | LL | foo::(42_u8); @@ -973,6 +1070,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f64); | ^^^^^^^^ expected u8, found f64 + | help: change the type of the numeric literal from `f64` to `u8` | LL | foo::(42u8); @@ -983,6 +1081,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f32); | ^^^^^^^^ expected u8, found f32 + | help: change the type of the numeric literal from `f32` to `u8` | LL | foo::(42u8); @@ -993,6 +1092,7 @@ error[E0308]: mismatched types | LL | foo::(42_usize); | ^^^^^^^^ expected i8, found usize + | help: change the type of the numeric literal from `usize` to `i8` | LL | foo::(42_i8); @@ -1003,6 +1103,7 @@ error[E0308]: mismatched types | LL | foo::(42_u64); | ^^^^^^ expected i8, found u64 + | help: change the type of the numeric literal from `u64` to `i8` | LL | foo::(42_i8); @@ -1013,6 +1114,7 @@ error[E0308]: mismatched types | LL | foo::(42_u32); | ^^^^^^ expected i8, found u32 + | help: change the type of the numeric literal from `u32` to `i8` | LL | foo::(42_i8); @@ -1023,6 +1125,7 @@ error[E0308]: mismatched types | LL | foo::(42_u16); | ^^^^^^ expected i8, found u16 + | help: change the type of the numeric literal from `u16` to `i8` | LL | foo::(42_i8); @@ -1033,6 +1136,7 @@ error[E0308]: mismatched types | LL | foo::(42_u8); | ^^^^^ expected i8, found u8 + | help: change the type of the numeric literal from `u8` to `i8` | LL | foo::(42_i8); @@ -1043,6 +1147,7 @@ error[E0308]: mismatched types | LL | foo::(42_isize); | ^^^^^^^^ expected i8, found isize + | help: change the type of the numeric literal from `isize` to `i8` | LL | foo::(42_i8); @@ -1053,6 +1158,7 @@ error[E0308]: mismatched types | LL | foo::(42_i64); | ^^^^^^ expected i8, found i64 + | help: change the type of the numeric literal from `i64` to `i8` | LL | foo::(42_i8); @@ -1063,6 +1169,7 @@ error[E0308]: mismatched types | LL | foo::(42_i32); | ^^^^^^ expected i8, found i32 + | help: change the type of the numeric literal from `i32` to `i8` | LL | foo::(42_i8); @@ -1073,6 +1180,7 @@ error[E0308]: mismatched types | LL | foo::(42_i16); | ^^^^^^ expected i8, found i16 + | help: change the type of the numeric literal from `i16` to `i8` | LL | foo::(42_i8); @@ -1083,6 +1191,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f64); | ^^^^^^^^ expected i8, found f64 + | help: change the type of the numeric literal from `f64` to `i8` | LL | foo::(42i8); @@ -1093,6 +1202,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f32); | ^^^^^^^^ expected i8, found f32 + | help: change the type of the numeric literal from `f32` to `i8` | LL | foo::(42i8); @@ -1103,6 +1213,7 @@ error[E0308]: mismatched types | LL | foo::(42_usize); | ^^^^^^^^ expected f64, found usize + | help: change the type of the numeric literal from `usize` to `f64` | LL | foo::(42_f64); @@ -1113,6 +1224,7 @@ error[E0308]: mismatched types | LL | foo::(42_u64); | ^^^^^^ expected f64, found u64 + | help: change the type of the numeric literal from `u64` to `f64` | LL | foo::(42_f64); @@ -1123,6 +1235,7 @@ error[E0308]: mismatched types | LL | foo::(42_u32); | ^^^^^^ expected f64, found u32 + | help: you can convert an `u32` to `f64`, producing the floating point representation of the integer | LL | foo::(42_u32.into()); @@ -1133,6 +1246,7 @@ error[E0308]: mismatched types | LL | foo::(42_u16); | ^^^^^^ expected f64, found u16 + | help: you can convert an `u16` to `f64`, producing the floating point representation of the integer | LL | foo::(42_u16.into()); @@ -1143,6 +1257,7 @@ error[E0308]: mismatched types | LL | foo::(42_u8); | ^^^^^ expected f64, found u8 + | help: you can convert an `u8` to `f64`, producing the floating point representation of the integer | LL | foo::(42_u8.into()); @@ -1153,6 +1268,7 @@ error[E0308]: mismatched types | LL | foo::(42_isize); | ^^^^^^^^ expected f64, found isize + | help: change the type of the numeric literal from `isize` to `f64` | LL | foo::(42_f64); @@ -1163,6 +1279,7 @@ error[E0308]: mismatched types | LL | foo::(42_i64); | ^^^^^^ expected f64, found i64 + | help: change the type of the numeric literal from `i64` to `f64` | LL | foo::(42_f64); @@ -1173,6 +1290,7 @@ error[E0308]: mismatched types | LL | foo::(42_i32); | ^^^^^^ expected f64, found i32 + | help: you can convert an `i32` to `f64`, producing the floating point representation of the integer | LL | foo::(42_i32.into()); @@ -1183,6 +1301,7 @@ error[E0308]: mismatched types | LL | foo::(42_i16); | ^^^^^^ expected f64, found i16 + | help: you can convert an `i16` to `f64`, producing the floating point representation of the integer | LL | foo::(42_i16.into()); @@ -1193,6 +1312,7 @@ error[E0308]: mismatched types | LL | foo::(42_i8); | ^^^^^ expected f64, found i8 + | help: you can convert an `i8` to `f64`, producing the floating point representation of the integer | LL | foo::(42_i8.into()); @@ -1203,6 +1323,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f32); | ^^^^^^^^ expected f64, found f32 + | help: change the type of the numeric literal from `f32` to `f64` | LL | foo::(42.0_f64); @@ -1213,6 +1334,7 @@ error[E0308]: mismatched types | LL | foo::(42_usize); | ^^^^^^^^ expected f32, found usize + | help: change the type of the numeric literal from `usize` to `f32` | LL | foo::(42_f32); @@ -1223,6 +1345,7 @@ error[E0308]: mismatched types | LL | foo::(42_u64); | ^^^^^^ expected f32, found u64 + | help: change the type of the numeric literal from `u64` to `f32` | LL | foo::(42_f32); @@ -1233,6 +1356,7 @@ error[E0308]: mismatched types | LL | foo::(42_u32); | ^^^^^^ expected f32, found u32 + | help: change the type of the numeric literal from `u32` to `f32` | LL | foo::(42_f32); @@ -1243,6 +1367,7 @@ error[E0308]: mismatched types | LL | foo::(42_u16); | ^^^^^^ expected f32, found u16 + | help: you can convert an `u16` to `f32`, producing the floating point representation of the integer | LL | foo::(42_u16.into()); @@ -1253,6 +1378,7 @@ error[E0308]: mismatched types | LL | foo::(42_u8); | ^^^^^ expected f32, found u8 + | help: you can convert an `u8` to `f32`, producing the floating point representation of the integer | LL | foo::(42_u8.into()); @@ -1263,6 +1389,7 @@ error[E0308]: mismatched types | LL | foo::(42_isize); | ^^^^^^^^ expected f32, found isize + | help: change the type of the numeric literal from `isize` to `f32` | LL | foo::(42_f32); @@ -1273,6 +1400,7 @@ error[E0308]: mismatched types | LL | foo::(42_i64); | ^^^^^^ expected f32, found i64 + | help: change the type of the numeric literal from `i64` to `f32` | LL | foo::(42_f32); @@ -1283,6 +1411,7 @@ error[E0308]: mismatched types | LL | foo::(42_i32); | ^^^^^^ expected f32, found i32 + | help: change the type of the numeric literal from `i32` to `f32` | LL | foo::(42_f32); @@ -1293,6 +1422,7 @@ error[E0308]: mismatched types | LL | foo::(42_i16); | ^^^^^^ expected f32, found i16 + | help: you can convert an `i16` to `f32`, producing the floating point representation of the integer | LL | foo::(42_i16.into()); @@ -1303,6 +1433,7 @@ error[E0308]: mismatched types | LL | foo::(42_i8); | ^^^^^ expected f32, found i8 + | help: you can convert an `i8` to `f32`, producing the floating point representation of the integer | LL | foo::(42_i8.into()); @@ -1313,6 +1444,7 @@ error[E0308]: mismatched types | LL | foo::(42.0_f64); | ^^^^^^^^ expected f32, found f64 + | help: change the type of the numeric literal from `f64` to `f32` | LL | foo::(42.0_f32); diff --git a/src/test/ui/obsolete-in-place/bad.stderr b/src/test/ui/obsolete-in-place/bad.stderr index 8a731b6240b2f..b9aad01b2929a 100644 --- a/src/test/ui/obsolete-in-place/bad.stderr +++ b/src/test/ui/obsolete-in-place/bad.stderr @@ -3,6 +3,7 @@ error: unexpected token: `<-` | LL | x <- y; | ^^ + | help: if you meant to write a comparison against a negative value, add a space in between `<` and `-` | LL | x < - y; diff --git a/src/test/ui/on-unimplemented/bad-annotation.stderr b/src/test/ui/on-unimplemented/bad-annotation.stderr index 20b2169f45824..ac0cf0f1f08fa 100644 --- a/src/test/ui/on-unimplemented/bad-annotation.stderr +++ b/src/test/ui/on-unimplemented/bad-annotation.stderr @@ -3,6 +3,7 @@ error: malformed `rustc_on_unimplemented` attribute input | LL | #[rustc_on_unimplemented] | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | help: the following are the possible correct uses | LL | #[rustc_on_unimplemented(/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...")] diff --git a/src/test/ui/parenthesized-deref-suggestion.stderr b/src/test/ui/parenthesized-deref-suggestion.stderr index a16510055f548..24be32ae9eba6 100644 --- a/src/test/ui/parenthesized-deref-suggestion.stderr +++ b/src/test/ui/parenthesized-deref-suggestion.stderr @@ -3,6 +3,7 @@ error[E0609]: no field `opts` on type `*const Session` | LL | (sess as *const Session).opts; | ^^^^ + | help: `(sess as *const Session)` is a raw pointer; try dereferencing it | LL | (*(sess as *const Session)).opts; diff --git a/src/test/ui/parser/associated-types-project-from-hrtb-explicit.stderr b/src/test/ui/parser/associated-types-project-from-hrtb-explicit.stderr index ada0f268a8d6b..7d0bb0965b6fe 100644 --- a/src/test/ui/parser/associated-types-project-from-hrtb-explicit.stderr +++ b/src/test/ui/parser/associated-types-project-from-hrtb-explicit.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `for` | LL | fn foo2(x: Foo<&'x isize>>::A) | ^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | fn foo2(x: Foo<&'x isize>>::A) diff --git a/src/test/ui/parser/bad-value-ident-false.stderr b/src/test/ui/parser/bad-value-ident-false.stderr index 9ddca101567ff..b59ea97e3b1e0 100644 --- a/src/test/ui/parser/bad-value-ident-false.stderr +++ b/src/test/ui/parser/bad-value-ident-false.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `false` | LL | fn false() { } | ^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | fn r#false() { } diff --git a/src/test/ui/parser/bad-value-ident-true.stderr b/src/test/ui/parser/bad-value-ident-true.stderr index ec497dbe40730..12132b0856bf1 100644 --- a/src/test/ui/parser/bad-value-ident-true.stderr +++ b/src/test/ui/parser/bad-value-ident-true.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `true` | LL | fn true() { } | ^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | fn r#true() { } diff --git a/src/test/ui/parser/expr-as-stmt.stderr b/src/test/ui/parser/expr-as-stmt.stderr index a11209998a7d5..4dcc914f25d79 100644 --- a/src/test/ui/parser/expr-as-stmt.stderr +++ b/src/test/ui/parser/expr-as-stmt.stderr @@ -35,6 +35,7 @@ error: expected expression, found `>` | LL | } > 0 | ^ expected expression + | help: parentheses are required to parse this as an expression | LL | (match x { diff --git a/src/test/ui/parser/issue-15980.stderr b/src/test/ui/parser/issue-15980.stderr index 879bcb2b4a1f7..47c275110b429 100644 --- a/src/test/ui/parser/issue-15980.stderr +++ b/src/test/ui/parser/issue-15980.stderr @@ -6,6 +6,7 @@ LL | Err(ref e) if e.kind == io::EndOfFile { LL | LL | return | ^^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | r#return diff --git a/src/test/ui/parser/issue-33418.stderr b/src/test/ui/parser/issue-33418.stderr index 660d9fd30c82e..479e7bed1016a 100644 --- a/src/test/ui/parser/issue-33418.stderr +++ b/src/test/ui/parser/issue-33418.stderr @@ -3,6 +3,7 @@ error: negative trait bounds are not supported | LL | trait Tr: !SuperA {} | ^^^^^^^^^ negative trait bounds are not supported + | = help: remove the trait bound error: negative trait bounds are not supported @@ -10,6 +11,7 @@ error: negative trait bounds are not supported | LL | trait Tr2: SuperA + !SuperB {} | ^^^^^^^^^ negative trait bounds are not supported + | = help: remove the trait bound error: negative trait bounds are not supported @@ -17,6 +19,7 @@ error: negative trait bounds are not supported | LL | trait Tr3: !SuperA + SuperB {} | ^^^^^^^^^ negative trait bounds are not supported + | = help: remove the trait bound error: negative trait bounds are not supported @@ -26,6 +29,7 @@ LL | trait Tr4: !SuperA + SuperB | ^^^^^^^^^ LL | + !SuperC + SuperD {} | ^^^^^^^^^ negative trait bounds are not supported + | = help: remove the trait bounds error: negative trait bounds are not supported @@ -35,6 +39,7 @@ LL | trait Tr5: !SuperA | ^^^^^^^^^ LL | + !SuperB {} | ^^^^^^^^^ negative trait bounds are not supported + | = help: remove the trait bounds error: aborting due to 5 previous errors diff --git a/src/test/ui/parser/issue-62895.stderr b/src/test/ui/parser/issue-62895.stderr index 39ce980964b77..14869e9c8f5e6 100644 --- a/src/test/ui/parser/issue-62895.stderr +++ b/src/test/ui/parser/issue-62895.stderr @@ -15,6 +15,7 @@ error: missing `fn` for function definition | LL | pub g() -> is | ^^^^ + | help: add `fn` here to parse `g` as a public function | LL | pub fn g() -> is diff --git a/src/test/ui/parser/issue-62973.stderr b/src/test/ui/parser/issue-62973.stderr index 141076bf6b638..e73776dc7b465 100644 --- a/src/test/ui/parser/issue-62973.stderr +++ b/src/test/ui/parser/issue-62973.stderr @@ -25,6 +25,7 @@ LL | fn p() { match s { v, E { [) {) } LL | | LL | | | |_^ + | help: surround the struct literal with parentheses | LL | fn p() { match (s { v, E { [) {) } diff --git a/src/test/ui/parser/keyword-abstract.stderr b/src/test/ui/parser/keyword-abstract.stderr index eb2c810099e16..b355b3a708d45 100644 --- a/src/test/ui/parser/keyword-abstract.stderr +++ b/src/test/ui/parser/keyword-abstract.stderr @@ -3,6 +3,7 @@ error: expected identifier, found reserved keyword `abstract` | LL | let abstract = (); | ^^^^^^^^ expected identifier, found reserved keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#abstract = (); diff --git a/src/test/ui/parser/keyword-as-as-identifier.stderr b/src/test/ui/parser/keyword-as-as-identifier.stderr index 5648652be9bca..dea4afd5c0a1c 100644 --- a/src/test/ui/parser/keyword-as-as-identifier.stderr +++ b/src/test/ui/parser/keyword-as-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `as` | LL | let as = "foo"; | ^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#as = "foo"; diff --git a/src/test/ui/parser/keyword-break-as-identifier.stderr b/src/test/ui/parser/keyword-break-as-identifier.stderr index 820193db70b0f..db05f3956a2a9 100644 --- a/src/test/ui/parser/keyword-break-as-identifier.stderr +++ b/src/test/ui/parser/keyword-break-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `break` | LL | let break = "foo"; | ^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#break = "foo"; diff --git a/src/test/ui/parser/keyword-const-as-identifier.stderr b/src/test/ui/parser/keyword-const-as-identifier.stderr index 95b536c99c75a..45c129960ecef 100644 --- a/src/test/ui/parser/keyword-const-as-identifier.stderr +++ b/src/test/ui/parser/keyword-const-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `const` | LL | let const = "foo"; | ^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#const = "foo"; diff --git a/src/test/ui/parser/keyword-continue-as-identifier.stderr b/src/test/ui/parser/keyword-continue-as-identifier.stderr index 6b24422a5557e..2ec4b28c94e09 100644 --- a/src/test/ui/parser/keyword-continue-as-identifier.stderr +++ b/src/test/ui/parser/keyword-continue-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `continue` | LL | let continue = "foo"; | ^^^^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#continue = "foo"; diff --git a/src/test/ui/parser/keyword-else-as-identifier.stderr b/src/test/ui/parser/keyword-else-as-identifier.stderr index f28635cd08cd6..b622806e91669 100644 --- a/src/test/ui/parser/keyword-else-as-identifier.stderr +++ b/src/test/ui/parser/keyword-else-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `else` | LL | let else = "foo"; | ^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#else = "foo"; diff --git a/src/test/ui/parser/keyword-enum-as-identifier.stderr b/src/test/ui/parser/keyword-enum-as-identifier.stderr index fc54dce1b68f4..0f3fa3fb624dc 100644 --- a/src/test/ui/parser/keyword-enum-as-identifier.stderr +++ b/src/test/ui/parser/keyword-enum-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `enum` | LL | let enum = "foo"; | ^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#enum = "foo"; diff --git a/src/test/ui/parser/keyword-final.stderr b/src/test/ui/parser/keyword-final.stderr index 291710d05cbfd..c74e3101729d4 100644 --- a/src/test/ui/parser/keyword-final.stderr +++ b/src/test/ui/parser/keyword-final.stderr @@ -3,6 +3,7 @@ error: expected identifier, found reserved keyword `final` | LL | let final = (); | ^^^^^ expected identifier, found reserved keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#final = (); diff --git a/src/test/ui/parser/keyword-fn-as-identifier.stderr b/src/test/ui/parser/keyword-fn-as-identifier.stderr index 692f195b2888d..3219eaf24f94f 100644 --- a/src/test/ui/parser/keyword-fn-as-identifier.stderr +++ b/src/test/ui/parser/keyword-fn-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `fn` | LL | let fn = "foo"; | ^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#fn = "foo"; diff --git a/src/test/ui/parser/keyword-for-as-identifier.stderr b/src/test/ui/parser/keyword-for-as-identifier.stderr index bcaf421286e76..30974af74248f 100644 --- a/src/test/ui/parser/keyword-for-as-identifier.stderr +++ b/src/test/ui/parser/keyword-for-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `for` | LL | let for = "foo"; | ^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#for = "foo"; diff --git a/src/test/ui/parser/keyword-if-as-identifier.stderr b/src/test/ui/parser/keyword-if-as-identifier.stderr index 43fbcd7148a1d..a72030befb38d 100644 --- a/src/test/ui/parser/keyword-if-as-identifier.stderr +++ b/src/test/ui/parser/keyword-if-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `if` | LL | let if = "foo"; | ^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#if = "foo"; diff --git a/src/test/ui/parser/keyword-impl-as-identifier.stderr b/src/test/ui/parser/keyword-impl-as-identifier.stderr index 01886eb45cb6d..e51c60ed494f3 100644 --- a/src/test/ui/parser/keyword-impl-as-identifier.stderr +++ b/src/test/ui/parser/keyword-impl-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `impl` | LL | let impl = "foo"; | ^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#impl = "foo"; diff --git a/src/test/ui/parser/keyword-let-as-identifier.stderr b/src/test/ui/parser/keyword-let-as-identifier.stderr index f6c39077be23b..d580b4518098c 100644 --- a/src/test/ui/parser/keyword-let-as-identifier.stderr +++ b/src/test/ui/parser/keyword-let-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `let` | LL | let let = "foo"; | ^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#let = "foo"; diff --git a/src/test/ui/parser/keyword-loop-as-identifier.stderr b/src/test/ui/parser/keyword-loop-as-identifier.stderr index f0c282faa29f1..15c008da35355 100644 --- a/src/test/ui/parser/keyword-loop-as-identifier.stderr +++ b/src/test/ui/parser/keyword-loop-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `loop` | LL | let loop = "foo"; | ^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#loop = "foo"; diff --git a/src/test/ui/parser/keyword-match-as-identifier.stderr b/src/test/ui/parser/keyword-match-as-identifier.stderr index f1f4397d194f0..5ba63965c87be 100644 --- a/src/test/ui/parser/keyword-match-as-identifier.stderr +++ b/src/test/ui/parser/keyword-match-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `match` | LL | let match = "foo"; | ^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#match = "foo"; diff --git a/src/test/ui/parser/keyword-mod-as-identifier.stderr b/src/test/ui/parser/keyword-mod-as-identifier.stderr index 65ae3baa8c21d..7fb1bda3fb053 100644 --- a/src/test/ui/parser/keyword-mod-as-identifier.stderr +++ b/src/test/ui/parser/keyword-mod-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `mod` | LL | let mod = "foo"; | ^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#mod = "foo"; diff --git a/src/test/ui/parser/keyword-move-as-identifier.stderr b/src/test/ui/parser/keyword-move-as-identifier.stderr index 216f7c931eea7..9721c88cb165d 100644 --- a/src/test/ui/parser/keyword-move-as-identifier.stderr +++ b/src/test/ui/parser/keyword-move-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `move` | LL | let move = "foo"; | ^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#move = "foo"; diff --git a/src/test/ui/parser/keyword-override.stderr b/src/test/ui/parser/keyword-override.stderr index 3183fa510c2d1..8bbc6fc654750 100644 --- a/src/test/ui/parser/keyword-override.stderr +++ b/src/test/ui/parser/keyword-override.stderr @@ -3,6 +3,7 @@ error: expected identifier, found reserved keyword `override` | LL | let override = (); | ^^^^^^^^ expected identifier, found reserved keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#override = (); diff --git a/src/test/ui/parser/keyword-pub-as-identifier.stderr b/src/test/ui/parser/keyword-pub-as-identifier.stderr index f81078b12bd3c..10ff53e29161e 100644 --- a/src/test/ui/parser/keyword-pub-as-identifier.stderr +++ b/src/test/ui/parser/keyword-pub-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `pub` | LL | let pub = "foo"; | ^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#pub = "foo"; diff --git a/src/test/ui/parser/keyword-return-as-identifier.stderr b/src/test/ui/parser/keyword-return-as-identifier.stderr index 8cc4d12fbbb9a..5b5f2b7ed54fe 100644 --- a/src/test/ui/parser/keyword-return-as-identifier.stderr +++ b/src/test/ui/parser/keyword-return-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `return` | LL | let return = "foo"; | ^^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#return = "foo"; diff --git a/src/test/ui/parser/keyword-static-as-identifier.stderr b/src/test/ui/parser/keyword-static-as-identifier.stderr index 7d22bc97d66ae..81aeb9e37abb3 100644 --- a/src/test/ui/parser/keyword-static-as-identifier.stderr +++ b/src/test/ui/parser/keyword-static-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `static` | LL | let static = "foo"; | ^^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#static = "foo"; diff --git a/src/test/ui/parser/keyword-struct-as-identifier.stderr b/src/test/ui/parser/keyword-struct-as-identifier.stderr index b109fa6247dcd..1b287b60197f4 100644 --- a/src/test/ui/parser/keyword-struct-as-identifier.stderr +++ b/src/test/ui/parser/keyword-struct-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `struct` | LL | let struct = "foo"; | ^^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#struct = "foo"; diff --git a/src/test/ui/parser/keyword-trait-as-identifier.stderr b/src/test/ui/parser/keyword-trait-as-identifier.stderr index ccc675cdb3a7c..c3d4d61dbb72a 100644 --- a/src/test/ui/parser/keyword-trait-as-identifier.stderr +++ b/src/test/ui/parser/keyword-trait-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `trait` | LL | let trait = "foo"; | ^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#trait = "foo"; diff --git a/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr b/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr index f71b889a30db5..fcd717d6e6712 100644 --- a/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr +++ b/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr @@ -3,6 +3,7 @@ error: expected identifier, found reserved keyword `try` | LL | let try = "foo"; | ^^^ expected identifier, found reserved keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#try = "foo"; diff --git a/src/test/ui/parser/keyword-type-as-identifier.stderr b/src/test/ui/parser/keyword-type-as-identifier.stderr index 88099d949a829..dfe1958e78fd7 100644 --- a/src/test/ui/parser/keyword-type-as-identifier.stderr +++ b/src/test/ui/parser/keyword-type-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `type` | LL | let type = "foo"; | ^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#type = "foo"; diff --git a/src/test/ui/parser/keyword-typeof.stderr b/src/test/ui/parser/keyword-typeof.stderr index 4a1b63d5c9357..7cef6de0cee80 100644 --- a/src/test/ui/parser/keyword-typeof.stderr +++ b/src/test/ui/parser/keyword-typeof.stderr @@ -3,6 +3,7 @@ error: expected identifier, found reserved keyword `typeof` | LL | let typeof = (); | ^^^^^^ expected identifier, found reserved keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#typeof = (); diff --git a/src/test/ui/parser/keyword-unsafe-as-identifier.stderr b/src/test/ui/parser/keyword-unsafe-as-identifier.stderr index 205bb81df405b..d714a99dac449 100644 --- a/src/test/ui/parser/keyword-unsafe-as-identifier.stderr +++ b/src/test/ui/parser/keyword-unsafe-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `unsafe` | LL | let unsafe = "foo"; | ^^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#unsafe = "foo"; diff --git a/src/test/ui/parser/keyword-use-as-identifier.stderr b/src/test/ui/parser/keyword-use-as-identifier.stderr index 85a0492f5735f..30a6c5b16a354 100644 --- a/src/test/ui/parser/keyword-use-as-identifier.stderr +++ b/src/test/ui/parser/keyword-use-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `use` | LL | let use = "foo"; | ^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#use = "foo"; diff --git a/src/test/ui/parser/keyword-where-as-identifier.stderr b/src/test/ui/parser/keyword-where-as-identifier.stderr index b8b8506907636..38d734ab81244 100644 --- a/src/test/ui/parser/keyword-where-as-identifier.stderr +++ b/src/test/ui/parser/keyword-where-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `where` | LL | let where = "foo"; | ^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#where = "foo"; diff --git a/src/test/ui/parser/keyword-while-as-identifier.stderr b/src/test/ui/parser/keyword-while-as-identifier.stderr index bb0c0ac668a41..22b5454add8b9 100644 --- a/src/test/ui/parser/keyword-while-as-identifier.stderr +++ b/src/test/ui/parser/keyword-while-as-identifier.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `while` | LL | let while = "foo"; | ^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#while = "foo"; diff --git a/src/test/ui/parser/keyword.stderr b/src/test/ui/parser/keyword.stderr index 262467b690720..c179f4ec56089 100644 --- a/src/test/ui/parser/keyword.stderr +++ b/src/test/ui/parser/keyword.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `break` | LL | pub mod break { | ^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | pub mod r#break { diff --git a/src/test/ui/parser/lex-bad-char-literals-2.stderr b/src/test/ui/parser/lex-bad-char-literals-2.stderr index 5653d4ea672af..3a545ee282660 100644 --- a/src/test/ui/parser/lex-bad-char-literals-2.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-2.stderr @@ -3,6 +3,7 @@ error: character literal may only contain one codepoint | LL | 'nope' | ^^^^^^ + | help: if you meant to write a `str` literal, use double quotes | LL | "nope" diff --git a/src/test/ui/parser/lex-bad-char-literals-3.stderr b/src/test/ui/parser/lex-bad-char-literals-3.stderr index 6462a3c0e57ba..ec661ee2a60d4 100644 --- a/src/test/ui/parser/lex-bad-char-literals-3.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-3.stderr @@ -3,6 +3,7 @@ error: character literal may only contain one codepoint | LL | static c: char = '●●'; | ^^^^ + | help: if you meant to write a `str` literal, use double quotes | LL | static c: char = "●●"; @@ -13,6 +14,7 @@ error: character literal may only contain one codepoint | LL | let ch: &str = '●●'; | ^^^^ + | help: if you meant to write a `str` literal, use double quotes | LL | let ch: &str = "●●"; diff --git a/src/test/ui/parser/lex-bad-char-literals-5.stderr b/src/test/ui/parser/lex-bad-char-literals-5.stderr index 97c6338820d73..334165a962a06 100644 --- a/src/test/ui/parser/lex-bad-char-literals-5.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-5.stderr @@ -3,6 +3,7 @@ error: character literal may only contain one codepoint | LL | static c: char = '\x10\x10'; | ^^^^^^^^^^ + | help: if you meant to write a `str` literal, use double quotes | LL | static c: char = "\x10\x10"; @@ -13,6 +14,7 @@ error: character literal may only contain one codepoint | LL | let ch: &str = '\x10\x10'; | ^^^^^^^^^^ + | help: if you meant to write a `str` literal, use double quotes | LL | let ch: &str = "\x10\x10"; diff --git a/src/test/ui/parser/lex-bad-char-literals-6.stderr b/src/test/ui/parser/lex-bad-char-literals-6.stderr index a7bbe05e94b7b..662cf2657e7b5 100644 --- a/src/test/ui/parser/lex-bad-char-literals-6.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-6.stderr @@ -3,6 +3,7 @@ error: character literal may only contain one codepoint | LL | let x: &str = 'ab'; | ^^^^ + | help: if you meant to write a `str` literal, use double quotes | LL | let x: &str = "ab"; @@ -13,6 +14,7 @@ error: character literal may only contain one codepoint | LL | let y: char = 'cd'; | ^^^^ + | help: if you meant to write a `str` literal, use double quotes | LL | let y: char = "cd"; @@ -23,6 +25,7 @@ error: character literal may only contain one codepoint | LL | let z = 'ef'; | ^^^^ + | help: if you meant to write a `str` literal, use double quotes | LL | let z = "ef"; diff --git a/src/test/ui/parser/macro-keyword.stderr b/src/test/ui/parser/macro-keyword.stderr index f74c8aa57e705..9fe95c3fd3dd0 100644 --- a/src/test/ui/parser/macro-keyword.stderr +++ b/src/test/ui/parser/macro-keyword.stderr @@ -3,6 +3,7 @@ error: expected identifier, found reserved keyword `macro` | LL | fn macro() { | ^^^^^ expected identifier, found reserved keyword + | help: you can escape reserved keywords to use them as identifiers | LL | fn r#macro() { diff --git a/src/test/ui/parser/macros-no-semicolon-items.stderr b/src/test/ui/parser/macros-no-semicolon-items.stderr index 5276aa6f5e9e9..980ceeed8c64d 100644 --- a/src/test/ui/parser/macros-no-semicolon-items.stderr +++ b/src/test/ui/parser/macros-no-semicolon-items.stderr @@ -3,6 +3,7 @@ error: macros that expand to items must be delimited with braces or followed by | LL | macro_rules! foo() | ^^ + | help: change the delimiters to curly braces | LL | macro_rules! foo {} @@ -22,6 +23,7 @@ LL | | blah LL | | blah LL | | ) | |_^ + | help: change the delimiters to curly braces | LL | bar! { diff --git a/src/test/ui/parser/match-arrows-block-then-binop.stderr b/src/test/ui/parser/match-arrows-block-then-binop.stderr index bb7df30783acd..3bc451e84e606 100644 --- a/src/test/ui/parser/match-arrows-block-then-binop.stderr +++ b/src/test/ui/parser/match-arrows-block-then-binop.stderr @@ -3,6 +3,7 @@ error: expected pattern, found `+` | LL | } + 5 | ^ expected pattern + | help: parentheses are required to parse this as an expression | LL | 0 => ({ diff --git a/src/test/ui/parser/mut-patterns.stderr b/src/test/ui/parser/mut-patterns.stderr index b1cf99189f17d..a0e290a834dfe 100644 --- a/src/test/ui/parser/mut-patterns.stderr +++ b/src/test/ui/parser/mut-patterns.stderr @@ -47,6 +47,7 @@ error: expected identifier, found reserved keyword `yield` | LL | let mut mut yield(become, await) = r#yield(0, 0); | ^^^^^ expected identifier, found reserved keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let mut mut r#yield(become, await) = r#yield(0, 0); @@ -57,6 +58,7 @@ error: expected identifier, found reserved keyword `become` | LL | let mut mut yield(become, await) = r#yield(0, 0); | ^^^^^^ expected identifier, found reserved keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let mut mut yield(r#become, await) = r#yield(0, 0); @@ -67,6 +69,7 @@ error: expected identifier, found keyword `await` | LL | let mut mut yield(become, await) = r#yield(0, 0); | ^^^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let mut mut yield(become, r#await) = r#yield(0, 0); diff --git a/src/test/ui/parser/range_inclusive_dotdotdot.stderr b/src/test/ui/parser/range_inclusive_dotdotdot.stderr index f877c5c6f79de..f129e1e372f1a 100644 --- a/src/test/ui/parser/range_inclusive_dotdotdot.stderr +++ b/src/test/ui/parser/range_inclusive_dotdotdot.stderr @@ -3,6 +3,7 @@ error: unexpected token: `...` | LL | return ...1; | ^^^ + | help: use `..` for an exclusive range | LL | return ..1; @@ -17,6 +18,7 @@ error: unexpected token: `...` | LL | let x = ...0; | ^^^ + | help: use `..` for an exclusive range | LL | let x = ..0; @@ -31,6 +33,7 @@ error: unexpected token: `...` | LL | let x = 5...5; | ^^^ + | help: use `..` for an exclusive range | LL | let x = 5..5; @@ -45,6 +48,7 @@ error: unexpected token: `...` | LL | for _ in 0...1 {} | ^^^ + | help: use `..` for an exclusive range | LL | for _ in 0..1 {} diff --git a/src/test/ui/parser/recover-from-homoglyph.stderr b/src/test/ui/parser/recover-from-homoglyph.stderr index 424d492b7ba64..ec7d041647a9f 100644 --- a/src/test/ui/parser/recover-from-homoglyph.stderr +++ b/src/test/ui/parser/recover-from-homoglyph.stderr @@ -3,6 +3,7 @@ error: unknown start of token: \u{37e} | LL | println!(""); | ^ + | help: Unicode character ';' (Greek Question Mark) looks like ';' (Semicolon), but it is not | LL | println!(""); diff --git a/src/test/ui/parser/removed-syntax-field-let.stderr b/src/test/ui/parser/removed-syntax-field-let.stderr index d6e38be4869eb..0d15151b7d451 100644 --- a/src/test/ui/parser/removed-syntax-field-let.stderr +++ b/src/test/ui/parser/removed-syntax-field-let.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `let` | LL | let foo: (), | ^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | r#let foo: (), diff --git a/src/test/ui/parser/require-parens-for-chained-comparison.stderr b/src/test/ui/parser/require-parens-for-chained-comparison.stderr index 5aa37a40cbd3d..85478dcd1dce5 100644 --- a/src/test/ui/parser/require-parens-for-chained-comparison.stderr +++ b/src/test/ui/parser/require-parens-for-chained-comparison.stderr @@ -15,6 +15,7 @@ error: chained comparison operators require parentheses | LL | f(); | ^^^ + | help: use `::<...>` instead of `<...>` to specify type arguments | LL | f::(); @@ -25,6 +26,7 @@ error: chained comparison operators require parentheses | LL | f, Option>>(1, 2); | ^^^^^^^^ + | help: use `::<...>` instead of `<...>` to specify type arguments | LL | f::, Option>>(1, 2); diff --git a/src/test/ui/parser/struct-literal-in-for.stderr b/src/test/ui/parser/struct-literal-in-for.stderr index 29af72a5d23d0..2e59914864abd 100644 --- a/src/test/ui/parser/struct-literal-in-for.stderr +++ b/src/test/ui/parser/struct-literal-in-for.stderr @@ -6,6 +6,7 @@ LL | for x in Foo { LL | | x: 3 LL | | }.hi() { | |_____^ + | help: surround the struct literal with parentheses | LL | for x in (Foo { diff --git a/src/test/ui/parser/struct-literal-in-if.stderr b/src/test/ui/parser/struct-literal-in-if.stderr index e76c1cb45dd4e..7a64a42e3c8aa 100644 --- a/src/test/ui/parser/struct-literal-in-if.stderr +++ b/src/test/ui/parser/struct-literal-in-if.stderr @@ -6,6 +6,7 @@ LL | if Foo { LL | | x: 3 LL | | }.hi() { | |_____^ + | help: surround the struct literal with parentheses | LL | if (Foo { diff --git a/src/test/ui/parser/struct-literal-in-match-discriminant.stderr b/src/test/ui/parser/struct-literal-in-match-discriminant.stderr index 95b0882b7aeb5..98077761e01cc 100644 --- a/src/test/ui/parser/struct-literal-in-match-discriminant.stderr +++ b/src/test/ui/parser/struct-literal-in-match-discriminant.stderr @@ -6,6 +6,7 @@ LL | match Foo { LL | | x: 3 LL | | } { | |_____^ + | help: surround the struct literal with parentheses | LL | match (Foo { diff --git a/src/test/ui/parser/struct-literal-in-while.stderr b/src/test/ui/parser/struct-literal-in-while.stderr index acd31b477dc27..a14df3a220e75 100644 --- a/src/test/ui/parser/struct-literal-in-while.stderr +++ b/src/test/ui/parser/struct-literal-in-while.stderr @@ -6,6 +6,7 @@ LL | while Foo { LL | | x: 3 LL | | }.hi() { | |_____^ + | help: surround the struct literal with parentheses | LL | while (Foo { diff --git a/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr b/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr index 24078074161e6..38f4a986e12d4 100644 --- a/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr +++ b/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr @@ -6,6 +6,7 @@ LL | while || Foo { LL | | x: 3 LL | | }.hi() { | |_____^ + | help: surround the struct literal with parentheses | LL | while || (Foo { diff --git a/src/test/ui/parser/unicode-chars.stderr b/src/test/ui/parser/unicode-chars.stderr index 76bf6627a4bc4..4e14eda8f2bfa 100644 --- a/src/test/ui/parser/unicode-chars.stderr +++ b/src/test/ui/parser/unicode-chars.stderr @@ -3,6 +3,7 @@ error: unknown start of token: \u{37e} | LL | let y = 0; | ^ + | help: Unicode character ';' (Greek Question Mark) looks like ';' (Semicolon), but it is not | LL | let y = 0; diff --git a/src/test/ui/parser/unicode-quote-chars.stderr b/src/test/ui/parser/unicode-quote-chars.stderr index 84e45ecd873a4..4b0cb96ed211f 100644 --- a/src/test/ui/parser/unicode-quote-chars.stderr +++ b/src/test/ui/parser/unicode-quote-chars.stderr @@ -3,6 +3,7 @@ error: unknown start of token: \u{201c} | LL | println!(“hello world”); | ^ + | help: Unicode characters '“' (Left Double Quotation Mark) and '”' (Right Double Quotation Mark) look like '"' (Quotation Mark), but are not | LL | println!("hello world"); @@ -13,6 +14,7 @@ error: unknown start of token: \u{201d} | LL | println!(“hello world”); | ^ + | help: Unicode character '”' (Right Double Quotation Mark) looks like '"' (Quotation Mark), but it is not | LL | println!(“hello world"); diff --git a/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr b/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr index 0764400254350..c73e17d2fc9af 100644 --- a/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr +++ b/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `as` | LL | use std::any:: as foo; | ^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | use std::any:: r#as foo; diff --git a/src/test/ui/placement-syntax.stderr b/src/test/ui/placement-syntax.stderr index e26931e60d88f..1a76f7c222fc2 100644 --- a/src/test/ui/placement-syntax.stderr +++ b/src/test/ui/placement-syntax.stderr @@ -3,6 +3,7 @@ error: unexpected token: `<-` | LL | if x<-1 { | ^^ + | help: if you meant to write a comparison against a negative value, add a space in between `<` and `-` | LL | if x< -1 { diff --git a/src/test/ui/pptypedef.stderr b/src/test/ui/pptypedef.stderr index dc4b3ce370cb1..0886622247a77 100644 --- a/src/test/ui/pptypedef.stderr +++ b/src/test/ui/pptypedef.stderr @@ -3,6 +3,7 @@ error[E0308]: mismatched types | LL | let_in(3u32, |i| { assert!(i == 3i32); }); | ^^^^ expected u32, found i32 + | help: change the type of the numeric literal from `i32` to `u32` | LL | let_in(3u32, |i| { assert!(i == 3u32); }); @@ -13,6 +14,7 @@ error[E0308]: mismatched types | LL | let_in(3i32, |i| { assert!(i == 3u32); }); | ^^^^ expected i32, found u32 + | help: change the type of the numeric literal from `u32` to `i32` | LL | let_in(3i32, |i| { assert!(i == 3i32); }); diff --git a/src/test/ui/privacy/privacy-ns1.stderr b/src/test/ui/privacy/privacy-ns1.stderr index 8ffc12c31cb66..16da57a78e092 100644 --- a/src/test/ui/privacy/privacy-ns1.stderr +++ b/src/test/ui/privacy/privacy-ns1.stderr @@ -3,6 +3,7 @@ error[E0423]: expected function, found trait `Bar` | LL | Bar(); | ^^^ + | help: a unit struct with a similar name exists | LL | Baz(); @@ -21,6 +22,7 @@ error[E0573]: expected type, found function `Bar` | LL | let _x: Box; | ^^^ + | help: a struct with a similar name exists | LL | let _x: Box; @@ -39,6 +41,7 @@ error[E0425]: cannot find function `Bar` in this scope | LL | Bar(); | ^^^ + | help: a unit struct with a similar name exists | LL | Baz(); @@ -57,6 +60,7 @@ error[E0412]: cannot find type `Bar` in this scope | LL | let _x: Box; | ^^^ + | help: a struct with a similar name exists | LL | let _x: Box; diff --git a/src/test/ui/privacy/privacy-ns2.stderr b/src/test/ui/privacy/privacy-ns2.stderr index 13057a899f3c9..f0d5da6868596 100644 --- a/src/test/ui/privacy/privacy-ns2.stderr +++ b/src/test/ui/privacy/privacy-ns2.stderr @@ -3,6 +3,7 @@ error[E0423]: expected function, found trait `Bar` | LL | Bar(); | ^^^ not a function + | help: possible better candidates are found in other modules, you can import them into scope | LL | use foo1::Bar; @@ -17,6 +18,7 @@ error[E0423]: expected function, found trait `Bar` | LL | Bar(); | ^^^ + | help: a unit struct with a similar name exists | LL | Baz(); @@ -35,6 +37,7 @@ error[E0573]: expected type, found function `Bar` | LL | let _x : Box; | ^^^ not a type + | help: possible better candidates are found in other modules, you can import them into scope | LL | use foo1::Bar; @@ -49,6 +52,7 @@ error[E0573]: expected type, found function `Bar` | LL | let _x: Box; | ^^^ + | help: a struct with a similar name exists | LL | let _x: Box; diff --git a/src/test/ui/proc-macro/mixed-site-span.stderr b/src/test/ui/proc-macro/mixed-site-span.stderr index 475e3e0ca359b..54d10fe0d9011 100644 --- a/src/test/ui/proc-macro/mixed-site-span.stderr +++ b/src/test/ui/proc-macro/mixed-site-span.stderr @@ -38,6 +38,7 @@ LL | | } | LL | pass_dollar_crate!(); | --------------------- in this macro invocation + | help: possible candidate is found in another module, you can import it into scope | LL | use ItemUse; diff --git a/src/test/ui/pub/pub-ident-fn-2.stderr b/src/test/ui/pub/pub-ident-fn-2.stderr index 69b273df031d7..c44a5961565ab 100644 --- a/src/test/ui/pub/pub-ident-fn-2.stderr +++ b/src/test/ui/pub/pub-ident-fn-2.stderr @@ -3,6 +3,7 @@ error: missing `fn` for function definition | LL | pub foo(s: usize) { bar() } | ^ + | help: add `fn` here to parse `foo` as a public function | LL | pub fn foo(s: usize) { bar() } diff --git a/src/test/ui/pub/pub-ident-fn-with-lifetime-2.stderr b/src/test/ui/pub/pub-ident-fn-with-lifetime-2.stderr index c403774df8ede..0df6c00a31656 100644 --- a/src/test/ui/pub/pub-ident-fn-with-lifetime-2.stderr +++ b/src/test/ui/pub/pub-ident-fn-with-lifetime-2.stderr @@ -3,6 +3,7 @@ error: missing `fn` for method definition | LL | pub bar<'a>(&self, _s: &'a usize) -> bool { true } | ^^^ + | help: add `fn` here to parse `bar` as a public method | LL | pub fn bar<'a>(&self, _s: &'a usize) -> bool { true } diff --git a/src/test/ui/pub/pub-ident-fn-with-lifetime.stderr b/src/test/ui/pub/pub-ident-fn-with-lifetime.stderr index 858238096408f..90c78141adbf6 100644 --- a/src/test/ui/pub/pub-ident-fn-with-lifetime.stderr +++ b/src/test/ui/pub/pub-ident-fn-with-lifetime.stderr @@ -3,6 +3,7 @@ error: missing `fn` for function definition | LL | pub foo<'a>(_s: &'a usize) -> bool { true } | ^^^ + | help: add `fn` here to parse `foo` as a public function | LL | pub fn foo<'a>(_s: &'a usize) -> bool { true } diff --git a/src/test/ui/pub/pub-ident-fn.stderr b/src/test/ui/pub/pub-ident-fn.stderr index b5ab88b8ccf80..928f62133a95b 100644 --- a/src/test/ui/pub/pub-ident-fn.stderr +++ b/src/test/ui/pub/pub-ident-fn.stderr @@ -3,6 +3,7 @@ error: missing `fn` for function definition | LL | pub foo(_s: usize) -> bool { true } | ^^^ + | help: add `fn` here to parse `foo` as a public function | LL | pub fn foo(_s: usize) -> bool { true } diff --git a/src/test/ui/pub/pub-ident-struct-with-lifetime.stderr b/src/test/ui/pub/pub-ident-struct-with-lifetime.stderr index 2bbcf5dfff010..79597c54e68e2 100644 --- a/src/test/ui/pub/pub-ident-struct-with-lifetime.stderr +++ b/src/test/ui/pub/pub-ident-struct-with-lifetime.stderr @@ -3,6 +3,7 @@ error: missing `struct` for struct definition | LL | pub S<'a> { | ^ + | help: add `struct` here to parse `S` as a public struct | LL | pub struct S<'a> { diff --git a/src/test/ui/pub/pub-ident-struct.stderr b/src/test/ui/pub/pub-ident-struct.stderr index a9f2f89edd998..efd7d1fe76a16 100644 --- a/src/test/ui/pub/pub-ident-struct.stderr +++ b/src/test/ui/pub/pub-ident-struct.stderr @@ -3,6 +3,7 @@ error: missing `struct` for struct definition | LL | pub S { | ^ + | help: add `struct` here to parse `S` as a public struct | LL | pub struct S { diff --git a/src/test/ui/repeat_count.stderr b/src/test/ui/repeat_count.stderr index df73ac0b182f0..aae79dfbb3fae 100644 --- a/src/test/ui/repeat_count.stderr +++ b/src/test/ui/repeat_count.stderr @@ -42,6 +42,7 @@ error[E0308]: mismatched types | LL | let f = [0; -4_isize]; | ^^^^^^^^ expected usize, found isize + | help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit | LL | let f = [0; (-4_isize).try_into().unwrap()]; @@ -52,6 +53,7 @@ error[E0308]: mismatched types | LL | let f = [0_usize; -1_isize]; | ^^^^^^^^ expected usize, found isize + | help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit | LL | let f = [0_usize; (-1_isize).try_into().unwrap()]; diff --git a/src/test/ui/reserved/reserved-become.stderr b/src/test/ui/reserved/reserved-become.stderr index 3ce9fb33c289e..47e5b803970b5 100644 --- a/src/test/ui/reserved/reserved-become.stderr +++ b/src/test/ui/reserved/reserved-become.stderr @@ -3,6 +3,7 @@ error: expected identifier, found reserved keyword `become` | LL | let become = 0; | ^^^^^^ expected identifier, found reserved keyword + | help: you can escape reserved keywords to use them as identifiers | LL | let r#become = 0; diff --git a/src/test/ui/resolve/enums-are-namespaced-xc.stderr b/src/test/ui/resolve/enums-are-namespaced-xc.stderr index d2209236a42e7..092051ed874ed 100644 --- a/src/test/ui/resolve/enums-are-namespaced-xc.stderr +++ b/src/test/ui/resolve/enums-are-namespaced-xc.stderr @@ -3,6 +3,7 @@ error[E0425]: cannot find value `A` in crate `namespaced_enums` | LL | let _ = namespaced_enums::A; | ^ not found in `namespaced_enums` + | help: possible candidate is found in another module, you can import it into scope | LL | use namespaced_enums::Foo::A; @@ -13,6 +14,7 @@ error[E0425]: cannot find function `B` in crate `namespaced_enums` | LL | let _ = namespaced_enums::B(10); | ^ not found in `namespaced_enums` + | help: possible candidate is found in another module, you can import it into scope | LL | use namespaced_enums::Foo::B; @@ -23,6 +25,7 @@ error[E0422]: cannot find struct, variant or union type `C` in crate `namespaced | LL | let _ = namespaced_enums::C { a: 10 }; | ^ not found in `namespaced_enums` + | help: possible candidate is found in another module, you can import it into scope | LL | use namespaced_enums::Foo::C; diff --git a/src/test/ui/resolve/issue-16058.stderr b/src/test/ui/resolve/issue-16058.stderr index 9766f8f1412b6..31f4998bd83b6 100644 --- a/src/test/ui/resolve/issue-16058.stderr +++ b/src/test/ui/resolve/issue-16058.stderr @@ -3,6 +3,7 @@ error[E0574]: expected struct, variant or union type, found enum `Result` | LL | Result { | ^^^^^^ not a struct, variant or union type + | help: possible better candidates are found in other modules, you can import them into scope | LL | use std::fmt::Result; diff --git a/src/test/ui/resolve/issue-17518.stderr b/src/test/ui/resolve/issue-17518.stderr index 057aac25234d2..6098d4f490155 100644 --- a/src/test/ui/resolve/issue-17518.stderr +++ b/src/test/ui/resolve/issue-17518.stderr @@ -3,6 +3,7 @@ error[E0422]: cannot find struct, variant or union type `E` in this scope | LL | E { name: "foobar" }; | ^ not found in this scope + | help: possible candidate is found in another module, you can import it into scope | LL | use SomeEnum::E; diff --git a/src/test/ui/resolve/issue-21221-1.stderr b/src/test/ui/resolve/issue-21221-1.stderr index 513e02f74e3b2..27fd612faca9c 100644 --- a/src/test/ui/resolve/issue-21221-1.stderr +++ b/src/test/ui/resolve/issue-21221-1.stderr @@ -3,6 +3,7 @@ error[E0405]: cannot find trait `Mul` in this scope | LL | impl Mul for Foo { | ^^^ not found in this scope + | help: possible candidates are found in other modules, you can import them into scope | LL | use mul1::Mul; @@ -17,6 +18,7 @@ error[E0412]: cannot find type `Mul` in this scope | LL | fn getMul() -> Mul { | ^^^ not found in this scope + | help: possible candidates are found in other modules, you can import them into scope | LL | use mul1::Mul; @@ -40,6 +42,7 @@ error[E0405]: cannot find trait `Div` in this scope | LL | impl Div for Foo { | ^^^ not found in this scope + | help: possible candidate is found in another module, you can import it into scope | LL | use std::ops::Div; diff --git a/src/test/ui/resolve/issue-21221-2.stderr b/src/test/ui/resolve/issue-21221-2.stderr index 23d4015ca54af..b360fda6f9d7c 100644 --- a/src/test/ui/resolve/issue-21221-2.stderr +++ b/src/test/ui/resolve/issue-21221-2.stderr @@ -3,6 +3,7 @@ error[E0405]: cannot find trait `T` in this scope | LL | impl T for Foo { } | ^ not found in this scope + | help: possible candidate is found in another module, you can import it into scope | LL | use foo::bar::T; diff --git a/src/test/ui/resolve/issue-21221-3.stderr b/src/test/ui/resolve/issue-21221-3.stderr index 09cfed96bed3d..f2c94d467e25e 100644 --- a/src/test/ui/resolve/issue-21221-3.stderr +++ b/src/test/ui/resolve/issue-21221-3.stderr @@ -3,6 +3,7 @@ error[E0405]: cannot find trait `OuterTrait` in this scope | LL | impl OuterTrait for Foo {} | ^^^^^^^^^^ not found in this scope + | help: possible candidate is found in another module, you can import it into scope | LL | use issue_21221_3::outer::OuterTrait; diff --git a/src/test/ui/resolve/issue-21221-4.stderr b/src/test/ui/resolve/issue-21221-4.stderr index 68989a30e6715..0b1527f91bd00 100644 --- a/src/test/ui/resolve/issue-21221-4.stderr +++ b/src/test/ui/resolve/issue-21221-4.stderr @@ -3,6 +3,7 @@ error[E0405]: cannot find trait `T` in this scope | LL | impl T for Foo {} | ^ not found in this scope + | help: possible candidate is found in another module, you can import it into scope | LL | use issue_21221_4::T; diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr index 7d8d1d0abfc21..b7cc79cfed9e6 100644 --- a/src/test/ui/resolve/privacy-enum-ctor.stderr +++ b/src/test/ui/resolve/privacy-enum-ctor.stderr @@ -3,6 +3,7 @@ error[E0423]: expected value, found enum `n::Z` | LL | n::Z; | ^^^^ + | help: try using one of the enum's variants | LL | m::Z::Fn; @@ -17,6 +18,7 @@ error[E0423]: expected value, found enum `Z` | LL | Z; | ^ + | help: a function with a similar name exists | LL | f; @@ -46,6 +48,7 @@ error[E0423]: expected value, found enum `m::E` | LL | let _: E = m::E; | ^^^^ + | help: a function with a similar name exists | LL | let _: E = m::f; @@ -81,6 +84,7 @@ error[E0423]: expected value, found enum `E` | LL | let _: E = E; | ^ + | help: try using one of the enum's variants | LL | let _: E = E::Fn; @@ -112,6 +116,7 @@ error[E0412]: cannot find type `Z` in this scope | LL | let _: Z = m::n::Z; | ^ + | help: an enum with a similar name exists | LL | let _: E = m::n::Z; @@ -126,6 +131,7 @@ error[E0423]: expected value, found enum `m::n::Z` | LL | let _: Z = m::n::Z; | ^^^^^^^ + | help: try using one of the enum's variants | LL | let _: Z = m::Z::Fn; @@ -140,6 +146,7 @@ error[E0412]: cannot find type `Z` in this scope | LL | let _: Z = m::n::Z::Fn; | ^ + | help: an enum with a similar name exists | LL | let _: E = m::n::Z::Fn; @@ -154,6 +161,7 @@ error[E0412]: cannot find type `Z` in this scope | LL | let _: Z = m::n::Z::Struct; | ^ + | help: an enum with a similar name exists | LL | let _: E = m::n::Z::Struct; @@ -179,6 +187,7 @@ error[E0412]: cannot find type `Z` in this scope | LL | let _: Z = m::n::Z::Unit {}; | ^ + | help: an enum with a similar name exists | LL | let _: E = m::n::Z::Unit {}; @@ -237,6 +246,7 @@ LL | let _ = Z::Unit(); | ^^^^^^^-- | | | call expression requires function + | help: `Z::Unit` is a unit variant, you need to write it without the parenthesis | LL | let _ = Z::Unit; @@ -267,6 +277,7 @@ LL | let _: E = m::E::Unit(); | ^^^^^^^^^^-- | | | call expression requires function + | help: `m::E::Unit` is a unit variant, you need to write it without the parenthesis | LL | let _: E = m::E::Unit; @@ -297,6 +308,7 @@ LL | let _: E = E::Unit(); | ^^^^^^^-- | | | call expression requires function + | help: `E::Unit` is a unit variant, you need to write it without the parenthesis | LL | let _: E = E::Unit; diff --git a/src/test/ui/resolve/privacy-struct-ctor.stderr b/src/test/ui/resolve/privacy-struct-ctor.stderr index 7d884d3a66910..51928c32e31f7 100644 --- a/src/test/ui/resolve/privacy-struct-ctor.stderr +++ b/src/test/ui/resolve/privacy-struct-ctor.stderr @@ -29,6 +29,7 @@ error[E0423]: expected value, found struct `xcrate::S` | LL | xcrate::S; | ^^^^^^^^^ constructor is not visible here due to private fields + | help: possible better candidate is found in another module, you can import it into scope | LL | use m::S; diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr index b7b158ce7efa6..9a3d5feee0426 100644 --- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr +++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr @@ -27,6 +27,7 @@ error[E0423]: expected value, found module `a::b` | LL | a::b.J | ^^^^ + | help: a constant with a similar name exists | LL | a::I.J @@ -57,6 +58,7 @@ error[E0423]: expected value, found module `a::b` | LL | a::b.f() | ^^^^ + | help: a constant with a similar name exists | LL | a::I.f() diff --git a/src/test/ui/resolve/use_suggestion_placement.stderr b/src/test/ui/resolve/use_suggestion_placement.stderr index 258b989387c50..ef451ea847a37 100644 --- a/src/test/ui/resolve/use_suggestion_placement.stderr +++ b/src/test/ui/resolve/use_suggestion_placement.stderr @@ -3,6 +3,7 @@ error[E0412]: cannot find type `Path` in this scope | LL | type Bar = Path; | ^^^^ not found in this scope + | help: possible candidate is found in another module, you can import it into scope | LL | use std::path::Path; @@ -13,6 +14,7 @@ error[E0425]: cannot find value `A` in this scope | LL | let _ = A; | ^ not found in this scope + | help: possible candidate is found in another module, you can import it into scope | LL | use m::A; @@ -23,6 +25,7 @@ error[E0412]: cannot find type `HashMap` in this scope | LL | type Dict = HashMap; | ^^^^^^^ not found in this scope + | help: possible candidates are found in other modules, you can import them into scope | LL | use std::collections::HashMap; diff --git a/src/test/ui/rust-2018/dyn-trait-compatibility.stderr b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr index e1f099e91907b..01c4737de5ec7 100644 --- a/src/test/ui/rust-2018/dyn-trait-compatibility.stderr +++ b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr @@ -3,6 +3,7 @@ error: expected identifier, found keyword `dyn` | LL | type A1 = dyn::dyn; | ^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | type A1 = dyn::r#dyn; diff --git a/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr b/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr index e0e846422d3ce..3515d42260591 100644 --- a/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr +++ b/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr @@ -19,6 +19,7 @@ error: outlives requirements can be inferred | LL | struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { | ^^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { @@ -29,6 +30,7 @@ error: outlives requirements can be inferred | LL | struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { | ^^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { @@ -39,6 +41,7 @@ error: outlives requirements can be inferred | LL | struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { | ^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug> { @@ -49,6 +52,7 @@ error: outlives requirements can be inferred | LL | struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { | ^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug> { @@ -59,6 +63,7 @@ error: outlives requirements can be inferred | LL | struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { | ^^^^ ^^^^^^^^^^^^ + | help: remove these bounds | LL | struct TeeOutlivesAyYooWhereBee<'a, 'b, T, U> { @@ -69,6 +74,7 @@ error: outlives requirements can be inferred | LL | struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { | ^^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug { @@ -79,6 +85,7 @@ error: outlives requirements can be inferred | LL | struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { | ^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { @@ -89,6 +96,7 @@ error: outlives requirements can be inferred | LL | struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { | ^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { @@ -99,6 +107,7 @@ error: outlives requirements can be inferred | LL | struct TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { | ^^^^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { @@ -109,6 +118,7 @@ error: outlives requirements can be inferred | LL | struct TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { | ^^^^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { @@ -119,6 +129,7 @@ error: outlives requirements can be inferred | LL | struct BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { | ^^^^ ^^^^ + | help: remove these bounds | LL | struct BeeOutlivesAyTeeBee<'a, 'b, T> { @@ -129,6 +140,7 @@ error: outlives requirements can be inferred | LL | struct BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { | ^^^^ ^^^^^^^^^ + | help: remove these bounds | LL | struct BeeOutlivesAyTeeAyBee<'a, 'b, T> { @@ -139,6 +151,7 @@ error: outlives requirements can be inferred | LL | struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { | ^^^^ ^^^^^ ^^^^^ + | help: remove these bounds | LL | struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { @@ -149,6 +162,7 @@ error: outlives requirements can be inferred | LL | struct BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { | ^^^^^^^^ ^^^^^ ^^^^^ + | help: remove these bounds | LL | struct BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { @@ -159,6 +173,7 @@ error: outlives requirements can be inferred | LL | struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { | ^^^^ ^^^^^ ^^^^^ + | help: remove these bounds | LL | struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { @@ -169,6 +184,7 @@ error: outlives requirements can be inferred | LL | where U: 'a + Debug + 'b, 'b: 'a | ^^^^^ ^^^^^ ^^^^^^ + | help: remove these bounds | LL | where U: Debug, @@ -179,6 +195,7 @@ error: outlives requirements can be inferred | LL | struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b>(&'a &'b T); | ^^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug>(&'a &'b T); @@ -189,6 +206,7 @@ error: outlives requirements can be inferred | LL | struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: 'a + Debug + 'b; | ^^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: Debug; @@ -199,6 +217,7 @@ error: outlives requirements can be inferred | LL | struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b>(T, &'a &'b U); | ^^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug>(T, &'a &'b U); @@ -209,6 +228,7 @@ error: outlives requirements can be inferred | LL | struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug>(&'a T, &'b U); | ^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug>(&'a T, &'b U); @@ -219,6 +239,7 @@ error: outlives requirements can be inferred | LL | struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b>(&'a T, &'b U); | ^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug>(&'a T, &'b U); @@ -229,6 +250,7 @@ error: outlives requirements can be inferred | LL | struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: 'b; | ^^^^ ^^^^^^^^^^^ + | help: remove these bounds | LL | struct TeeOutlivesAyYooWhereBee<'a, 'b, T, U>(&'a T, &'b U) ; @@ -239,6 +261,7 @@ error: outlives requirements can be inferred | LL | struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U>(T, &'a &'b U) where U: 'a + Debug + 'b; | ^^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U>(T, &'a &'b U) where U: Debug; @@ -249,6 +272,7 @@ error: outlives requirements can be inferred | LL | struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: 'b + Debug; | ^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; @@ -259,6 +283,7 @@ error: outlives requirements can be inferred | LL | struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U>(&'a T, &'b U) where U: Debug + 'b; | ^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; @@ -269,6 +294,7 @@ error: outlives requirements can be inferred | LL | struct TeeWhereAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where T: 'a, U: 'b + Debug; | ^^^^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeWhereAyYooWhereBeeIsDebug<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; @@ -279,6 +305,7 @@ error: outlives requirements can be inferred | LL | struct TeeWhereAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where T: 'a, U: Debug + 'b; | ^^^^^^^ ^^^^^ + | help: remove these bounds | LL | struct TeeWhereAyYooWhereIsDebugBee<'a, 'b, T, U>(&'a T, &'b U) where U: Debug; @@ -289,6 +316,7 @@ error: outlives requirements can be inferred | LL | struct BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b>(&'a &'b T); | ^^^^ ^^^^ + | help: remove these bounds | LL | struct BeeOutlivesAyTeeBee<'a, 'b, T>(&'a &'b T); @@ -299,6 +327,7 @@ error: outlives requirements can be inferred | LL | struct BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b>(&'a &'b T); | ^^^^ ^^^^^^^^^ + | help: remove these bounds | LL | struct BeeOutlivesAyTeeAyBee<'a, 'b, T>(&'a &'b T); @@ -309,6 +338,7 @@ error: outlives requirements can be inferred | LL | struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b>(&'a &'b T); | ^^^^ ^^^^^ ^^^^^ + | help: remove these bounds | LL | struct BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug>(&'a &'b T); @@ -319,6 +349,7 @@ error: outlives requirements can be inferred | LL | struct BeeWhereAyTeeWhereAyIsDebugBee<'a, 'b, T>(&'a &'b T) where 'b: 'a, T: 'a + Debug + 'b; | ^^^^^^^^ ^^^^^ ^^^^^ + | help: remove these bounds | LL | struct BeeWhereAyTeeWhereAyIsDebugBee<'a, 'b, T>(&'a &'b T) where T: Debug; @@ -329,6 +360,7 @@ error: outlives requirements can be inferred | LL | struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b>(T, &'a &'b U); | ^^^^ ^^^^^ ^^^^^ + | help: remove these bounds | LL | struct BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug>(T, &'a &'b U); @@ -339,6 +371,7 @@ error: outlives requirements can be inferred | LL | where U: 'a + Debug + 'b, 'b: 'a; | ^^^^^ ^^^^^ ^^^^^^ + | help: remove these bounds | LL | where U: Debug, ; @@ -349,6 +382,7 @@ error: outlives requirements can be inferred | LL | enum TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { | ^^^^^ ^^^^^ + | help: remove these bounds | LL | enum TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { @@ -359,6 +393,7 @@ error: outlives requirements can be inferred | LL | enum TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { | ^^^^^ ^^^^^ + | help: remove these bounds | LL | enum TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { @@ -369,6 +404,7 @@ error: outlives requirements can be inferred | LL | enum TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { | ^^^^^ ^^^^^ + | help: remove these bounds | LL | enum TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { @@ -379,6 +415,7 @@ error: outlives requirements can be inferred | LL | enum TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { | ^^^^ ^^^^^ + | help: remove these bounds | LL | enum TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug> { @@ -389,6 +426,7 @@ error: outlives requirements can be inferred | LL | enum TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { | ^^^^ ^^^^^ + | help: remove these bounds | LL | enum TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug> { @@ -399,6 +437,7 @@ error: outlives requirements can be inferred | LL | enum TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { | ^^^^ ^^^^^^^^^^^^ + | help: remove these bounds | LL | enum TeeOutlivesAyYooWhereBee<'a, 'b, T, U> { @@ -409,6 +448,7 @@ error: outlives requirements can be inferred | LL | enum TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { | ^^^^^ ^^^^^ + | help: remove these bounds | LL | enum TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug { @@ -419,6 +459,7 @@ error: outlives requirements can be inferred | LL | enum TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { | ^^^^ ^^^^^ + | help: remove these bounds | LL | enum TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { @@ -429,6 +470,7 @@ error: outlives requirements can be inferred | LL | enum TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { | ^^^^ ^^^^^ + | help: remove these bounds | LL | enum TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { @@ -439,6 +481,7 @@ error: outlives requirements can be inferred | LL | enum TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { | ^^^^^^^ ^^^^^ + | help: remove these bounds | LL | enum TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { @@ -449,6 +492,7 @@ error: outlives requirements can be inferred | LL | enum TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { | ^^^^^^^ ^^^^^ + | help: remove these bounds | LL | enum TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { @@ -459,6 +503,7 @@ error: outlives requirements can be inferred | LL | enum BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { | ^^^^ ^^^^ + | help: remove these bounds | LL | enum BeeOutlivesAyTeeBee<'a, 'b, T> { @@ -469,6 +514,7 @@ error: outlives requirements can be inferred | LL | enum BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { | ^^^^ ^^^^^^^^^ + | help: remove these bounds | LL | enum BeeOutlivesAyTeeAyBee<'a, 'b, T> { @@ -479,6 +525,7 @@ error: outlives requirements can be inferred | LL | enum BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { | ^^^^ ^^^^^ ^^^^^ + | help: remove these bounds | LL | enum BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { @@ -489,6 +536,7 @@ error: outlives requirements can be inferred | LL | enum BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { | ^^^^^^^^ ^^^^^ ^^^^^ + | help: remove these bounds | LL | enum BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { @@ -499,6 +547,7 @@ error: outlives requirements can be inferred | LL | enum BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { | ^^^^ ^^^^^ ^^^^^ + | help: remove these bounds | LL | enum BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { @@ -509,6 +558,7 @@ error: outlives requirements can be inferred | LL | enum BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b, 'b: 'a { | ^^^^^ ^^^^^ ^^^^^^ + | help: remove these bounds | LL | enum BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug, { @@ -519,6 +569,7 @@ error: outlives requirements can be inferred | LL | union TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { | ^^^^^ ^^^^^ + | help: remove these bounds | LL | union TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { @@ -529,6 +580,7 @@ error: outlives requirements can be inferred | LL | union TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { | ^^^^^ ^^^^^ + | help: remove these bounds | LL | union TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { @@ -539,6 +591,7 @@ error: outlives requirements can be inferred | LL | union TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { | ^^^^^ ^^^^^ + | help: remove these bounds | LL | union TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { @@ -549,6 +602,7 @@ error: outlives requirements can be inferred | LL | union TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { | ^^^^ ^^^^^ + | help: remove these bounds | LL | union TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug> { @@ -559,6 +613,7 @@ error: outlives requirements can be inferred | LL | union TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { | ^^^^ ^^^^^ + | help: remove these bounds | LL | union TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug> { @@ -569,6 +624,7 @@ error: outlives requirements can be inferred | LL | union TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { | ^^^^ ^^^^^^^^^^^^ + | help: remove these bounds | LL | union TeeOutlivesAyYooWhereBee<'a, 'b, T, U> { @@ -579,6 +635,7 @@ error: outlives requirements can be inferred | LL | union TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { | ^^^^^ ^^^^^ + | help: remove these bounds | LL | union TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug { @@ -589,6 +646,7 @@ error: outlives requirements can be inferred | LL | union TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { | ^^^^ ^^^^^ + | help: remove these bounds | LL | union TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { @@ -599,6 +657,7 @@ error: outlives requirements can be inferred | LL | union TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { | ^^^^ ^^^^^ + | help: remove these bounds | LL | union TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { @@ -609,6 +668,7 @@ error: outlives requirements can be inferred | LL | union TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { | ^^^^^^^ ^^^^^ + | help: remove these bounds | LL | union TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { @@ -619,6 +679,7 @@ error: outlives requirements can be inferred | LL | union TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { | ^^^^^^^ ^^^^^ + | help: remove these bounds | LL | union TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { @@ -629,6 +690,7 @@ error: outlives requirements can be inferred | LL | union BeeOutlivesAyTeeBee<'a, 'b: 'a, T: 'b> { | ^^^^ ^^^^ + | help: remove these bounds | LL | union BeeOutlivesAyTeeBee<'a, 'b, T> { @@ -639,6 +701,7 @@ error: outlives requirements can be inferred | LL | union BeeOutlivesAyTeeAyBee<'a, 'b: 'a, T: 'a + 'b> { | ^^^^ ^^^^^^^^^ + | help: remove these bounds | LL | union BeeOutlivesAyTeeAyBee<'a, 'b, T> { @@ -649,6 +712,7 @@ error: outlives requirements can be inferred | LL | union BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b: 'a, T: 'a + Debug + 'b> { | ^^^^ ^^^^^ ^^^^^ + | help: remove these bounds | LL | union BeeOutlivesAyTeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { @@ -659,6 +723,7 @@ error: outlives requirements can be inferred | LL | union BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where 'b: 'a, T: 'a + Debug + 'b { | ^^^^^^^^ ^^^^^ ^^^^^ + | help: remove these bounds | LL | union BeeWhereAyTeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { @@ -669,6 +734,7 @@ error: outlives requirements can be inferred | LL | union BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b: 'a, T, U: 'a + Debug + 'b> { | ^^^^ ^^^^^ ^^^^^ + | help: remove these bounds | LL | union BeeOutlivesAyTeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { @@ -679,6 +745,7 @@ error: outlives requirements can be inferred | LL | union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b, 'b: 'a { | ^^^^^ ^^^^^ ^^^^^^ + | help: remove these bounds | LL | union BeeWhereAyTeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug, { diff --git a/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr b/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr index 973c486970e65..c712fd048f191 100644 --- a/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr +++ b/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr @@ -3,6 +3,7 @@ error[E0422]: cannot find struct, variant or union type `Drain` in this scope | LL | let _d = Drain {}; | ^^^^^ not found in this scope + | help: possible candidates are found in other modules, you can import them into scope | LL | use crate::plumbing::Drain; diff --git a/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.nll.stderr b/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.nll.stderr index a585b4fdbe608..713d4b759096e 100644 --- a/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.nll.stderr +++ b/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.nll.stderr @@ -5,6 +5,7 @@ LL | async fn f(self: Pin<&Self>) -> impl Clone { self } | - ^^^^^^^^ returning this value requires that `'_` must outlive `'static` | | | lifetime `'_` defined here + | help: to allow this `impl Trait` to capture borrowed data with lifetime `'_`, add `'_` as a constraint | LL | async fn f(self: Pin<&Self>) -> impl Clone + '_ { self } diff --git a/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.nll.stderr b/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.nll.stderr index dcfc9ba511d74..b46c6b9b71309 100644 --- a/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.nll.stderr +++ b/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.nll.stderr @@ -5,6 +5,7 @@ LL | fn f(self: Pin<&Self>) -> impl Clone { self } | - ^^^^^^^^^^ 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 f(self: Pin<&Self>) -> impl Clone + '_ { self } diff --git a/src/test/ui/self/self_type_keyword.stderr b/src/test/ui/self/self_type_keyword.stderr index 0af24dcedfbea..e3b871bd86764 100644 --- a/src/test/ui/self/self_type_keyword.stderr +++ b/src/test/ui/self/self_type_keyword.stderr @@ -65,6 +65,7 @@ error[E0531]: cannot find unit struct/variant or constant `Self` in this scope | LL | mut Self => (), | ^^^^ not found in this scope + | help: possible candidate is found in another module, you can import it into scope | LL | use foo::Self; diff --git a/src/test/ui/shift-various-bad-types.stderr b/src/test/ui/shift-various-bad-types.stderr index 409fabb951adc..c7a9588322651 100644 --- a/src/test/ui/shift-various-bad-types.stderr +++ b/src/test/ui/shift-various-bad-types.stderr @@ -27,6 +27,7 @@ error[E0308]: mismatched types | LL | let _: i32 = 22_i64 >> 1_i32; | ^^^^^^^^^^^^^^^ expected i32, found i64 + | help: you can convert an `i64` to `i32` and panic if the converted value wouldn't fit | LL | let _: i32 = (22_i64 >> 1_i32).try_into().unwrap(); diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr index faaa7e2f1b01b..25aa8bb6fb0bc 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr @@ -23,6 +23,7 @@ LL | fn center<'m>(_: Single<'m>) {} | ^^ -- ...is used only here | | | this lifetime... + | help: elide the single-use lifetime | LL | fn center(_: Single<'_>) {} @@ -33,6 +34,7 @@ error: lifetime parameter `'y` only used once | LL | fn left<'x, 'y>(foo: Double<'x, 'y>) -> &'x u32 { foo.f } | ^^ this lifetime... -- ...is used only here + | help: elide the single-use lifetime | LL | fn left<'x>(foo: Double<'x, '_>) -> &'x u32 { foo.f } @@ -43,6 +45,7 @@ error: lifetime parameter `'x` only used once | LL | fn right<'x, 'y>(foo: Double<'x, 'y>) -> &'y u32 { foo.f } | ^^ this lifetime... -- ...is used only here + | help: elide the single-use lifetime | LL | fn right<'y>(foo: Double<'_, 'y>) -> &'y u32 { foo.f } diff --git a/src/test/ui/span/issue-35987.stderr b/src/test/ui/span/issue-35987.stderr index f73bf27110b5c..3245d8655e87d 100644 --- a/src/test/ui/span/issue-35987.stderr +++ b/src/test/ui/span/issue-35987.stderr @@ -3,6 +3,7 @@ error[E0404]: expected trait, found type parameter `Add` | LL | impl Add for Foo { | ^^^ not a trait + | help: possible better candidate is found in another module, you can import it into scope | LL | use std::ops::Add; diff --git a/src/test/ui/span/issue-39018.stderr b/src/test/ui/span/issue-39018.stderr index d8fbf841b6157..2ce5b0c11712a 100644 --- a/src/test/ui/span/issue-39018.stderr +++ b/src/test/ui/span/issue-39018.stderr @@ -6,6 +6,7 @@ LL | let x = "Hello " + "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 x = "Hello ".to_owned() + "World!"; @@ -29,6 +30,7 @@ LL | let x = "Hello " + "World!".to_owned(); | | | | | `+` cannot be used to concatenate a `&str` with a `String` | &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 x = "Hello ".to_owned() + &"World!".to_owned(); @@ -42,6 +44,7 @@ LL | let _ = &a + &b; | | | | | `+` cannot be used to concatenate two `&str` strings | &std::string::String + | help: 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; @@ -55,6 +58,7 @@ LL | let _ = &a + b; | | | | | `+` cannot be used to concatenate a `&str` with a `String` | &std::string::String + | 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; @@ -80,6 +84,7 @@ LL | let _ = e + b; | | | | | `+` cannot be used to concatenate a `&str` with a `String` | &std::string::String + | 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 _ = e.to_owned() + &b; @@ -93,6 +98,7 @@ LL | let _ = e + &b; | | | | | `+` cannot be used to concatenate two `&str` strings | &std::string::String + | 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 _ = e.to_owned() + &b; @@ -106,6 +112,7 @@ LL | let _ = e + d; | | | | | `+` cannot be used to concatenate two `&str` strings | &std::string::String + | 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 _ = e.to_owned() + d; @@ -119,6 +126,7 @@ LL | let _ = e + &d; | | | | | `+` cannot be used to concatenate two `&str` strings | &std::string::String + | 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 _ = e.to_owned() + &d; @@ -152,6 +160,7 @@ LL | let _ = c + &d; | | | | | `+` 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 _ = c.to_owned() + &d; @@ -165,6 +174,7 @@ LL | let _ = c + d; | | | | | `+` 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 _ = c.to_owned() + d; diff --git a/src/test/ui/span/missing-unit-argument.stderr b/src/test/ui/span/missing-unit-argument.stderr index f1a29bed32b1c..90a96e3f17403 100644 --- a/src/test/ui/span/missing-unit-argument.stderr +++ b/src/test/ui/span/missing-unit-argument.stderr @@ -3,6 +3,7 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied | LL | let _: Result<(), String> = Ok(); | ^^^^ + | help: expected the unit value `()`; create it with empty parentheses | LL | let _: Result<(), String> = Ok(()); @@ -34,6 +35,7 @@ LL | fn bar(():()) {} ... LL | bar(); | ^^^^^ + | help: expected the unit value `()`; create it with empty parentheses | LL | bar(()); @@ -47,6 +49,7 @@ LL | fn baz(self, (): ()) { } ... LL | S.baz(); | ^^^ + | help: expected the unit value `()`; create it with empty parentheses | LL | S.baz(()); @@ -60,6 +63,7 @@ LL | fn generic(self, _: T) { } ... LL | S.generic::<()>(); | ^^^^^^^ + | help: expected the unit value `()`; create it with empty parentheses | LL | S.generic::<()>(()); diff --git a/src/test/ui/str/str-as-char.stderr b/src/test/ui/str/str-as-char.stderr index 540a1b55376ff..27d6336974c85 100644 --- a/src/test/ui/str/str-as-char.stderr +++ b/src/test/ui/str/str-as-char.stderr @@ -3,6 +3,7 @@ error: character literal may only contain one codepoint | LL | println!('●●'); | ^^^^ + | help: if you meant to write a `str` literal, use double quotes | LL | println!("●●"); diff --git a/src/test/ui/str/str-concat-on-double-ref.stderr b/src/test/ui/str/str-concat-on-double-ref.stderr index 3e53cdc4d98ca..d193955af4ba6 100644 --- a/src/test/ui/str/str-concat-on-double-ref.stderr +++ b/src/test/ui/str/str-concat-on-double-ref.stderr @@ -6,6 +6,7 @@ LL | let c = a + b; | | | | | `+` cannot be used to concatenate two `&str` strings | &std::string::String + | 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 c = a.to_owned() + b; diff --git a/src/test/ui/struct-literal-variant-in-if.stderr b/src/test/ui/struct-literal-variant-in-if.stderr index a52ec6dc53938..bfc8b24e8ac49 100644 --- a/src/test/ui/struct-literal-variant-in-if.stderr +++ b/src/test/ui/struct-literal-variant-in-if.stderr @@ -3,6 +3,7 @@ error: struct literals are not allowed here | LL | if x == E::I { field1: true, field2: 42 } {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | help: surround the struct literal with parentheses | LL | if x == (E::I { field1: true, field2: 42 }) {} @@ -13,6 +14,7 @@ error: struct literals are not allowed here | LL | if x == E::V { field: false } {} | ^^^^^^^^^^^^^^^^^^^^^ + | help: surround the struct literal with parentheses | LL | if x == (E::V { field: false }) {} @@ -23,6 +25,7 @@ error: struct literals are not allowed here | LL | if x == E::J { field: -42 } {} | ^^^^^^^^^^^^^^^^^^^ + | help: surround the struct literal with parentheses | LL | if x == (E::J { field: -42 }) {} @@ -33,6 +36,7 @@ error: struct literals are not allowed here | LL | if x == E::K { field: "" } {} | ^^^^^^^^^^^^^^^^^^ + | help: surround the struct literal with parentheses | LL | if x == (E::K { field: "" }) {} diff --git a/src/test/ui/suggestions/no-extern-crate-in-type.stderr b/src/test/ui/suggestions/no-extern-crate-in-type.stderr index d4a5a956714c9..22aad3b0a9f58 100644 --- a/src/test/ui/suggestions/no-extern-crate-in-type.stderr +++ b/src/test/ui/suggestions/no-extern-crate-in-type.stderr @@ -3,6 +3,7 @@ error[E0412]: cannot find type `Foo` in this scope | LL | type Output = Option; | ^^^ not found in this scope + | help: possible candidate is found in another module, you can import it into scope | LL | use foo::Foo; diff --git a/src/test/ui/suggestions/suggest-closure-return-type-1.stderr b/src/test/ui/suggestions/suggest-closure-return-type-1.stderr index de2d29f1270c6..7ef959053805b 100644 --- a/src/test/ui/suggestions/suggest-closure-return-type-1.stderr +++ b/src/test/ui/suggestions/suggest-closure-return-type-1.stderr @@ -3,6 +3,7 @@ error[E0282]: type annotations needed for the closure `fn() -> [_; 0]` | LL | let _v = || -> _ { [] }; | ^^ cannot infer type + | help: give this closure an explicit return type without `_` placeholders | LL | let _v = || -> [_; 0] { [] }; diff --git a/src/test/ui/suggestions/suggest-closure-return-type-2.stderr b/src/test/ui/suggestions/suggest-closure-return-type-2.stderr index 9dbd822fbb5de..2a8d7dd5b85db 100644 --- a/src/test/ui/suggestions/suggest-closure-return-type-2.stderr +++ b/src/test/ui/suggestions/suggest-closure-return-type-2.stderr @@ -3,6 +3,7 @@ error[E0282]: type annotations needed for the closure `fn() -> [_; 0]` | LL | let _v = || { [] }; | ^^ cannot infer type + | help: give this closure an explicit return type without `_` placeholders | LL | let _v = || -> [_; 0] { [] }; diff --git a/src/test/ui/suggestions/suggest-closure-return-type-3.stderr b/src/test/ui/suggestions/suggest-closure-return-type-3.stderr index ad0d4e41f7874..67dc4d8fd69b2 100644 --- a/src/test/ui/suggestions/suggest-closure-return-type-3.stderr +++ b/src/test/ui/suggestions/suggest-closure-return-type-3.stderr @@ -3,6 +3,7 @@ error[E0282]: type annotations needed for the closure `fn() -> [_; 0]` | LL | let _v = || []; | ^^ cannot infer type + | help: give this closure an explicit return type without `_` placeholders | LL | let _v = || -> [_; 0] { [] }; diff --git a/src/test/ui/suggestions/suggest-labels.stderr b/src/test/ui/suggestions/suggest-labels.stderr index 02d46a3f59607..079821e649070 100644 --- a/src/test/ui/suggestions/suggest-labels.stderr +++ b/src/test/ui/suggestions/suggest-labels.stderr @@ -3,6 +3,7 @@ error[E0426]: use of undeclared label `'fo` | LL | break 'fo; | ^^^ + | help: a label with a similar name exists in this scope | LL | break 'foo; @@ -13,6 +14,7 @@ error[E0426]: use of undeclared label `'bor` | LL | continue 'bor; | ^^^^ + | help: a label with a similar name exists in this scope | LL | continue 'bar; @@ -23,6 +25,7 @@ error[E0426]: use of undeclared label `'longlable` | LL | break 'longlable; | ^^^^^^^^^^ + | help: a label with a similar name exists in this scope | LL | break 'longlabel1; diff --git a/src/test/ui/suggestions/suggest-on-bare-closure-call.stderr b/src/test/ui/suggestions/suggest-on-bare-closure-call.stderr index 17001e3974c6d..28fef511e04b1 100644 --- a/src/test/ui/suggestions/suggest-on-bare-closure-call.stderr +++ b/src/test/ui/suggestions/suggest-on-bare-closure-call.stderr @@ -5,6 +5,7 @@ LL | let _ = ||{}(); | ^^-- | | | call expression requires function + | help: if you meant to create this closure and immediately call it, surround the closure with parenthesis | LL | let _ = (||{})(); diff --git a/src/test/ui/suggestions/suggest-std-when-using-type.stderr b/src/test/ui/suggestions/suggest-std-when-using-type.stderr index eecb4e60f9d59..5199faa5c8ec6 100644 --- a/src/test/ui/suggestions/suggest-std-when-using-type.stderr +++ b/src/test/ui/suggestions/suggest-std-when-using-type.stderr @@ -3,6 +3,7 @@ error[E0223]: ambiguous associated type | LL | let pi = f32::consts::PI; | ^^^^^^^^^^^^^^^ + | help: you are looking for the module in `std`, not the primitive type | LL | let pi = std::f32::consts::PI; @@ -13,6 +14,7 @@ error[E0599]: no function or associated item named `from_utf8` found for type `s | LL | str::from_utf8(bytes) | ^^^^^^^^^ function or associated item not found in `str` + | help: you are looking for the module in `std`, not the primitive type | LL | std::str::from_utf8(bytes) diff --git a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr index d273ec3fca59b..098d76a5c48c6 100644 --- a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr +++ b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr @@ -20,6 +20,7 @@ LL | i: Box>, | | | associated type `A` must be specified | associated type `C` must be specified + | help: if you meant to specify the associated types, write | LL | i: Box>, diff --git a/src/test/ui/traits/traits-multidispatch-bad.stderr b/src/test/ui/traits/traits-multidispatch-bad.stderr index 9e6c38ced0d26..f4ce548314d11 100644 --- a/src/test/ui/traits/traits-multidispatch-bad.stderr +++ b/src/test/ui/traits/traits-multidispatch-bad.stderr @@ -3,6 +3,7 @@ error[E0308]: mismatched types | LL | test(22i32, 44i32); | ^^^^^ expected u32, found i32 + | help: change the type of the numeric literal from `i32` to `u32` | LL | test(22i32, 44u32); diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr index e9c28248044f9..5820e4699c14f 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr @@ -6,6 +6,7 @@ LL | fn global_bound_is_hidden() -> u8 ... LL | B::get_x() | ^^^^^^^^^^ expected u8, found i32 + | help: you can convert an `i32` to `u8` and panic if the converted value wouldn't fit | LL | B::get_x().try_into().unwrap() diff --git a/src/test/ui/try-block/try-block-in-edition2015.stderr b/src/test/ui/try-block/try-block-in-edition2015.stderr index c94e43131faf0..7547dadf9e209 100644 --- a/src/test/ui/try-block/try-block-in-edition2015.stderr +++ b/src/test/ui/try-block/try-block-in-edition2015.stderr @@ -6,6 +6,7 @@ LL | let try_result: Option<_> = try { LL | LL | let x = 5; | ^^^ expected identifier, found keyword + | help: you can escape reserved keywords to use them as identifiers | LL | r#let x = 5; diff --git a/src/test/ui/tutorial-suffix-inference-test.stderr b/src/test/ui/tutorial-suffix-inference-test.stderr index f3e1cc41cada2..ae0cf124673db 100644 --- a/src/test/ui/tutorial-suffix-inference-test.stderr +++ b/src/test/ui/tutorial-suffix-inference-test.stderr @@ -12,6 +12,7 @@ error[E0308]: mismatched types | LL | identity_u16(y); | ^ expected u16, found i32 + | help: you can convert an `i32` to `u16` and panic if the converted value wouldn't fit | LL | identity_u16(y.try_into().unwrap()); @@ -22,6 +23,7 @@ error[E0308]: mismatched types | LL | identity_u16(a); | ^ expected u16, found isize + | help: you can convert an `isize` to `u16` and panic if the converted value wouldn't fit | LL | identity_u16(a.try_into().unwrap()); diff --git a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr index c6528e417d8ae..801ca5f013b3e 100644 --- a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr +++ b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr @@ -26,6 +26,7 @@ LL | Alias::Unit(); | ^^^^^^^^^^^-- | | | call expression requires function + | help: `::Unit` is a unit variant, you need to write it without the parenthesis | LL | ::Unit; diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr index f749ed3f9d865..a6f24984c8b9b 100644 --- a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -11,6 +11,7 @@ error[E0308]: mismatched types | LL | >::add(1u32, 2); | ^^^^ expected i32, found u32 + | help: change the type of the numeric literal from `u32` to `i32` | LL | >::add(1i32, 2); @@ -21,6 +22,7 @@ error[E0308]: mismatched types | LL | >::add(1, 2u32); | ^^^^ expected i32, found u32 + | help: change the type of the numeric literal from `u32` to `i32` | LL | >::add(1, 2i32); diff --git a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr index 758762fd5fde3..2479f3e601e2c 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr @@ -3,6 +3,7 @@ error[E0308]: mismatched types | LL | let z = f(1_usize, 2); | ^^^^^^^ expected isize, found usize + | help: change the type of the numeric literal from `usize` to `isize` | LL | let z = f(1_isize, 2); diff --git a/src/test/ui/use/use-super-global-path.stderr b/src/test/ui/use/use-super-global-path.stderr index 72b3deaaecea5..3ca30ebebbab7 100644 --- a/src/test/ui/use/use-super-global-path.stderr +++ b/src/test/ui/use/use-super-global-path.stderr @@ -15,6 +15,7 @@ error[E0425]: cannot find function `main` in this scope | LL | main(); | ^^^^ not found in this scope + | help: possible candidate is found in another module, you can import it into scope | LL | use main; diff --git a/src/test/ui/variants/variant-used-as-type.stderr b/src/test/ui/variants/variant-used-as-type.stderr index fdfc044d81f6c..096dd16c63431 100644 --- a/src/test/ui/variants/variant-used-as-type.stderr +++ b/src/test/ui/variants/variant-used-as-type.stderr @@ -3,6 +3,7 @@ error[E0573]: expected type, found variant `Ty::A` | LL | B(Ty::A), | ^^^^^ not a type + | help: try using the variant's enum | LL | B(E), @@ -15,6 +16,7 @@ error[E0573]: expected type, found variant `E::A` | LL | impl E::A {} | ^^^^ not a type + | help: try using the variant's enum | LL | impl E {} From 508d0326475e0ceef2ea5755a03cacf181b34d7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 24 Oct 2019 15:44:43 -0700 Subject: [PATCH 04/10] review comment: deduplicate logic --- src/librustc_errors/emitter.rs | 40 +++++++++++----------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index e59d6c5675094..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); @@ -1629,19 +1628,6 @@ impl EmitterWriter { _ => () } } - 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); - } - match emit_to_destination(&buffer.render(), level, &mut self.dst, - self.short_message) { - Ok(()) => (), - Err(e) => panic!("failed to emit error: {}", e) - } - } for sugg in suggestions { if sugg.style == SuggestionStyle::CompletelyHidden { // do not display this suggestion, it is meant only for tools From 9733b0f122db7eb7662799b164bc02b0f54cb84a Mon Sep 17 00:00:00 2001 From: Yves Dorfsman Date: Thu, 24 Oct 2019 21:35:16 -0600 Subject: [PATCH 05/10] Adding doc on keyword continue --- src/libstd/keyword_docs.rs | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) 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")] From 4d81e9dd2ff873df9bb67da5c05d54b18d78b983 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Fri, 25 Oct 2019 20:03:17 +0300 Subject: [PATCH 06/10] rustc: make DefPathData (and friends) Copy (now that it uses Symbol). --- src/librustc/hir/map/definitions.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index 5993a97c40d6a..40a51b92473bb 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. @@ -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 From 595d19e6258f2bb6a8f36a1f6f1065ae52efb47e Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Fri, 25 Oct 2019 20:21:37 +0300 Subject: [PATCH 07/10] rustc: replace a few `.cloned()` with `.copied()`. --- src/librustc/hir/map/definitions.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index 40a51b92473bb..58e638e93ba34 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -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 } @@ -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 { From f04867cafbf329f6755d28ff288dd89ef39e2b4d Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Fri, 25 Oct 2019 21:11:29 +0200 Subject: [PATCH 08/10] Derive Eq and Hash for SourceInfo again --- src/librustc/mir/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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, From ae5203a1420013e88b212d882ccf53dfa64170ad Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Thu, 24 Oct 2019 16:11:43 +0300 Subject: [PATCH 09/10] libsyntax: Document ast module Apply review suggestions Remove links in the module docs Flatten imports Apply review suggestions Remove useless comments Fix nits --- src/libsyntax/ast.rs | 138 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 112 insertions(+), 26 deletions(-) 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, From 1f25fd74a03f9c502851067a3e2b089a1a332da5 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 26 Oct 2019 11:26:02 +0200 Subject: [PATCH 10/10] Add more information on search --- src/librustdoc/html/layout.rs | 8 ++++++++ 1 file changed, 8 insertions(+) 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\ +

\ \ \ \