From 952bf87da1f817c767d61d01a365796b07c71fc4 Mon Sep 17 00:00:00 2001 From: "Alexis (Poliorcetics) Bourget" Date: Sat, 10 Dec 2022 16:04:00 +0100 Subject: [PATCH 1/8] doc: document remap matching behaviour in rustc flags --- src/doc/rustc/src/command-line-arguments.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/doc/rustc/src/command-line-arguments.md b/src/doc/rustc/src/command-line-arguments.md index ef6eee75f1ce6..d4d26654ed114 100644 --- a/src/doc/rustc/src/command-line-arguments.md +++ b/src/doc/rustc/src/command-line-arguments.md @@ -434,6 +434,9 @@ replacement is purely textual, with no consideration of the current system's pathname syntax. For example `--remap-path-prefix foo=bar` will match `foo/lib.rs` but not `./foo/lib.rs`. +When multiple remappings are given and several of them match, the **last** +matching one is applied. + ## `--json`: configure json messages printed by the compiler From 9bc69925cb4a1391a9a41411c56ae059877bf8fb Mon Sep 17 00:00:00 2001 From: KaDiWa Date: Tue, 9 Aug 2022 02:14:43 +0200 Subject: [PATCH 2/8] compiler: remove unnecessary imports and qualified paths --- compiler/rustc_abi/src/lib.rs | 1 - compiler/rustc_apfloat/src/ieee.rs | 1 - compiler/rustc_arena/src/lib.rs | 2 +- compiler/rustc_ast/src/ast.rs | 1 - compiler/rustc_ast/src/ptr.rs | 1 - compiler/rustc_ast/src/tokenstream.rs | 2 +- compiler/rustc_ast_lowering/src/lib.rs | 4 ++-- compiler/rustc_builtin_macros/src/concat.rs | 2 -- compiler/rustc_codegen_ssa/src/base.rs | 1 - compiler/rustc_const_eval/src/const_eval/eval_queries.rs | 1 - compiler/rustc_const_eval/src/interpret/cast.rs | 1 - compiler/rustc_const_eval/src/interpret/intrinsics.rs | 2 -- .../src/interpret/intrinsics/caller_location.rs | 2 -- compiler/rustc_const_eval/src/interpret/operator.rs | 2 -- compiler/rustc_const_eval/src/interpret/util.rs | 1 - compiler/rustc_const_eval/src/interpret/validity.rs | 1 - compiler/rustc_const_eval/src/util/aggregate.rs | 1 - compiler/rustc_data_structures/src/fingerprint.rs | 1 - compiler/rustc_data_structures/src/graph/scc/mod.rs | 1 - compiler/rustc_data_structures/src/graph/vec_graph/mod.rs | 2 -- compiler/rustc_data_structures/src/owning_ref/mod.rs | 5 +---- compiler/rustc_data_structures/src/owning_ref/tests.rs | 4 ++-- compiler/rustc_data_structures/src/profiling.rs | 1 - compiler/rustc_data_structures/src/sorted_map.rs | 1 - compiler/rustc_data_structures/src/sorted_map/index_map.rs | 1 - compiler/rustc_data_structures/src/sso/either_iter.rs | 2 -- compiler/rustc_data_structures/src/sso/map.rs | 1 - compiler/rustc_data_structures/src/sso/set.rs | 1 - compiler/rustc_data_structures/src/sync.rs | 2 +- compiler/rustc_data_structures/src/tagged_ptr/drop.rs | 2 +- compiler/rustc_data_structures/src/vec_map.rs | 1 - compiler/rustc_driver/src/lib.rs | 1 - compiler/rustc_error_codes/src/error_codes/E0492.md | 1 - compiler/rustc_errors/src/diagnostic_impls.rs | 2 +- compiler/rustc_expand/src/base.rs | 1 - compiler/rustc_hir/src/pat_util.rs | 2 +- compiler/rustc_hir_analysis/src/check/wfcheck.rs | 1 - compiler/rustc_incremental/src/persist/dirty_clean.rs | 2 -- compiler/rustc_incremental/src/persist/fs.rs | 7 +++---- compiler/rustc_index/src/vec.rs | 1 - compiler/rustc_interface/src/tests.rs | 1 - compiler/rustc_lexer/src/lib.rs | 1 - compiler/rustc_lint/src/types.rs | 3 +-- compiler/rustc_metadata/src/rmeta/table.rs | 1 - compiler/rustc_middle/src/mir/coverage.rs | 1 - compiler/rustc_middle/src/mir/interpret/mod.rs | 1 - compiler/rustc_middle/src/mir/interpret/pointer.rs | 1 - compiler/rustc_middle/src/mir/interpret/value.rs | 1 - compiler/rustc_middle/src/mir/mod.rs | 1 - compiler/rustc_middle/src/traits/query.rs | 1 - compiler/rustc_middle/src/ty/consts/int.rs | 1 - compiler/rustc_middle/src/ty/consts/kind.rs | 2 -- compiler/rustc_middle/src/ty/print/pretty.rs | 1 - compiler/rustc_middle/src/ty/vtable.rs | 1 - compiler/rustc_mir_build/src/build/matches/mod.rs | 1 - compiler/rustc_mir_build/src/build/matches/util.rs | 1 - .../rustc_mir_build/src/thir/pattern/deconstruct_pat.rs | 2 +- compiler/rustc_mir_dataflow/src/framework/lattice.rs | 2 +- compiler/rustc_mir_transform/src/simplify.rs | 1 - compiler/rustc_monomorphize/src/polymorphize.rs | 1 - compiler/rustc_parse/src/parser/attr.rs | 1 - compiler/rustc_parse/src/parser/attr_wrapper.rs | 1 - compiler/rustc_parse/src/parser/item.rs | 1 - compiler/rustc_query_system/src/dep_graph/graph.rs | 2 +- compiler/rustc_query_system/src/dep_graph/serialized.rs | 1 - compiler/rustc_query_system/src/query/caches.rs | 1 - compiler/rustc_query_system/src/query/job.rs | 6 +++--- compiler/rustc_save_analysis/src/lib.rs | 1 - compiler/rustc_serialize/src/opaque.rs | 1 - compiler/rustc_session/src/config.rs | 2 +- compiler/rustc_session/src/filesearch.rs | 1 - compiler/rustc_span/src/source_map.rs | 3 +-- compiler/rustc_span/src/symbol.rs | 2 -- compiler/rustc_target/src/lib.rs | 1 - compiler/rustc_target/src/spec/mod.rs | 2 -- compiler/rustc_type_ir/src/sty.rs | 2 +- 76 files changed, 24 insertions(+), 98 deletions(-) diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index e14c9ea9a5d1a..4ca59144b2990 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -1,6 +1,5 @@ #![cfg_attr(feature = "nightly", feature(step_trait, rustc_attrs, min_specialization))] -use std::convert::{TryFrom, TryInto}; use std::fmt; #[cfg(feature = "nightly")] use std::iter::Step; diff --git a/compiler/rustc_apfloat/src/ieee.rs b/compiler/rustc_apfloat/src/ieee.rs index 3db8adb2a2444..2286712f02565 100644 --- a/compiler/rustc_apfloat/src/ieee.rs +++ b/compiler/rustc_apfloat/src/ieee.rs @@ -2,7 +2,6 @@ use crate::{Category, ExpInt, IEK_INF, IEK_NAN, IEK_ZERO}; use crate::{Float, FloatConvert, ParseError, Round, Status, StatusAnd}; use core::cmp::{self, Ordering}; -use core::convert::TryFrom; use core::fmt::{self, Write}; use core::marker::PhantomData; use core::mem; diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index 46dbbd83d1905..4fae5ef845f7d 100644 --- a/compiler/rustc_arena/src/lib.rs +++ b/compiler/rustc_arena/src/lib.rs @@ -28,7 +28,7 @@ use smallvec::SmallVec; use std::alloc::Layout; use std::cell::{Cell, RefCell}; use std::cmp; -use std::marker::{PhantomData, Send}; +use std::marker::PhantomData; use std::mem::{self, MaybeUninit}; use std::ptr::{self, NonNull}; use std::slice; diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 4d80f904ac461..74a0c13b23f74 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -33,7 +33,6 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use rustc_span::source_map::{respan, Spanned}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::{Span, DUMMY_SP}; -use std::convert::TryFrom; use std::fmt; use std::mem; use thin_vec::{thin_vec, ThinVec}; diff --git a/compiler/rustc_ast/src/ptr.rs b/compiler/rustc_ast/src/ptr.rs index 30481eddf9160..4b2850336a03d 100644 --- a/compiler/rustc_ast/src/ptr.rs +++ b/compiler/rustc_ast/src/ptr.rs @@ -22,7 +22,6 @@ //! Moreover, a switch to, e.g., `P<'a, T>` would be easy and mostly automated. use std::fmt::{self, Debug, Display}; -use std::iter::FromIterator; use std::ops::{Deref, DerefMut}; use std::{slice, vec}; diff --git a/compiler/rustc_ast/src/tokenstream.rs b/compiler/rustc_ast/src/tokenstream.rs index 482c302950f01..29a5eb4b7c509 100644 --- a/compiler/rustc_ast/src/tokenstream.rs +++ b/compiler/rustc_ast/src/tokenstream.rs @@ -362,7 +362,7 @@ impl TokenStream { } } -impl iter::FromIterator for TokenStream { +impl FromIterator for TokenStream { fn from_iter>(iter: I) -> Self { TokenStream::new(iter.into_iter().collect::>()) } diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 4fa18907fcd46..5d7397977e984 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -456,8 +456,8 @@ pub fn lower_to_hir<'hir>(tcx: TyCtxt<'hir>, (): ()) -> hir::Crate<'hir> { } // Drop AST to free memory - std::mem::drop(ast_index); - sess.time("drop_ast", || std::mem::drop(krate)); + drop(ast_index); + sess.time("drop_ast", || drop(krate)); // Discard hygiene data, which isn't required after lowering to HIR. if !sess.opts.unstable_opts.keep_hygiene_data { diff --git a/compiler/rustc_builtin_macros/src/concat.rs b/compiler/rustc_builtin_macros/src/concat.rs index e2d71825d556f..c9dc6b847cdb5 100644 --- a/compiler/rustc_builtin_macros/src/concat.rs +++ b/compiler/rustc_builtin_macros/src/concat.rs @@ -4,8 +4,6 @@ use rustc_expand::base::{self, DummyResult}; use rustc_session::errors::report_lit_error; use rustc_span::symbol::Symbol; -use std::string::String; - pub fn expand_concat( cx: &mut base::ExtCtxt<'_>, sp: rustc_span::Span, diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index 4f396e970ad70..664697e0edaa4 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -41,7 +41,6 @@ use rustc_span::{DebuggerVisualizerFile, DebuggerVisualizerType}; use rustc_target::abi::{Align, Size, VariantIdx}; use std::collections::BTreeSet; -use std::convert::TryFrom; use std::time::{Duration, Instant}; use itertools::Itertools; diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index c27790d8887a3..319f2b2c25ebf 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -1,5 +1,4 @@ use std::borrow::Cow; -use std::convert::TryInto; use either::{Left, Right}; diff --git a/compiler/rustc_const_eval/src/interpret/cast.rs b/compiler/rustc_const_eval/src/interpret/cast.rs index 269ae15d49745..b1fdeb01b100a 100644 --- a/compiler/rustc_const_eval/src/interpret/cast.rs +++ b/compiler/rustc_const_eval/src/interpret/cast.rs @@ -1,5 +1,4 @@ use std::assert_matches::assert_matches; -use std::convert::TryFrom; use rustc_apfloat::ieee::{Double, Single}; use rustc_apfloat::{Float, FloatConvert}; diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs index 7940efcd2b11f..b9be7fa48000b 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics.rs @@ -2,8 +2,6 @@ //! looking at their MIR. Intrinsics/functions supported here are shared by CTFE //! and miri. -use std::convert::TryFrom; - use rustc_hir::def_id::DefId; use rustc_middle::mir::{ self, diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs b/compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs index 7d94a22c43d71..77c7b4bacb8c8 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics/caller_location.rs @@ -1,5 +1,3 @@ -use std::convert::TryFrom; - use rustc_ast::Mutability; use rustc_hir::lang_items::LangItem; use rustc_middle::mir::TerminatorKind; diff --git a/compiler/rustc_const_eval/src/interpret/operator.rs b/compiler/rustc_const_eval/src/interpret/operator.rs index 1f1d0665139d0..949f95c5fa81c 100644 --- a/compiler/rustc_const_eval/src/interpret/operator.rs +++ b/compiler/rustc_const_eval/src/interpret/operator.rs @@ -1,5 +1,3 @@ -use std::convert::TryFrom; - use rustc_apfloat::Float; use rustc_middle::mir; use rustc_middle::mir::interpret::{InterpResult, Scalar}; diff --git a/compiler/rustc_const_eval/src/interpret/util.rs b/compiler/rustc_const_eval/src/interpret/util.rs index 2bc521d5bbe0b..e4f716c31945c 100644 --- a/compiler/rustc_const_eval/src/interpret/util.rs +++ b/compiler/rustc_const_eval/src/interpret/util.rs @@ -1,6 +1,5 @@ use rustc_middle::mir::interpret::InterpResult; use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor}; -use std::convert::TryInto; use std::ops::ControlFlow; /// Checks whether a type contains generic parameters which require substitution. diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs index 0e85c7d11bce5..fc65306e440a9 100644 --- a/compiler/rustc_const_eval/src/interpret/validity.rs +++ b/compiler/rustc_const_eval/src/interpret/validity.rs @@ -4,7 +4,6 @@ //! That's useful because it means other passes (e.g. promotion) can rely on `const`s //! to be const-safe. -use std::convert::TryFrom; use std::fmt::{Display, Write}; use std::num::NonZeroUsize; diff --git a/compiler/rustc_const_eval/src/util/aggregate.rs b/compiler/rustc_const_eval/src/util/aggregate.rs index c43de3368c62f..10783c5ed1d1c 100644 --- a/compiler/rustc_const_eval/src/util/aggregate.rs +++ b/compiler/rustc_const_eval/src/util/aggregate.rs @@ -3,7 +3,6 @@ use rustc_middle::mir::*; use rustc_middle::ty::{Ty, TyCtxt}; use rustc_target::abi::VariantIdx; -use std::convert::TryFrom; use std::iter::TrustedLen; /// Expand `lhs = Rvalue::Aggregate(kind, operands)` into assignments to the fields. diff --git a/compiler/rustc_data_structures/src/fingerprint.rs b/compiler/rustc_data_structures/src/fingerprint.rs index d98f4e43fe884..b6e866f15efe3 100644 --- a/compiler/rustc_data_structures/src/fingerprint.rs +++ b/compiler/rustc_data_structures/src/fingerprint.rs @@ -1,6 +1,5 @@ use crate::stable_hasher; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; -use std::convert::TryInto; use std::hash::{Hash, Hasher}; #[cfg(test)] diff --git a/compiler/rustc_data_structures/src/graph/scc/mod.rs b/compiler/rustc_data_structures/src/graph/scc/mod.rs index 7099ca7eb88c2..b31092eca9837 100644 --- a/compiler/rustc_data_structures/src/graph/scc/mod.rs +++ b/compiler/rustc_data_structures/src/graph/scc/mod.rs @@ -9,7 +9,6 @@ use crate::fx::FxHashSet; use crate::graph::vec_graph::VecGraph; use crate::graph::{DirectedGraph, GraphSuccessors, WithNumEdges, WithNumNodes, WithSuccessors}; use rustc_index::vec::{Idx, IndexVec}; -use std::cmp::Ord; use std::ops::Range; #[cfg(test)] diff --git a/compiler/rustc_data_structures/src/graph/vec_graph/mod.rs b/compiler/rustc_data_structures/src/graph/vec_graph/mod.rs index e8efbd09a2c38..94232bb7626ec 100644 --- a/compiler/rustc_data_structures/src/graph/vec_graph/mod.rs +++ b/compiler/rustc_data_structures/src/graph/vec_graph/mod.rs @@ -1,5 +1,3 @@ -use std::cmp::Ord; - use crate::graph::{DirectedGraph, GraphSuccessors, WithNumEdges, WithNumNodes, WithSuccessors}; use rustc_index::vec::{Idx, IndexVec}; diff --git a/compiler/rustc_data_structures/src/owning_ref/mod.rs b/compiler/rustc_data_structures/src/owning_ref/mod.rs index 980a540ccba7a..d1d92b905b82e 100644 --- a/compiler/rustc_data_structures/src/owning_ref/mod.rs +++ b/compiler/rustc_data_structures/src/owning_ref/mod.rs @@ -867,11 +867,9 @@ where ///////////////////////////////////////////////////////////////////////////// use std::borrow::Borrow; -use std::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd}; -use std::convert::From; +use std::cmp::Ordering; use std::fmt::{self, Debug}; use std::hash::{Hash, Hasher}; -use std::marker::{Send, Sync}; impl Deref for OwningRef { type Target = T; @@ -1096,7 +1094,6 @@ where // std types integration and convenience type defs ///////////////////////////////////////////////////////////////////////////// -use std::boxed::Box; use std::cell::{Ref, RefCell, RefMut}; use std::rc::Rc; use std::sync::Arc; diff --git a/compiler/rustc_data_structures/src/owning_ref/tests.rs b/compiler/rustc_data_structures/src/owning_ref/tests.rs index 320c03d5139f4..a9b187c4ce0a7 100644 --- a/compiler/rustc_data_structures/src/owning_ref/tests.rs +++ b/compiler/rustc_data_structures/src/owning_ref/tests.rs @@ -3,7 +3,7 @@ mod owning_ref { use super::super::OwningRef; use super::super::{BoxRef, Erased, ErasedBoxRef, RcRef}; - use std::cmp::{Ord, Ordering, PartialEq, PartialOrd}; + use std::cmp::Ordering; use std::collections::hash_map::DefaultHasher; use std::collections::HashMap; use std::hash::{Hash, Hasher}; @@ -368,7 +368,7 @@ mod owning_handle { mod owning_ref_mut { use super::super::BoxRef; use super::super::{BoxRefMut, Erased, ErasedBoxRefMut, OwningRefMut}; - use std::cmp::{Ord, Ordering, PartialEq, PartialOrd}; + use std::cmp::Ordering; use std::collections::hash_map::DefaultHasher; use std::collections::HashMap; use std::hash::{Hash, Hasher}; diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs index aa7a01eed15c9..1d4014f05acdc 100644 --- a/compiler/rustc_data_structures/src/profiling.rs +++ b/compiler/rustc_data_structures/src/profiling.rs @@ -86,7 +86,6 @@ use crate::fx::FxHashMap; use std::borrow::Borrow; use std::collections::hash_map::Entry; -use std::convert::Into; use std::error::Error; use std::fs; use std::path::Path; diff --git a/compiler/rustc_data_structures/src/sorted_map.rs b/compiler/rustc_data_structures/src/sorted_map.rs index d13313dfd0ebf..03ff5e5b3751f 100644 --- a/compiler/rustc_data_structures/src/sorted_map.rs +++ b/compiler/rustc_data_structures/src/sorted_map.rs @@ -1,7 +1,6 @@ use crate::stable_hasher::{HashStable, StableHasher, StableOrd}; use std::borrow::Borrow; use std::cmp::Ordering; -use std::iter::FromIterator; use std::mem; use std::ops::{Bound, Index, IndexMut, RangeBounds}; diff --git a/compiler/rustc_data_structures/src/sorted_map/index_map.rs b/compiler/rustc_data_structures/src/sorted_map/index_map.rs index c2f0ae328962b..7af5c14942adf 100644 --- a/compiler/rustc_data_structures/src/sorted_map/index_map.rs +++ b/compiler/rustc_data_structures/src/sorted_map/index_map.rs @@ -1,7 +1,6 @@ //! A variant of `SortedMap` that preserves insertion order. use std::hash::{Hash, Hasher}; -use std::iter::FromIterator; use crate::stable_hasher::{HashStable, StableHasher}; use rustc_index::vec::{Idx, IndexVec}; diff --git a/compiler/rustc_data_structures/src/sso/either_iter.rs b/compiler/rustc_data_structures/src/sso/either_iter.rs index 131eeef4582de..bca6c0955b905 100644 --- a/compiler/rustc_data_structures/src/sso/either_iter.rs +++ b/compiler/rustc_data_structures/src/sso/either_iter.rs @@ -1,7 +1,5 @@ use std::fmt; -use std::iter::ExactSizeIterator; use std::iter::FusedIterator; -use std::iter::Iterator; /// Iterator which may contain instance of /// one of two specific implementations. diff --git a/compiler/rustc_data_structures/src/sso/map.rs b/compiler/rustc_data_structures/src/sso/map.rs index ec6a62016a87c..7cdac58197714 100644 --- a/compiler/rustc_data_structures/src/sso/map.rs +++ b/compiler/rustc_data_structures/src/sso/map.rs @@ -3,7 +3,6 @@ use crate::fx::FxHashMap; use arrayvec::ArrayVec; use std::fmt; use std::hash::Hash; -use std::iter::FromIterator; use std::ops::Index; // For pointer-sized arguments arrays diff --git a/compiler/rustc_data_structures/src/sso/set.rs b/compiler/rustc_data_structures/src/sso/set.rs index 406f0270dcc1b..a4b40138933de 100644 --- a/compiler/rustc_data_structures/src/sso/set.rs +++ b/compiler/rustc_data_structures/src/sso/set.rs @@ -1,6 +1,5 @@ use std::fmt; use std::hash::Hash; -use std::iter::FromIterator; use super::map::SsoHashMap; diff --git a/compiler/rustc_data_structures/src/sync.rs b/compiler/rustc_data_structures/src/sync.rs index e4f47b22ac358..ed5341c40ef08 100644 --- a/compiler/rustc_data_structures/src/sync.rs +++ b/compiler/rustc_data_structures/src/sync.rs @@ -138,7 +138,7 @@ cfg_if! { } } - pub use std::iter::Iterator as ParallelIterator; + pub use Iterator as ParallelIterator; pub fn par_iter(t: T) -> T::IntoIter { t.into_iter() diff --git a/compiler/rustc_data_structures/src/tagged_ptr/drop.rs b/compiler/rustc_data_structures/src/tagged_ptr/drop.rs index d44ccd368b3cb..b0315c93d934d 100644 --- a/compiler/rustc_data_structures/src/tagged_ptr/drop.rs +++ b/compiler/rustc_data_structures/src/tagged_ptr/drop.rs @@ -76,7 +76,7 @@ where fn drop(&mut self) { // No need to drop the tag, as it's Copy unsafe { - std::mem::drop(P::from_usize(self.raw.pointer_raw())); + drop(P::from_usize(self.raw.pointer_raw())); } } } diff --git a/compiler/rustc_data_structures/src/vec_map.rs b/compiler/rustc_data_structures/src/vec_map.rs index 86be0bd8775d7..2417df66bb9d8 100644 --- a/compiler/rustc_data_structures/src/vec_map.rs +++ b/compiler/rustc_data_structures/src/vec_map.rs @@ -1,6 +1,5 @@ use std::borrow::Borrow; use std::fmt::Debug; -use std::iter::FromIterator; use std::slice::Iter; use std::vec::IntoIter; diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index f06ca5a0733a5..711eed2b27231 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -45,7 +45,6 @@ use rustc_target::json::ToJson; use std::borrow::Cow; use std::cmp::max; -use std::default::Default; use std::env; use std::ffi::OsString; use std::fs; diff --git a/compiler/rustc_error_codes/src/error_codes/E0492.md b/compiler/rustc_error_codes/src/error_codes/E0492.md index 79e7c069a91c4..7c0719dc217d0 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0492.md +++ b/compiler/rustc_error_codes/src/error_codes/E0492.md @@ -55,7 +55,6 @@ wrapper: ``` use std::cell::Cell; -use std::marker::Sync; struct NotThreadSafe { value: Cell, diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs index 7155db32e53b7..88b4fffd46f61 100644 --- a/compiler/rustc_errors/src/diagnostic_impls.rs +++ b/compiler/rustc_errors/src/diagnostic_impls.rs @@ -59,7 +59,7 @@ into_diagnostic_arg_using_display!( i128, u128, std::io::Error, - std::boxed::Box, + Box, std::num::NonZeroU32, hir::Target, Edition, diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs index 9d6a4f9a1fd7d..321c43a1aba8d 100644 --- a/compiler/rustc_expand/src/base.rs +++ b/compiler/rustc_expand/src/base.rs @@ -26,7 +26,6 @@ use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::{BytePos, FileName, RealFileName, Span, DUMMY_SP}; use smallvec::{smallvec, SmallVec}; -use std::default::Default; use std::iter; use std::path::PathBuf; use std::rc::Rc; diff --git a/compiler/rustc_hir/src/pat_util.rs b/compiler/rustc_hir/src/pat_util.rs index 6e2fbf96cbfb3..e870aa543d0b5 100644 --- a/compiler/rustc_hir/src/pat_util.rs +++ b/compiler/rustc_hir/src/pat_util.rs @@ -6,7 +6,7 @@ use rustc_span::hygiene::DesugaringKind; use rustc_span::symbol::Ident; use rustc_span::Span; -use std::iter::{Enumerate, ExactSizeIterator}; +use std::iter::Enumerate; pub struct EnumerateAndAdjust { enumerate: Enumerate, diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index b065ace6bf5e1..69eb96fe8e925 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -31,7 +31,6 @@ use rustc_trait_selection::traits::{ }; use std::cell::LazyCell; -use std::convert::TryInto; use std::iter; use std::ops::{ControlFlow, Deref}; diff --git a/compiler/rustc_incremental/src/persist/dirty_clean.rs b/compiler/rustc_incremental/src/persist/dirty_clean.rs index a8acaf6597aab..d1d328128bc15 100644 --- a/compiler/rustc_incremental/src/persist/dirty_clean.rs +++ b/compiler/rustc_incremental/src/persist/dirty_clean.rs @@ -30,8 +30,6 @@ use rustc_middle::hir::nested_filter; use rustc_middle::ty::TyCtxt; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; -use std::iter::FromIterator; -use std::vec::Vec; const LOADED_FROM_DISK: Symbol = sym::loaded_from_disk; const EXCEPT: Symbol = sym::except; diff --git a/compiler/rustc_incremental/src/persist/fs.rs b/compiler/rustc_incremental/src/persist/fs.rs index 97ebed0585579..1fd2b9b0d7b7b 100644 --- a/compiler/rustc_incremental/src/persist/fs.rs +++ b/compiler/rustc_incremental/src/persist/fs.rs @@ -113,7 +113,6 @@ use rustc_span::Symbol; use std::fs as std_fs; use std::io::{self, ErrorKind}; -use std::mem; use std::path::{Path, PathBuf}; use std::time::{Duration, SystemTime, UNIX_EPOCH}; @@ -305,7 +304,7 @@ pub fn prepare_session_directory( } delete_session_dir_lock_file(sess, &lock_file_path); - mem::drop(directory_lock); + drop(directory_lock); } } } @@ -864,7 +863,7 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> { // Let's make it explicit that the file lock is released at this point, // or rather, that we held on to it until here - mem::drop(lock); + drop(lock); } Err(_) => { debug!( @@ -898,7 +897,7 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> { // Let's make it explicit that the file lock is released at this point, // or rather, that we held on to it until here - mem::drop(lock); + drop(lock); } Ok(()) diff --git a/compiler/rustc_index/src/vec.rs b/compiler/rustc_index/src/vec.rs index 39aa27a23c1d2..c18a911b2fbcd 100644 --- a/compiler/rustc_index/src/vec.rs +++ b/compiler/rustc_index/src/vec.rs @@ -4,7 +4,6 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use std::fmt; use std::fmt::Debug; use std::hash::Hash; -use std::iter::FromIterator; use std::marker::PhantomData; use std::ops::{Index, IndexMut, RangeBounds}; use std::slice; diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 2b8f6557c829b..e903cb86dd204 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -25,7 +25,6 @@ use rustc_target::spec::{CodeModel, LinkerFlavorCli, MergeFunctions, PanicStrate use rustc_target::spec::{RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, TlsModel}; use std::collections::{BTreeMap, BTreeSet}; -use std::iter::FromIterator; use std::num::NonZeroUsize; use std::path::{Path, PathBuf}; diff --git a/compiler/rustc_lexer/src/lib.rs b/compiler/rustc_lexer/src/lib.rs index 3fbabbc6344a7..50d6d5b9bab91 100644 --- a/compiler/rustc_lexer/src/lib.rs +++ b/compiler/rustc_lexer/src/lib.rs @@ -34,7 +34,6 @@ pub use crate::cursor::Cursor; use self::LiteralKind::*; use self::TokenKind::*; use crate::cursor::EOF_CHAR; -use std::convert::TryFrom; /// Parsed token. /// It doesn't contain information about data that has been parsed, diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 297b509d4023d..8446da6098ee9 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -16,7 +16,6 @@ use rustc_target::abi::{Abi, Size, WrappingRange}; use rustc_target::abi::{Integer, TagEncoding, Variants}; use rustc_target::spec::abi::Abi as SpecAbi; -use std::cmp; use std::iter; use std::ops::ControlFlow; @@ -531,7 +530,7 @@ impl<'tcx> LateLintPass<'tcx> for TypeLimits { _ => {} }; - fn is_valid(binop: hir::BinOp, v: T, min: T, max: T) -> bool { + fn is_valid(binop: hir::BinOp, v: T, min: T, max: T) -> bool { match binop.node { hir::BinOpKind::Lt => v > min && v <= max, hir::BinOpKind::Le => v >= min && v < max, diff --git a/compiler/rustc_metadata/src/rmeta/table.rs b/compiler/rustc_metadata/src/rmeta/table.rs index 29fe6110797e3..716655c7f144d 100644 --- a/compiler/rustc_metadata/src/rmeta/table.rs +++ b/compiler/rustc_metadata/src/rmeta/table.rs @@ -7,7 +7,6 @@ use rustc_middle::ty::ParameterizedOverTcx; use rustc_serialize::opaque::FileEncoder; use rustc_serialize::Encoder as _; use rustc_span::hygiene::MacroKind; -use std::convert::TryInto; use std::marker::PhantomData; use std::num::NonZeroUsize; diff --git a/compiler/rustc_middle/src/mir/coverage.rs b/compiler/rustc_middle/src/mir/coverage.rs index efa9464529e71..0b55757eb0382 100644 --- a/compiler/rustc_middle/src/mir/coverage.rs +++ b/compiler/rustc_middle/src/mir/coverage.rs @@ -3,7 +3,6 @@ use rustc_macros::HashStable; use rustc_span::Symbol; -use std::cmp::Ord; use std::fmt::{self, Debug, Formatter}; rustc_index::newtype_index! { diff --git a/compiler/rustc_middle/src/mir/interpret/mod.rs b/compiler/rustc_middle/src/mir/interpret/mod.rs index d79cd8b7a8a4b..8fe349d9640da 100644 --- a/compiler/rustc_middle/src/mir/interpret/mod.rs +++ b/compiler/rustc_middle/src/mir/interpret/mod.rs @@ -95,7 +95,6 @@ mod pointer; mod queries; mod value; -use std::convert::TryFrom; use std::fmt; use std::io; use std::io::{Read, Write}; diff --git a/compiler/rustc_middle/src/mir/interpret/pointer.rs b/compiler/rustc_middle/src/mir/interpret/pointer.rs index 9c270ba1ec179..b083099107620 100644 --- a/compiler/rustc_middle/src/mir/interpret/pointer.rs +++ b/compiler/rustc_middle/src/mir/interpret/pointer.rs @@ -3,7 +3,6 @@ use super::{AllocId, InterpResult}; use rustc_macros::HashStable; use rustc_target::abi::{HasDataLayout, Size}; -use std::convert::{TryFrom, TryInto}; use std::fmt; //////////////////////////////////////////////////////////////////////////////// diff --git a/compiler/rustc_middle/src/mir/interpret/value.rs b/compiler/rustc_middle/src/mir/interpret/value.rs index e6636e50e6e7a..88fb14eb35942 100644 --- a/compiler/rustc_middle/src/mir/interpret/value.rs +++ b/compiler/rustc_middle/src/mir/interpret/value.rs @@ -1,4 +1,3 @@ -use std::convert::{TryFrom, TryInto}; use std::fmt; use either::{Either, Left, Right}; diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index a513444e1e08b..db4fe6f886b25 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -36,7 +36,6 @@ use rustc_span::{Span, DUMMY_SP}; use either::Either; use std::borrow::Cow; -use std::convert::TryInto; use std::fmt::{self, Debug, Display, Formatter, Write}; use std::ops::{ControlFlow, Index, IndexMut}; use std::{iter, mem}; diff --git a/compiler/rustc_middle/src/traits/query.rs b/compiler/rustc_middle/src/traits/query.rs index fb152b63f6344..d40d7de5f315f 100644 --- a/compiler/rustc_middle/src/traits/query.rs +++ b/compiler/rustc_middle/src/traits/query.rs @@ -12,7 +12,6 @@ use crate::ty::subst::{GenericArg, SubstsRef}; use crate::ty::{self, Ty, TyCtxt}; use rustc_hir::def_id::DefId; use rustc_span::source_map::Span; -use std::iter::FromIterator; pub mod type_op { use crate::ty::fold::TypeFoldable; diff --git a/compiler/rustc_middle/src/ty/consts/int.rs b/compiler/rustc_middle/src/ty/consts/int.rs index f3186e1c30c3d..2a8a4d598882d 100644 --- a/compiler/rustc_middle/src/ty/consts/int.rs +++ b/compiler/rustc_middle/src/ty/consts/int.rs @@ -2,7 +2,6 @@ use rustc_apfloat::ieee::{Double, Single}; use rustc_apfloat::Float; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use rustc_target::abi::Size; -use std::convert::{TryFrom, TryInto}; use std::fmt; use std::num::NonZeroU8; diff --git a/compiler/rustc_middle/src/ty/consts/kind.rs b/compiler/rustc_middle/src/ty/consts/kind.rs index becc2b805dd1e..d9721863a58c8 100644 --- a/compiler/rustc_middle/src/ty/consts/kind.rs +++ b/compiler/rustc_middle/src/ty/consts/kind.rs @@ -1,5 +1,3 @@ -use std::convert::TryInto; - use super::Const; use crate::mir; use crate::mir::interpret::{AllocId, ConstValue, Scalar}; diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 5303341ba443c..01e96fa5c7ade 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -23,7 +23,6 @@ use smallvec::SmallVec; use std::cell::Cell; use std::char; use std::collections::BTreeMap; -use std::convert::TryFrom; use std::fmt::{self, Write as _}; use std::iter; use std::ops::{ControlFlow, Deref, DerefMut}; diff --git a/compiler/rustc_middle/src/ty/vtable.rs b/compiler/rustc_middle/src/ty/vtable.rs index 6eae94511e4d6..802925dfb043e 100644 --- a/compiler/rustc_middle/src/ty/vtable.rs +++ b/compiler/rustc_middle/src/ty/vtable.rs @@ -1,4 +1,3 @@ -use std::convert::TryFrom; use std::fmt; use crate::mir::interpret::{alloc_range, AllocId, Allocation, Pointer, Scalar}; diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index 691cbee2c7319..ba6bc41c6675c 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -30,7 +30,6 @@ mod test; mod util; use std::borrow::Borrow; -use std::convert::TryFrom; use std::mem; impl<'a, 'tcx> Builder<'a, 'tcx> { diff --git a/compiler/rustc_mir_build/src/build/matches/util.rs b/compiler/rustc_mir_build/src/build/matches/util.rs index bd435f9ab0095..cbd494862a01f 100644 --- a/compiler/rustc_mir_build/src/build/matches/util.rs +++ b/compiler/rustc_mir_build/src/build/matches/util.rs @@ -7,7 +7,6 @@ use rustc_middle::thir::*; use rustc_middle::ty; use rustc_middle::ty::TypeVisitable; use smallvec::SmallVec; -use std::convert::TryInto; impl<'a, 'tcx> Builder<'a, 'tcx> { pub(crate) fn field_match_pairs<'pat>( diff --git a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs index d60e8722cb61d..18e9c69c4870e 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs @@ -45,7 +45,7 @@ use std::cell::Cell; use std::cmp::{self, max, min, Ordering}; use std::fmt; -use std::iter::{once, IntoIterator}; +use std::iter::once; use std::ops::RangeInclusive; use smallvec::{smallvec, SmallVec}; diff --git a/compiler/rustc_mir_dataflow/src/framework/lattice.rs b/compiler/rustc_mir_dataflow/src/framework/lattice.rs index f0e75c53ea15c..8fdac7b2cf501 100644 --- a/compiler/rustc_mir_dataflow/src/framework/lattice.rs +++ b/compiler/rustc_mir_dataflow/src/framework/lattice.rs @@ -26,7 +26,7 @@ //! ## `PartialOrd` //! //! Given that they represent partially ordered sets, you may be surprised that [`JoinSemiLattice`] -//! and [`MeetSemiLattice`] do not have [`PartialOrd`][std::cmp::PartialOrd] as a supertrait. This +//! and [`MeetSemiLattice`] do not have [`PartialOrd`] as a supertrait. This //! is because most standard library types use lexicographic ordering instead of set inclusion for //! their `PartialOrd` impl. Since we do not actually need to compare lattice elements to run a //! dataflow analysis, there's no need for a newtype wrapper with a custom `PartialOrd` impl. The diff --git a/compiler/rustc_mir_transform/src/simplify.rs b/compiler/rustc_mir_transform/src/simplify.rs index 475e2ec9a1dea..8212a7b523bbc 100644 --- a/compiler/rustc_mir_transform/src/simplify.rs +++ b/compiler/rustc_mir_transform/src/simplify.rs @@ -35,7 +35,6 @@ use rustc_middle::mir::visit::{MutVisitor, MutatingUseContext, PlaceContext, Vis use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; use smallvec::SmallVec; -use std::convert::TryInto; pub struct SimplifyCfg { label: String, diff --git a/compiler/rustc_monomorphize/src/polymorphize.rs b/compiler/rustc_monomorphize/src/polymorphize.rs index 650076c2213a3..703ed09a254a9 100644 --- a/compiler/rustc_monomorphize/src/polymorphize.rs +++ b/compiler/rustc_monomorphize/src/polymorphize.rs @@ -20,7 +20,6 @@ use rustc_middle::ty::{ Const, Ty, TyCtxt, }; use rustc_span::symbol::sym; -use std::convert::TryInto; use std::ops::ControlFlow; use crate::errors::UnusedGenericParams; diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs index c7d239b647f35..686454a8f1811 100644 --- a/compiler/rustc_parse/src/parser/attr.rs +++ b/compiler/rustc_parse/src/parser/attr.rs @@ -6,7 +6,6 @@ use rustc_ast::attr; use rustc_ast::token::{self, Delimiter, Nonterminal}; use rustc_errors::{error_code, fluent, Diagnostic, IntoDiagnostic, PResult}; use rustc_span::{sym, BytePos, Span}; -use std::convert::TryInto; // Public for rustfmt usage #[derive(Debug)] diff --git a/compiler/rustc_parse/src/parser/attr_wrapper.rs b/compiler/rustc_parse/src/parser/attr_wrapper.rs index a084a70108859..b97f22417cb7b 100644 --- a/compiler/rustc_parse/src/parser/attr_wrapper.rs +++ b/compiler/rustc_parse/src/parser/attr_wrapper.rs @@ -8,7 +8,6 @@ use rustc_errors::PResult; use rustc_session::parse::ParseSess; use rustc_span::{sym, Span, DUMMY_SP}; -use std::convert::TryInto; use std::ops::Range; /// A wrapper type to ensure that the parser handles outer attributes correctly. diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 03f25392a7c1f..7ebcda249e23a 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -21,7 +21,6 @@ use rustc_span::lev_distance::lev_distance; use rustc_span::source_map::{self, Span}; use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::DUMMY_SP; -use std::convert::TryFrom; use std::mem; use thin_vec::ThinVec; use tracing::debug; diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs index 38c7c6cce6765..0e7d628c1eb63 100644 --- a/compiler/rustc_query_system/src/dep_graph/graph.rs +++ b/compiler/rustc_query_system/src/dep_graph/graph.rs @@ -46,7 +46,7 @@ impl DepNodeIndex { pub const FOREVER_RED_NODE: DepNodeIndex = DepNodeIndex::from_u32(1); } -impl std::convert::From for QueryInvocationId { +impl From for QueryInvocationId { #[inline] fn from(dep_node_index: DepNodeIndex) -> Self { QueryInvocationId(dep_node_index.as_u32()) diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs index 3b20ec70d73cb..d292f4beef2eb 100644 --- a/compiler/rustc_query_system/src/dep_graph/serialized.rs +++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs @@ -22,7 +22,6 @@ use rustc_index::vec::{Idx, IndexVec}; use rustc_serialize::opaque::{FileEncodeResult, FileEncoder, IntEncodedWithFixedSize, MemDecoder}; use rustc_serialize::{Decodable, Decoder, Encodable}; use smallvec::SmallVec; -use std::convert::TryInto; // The maximum value of `SerializedDepNodeIndex` leaves the upper two bits // unused so that we can store multiple index types in `CompressedHybridIndex`, diff --git a/compiler/rustc_query_system/src/query/caches.rs b/compiler/rustc_query_system/src/query/caches.rs index 4c4680b5d8ea8..f65846fc77f6e 100644 --- a/compiler/rustc_query_system/src/query/caches.rs +++ b/compiler/rustc_query_system/src/query/caches.rs @@ -9,7 +9,6 @@ use rustc_data_structures::sharded::Sharded; use rustc_data_structures::sync::Lock; use rustc_data_structures::sync::WorkerLocal; use rustc_index::vec::{Idx, IndexVec}; -use std::default::Default; use std::fmt::Debug; use std::hash::Hash; use std::marker::PhantomData; diff --git a/compiler/rustc_query_system/src/query/job.rs b/compiler/rustc_query_system/src/query/job.rs index 49bbcf5780459..701bbde6ad23f 100644 --- a/compiler/rustc_query_system/src/query/job.rs +++ b/compiler/rustc_query_system/src/query/job.rs @@ -22,8 +22,8 @@ use { rustc_data_structures::{jobserver, OnDrop}, rustc_rayon_core as rayon_core, rustc_span::DUMMY_SP, - std::iter::{self, FromIterator}, - std::{mem, process}, + std::iter, + std::process, }; /// Represents a span and a query key. @@ -247,7 +247,7 @@ impl QueryLatch { jobserver::release_thread(); waiter.condvar.wait(&mut info); // Release the lock before we potentially block in `acquire_thread` - mem::drop(info); + drop(info); jobserver::acquire_thread(); } } diff --git a/compiler/rustc_save_analysis/src/lib.rs b/compiler/rustc_save_analysis/src/lib.rs index 7735c571310dd..6c310abf10ac5 100644 --- a/compiler/rustc_save_analysis/src/lib.rs +++ b/compiler/rustc_save_analysis/src/lib.rs @@ -36,7 +36,6 @@ use rustc_span::symbol::Ident; use rustc_span::*; use std::cell::Cell; -use std::default::Default; use std::env; use std::fs::File; use std::io::BufWriter; diff --git a/compiler/rustc_serialize/src/opaque.rs b/compiler/rustc_serialize/src/opaque.rs index 0afeb86fceb24..0e0ebc79eb2e3 100644 --- a/compiler/rustc_serialize/src/opaque.rs +++ b/compiler/rustc_serialize/src/opaque.rs @@ -1,6 +1,5 @@ use crate::leb128::{self, largest_max_leb128_len}; use crate::serialize::{Decodable, Decoder, Encodable, Encoder}; -use std::convert::TryInto; use std::fs::File; use std::io::{self, Write}; use std::mem::MaybeUninit; diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 7a20100fd3133..6de564a3a0692 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -32,7 +32,7 @@ use std::collections::btree_map::{ use std::collections::{BTreeMap, BTreeSet}; use std::fmt; use std::hash::Hash; -use std::iter::{self, FromIterator}; +use std::iter; use std::path::{Path, PathBuf}; use std::str::{self, FromStr}; diff --git a/compiler/rustc_session/src/filesearch.rs b/compiler/rustc_session/src/filesearch.rs index 1b66773be6f08..1855a49c1ecdf 100644 --- a/compiler/rustc_session/src/filesearch.rs +++ b/compiler/rustc_session/src/filesearch.rs @@ -3,7 +3,6 @@ use smallvec::{smallvec, SmallVec}; use std::env; use std::fs; -use std::iter::FromIterator; use std::path::{Path, PathBuf}; use crate::search_paths::{PathKind, SearchPath}; diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index 2ae57d9e56d7c..43a3172270733 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -15,11 +15,10 @@ pub use crate::*; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::StableHasher; use rustc_data_structures::sync::{AtomicU32, Lrc, MappedReadGuard, ReadGuard, RwLock}; +use std::cmp; use std::hash::Hash; use std::path::{Path, PathBuf}; use std::sync::atomic::Ordering; -use std::{clone::Clone, cmp}; -use std::{convert::TryFrom, unreachable}; use std::fs; use std::io; diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 1fcf8c7a8bf13..d0fe598ce086e 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -9,7 +9,6 @@ use rustc_data_structures::sync::Lock; use rustc_macros::HashStable_Generic; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; -use std::cmp::{Ord, PartialEq, PartialOrd}; use std::fmt; use std::hash::{Hash, Hasher}; use std::str; @@ -1974,7 +1973,6 @@ pub mod kw { /// For example `sym::rustfmt` or `sym::u8`. pub mod sym { use super::Symbol; - use std::convert::TryInto; #[doc(inline)] pub use super::sym_generated::*; diff --git a/compiler/rustc_target/src/lib.rs b/compiler/rustc_target/src/lib.rs index b69a0a645a415..dc2cc23ffb1e4 100644 --- a/compiler/rustc_target/src/lib.rs +++ b/compiler/rustc_target/src/lib.rs @@ -18,7 +18,6 @@ #![deny(rustc::untranslatable_diagnostic)] #![deny(rustc::diagnostic_outside_of_impl)] -use std::iter::FromIterator; use std::path::{Path, PathBuf}; #[macro_use] diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 1db1d7e85adcc..be994eda14c00 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -45,9 +45,7 @@ use rustc_span::symbol::{sym, Symbol}; use serde_json::Value; use std::borrow::Cow; use std::collections::BTreeMap; -use std::convert::TryFrom; use std::hash::{Hash, Hasher}; -use std::iter::FromIterator; use std::ops::{Deref, DerefMut}; use std::path::{Path, PathBuf}; use std::str::FromStr; diff --git a/compiler/rustc_type_ir/src/sty.rs b/compiler/rustc_type_ir/src/sty.rs index 3ed616d709b1e..9aa2be124e294 100644 --- a/compiler/rustc_type_ir/src/sty.rs +++ b/compiler/rustc_type_ir/src/sty.rs @@ -1,6 +1,6 @@ #![allow(rustc::usage_of_ty_tykind)] -use std::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd}; +use std::cmp::Ordering; use std::{fmt, hash}; use crate::DebruijnIndex; From e81ad69331dd5fafc9f89756c08a3882680b70e7 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 10 Dec 2022 21:01:48 +0100 Subject: [PATCH 3/8] Don't take into account hashtag prepended lines if not in rust code block --- src/librustdoc/html/markdown.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 5ce62224d35e5..1e1c657b0bf22 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -246,8 +246,6 @@ impl<'a, I: Iterator>> Iterator for CodeBlocks<'_, 'a, I> { _ => {} } } - let lines = origtext.lines().filter_map(|l| map_line(l).for_html()); - let text = lines.intersperse("\n".into()).collect::(); let parse_result = match kind { CodeBlockKind::Fenced(ref lang) => { @@ -260,7 +258,7 @@ impl<'a, I: Iterator>> Iterator for CodeBlocks<'_, 'a, I> {
{}
\ ", lang, - Escape(&text), + Escape(&origtext), ) .into(), )); @@ -270,6 +268,9 @@ impl<'a, I: Iterator>> Iterator for CodeBlocks<'_, 'a, I> { CodeBlockKind::Indented => Default::default(), }; + let lines = origtext.lines().filter_map(|l| map_line(l).for_html()); + let text = lines.intersperse("\n".into()).collect::(); + compile_fail = parse_result.compile_fail; should_panic = parse_result.should_panic; ignore = parse_result.ignore; From bc63c0edc0d1e82302305a479f53aa1137e96179 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 10 Dec 2022 21:02:08 +0100 Subject: [PATCH 4/8] Add test for non-rust code block hashtag prepended lines --- src/librustdoc/html/markdown/tests.rs | 37 +++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/librustdoc/html/markdown/tests.rs b/src/librustdoc/html/markdown/tests.rs index e4f72a057892f..68b31a6ee083d 100644 --- a/src/librustdoc/html/markdown/tests.rs +++ b/src/librustdoc/html/markdown/tests.rs @@ -309,3 +309,40 @@ fn test_find_testable_code_line() { t("```rust\n```\n```rust\n```", &[1, 3]); t("```rust\n```\n ```rust\n```", &[1, 3]); } + +#[test] +fn test_ascii_with_prepending_hashtag() { + fn t(input: &str, expect: &str) { + let mut map = IdMap::new(); + let output = Markdown { + content: input, + links: &[], + ids: &mut map, + error_codes: ErrorCodes::Yes, + edition: DEFAULT_EDITION, + playground: &None, + heading_offset: HeadingOffset::H2, + } + .into_string(); + assert_eq!(output, expect, "original: {}", input); + } + + t( + r#"```ascii +#..#.####.#....#.....##.. +#..#.#....#....#....#..#. +####.###..#....#....#..#. +#..#.#....#....#....#..#. +#..#.#....#....#....#..#. +#..#.####.####.####..##.. +```"#, + "
\
+#..#.####.#....#.....##..
+#..#.#....#....#....#..#.
+####.###..#....#....#..#.
+#..#.#....#....#....#..#.
+#..#.#....#....#....#..#.
+#..#.####.####.####..##..
+
", + ); +} From 3ad7131aa1d76f46af8994831b2f950c09d206cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 6 Dec 2022 20:13:31 -0800 Subject: [PATCH 5/8] Introduce `with_forced_trimmed_paths` --- compiler/rustc_middle/src/ty/error.rs | 46 +++++++---- compiler/rustc_middle/src/ty/print/pretty.rs | 82 ++++++++++++++++++- .../src/traits/error_reporting/suggestions.rs | 7 +- .../closure-return-type-must-be-sized.stderr | 6 +- .../abstract-const-as-cast-3.stderr | 24 +++--- src/test/ui/diagnostic-width/long-E0308.rs | 17 +++- .../ui/diagnostic-width/long-E0308.stderr | 8 +- .../ui/disambiguate-identical-names.stderr | 2 +- .../ui/dyn-star/no-implicit-dyn-star.stderr | 2 +- .../cross-crate-bounds.stderr | 2 +- ...sive_range_pattern_syntax_collision.stderr | 2 +- ...ive_range_pattern_syntax_collision2.stderr | 2 +- ...ive_range_pattern_syntax_collision3.stderr | 6 +- ...s-impl-trait-declaration-too-subtle.stderr | 4 +- src/test/ui/issues/issue-23966.stderr | 2 +- src/test/ui/issues/issue-31173.stderr | 2 +- src/test/ui/issues/issue-33941.stderr | 2 +- src/test/ui/issues/issue-34334.stderr | 2 +- ...e-66923-show-error-for-correct-call.stderr | 4 +- .../ui/iterators/collect-into-array.stderr | 2 +- .../ui/iterators/collect-into-slice.stderr | 4 +- .../branches.stderr | 2 +- .../recursion4.stderr | 4 +- .../let-else/let-else-deref-coercion.stderr | 2 +- src/test/ui/methods/issues/issue-90315.stderr | 10 +-- .../mismatched_types/closure-arg-count.stderr | 8 +- .../closure-arg-type-mismatch.stderr | 6 +- .../ui/mismatched_types/issue-36053-2.stderr | 2 +- .../wrap-suggestion-privacy.stderr | 2 +- .../ui/range/issue-54505-no-literals.stderr | 4 +- src/test/ui/range/issue-54505.stderr | 2 +- ...issue-73553-misinterp-range-literal.stderr | 4 +- .../disallowed-positions.stderr | 38 ++++----- .../structs/struct-record-suggestion.stderr | 2 +- .../ui/suggestions/bound-suggestions.stderr | 10 +-- ...sary_dot_for_floating_point_literal.stderr | 4 +- .../ui/traits/suggest-where-clause.stderr | 8 +- .../ui/type/type-ascription-precedence.stderr | 2 +- src/test/ui/typeck/issue-13853.stderr | 2 +- 39 files changed, 223 insertions(+), 117 deletions(-) diff --git a/compiler/rustc_middle/src/ty/error.rs b/compiler/rustc_middle/src/ty/error.rs index aa61c39b8d819..4e113d72469c8 100644 --- a/compiler/rustc_middle/src/ty/error.rs +++ b/compiler/rustc_middle/src/ty/error.rs @@ -1,6 +1,6 @@ use crate::traits::{ObligationCause, ObligationCauseCode}; use crate::ty::diagnostics::suggest_constraining_type_param; -use crate::ty::print::{FmtPrinter, Printer}; +use crate::ty::print::{with_forced_trimmed_paths, FmtPrinter, Printer}; use crate::ty::{self, BoundRegionKind, Region, Ty, TyCtxt}; use hir::def::DefKind; use rustc_errors::Applicability::{MachineApplicable, MaybeIncorrect}; @@ -162,17 +162,29 @@ impl<'tcx> fmt::Display for TypeError<'tcx> { ), RegionsPlaceholderMismatch => write!(f, "one type is more general than the other"), ArgumentSorts(values, _) | Sorts(values) => ty::tls::with(|tcx| { - report_maybe_different( - f, - &values.expected.sort_string(tcx), - &values.found.sort_string(tcx), - ) + let (mut expected, mut found) = with_forced_trimmed_paths!(( + values.expected.sort_string(tcx), + values.found.sort_string(tcx), + )); + if expected == found { + expected = values.expected.sort_string(tcx); + found = values.found.sort_string(tcx); + } + report_maybe_different(f, &expected, &found) }), Traits(values) => ty::tls::with(|tcx| { + let (mut expected, mut found) = with_forced_trimmed_paths!(( + tcx.def_path_str(values.expected), + tcx.def_path_str(values.found), + )); + if expected == found { + expected = tcx.def_path_str(values.expected); + found = tcx.def_path_str(values.found); + } report_maybe_different( f, - &format!("trait `{}`", tcx.def_path_str(values.expected)), - &format!("trait `{}`", tcx.def_path_str(values.found)), + &format!("trait `{expected}`"), + &format!("trait `{found}`"), ) }), IntMismatch(ref values) => { @@ -999,14 +1011,16 @@ fn foo(&self) -> Self::T { String::new() } let mut short; loop { // Look for the longest properly trimmed path that still fits in lenght_limit. - short = FmtPrinter::new_with_limit( - self, - hir::def::Namespace::TypeNS, - rustc_session::Limit(type_limit), - ) - .pretty_print_type(ty) - .expect("could not write to `String`") - .into_buffer(); + short = with_forced_trimmed_paths!( + FmtPrinter::new_with_limit( + self, + hir::def::Namespace::TypeNS, + rustc_session::Limit(type_limit), + ) + .pretty_print_type(ty) + .expect("could not write to `String`") + .into_buffer() + ); if short.len() <= length_limit || type_limit == 0 { break; } diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 5303341ba443c..de10b9b187cab 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -10,7 +10,7 @@ use rustc_data_structures::sso::SsoHashSet; use rustc_hir as hir; use rustc_hir::def::{self, CtorKind, DefKind, Namespace}; use rustc_hir::def_id::{DefId, DefIdSet, CRATE_DEF_ID, LOCAL_CRATE}; -use rustc_hir::definitions::{DefPathData, DefPathDataName, DisambiguatedDefPathData}; +use rustc_hir::definitions::{DefKey, DefPathData, DefPathDataName, DisambiguatedDefPathData}; use rustc_hir::LangItem; use rustc_session::config::TrimmedDefPaths; use rustc_session::cstore::{ExternCrate, ExternCrateSource}; @@ -63,6 +63,7 @@ thread_local! { static FORCE_IMPL_FILENAME_LINE: Cell = const { Cell::new(false) }; static SHOULD_PREFIX_WITH_CRATE: Cell = const { Cell::new(false) }; static NO_TRIMMED_PATH: Cell = const { Cell::new(false) }; + static FORCE_TRIMMED_PATH: Cell = const { Cell::new(false) }; static NO_QUERIES: Cell = const { Cell::new(false) }; static NO_VISIBLE_PATH: Cell = const { Cell::new(false) }; } @@ -116,6 +117,7 @@ define_helper!( /// of various rustc types, for example `std::vec::Vec` would be trimmed to `Vec`, /// if no other `Vec` is found. fn with_no_trimmed_paths(NoTrimmedGuard, NO_TRIMMED_PATH); + fn with_forced_trimmed_paths(ForceTrimmedGuard, FORCE_TRIMMED_PATH); /// Prevent selection of visible paths. `Display` impl of DefId will prefer /// visible (public) reexports of types as paths. fn with_no_visible_paths(NoVisibleGuard, NO_VISIBLE_PATH); @@ -295,11 +297,89 @@ pub trait PrettyPrinter<'tcx>: self.try_print_visible_def_path_recur(def_id, &mut callers) } + // Given a `DefId`, produce a short name. For types and traits, it prints *only* its name, + // For associated items on traits it prints out the trait's name and the associated item's name. + // For enum variants, if they have an unique name, then we only print the name, otherwise we + // print the enum name and the variant name. Otherwise, we do not print anything and let the + // caller use the `print_def_path` fallback. + fn force_print_trimmed_def_path( + mut self, + def_id: DefId, + ) -> Result<(Self::Path, bool), Self::Error> { + let key = self.tcx().def_key(def_id); + let visible_parent_map = self.tcx().visible_parent_map(()); + let kind = self.tcx().def_kind(def_id); + + let get_local_name = |this: &Self, name, def_id, key: DefKey| { + if let Some(visible_parent) = visible_parent_map.get(&def_id) + && let actual_parent = this.tcx().opt_parent(def_id) + && let DefPathData::TypeNs(_) = key.disambiguated_data.data + && Some(*visible_parent) != actual_parent + { + this + .tcx() + .module_children(visible_parent) + .iter() + .filter(|child| child.res.opt_def_id() == Some(def_id)) + .find(|child| child.vis.is_public() && child.ident.name != kw::Underscore) + .map(|child| child.ident.name) + .unwrap_or(name) + } else { + name + } + }; + if let DefKind::Variant = kind + && let Some(symbol) = self.tcx().trimmed_def_paths(()).get(&def_id) + { + // If `Assoc` is unique, we don't want to talk about `Trait::Assoc`. + self.write_str(get_local_name(&self, *symbol, def_id, key).as_str())?; + return Ok((self, true)); + } + if let Some(symbol) = key.get_opt_name() { + if let DefKind::AssocConst | DefKind::AssocFn | DefKind::AssocTy = kind + && let Some(parent) = self.tcx().opt_parent(def_id) + && let parent_key = self.tcx().def_key(parent) + && let Some(symbol) = parent_key.get_opt_name() + { + // Trait + self.write_str(get_local_name(&self, symbol, parent, parent_key).as_str())?; + self.write_str("::")?; + } else if let DefKind::Variant = kind + && let Some(parent) = self.tcx().opt_parent(def_id) + && let parent_key = self.tcx().def_key(parent) + && let Some(symbol) = parent_key.get_opt_name() + { + // Enum + + // For associated items and variants, we want the "full" path, namely, include + // the parent type in the path. For example, `Iterator::Item`. + self.write_str(get_local_name(&self, symbol, parent, parent_key).as_str())?; + self.write_str("::")?; + } else if let DefKind::Struct | DefKind::Union | DefKind::Enum | DefKind::Trait + | DefKind::TyAlias | DefKind::Fn | DefKind::Const | DefKind::Static(_) = kind + { + } else { + // If not covered above, like for example items out of `impl` blocks, fallback. + return Ok((self, false)); + } + self.write_str(get_local_name(&self, symbol, def_id, key).as_str())?; + return Ok((self, true)); + } + Ok((self, false)) + } + /// Try to see if this path can be trimmed to a unique symbol name. fn try_print_trimmed_def_path( mut self, def_id: DefId, ) -> Result<(Self::Path, bool), Self::Error> { + if FORCE_TRIMMED_PATH.with(|flag| flag.get()) { + let (s, trimmed) = self.force_print_trimmed_def_path(def_id)?; + if trimmed { + return Ok((s, true)); + } + self = s; + } if !self.tcx().sess.opts.unstable_opts.trim_diagnostic_paths || matches!(self.tcx().sess.opts.trimmed_def_paths, TrimmedDefPaths::Never) || NO_TRIMMED_PATH.with(|flag| flag.get()) diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 443d57aaf3dce..9f5814a6bda73 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -36,7 +36,7 @@ use std::fmt; use super::InferCtxtPrivExt; use crate::infer::InferCtxtExt as _; use crate::traits::query::evaluate_obligation::InferCtxtExt as _; -use rustc_middle::ty::print::with_no_trimmed_paths; +use rustc_middle::ty::print::{with_forced_trimmed_paths, with_no_trimmed_paths}; #[derive(Debug)] pub enum GeneratorInteriorOrUpvar { @@ -2412,6 +2412,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ObligationCauseCode::BindingObligation(item_def_id, span) | ObligationCauseCode::ExprBindingObligation(item_def_id, span, ..) => { let item_name = tcx.def_path_str(item_def_id); + let short_item_name = with_forced_trimmed_paths!(tcx.def_path_str(item_def_id)); let mut multispan = MultiSpan::from(span); let sm = tcx.sess.source_map(); if let Some(ident) = tcx.opt_item_ident(item_def_id) { @@ -2424,9 +2425,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { multispan.push_span_label(ident.span, "required by a bound in this"); } } - let descr = format!("required by a bound in `{}`", item_name); + let descr = format!("required by a bound in `{item_name}`"); if span.is_visible(sm) { - let msg = format!("required by this bound in `{}`", item_name); + let msg = format!("required by this bound in `{short_item_name}`"); multispan.push_span_label(span, msg); err.span_note(multispan, &descr); } else { diff --git a/src/test/ui/closures/closure-return-type-must-be-sized.stderr b/src/test/ui/closures/closure-return-type-must-be-sized.stderr index b07425bd82501..d4fc723fa8176 100644 --- a/src/test/ui/closures/closure-return-type-must-be-sized.stderr +++ b/src/test/ui/closures/closure-return-type-must-be-sized.stderr @@ -19,7 +19,7 @@ note: required by a bound in `a::bar` --> $DIR/closure-return-type-must-be-sized.rs:14:19 | LL | pub fn bar R, R: ?Sized>() {} - | ^^^^^^^^^^^^^ required by this bound in `a::bar` + | ^^^^^^^^^^^^^ required by this bound in `bar` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time --> $DIR/closure-return-type-must-be-sized.rs:56:5 @@ -51,7 +51,7 @@ note: required by a bound in `b::bar` --> $DIR/closure-return-type-must-be-sized.rs:28:19 | LL | pub fn bar R, R: ?Sized>() {} - | ^^^^^^^^^ required by this bound in `b::bar` + | ^^^^^^^^^ required by this bound in `bar` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time --> $DIR/closure-return-type-must-be-sized.rs:63:5 @@ -83,7 +83,7 @@ note: required by a bound in `c::bar` --> $DIR/closure-return-type-must-be-sized.rs:42:19 | LL | pub fn bar R, R: ?Sized>() {} - | ^^^^^^^^^^^^ required by this bound in `c::bar` + | ^^^^^^^^^^^^ required by this bound in `bar` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time --> $DIR/closure-return-type-must-be-sized.rs:70:5 diff --git a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr b/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr index ada1050d35f35..cdf97bd88fd23 100644 --- a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr @@ -14,7 +14,7 @@ note: required by a bound in `use_trait_impl::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:14:23 | LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:17:5 @@ -28,7 +28,7 @@ note: required by a bound in `use_trait_impl::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:14:23 | LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error: unconstrained generic constant --> $DIR/abstract-const-as-cast-3.rs:20:19 @@ -46,7 +46,7 @@ note: required by a bound in `use_trait_impl::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:14:23 | LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:20:5 @@ -60,7 +60,7 @@ note: required by a bound in `use_trait_impl::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:14:23 | LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:23:5 @@ -74,7 +74,7 @@ note: required by a bound in `use_trait_impl::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:14:23 | LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:25:5 @@ -88,7 +88,7 @@ note: required by a bound in `use_trait_impl::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:14:23 | LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error: unconstrained generic constant --> $DIR/abstract-const-as-cast-3.rs:35:19 @@ -106,7 +106,7 @@ note: required by a bound in `use_trait_impl_2::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:32:23 | LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:35:5 @@ -120,7 +120,7 @@ note: required by a bound in `use_trait_impl_2::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:32:23 | LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error: unconstrained generic constant --> $DIR/abstract-const-as-cast-3.rs:38:19 @@ -138,7 +138,7 @@ note: required by a bound in `use_trait_impl_2::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:32:23 | LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:38:5 @@ -152,7 +152,7 @@ note: required by a bound in `use_trait_impl_2::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:32:23 | LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:41:5 @@ -166,7 +166,7 @@ note: required by a bound in `use_trait_impl_2::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:32:23 | LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:43:5 @@ -180,7 +180,7 @@ note: required by a bound in `use_trait_impl_2::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:32:23 | LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error: aborting due to 12 previous errors diff --git a/src/test/ui/diagnostic-width/long-E0308.rs b/src/test/ui/diagnostic-width/long-E0308.rs index 3fd7a7110fd97..f021f10293341 100644 --- a/src/test/ui/diagnostic-width/long-E0308.rs +++ b/src/test/ui/diagnostic-width/long-E0308.rs @@ -1,9 +1,20 @@ // compile-flags: --diagnostic-width=60 // normalize-stderr-test: "long-type-\d+" -> "long-type-hash" -struct Atype(T, K); -struct Btype(T, K); -struct Ctype(T, K); +mod a { + // Force the "short path for unique types" machinery to trip up + pub struct Atype; + pub struct Btype; + pub struct Ctype; +} + +mod b { + pub struct Atype(T, K); + pub struct Btype(T, K); + pub struct Ctype(T, K); +} + +use b::*; fn main() { let x: Atype< diff --git a/src/test/ui/diagnostic-width/long-E0308.stderr b/src/test/ui/diagnostic-width/long-E0308.stderr index 487ab23a1c100..1c99898bc8329 100644 --- a/src/test/ui/diagnostic-width/long-E0308.stderr +++ b/src/test/ui/diagnostic-width/long-E0308.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/long-E0308.rs:33:9 + --> $DIR/long-E0308.rs:44:9 | LL | let x: Atype< | _____________- @@ -24,7 +24,7 @@ LL | | )))))))))))))))))))))))))))))); the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt' error[E0308]: mismatched types - --> $DIR/long-E0308.rs:46:26 + --> $DIR/long-E0308.rs:57:26 | LL | ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O... | __________________________^ @@ -40,7 +40,7 @@ LL | | )))))))))))))))))))))))); the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt' error[E0308]: mismatched types - --> $DIR/long-E0308.rs:77:9 + --> $DIR/long-E0308.rs:88:9 | LL | let x: Atype< | ____________- @@ -59,7 +59,7 @@ LL | | > = (); found unit type `()` error[E0308]: mismatched types - --> $DIR/long-E0308.rs:80:17 + --> $DIR/long-E0308.rs:91:17 | LL | let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O... | ____________--___^ diff --git a/src/test/ui/disambiguate-identical-names.stderr b/src/test/ui/disambiguate-identical-names.stderr index 42925cfed5507..87560c4c79735 100644 --- a/src/test/ui/disambiguate-identical-names.stderr +++ b/src/test/ui/disambiguate-identical-names.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/disambiguate-identical-names.rs:13:10 | LL | test(&v); - | ---- ^^ expected struct `std::vec::Vec`, found struct `HashMap` + | ---- ^^ expected struct `Vec`, found struct `HashMap` | | | arguments to this function are incorrect | diff --git a/src/test/ui/dyn-star/no-implicit-dyn-star.stderr b/src/test/ui/dyn-star/no-implicit-dyn-star.stderr index e7c5918629bdc..a3f4d21ca94bd 100644 --- a/src/test/ui/dyn-star/no-implicit-dyn-star.stderr +++ b/src/test/ui/dyn-star/no-implicit-dyn-star.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/no-implicit-dyn-star.rs:6:48 | LL | dyn_star_foreign::require_dyn_star_display(1usize); - | ------------------------------------------ ^^^^^^ expected trait object `dyn std::fmt::Display`, found `usize` + | ------------------------------------------ ^^^^^^ expected trait object `dyn Display`, found `usize` | | | arguments to this function are incorrect | diff --git a/src/test/ui/generic-associated-types/cross-crate-bounds.stderr b/src/test/ui/generic-associated-types/cross-crate-bounds.stderr index c81cd7e7718ca..83ee04d5a6c60 100644 --- a/src/test/ui/generic-associated-types/cross-crate-bounds.stderr +++ b/src/test/ui/generic-associated-types/cross-crate-bounds.stderr @@ -8,7 +8,7 @@ note: required by a bound in `foo_defn::Foo::Bar` --> $DIR/auxiliary/foo_defn.rs:4:15 | LL | type Bar: AsRef<()>; - | ^^^^^^^^^ required by this bound in `foo_defn::Foo::Bar` + | ^^^^^^^^^ required by this bound in `Foo::Bar` error: aborting due to previous error diff --git a/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr b/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr index a6f8563a04785..095a1c6af37bc 100644 --- a/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr +++ b/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` LL | [_, 99.., _] => {}, - | ^^ expected struct `std::ops::Range`, found integer + | ^^ expected struct `Range`, found integer | = note: expected struct `std::ops::Range<{integer}>` found type `{integer}` diff --git a/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr b/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr index 4e0102c930da8..2ea3205dcd4ac 100644 --- a/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr +++ b/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr @@ -10,7 +10,7 @@ error[E0308]: mismatched types LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` LL | [_, 99..] => {}, - | ^^ expected struct `std::ops::Range`, found integer + | ^^ expected struct `Range`, found integer | = note: expected struct `std::ops::Range<{integer}>` found type `{integer}` diff --git a/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr b/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr index 790a1337228d0..bbdf0c83f6203 100644 --- a/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr +++ b/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` LL | [..9, 99..100, _] => {}, - | ^ expected struct `std::ops::Range`, found integer + | ^ expected struct `Range`, found integer | = note: expected struct `std::ops::Range<{integer}>` found type `{integer}` @@ -17,7 +17,7 @@ LL | match [5..4, 99..105, 43..44] { LL | [..9, 99..100, _] => {}, | ^^ --- this is of type `{integer}` | | - | expected struct `std::ops::Range`, found integer + | expected struct `Range`, found integer | = note: expected struct `std::ops::Range<{integer}>` found type `{integer}` @@ -28,7 +28,7 @@ error[E0308]: mismatched types LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` LL | [..9, 99..100, _] => {}, - | -- ^^^ expected struct `std::ops::Range`, found integer + | -- ^^^ expected struct `Range`, found integer | | | this is of type `{integer}` | diff --git a/src/test/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr b/src/test/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr index 3dda5761ada6b..3ee26f74a787b 100644 --- a/src/test/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr +++ b/src/test/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr @@ -15,7 +15,7 @@ LL | type Foo = impl PartialEq<(Foo, i32)>; LL | fn eq(&self, _other: &(Foo, i32)) -> bool { | ^^^^^^^^^^^ | | - | expected struct `a::Bar`, found opaque type + | expected struct `Bar`, found opaque type | help: change the parameter type to match the trait: `&(a::Bar, i32)` | = note: expected fn pointer `fn(&a::Bar, &(a::Bar, i32)) -> _` @@ -38,7 +38,7 @@ LL | type Foo = impl PartialEq<(Foo, i32)>; LL | fn eq(&self, _other: &(Bar, i32)) -> bool { | ^^^^^^^^^^^ | | - | expected opaque type, found struct `b::Bar` + | expected opaque type, found struct `Bar` | help: change the parameter type to match the trait: `&(b::Foo, i32)` | = note: expected fn pointer `fn(&b::Bar, &(b::Foo, i32)) -> _` diff --git a/src/test/ui/issues/issue-23966.stderr b/src/test/ui/issues/issue-23966.stderr index ae8233d5c76e6..22c4055f54be3 100644 --- a/src/test/ui/issues/issue-23966.stderr +++ b/src/test/ui/issues/issue-23966.stderr @@ -11,7 +11,7 @@ note: required by a bound in `fold` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | F: FnMut(B, Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `fold` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::fold` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-31173.stderr b/src/test/ui/issues/issue-31173.stderr index e3334eef3ad7f..58d9b564427a7 100644 --- a/src/test/ui/issues/issue-31173.stderr +++ b/src/test/ui/issues/issue-31173.stderr @@ -18,7 +18,7 @@ note: required by a bound in `cloned` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | Self: Sized + Iterator, - | ^^^^^^^^^^^^ required by this bound in `cloned` + | ^^^^^^^^^^^^ required by this bound in `Iterator::cloned` error[E0599]: the method `collect` exists for struct `Cloned, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>`, but its trait bounds were not satisfied --> $DIR/issue-31173.rs:13:10 diff --git a/src/test/ui/issues/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr index 691b8f88f4ed5..c28986a29854b 100644 --- a/src/test/ui/issues/issue-33941.stderr +++ b/src/test/ui/issues/issue-33941.stderr @@ -12,7 +12,7 @@ note: required by a bound in `cloned` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | Self: Sized + Iterator, - | ^^^^^^^^^^^^ required by this bound in `cloned` + | ^^^^^^^^^^^^ required by this bound in `Iterator::cloned` error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` --> $DIR/issue-33941.rs:6:14 diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr index 72082f0cd1728..3188cd80cca83 100644 --- a/src/test/ui/issues/issue-34334.stderr +++ b/src/test/ui/issues/issue-34334.stderr @@ -26,7 +26,7 @@ note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | fn collect>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr index 2de1503765082..ce38c3320bb35 100644 --- a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr +++ b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr @@ -12,7 +12,7 @@ note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | fn collect>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect` error[E0277]: a value of type `Vec` cannot be built from an iterator over elements of type `&f64` --> $DIR/issue-66923-show-error-for-correct-call.rs:12:14 @@ -28,7 +28,7 @@ note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | fn collect>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect` error: aborting due to 2 previous errors diff --git a/src/test/ui/iterators/collect-into-array.stderr b/src/test/ui/iterators/collect-into-array.stderr index a23a36a88abb3..544b1da178a3d 100644 --- a/src/test/ui/iterators/collect-into-array.stderr +++ b/src/test/ui/iterators/collect-into-array.stderr @@ -11,7 +11,7 @@ note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | fn collect>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect` error: aborting due to previous error diff --git a/src/test/ui/iterators/collect-into-slice.stderr b/src/test/ui/iterators/collect-into-slice.stderr index bc152467ce3a5..65ef124a46302 100644 --- a/src/test/ui/iterators/collect-into-slice.stderr +++ b/src/test/ui/iterators/collect-into-slice.stderr @@ -19,7 +19,7 @@ note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | fn collect>(self) -> B - | ^ required by this bound in `collect` + | ^ required by this bound in `Iterator::collect` error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size --> $DIR/collect-into-slice.rs:6:30 @@ -34,7 +34,7 @@ note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | fn collect>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect` error: aborting due to 3 previous errors diff --git a/src/test/ui/lazy-type-alias-impl-trait/branches.stderr b/src/test/ui/lazy-type-alias-impl-trait/branches.stderr index 33f82448dd2ac..5a46027dd52ba 100644 --- a/src/test/ui/lazy-type-alias-impl-trait/branches.stderr +++ b/src/test/ui/lazy-type-alias-impl-trait/branches.stderr @@ -11,7 +11,7 @@ note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | fn collect>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect` error: aborting due to previous error diff --git a/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr b/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr index 57978edf2bf05..a4b4968b7d24c 100644 --- a/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr +++ b/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr @@ -11,7 +11,7 @@ note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | fn collect>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect` error[E0277]: a value of type `impl Debug` cannot be built from an iterator over elements of type `_` --> $DIR/recursion4.rs:19:9 @@ -26,7 +26,7 @@ note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | fn collect>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect` error: aborting due to 2 previous errors diff --git a/src/test/ui/let-else/let-else-deref-coercion.stderr b/src/test/ui/let-else/let-else-deref-coercion.stderr index addcd798f4ffb..bf78a079cdfa9 100644 --- a/src/test/ui/let-else/let-else-deref-coercion.stderr +++ b/src/test/ui/let-else/let-else-deref-coercion.stderr @@ -12,7 +12,7 @@ error[E0308]: mismatched types LL | let Bar(z) = x; | ^^^^^^ - this expression has type `&mut irrefutable::Foo` | | - | expected struct `irrefutable::Foo`, found struct `irrefutable::Bar` + | expected struct `Foo`, found struct `Bar` error: aborting due to 2 previous errors diff --git a/src/test/ui/methods/issues/issue-90315.stderr b/src/test/ui/methods/issues/issue-90315.stderr index 070cd3054369b..8d7b32e025a08 100644 --- a/src/test/ui/methods/issues/issue-90315.stderr +++ b/src/test/ui/methods/issues/issue-90315.stderr @@ -57,7 +57,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:28:8 | LL | if 1..(end + 1).is_empty() { - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<{integer}>` @@ -77,7 +77,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:34:8 | LL | if 1..(end + 1).is_sorted() { - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<{integer}>` @@ -97,7 +97,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:40:21 | LL | let _res: i32 = 3..6.take(2).sum(); - | --- ^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `std::ops::Range` + | --- ^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `Range` | | | expected due to this | @@ -119,7 +119,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:45:21 | LL | let _sum: i32 = 3..6.sum(); - | --- ^^^^^^^^^^ expected `i32`, found struct `std::ops::Range` + | --- ^^^^^^^^^^ expected `i32`, found struct `Range` | | | expected due to this | @@ -158,7 +158,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:62:8 | LL | if 1..end.error_method() { - | ^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<{integer}>` diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index a02ec81983883..a2bf2e8d5b7b3 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -130,7 +130,7 @@ note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | F: FnMut(Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::map` error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments --> $DIR/closure-arg-count.rs:27:57 @@ -146,7 +146,7 @@ note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | F: FnMut(Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::map` error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments --> $DIR/closure-arg-count.rs:29:57 @@ -163,7 +163,7 @@ note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | F: FnMut(Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::map` error[E0593]: function is expected to take 1 argument, but it takes 2 arguments --> $DIR/closure-arg-count.rs:32:45 @@ -177,7 +177,7 @@ note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | F: FnMut(Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::map` error[E0593]: function is expected to take 0 arguments, but it takes 1 argument --> $DIR/closure-arg-count.rs:35:10 diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr index 92d545b7366e3..f2e2a4c7fd5fe 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -12,7 +12,7 @@ note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | F: FnMut(Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::map` error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:4:14 @@ -28,7 +28,7 @@ note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | F: FnMut(Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::map` error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:5:14 @@ -44,7 +44,7 @@ note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | F: FnMut(Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::map` error: aborting due to 3 previous errors diff --git a/src/test/ui/mismatched_types/issue-36053-2.stderr b/src/test/ui/mismatched_types/issue-36053-2.stderr index 906001ca1e09e..b3509abbf84eb 100644 --- a/src/test/ui/mismatched_types/issue-36053-2.stderr +++ b/src/test/ui/mismatched_types/issue-36053-2.stderr @@ -12,7 +12,7 @@ note: required by a bound in `filter` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | P: FnMut(&Self::Item) -> bool, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `filter` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::filter` error[E0599]: the method `count` exists for struct `Filter>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>`, but its trait bounds were not satisfied --> $DIR/issue-36053-2.rs:7:55 diff --git a/src/test/ui/mismatched_types/wrap-suggestion-privacy.stderr b/src/test/ui/mismatched_types/wrap-suggestion-privacy.stderr index e8eb8d263ec79..fdd92cbfc4437 100644 --- a/src/test/ui/mismatched_types/wrap-suggestion-privacy.stderr +++ b/src/test/ui/mismatched_types/wrap-suggestion-privacy.stderr @@ -42,7 +42,7 @@ error[E0308]: mismatched types --> $DIR/wrap-suggestion-privacy.rs:22:17 | LL | needs_ready(Some(0)); - | ----------- ^^^^^^^ expected struct `std::future::Ready`, found enum `Option` + | ----------- ^^^^^^^ expected struct `Ready`, found enum `Option` | | | arguments to this function are incorrect | diff --git a/src/test/ui/range/issue-54505-no-literals.stderr b/src/test/ui/range/issue-54505-no-literals.stderr index 4cbf8869d0c59..070dc844563c9 100644 --- a/src/test/ui/range/issue-54505-no-literals.stderr +++ b/src/test/ui/range/issue-54505-no-literals.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | take_range(std::ops::Range { start: 0, end: 1 }); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `std::ops::Range` + | | expected reference, found struct `Range` | | help: consider borrowing here: `&std::ops::Range { start: 0, end: 1 }` | arguments to this function are incorrect | @@ -22,7 +22,7 @@ error[E0308]: mismatched types LL | take_range(::std::ops::Range { start: 0, end: 1 }); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `std::ops::Range` + | | expected reference, found struct `Range` | | help: consider borrowing here: `&::std::ops::Range { start: 0, end: 1 }` | arguments to this function are incorrect | diff --git a/src/test/ui/range/issue-54505.stderr b/src/test/ui/range/issue-54505.stderr index 38df6e14496a6..9eec169404cdf 100644 --- a/src/test/ui/range/issue-54505.stderr +++ b/src/test/ui/range/issue-54505.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | take_range(0..1); | ---------- ^^^^ | | | - | | expected reference, found struct `std::ops::Range` + | | expected reference, found struct `Range` | | help: consider borrowing here: `&(0..1)` | arguments to this function are incorrect | diff --git a/src/test/ui/range/issue-73553-misinterp-range-literal.stderr b/src/test/ui/range/issue-73553-misinterp-range-literal.stderr index 6badd998f9617..d08d9b1345d4a 100644 --- a/src/test/ui/range/issue-73553-misinterp-range-literal.stderr +++ b/src/test/ui/range/issue-73553-misinterp-range-literal.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | demo(tell(1)..tell(10)); | ---- ^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `std::ops::Range` + | | expected `&Range`, found struct `Range` | | help: consider borrowing here: `&(tell(1)..tell(10))` | arguments to this function are incorrect | @@ -22,7 +22,7 @@ error[E0308]: mismatched types LL | demo(1..10); | ---- ^^^^^ | | | - | | expected reference, found struct `std::ops::Range` + | | expected `&Range`, found struct `Range` | | help: consider borrowing here: `&(1..10)` | arguments to this function are incorrect | diff --git a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr index 91c001151803a..3028f8dbdbf77 100644 --- a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr +++ b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr @@ -1516,7 +1516,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:157:8 | LL | if true..(let 0 = 0) {} - | ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1545,7 +1545,7 @@ error[E0308]: mismatched types LL | if let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `std::ops::Range` + | expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1554,7 +1554,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:171:8 | LL | if let Range { start: _, end: _ } = true..true && false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1565,7 +1565,7 @@ error[E0308]: mismatched types LL | if let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `std::ops::Range` + | expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1574,7 +1574,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:175:8 | LL | if let Range { start: _, end: _ } = true..true || false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1585,7 +1585,7 @@ error[E0308]: mismatched types LL | if let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool` | | - | expected fn pointer, found struct `std::ops::Range` + | expected fn pointer, found struct `Range` | = note: expected fn pointer `fn() -> bool` found struct `std::ops::Range<_>` @@ -1607,7 +1607,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:182:8 | LL | if let Range { start: F, end } = F..|| true {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1618,7 +1618,7 @@ error[E0308]: mismatched types LL | if let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool` | | - | expected `bool`, found struct `std::ops::Range` + | expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1639,7 +1639,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:190:8 | LL | if let Range { start: true, end } = t..&&false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1710,7 +1710,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:249:11 | LL | while true..(let 0 = 0) {} - | ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1739,7 +1739,7 @@ error[E0308]: mismatched types LL | while let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `std::ops::Range` + | expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1748,7 +1748,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:263:11 | LL | while let Range { start: _, end: _ } = true..true && false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1759,7 +1759,7 @@ error[E0308]: mismatched types LL | while let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `std::ops::Range` + | expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1768,7 +1768,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:267:11 | LL | while let Range { start: _, end: _ } = true..true || false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1779,7 +1779,7 @@ error[E0308]: mismatched types LL | while let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool` | | - | expected fn pointer, found struct `std::ops::Range` + | expected fn pointer, found struct `Range` | = note: expected fn pointer `fn() -> bool` found struct `std::ops::Range<_>` @@ -1801,7 +1801,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:274:11 | LL | while let Range { start: F, end } = F..|| true {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1812,7 +1812,7 @@ error[E0308]: mismatched types LL | while let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool` | | - | expected `bool`, found struct `std::ops::Range` + | expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1833,7 +1833,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:282:11 | LL | while let Range { start: true, end } = t..&&false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range` @@ -1883,7 +1883,7 @@ error[E0308]: mismatched types LL | (let Range { start: _, end: _ } = true..true || false); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `std::ops::Range` + | expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<_>` diff --git a/src/test/ui/structs/struct-record-suggestion.stderr b/src/test/ui/structs/struct-record-suggestion.stderr index f4fd655e698b0..9b751d1b66c54 100644 --- a/src/test/ui/structs/struct-record-suggestion.stderr +++ b/src/test/ui/structs/struct-record-suggestion.stderr @@ -18,7 +18,7 @@ error[E0308]: mismatched types --> $DIR/struct-record-suggestion.rs:23:20 | LL | let q = B { b: 1..Default::default() }; - | ^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found struct `Range` | = note: expected type `u32` found struct `std::ops::Range<{integer}>` diff --git a/src/test/ui/suggestions/bound-suggestions.stderr b/src/test/ui/suggestions/bound-suggestions.stderr index d53715937f7d8..4cb595c32c061 100644 --- a/src/test/ui/suggestions/bound-suggestions.stderr +++ b/src/test/ui/suggestions/bound-suggestions.stderr @@ -80,7 +80,7 @@ note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of() -> usize { - | ^ required by this bound in `std::mem::size_of` + | ^ required by this bound in `size_of` help: consider further restricting `Self` | LL | trait Foo: Sized { @@ -96,7 +96,7 @@ note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of() -> usize { - | ^ required by this bound in `std::mem::size_of` + | ^ required by this bound in `size_of` help: consider further restricting `Self` | LL | trait Bar: std::fmt::Display + Sized { @@ -112,7 +112,7 @@ note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of() -> usize { - | ^ required by this bound in `std::mem::size_of` + | ^ required by this bound in `size_of` help: consider further restricting `Self` | LL | trait Baz: Sized where Self: std::fmt::Display { @@ -128,7 +128,7 @@ note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of() -> usize { - | ^ required by this bound in `std::mem::size_of` + | ^ required by this bound in `size_of` help: consider further restricting `Self` | LL | trait Qux: Sized where Self: std::fmt::Display { @@ -144,7 +144,7 @@ note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of() -> usize { - | ^ required by this bound in `std::mem::size_of` + | ^ required by this bound in `size_of` help: consider further restricting `Self` | LL | trait Bat: std::fmt::Display + Sized { diff --git a/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr b/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr index 773f1392ae765..34eaa8322c870 100644 --- a/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr +++ b/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:2:18 | LL | let _: f64 = 0..10; - | --- ^^^^^ expected `f64`, found struct `std::ops::Range` + | --- ^^^^^ expected `f64`, found struct `Range` | | | expected due to this | @@ -47,7 +47,7 @@ error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:5:18 | LL | let _: f64 = std::ops::Range { start: 0, end: 1 }; - | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `f64`, found struct `std::ops::Range` + | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `f64`, found struct `Range` | | | expected due to this | diff --git a/src/test/ui/traits/suggest-where-clause.stderr b/src/test/ui/traits/suggest-where-clause.stderr index 747e2477b9cf1..9765fbd47ff46 100644 --- a/src/test/ui/traits/suggest-where-clause.stderr +++ b/src/test/ui/traits/suggest-where-clause.stderr @@ -11,7 +11,7 @@ note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of() -> usize { - | ^ required by this bound in `std::mem::size_of` + | ^ required by this bound in `size_of` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn check() { @@ -36,7 +36,7 @@ note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of() -> usize { - | ^ required by this bound in `std::mem::size_of` + | ^ required by this bound in `size_of` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn check() { @@ -82,7 +82,7 @@ note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of() -> usize { - | ^ required by this bound in `std::mem::size_of` + | ^ required by this bound in `size_of` error[E0277]: the size for values of type `[&U]` cannot be known at compilation time --> $DIR/suggest-where-clause.rs:31:20 @@ -95,7 +95,7 @@ note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | LL | pub const fn size_of() -> usize { - | ^ required by this bound in `std::mem::size_of` + | ^ required by this bound in `size_of` error: aborting due to 7 previous errors diff --git a/src/test/ui/type/type-ascription-precedence.stderr b/src/test/ui/type/type-ascription-precedence.stderr index a8139063db1d8..fc85ec9331556 100644 --- a/src/test/ui/type/type-ascription-precedence.stderr +++ b/src/test/ui/type/type-ascription-precedence.stderr @@ -55,7 +55,7 @@ error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:53:5 | LL | (S .. S): S; - | ^^^^^^^^ expected struct `S`, found struct `std::ops::Range` + | ^^^^^^^^ expected struct `S`, found struct `Range` | = note: expected struct `S` found struct `std::ops::Range` diff --git a/src/test/ui/typeck/issue-13853.stderr b/src/test/ui/typeck/issue-13853.stderr index 657bda5f62b3f..876ac2c67ef3f 100644 --- a/src/test/ui/typeck/issue-13853.stderr +++ b/src/test/ui/typeck/issue-13853.stderr @@ -5,7 +5,7 @@ LL | fn nodes<'a, I: Iterator>(&self) -> I | - this type parameter - expected `I` because of return type ... LL | self.iter() - | ^^^^^^^^^^^ expected type parameter `I`, found struct `std::slice::Iter` + | ^^^^^^^^^^^ expected type parameter `I`, found struct `Iter` | = note: expected type parameter `I` found struct `std::slice::Iter<'_, N>` From 17547af3fb3ee04d922a0fb7a71e74547d18695e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 10 Dec 2022 15:03:47 -0800 Subject: [PATCH 6/8] fix rebase --- src/test/ui/on-unimplemented/sum.stderr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/ui/on-unimplemented/sum.stderr b/src/test/ui/on-unimplemented/sum.stderr index 0c99e63f0e518..c3103671178b5 100644 --- a/src/test/ui/on-unimplemented/sum.stderr +++ b/src/test/ui/on-unimplemented/sum.stderr @@ -14,7 +14,7 @@ note: required by a bound in `std::iter::Iterator::sum` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | S: Sum, - | ^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::sum` + | ^^^^^^^^^^^^^^^ required by this bound in `Iterator::sum` error[E0277]: a value of type `i32` cannot be made by multiplying all elements of type `&()` from an iterator --> $DIR/sum.rs:7:5 @@ -32,7 +32,7 @@ note: required by a bound in `std::iter::Iterator::product` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL | P: Product, - | ^^^^^^^^^^^^^^^^^^^ required by this bound in `std::iter::Iterator::product` + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::product` error: aborting due to 2 previous errors From 8a3005d3dafa10739a45a097536fb2f734e3173d Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 11 Dec 2022 10:47:51 +0900 Subject: [PATCH 7/8] Add regression test for #104582 Signed-off-by: Yuki Okushi --- src/test/ui/typeck/issue-104582.rs | 5 +++++ src/test/ui/typeck/issue-104582.stderr | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/test/ui/typeck/issue-104582.rs create mode 100644 src/test/ui/typeck/issue-104582.stderr diff --git a/src/test/ui/typeck/issue-104582.rs b/src/test/ui/typeck/issue-104582.rs new file mode 100644 index 0000000000000..104669dadbea1 --- /dev/null +++ b/src/test/ui/typeck/issue-104582.rs @@ -0,0 +1,5 @@ +fn main(){ + let my_var: String(String?); + //~^ ERROR: invalid `?` in type + //~| ERROR: parenthesized type parameters may only be used with a `Fn` trait +} diff --git a/src/test/ui/typeck/issue-104582.stderr b/src/test/ui/typeck/issue-104582.stderr new file mode 100644 index 0000000000000..61b6b23642cce --- /dev/null +++ b/src/test/ui/typeck/issue-104582.stderr @@ -0,0 +1,25 @@ +error: invalid `?` in type + --> $DIR/issue-104582.rs:2:30 + | +LL | let my_var: String(String?); + | ^ `?` is only allowed on expressions, not types + | +help: if you meant to express that the type might not contain a value, use the `Option` wrapper type + | +LL | let my_var: String(Option); + | +++++++ ~ + +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-104582.rs:2:17 + | +LL | let my_var: String(String?); + | ^^^^^^^^^^^^^^^ only `Fn` traits may use parentheses + | +help: use angle brackets instead + | +LL | let my_var: String; + | ~ ~ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0214`. From 0f5f163a949717eb0361b2ad4d31c731171d100e Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 11 Dec 2022 10:57:56 +0900 Subject: [PATCH 8/8] Add some regression tests for #44454 Signed-off-by: Yuki Okushi --- src/test/ui/traits/object/issue-44454-1.rs | 22 +++++++++++++ .../ui/traits/object/issue-44454-1.stderr | 10 ++++++ src/test/ui/traits/object/issue-44454-2.rs | 22 +++++++++++++ .../ui/traits/object/issue-44454-2.stderr | 17 ++++++++++ src/test/ui/traits/object/issue-44454-3.rs | 33 +++++++++++++++++++ .../ui/traits/object/issue-44454-3.stderr | 11 +++++++ 6 files changed, 115 insertions(+) create mode 100644 src/test/ui/traits/object/issue-44454-1.rs create mode 100644 src/test/ui/traits/object/issue-44454-1.stderr create mode 100644 src/test/ui/traits/object/issue-44454-2.rs create mode 100644 src/test/ui/traits/object/issue-44454-2.stderr create mode 100644 src/test/ui/traits/object/issue-44454-3.rs create mode 100644 src/test/ui/traits/object/issue-44454-3.stderr diff --git a/src/test/ui/traits/object/issue-44454-1.rs b/src/test/ui/traits/object/issue-44454-1.rs new file mode 100644 index 0000000000000..bbaf3188a8963 --- /dev/null +++ b/src/test/ui/traits/object/issue-44454-1.rs @@ -0,0 +1,22 @@ +// Taken from https://github.com/rust-lang/rust/issues/44454#issue-256435333 + +trait Animal: 'static {} + +fn foo() +where + Y: Animal + ?Sized, +{ + // `Y` implements `Animal` so `Y` is 'static. + baz::() +} + +fn bar<'a>(_arg: &'a i32) { + foo::, &'a i32>() //~ ERROR: lifetime may not live long enough +} + +fn baz() {} + +fn main() { + let a = 5; + bar(&a); +} diff --git a/src/test/ui/traits/object/issue-44454-1.stderr b/src/test/ui/traits/object/issue-44454-1.stderr new file mode 100644 index 0000000000000..859487f50ac1e --- /dev/null +++ b/src/test/ui/traits/object/issue-44454-1.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/issue-44454-1.rs:14:5 + | +LL | fn bar<'a>(_arg: &'a i32) { + | -- lifetime `'a` defined here +LL | foo::, &'a i32>() + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/traits/object/issue-44454-2.rs b/src/test/ui/traits/object/issue-44454-2.rs new file mode 100644 index 0000000000000..f5178bcdbe224 --- /dev/null +++ b/src/test/ui/traits/object/issue-44454-2.rs @@ -0,0 +1,22 @@ +// Taken from https://github.com/rust-lang/rust/issues/44454#issuecomment-1175925928 + +trait Trait: 'static { + type Assoc: AsRef; +} + +fn hr(x: T::Assoc) -> Box + 'static> +where + T: Trait +{ + Box::new(x) +} + +fn extend_lt<'a>(x: &'a str) -> Box + 'static> { + type DynTrait = dyn for<'a> Trait<&'a str, Assoc = &'a str>; + hr::(x) //~ ERROR: borrowed data escapes outside of function +} + +fn main() { + let extended = extend_lt(&String::from("hello")); + println!("{}", extended.as_ref().as_ref()); +} diff --git a/src/test/ui/traits/object/issue-44454-2.stderr b/src/test/ui/traits/object/issue-44454-2.stderr new file mode 100644 index 0000000000000..7f574769b7f60 --- /dev/null +++ b/src/test/ui/traits/object/issue-44454-2.stderr @@ -0,0 +1,17 @@ +error[E0521]: borrowed data escapes outside of function + --> $DIR/issue-44454-2.rs:16:5 + | +LL | fn extend_lt<'a>(x: &'a str) -> Box + 'static> { + | -- - `x` is a reference that is only valid in the function body + | | + | lifetime `'a` defined here +LL | type DynTrait = dyn for<'a> Trait<&'a str, Assoc = &'a str>; +LL | hr::(x) + | ^^^^^^^^^^^^^^^^^^^^ + | | + | `x` escapes the function body here + | argument requires that `'a` must outlive `'static` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0521`. diff --git a/src/test/ui/traits/object/issue-44454-3.rs b/src/test/ui/traits/object/issue-44454-3.rs new file mode 100644 index 0000000000000..bff7270353464 --- /dev/null +++ b/src/test/ui/traits/object/issue-44454-3.rs @@ -0,0 +1,33 @@ +// Taken from https://github.com/rust-lang/rust/issues/44454#issuecomment-1332781290 + +use std::any::Any; + +trait Animal: 'static {} + +trait Projector { + type Foo; +} + +impl Projector for dyn Animal { + type Foo = X; +} + +fn make_static<'a, T>(t: &'a T) -> &'static T { + let x: as Projector>::Foo = t; + let any = generic::, &'a T>(x); + //~^ ERROR: lifetime may not live long enough + any.downcast_ref::<&'static T>().unwrap() +} + +fn generic + ?Sized, U>(x: ::Foo) -> Box { + make_static_any(x) +} + +fn make_static_any(u: U) -> Box { + Box::new(u) +} + +fn main() { + let a = make_static(&"salut".to_string()); + println!("{}", *a); +} diff --git a/src/test/ui/traits/object/issue-44454-3.stderr b/src/test/ui/traits/object/issue-44454-3.stderr new file mode 100644 index 0000000000000..294684d26bdfc --- /dev/null +++ b/src/test/ui/traits/object/issue-44454-3.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-44454-3.rs:17:15 + | +LL | fn make_static<'a, T>(t: &'a T) -> &'static T { + | -- lifetime `'a` defined here +LL | let x: as Projector>::Foo = t; +LL | let any = generic::, &'a T>(x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to previous error +