Auto merge of #105554 - matthiaskrgr:rollup-ir60gc7, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #105411 (Introduce `with_forced_trimmed_paths`)
 - #105532 (Document behaviour of `--remap-path-prefix` with several matches)
 - #105537 (compiler: remove unnecessary imports and qualified paths)
 - #105539 (rustdoc: Only hide lines starting with `#` in rust code blocks )
 - #105546 (Add some regression tests for #44454)
 - #105547 (Add regression test for #104582)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-12-11 09:01:37 +00:00
commit f34356eace
126 changed files with 438 additions and 220 deletions

View File

@ -1,6 +1,5 @@
#![cfg_attr(feature = "nightly", feature(step_trait, rustc_attrs, min_specialization))] #![cfg_attr(feature = "nightly", feature(step_trait, rustc_attrs, min_specialization))]
use std::convert::{TryFrom, TryInto};
use std::fmt; use std::fmt;
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
use std::iter::Step; use std::iter::Step;

View File

@ -2,7 +2,6 @@ use crate::{Category, ExpInt, IEK_INF, IEK_NAN, IEK_ZERO};
use crate::{Float, FloatConvert, ParseError, Round, Status, StatusAnd}; use crate::{Float, FloatConvert, ParseError, Round, Status, StatusAnd};
use core::cmp::{self, Ordering}; use core::cmp::{self, Ordering};
use core::convert::TryFrom;
use core::fmt::{self, Write}; use core::fmt::{self, Write};
use core::marker::PhantomData; use core::marker::PhantomData;
use core::mem; use core::mem;

View File

@ -28,7 +28,7 @@ use smallvec::SmallVec;
use std::alloc::Layout; use std::alloc::Layout;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::cmp; use std::cmp;
use std::marker::{PhantomData, Send}; use std::marker::PhantomData;
use std::mem::{self, MaybeUninit}; use std::mem::{self, MaybeUninit};
use std::ptr::{self, NonNull}; use std::ptr::{self, NonNull};
use std::slice; use std::slice;

View File

@ -33,7 +33,6 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
use rustc_span::source_map::{respan, Spanned}; use rustc_span::source_map::{respan, Spanned};
use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{Span, DUMMY_SP}; use rustc_span::{Span, DUMMY_SP};
use std::convert::TryFrom;
use std::fmt; use std::fmt;
use std::mem; use std::mem;
use thin_vec::{thin_vec, ThinVec}; use thin_vec::{thin_vec, ThinVec};

View File

@ -22,7 +22,6 @@
//! Moreover, a switch to, e.g., `P<'a, T>` would be easy and mostly automated. //! Moreover, a switch to, e.g., `P<'a, T>` would be easy and mostly automated.
use std::fmt::{self, Debug, Display}; use std::fmt::{self, Debug, Display};
use std::iter::FromIterator;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use std::{slice, vec}; use std::{slice, vec};

View File

@ -362,7 +362,7 @@ impl TokenStream {
} }
} }
impl iter::FromIterator<TokenTree> for TokenStream { impl FromIterator<TokenTree> for TokenStream {
fn from_iter<I: IntoIterator<Item = TokenTree>>(iter: I) -> Self { fn from_iter<I: IntoIterator<Item = TokenTree>>(iter: I) -> Self {
TokenStream::new(iter.into_iter().collect::<Vec<TokenTree>>()) TokenStream::new(iter.into_iter().collect::<Vec<TokenTree>>())
} }

View File

@ -456,8 +456,8 @@ pub fn lower_to_hir<'hir>(tcx: TyCtxt<'hir>, (): ()) -> hir::Crate<'hir> {
} }
// Drop AST to free memory // Drop AST to free memory
std::mem::drop(ast_index); drop(ast_index);
sess.time("drop_ast", || std::mem::drop(krate)); sess.time("drop_ast", || drop(krate));
// Discard hygiene data, which isn't required after lowering to HIR. // Discard hygiene data, which isn't required after lowering to HIR.
if !sess.opts.unstable_opts.keep_hygiene_data { if !sess.opts.unstable_opts.keep_hygiene_data {

View File

@ -4,8 +4,6 @@ use rustc_expand::base::{self, DummyResult};
use rustc_session::errors::report_lit_error; use rustc_session::errors::report_lit_error;
use rustc_span::symbol::Symbol; use rustc_span::symbol::Symbol;
use std::string::String;
pub fn expand_concat( pub fn expand_concat(
cx: &mut base::ExtCtxt<'_>, cx: &mut base::ExtCtxt<'_>,
sp: rustc_span::Span, sp: rustc_span::Span,

View File

@ -41,7 +41,6 @@ use rustc_span::{DebuggerVisualizerFile, DebuggerVisualizerType};
use rustc_target::abi::{Align, Size, VariantIdx}; use rustc_target::abi::{Align, Size, VariantIdx};
use std::collections::BTreeSet; use std::collections::BTreeSet;
use std::convert::TryFrom;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use itertools::Itertools; use itertools::Itertools;

View File

@ -1,5 +1,4 @@
use std::borrow::Cow; use std::borrow::Cow;
use std::convert::TryInto;
use either::{Left, Right}; use either::{Left, Right};

View File

@ -1,5 +1,4 @@
use std::assert_matches::assert_matches; use std::assert_matches::assert_matches;
use std::convert::TryFrom;
use rustc_apfloat::ieee::{Double, Single}; use rustc_apfloat::ieee::{Double, Single};
use rustc_apfloat::{Float, FloatConvert}; use rustc_apfloat::{Float, FloatConvert};

View File

@ -2,8 +2,6 @@
//! looking at their MIR. Intrinsics/functions supported here are shared by CTFE //! looking at their MIR. Intrinsics/functions supported here are shared by CTFE
//! and miri. //! and miri.
use std::convert::TryFrom;
use rustc_hir::def_id::DefId; use rustc_hir::def_id::DefId;
use rustc_middle::mir::{ use rustc_middle::mir::{
self, self,

View File

@ -1,5 +1,3 @@
use std::convert::TryFrom;
use rustc_ast::Mutability; use rustc_ast::Mutability;
use rustc_hir::lang_items::LangItem; use rustc_hir::lang_items::LangItem;
use rustc_middle::mir::TerminatorKind; use rustc_middle::mir::TerminatorKind;

View File

@ -1,5 +1,3 @@
use std::convert::TryFrom;
use rustc_apfloat::Float; use rustc_apfloat::Float;
use rustc_middle::mir; use rustc_middle::mir;
use rustc_middle::mir::interpret::{InterpResult, Scalar}; use rustc_middle::mir::interpret::{InterpResult, Scalar};

View File

@ -1,6 +1,5 @@
use rustc_middle::mir::interpret::InterpResult; use rustc_middle::mir::interpret::InterpResult;
use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor}; use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor};
use std::convert::TryInto;
use std::ops::ControlFlow; use std::ops::ControlFlow;
/// Checks whether a type contains generic parameters which require substitution. /// Checks whether a type contains generic parameters which require substitution.

View File

@ -4,7 +4,6 @@
//! That's useful because it means other passes (e.g. promotion) can rely on `const`s //! That's useful because it means other passes (e.g. promotion) can rely on `const`s
//! to be const-safe. //! to be const-safe.
use std::convert::TryFrom;
use std::fmt::{Display, Write}; use std::fmt::{Display, Write};
use std::num::NonZeroUsize; use std::num::NonZeroUsize;

View File

@ -3,7 +3,6 @@ use rustc_middle::mir::*;
use rustc_middle::ty::{Ty, TyCtxt}; use rustc_middle::ty::{Ty, TyCtxt};
use rustc_target::abi::VariantIdx; use rustc_target::abi::VariantIdx;
use std::convert::TryFrom;
use std::iter::TrustedLen; use std::iter::TrustedLen;
/// Expand `lhs = Rvalue::Aggregate(kind, operands)` into assignments to the fields. /// Expand `lhs = Rvalue::Aggregate(kind, operands)` into assignments to the fields.

View File

@ -1,6 +1,5 @@
use crate::stable_hasher; use crate::stable_hasher;
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
use std::convert::TryInto;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
#[cfg(test)] #[cfg(test)]

View File

@ -9,7 +9,6 @@ use crate::fx::FxHashSet;
use crate::graph::vec_graph::VecGraph; use crate::graph::vec_graph::VecGraph;
use crate::graph::{DirectedGraph, GraphSuccessors, WithNumEdges, WithNumNodes, WithSuccessors}; use crate::graph::{DirectedGraph, GraphSuccessors, WithNumEdges, WithNumNodes, WithSuccessors};
use rustc_index::vec::{Idx, IndexVec}; use rustc_index::vec::{Idx, IndexVec};
use std::cmp::Ord;
use std::ops::Range; use std::ops::Range;
#[cfg(test)] #[cfg(test)]

View File

@ -1,5 +1,3 @@
use std::cmp::Ord;
use crate::graph::{DirectedGraph, GraphSuccessors, WithNumEdges, WithNumNodes, WithSuccessors}; use crate::graph::{DirectedGraph, GraphSuccessors, WithNumEdges, WithNumNodes, WithSuccessors};
use rustc_index::vec::{Idx, IndexVec}; use rustc_index::vec::{Idx, IndexVec};

View File

@ -867,11 +867,9 @@ where
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
use std::borrow::Borrow; use std::borrow::Borrow;
use std::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd}; use std::cmp::Ordering;
use std::convert::From;
use std::fmt::{self, Debug}; use std::fmt::{self, Debug};
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::marker::{Send, Sync};
impl<O, T: ?Sized> Deref for OwningRef<O, T> { impl<O, T: ?Sized> Deref for OwningRef<O, T> {
type Target = T; type Target = T;
@ -1096,7 +1094,6 @@ where
// std types integration and convenience type defs // std types integration and convenience type defs
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
use std::boxed::Box;
use std::cell::{Ref, RefCell, RefMut}; use std::cell::{Ref, RefCell, RefMut};
use std::rc::Rc; use std::rc::Rc;
use std::sync::Arc; use std::sync::Arc;

View File

@ -3,7 +3,7 @@
mod owning_ref { mod owning_ref {
use super::super::OwningRef; use super::super::OwningRef;
use super::super::{BoxRef, Erased, ErasedBoxRef, RcRef}; 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::hash_map::DefaultHasher;
use std::collections::HashMap; use std::collections::HashMap;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
@ -368,7 +368,7 @@ mod owning_handle {
mod owning_ref_mut { mod owning_ref_mut {
use super::super::BoxRef; use super::super::BoxRef;
use super::super::{BoxRefMut, Erased, ErasedBoxRefMut, OwningRefMut}; 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::hash_map::DefaultHasher;
use std::collections::HashMap; use std::collections::HashMap;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};

View File

@ -86,7 +86,6 @@ use crate::fx::FxHashMap;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::collections::hash_map::Entry; use std::collections::hash_map::Entry;
use std::convert::Into;
use std::error::Error; use std::error::Error;
use std::fs; use std::fs;
use std::path::Path; use std::path::Path;

View File

@ -1,7 +1,6 @@
use crate::stable_hasher::{HashStable, StableHasher, StableOrd}; use crate::stable_hasher::{HashStable, StableHasher, StableOrd};
use std::borrow::Borrow; use std::borrow::Borrow;
use std::cmp::Ordering; use std::cmp::Ordering;
use std::iter::FromIterator;
use std::mem; use std::mem;
use std::ops::{Bound, Index, IndexMut, RangeBounds}; use std::ops::{Bound, Index, IndexMut, RangeBounds};

View File

@ -1,7 +1,6 @@
//! A variant of `SortedMap` that preserves insertion order. //! A variant of `SortedMap` that preserves insertion order.
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::iter::FromIterator;
use crate::stable_hasher::{HashStable, StableHasher}; use crate::stable_hasher::{HashStable, StableHasher};
use rustc_index::vec::{Idx, IndexVec}; use rustc_index::vec::{Idx, IndexVec};

View File

@ -1,7 +1,5 @@
use std::fmt; use std::fmt;
use std::iter::ExactSizeIterator;
use std::iter::FusedIterator; use std::iter::FusedIterator;
use std::iter::Iterator;
/// Iterator which may contain instance of /// Iterator which may contain instance of
/// one of two specific implementations. /// one of two specific implementations.

View File

@ -3,7 +3,6 @@ use crate::fx::FxHashMap;
use arrayvec::ArrayVec; use arrayvec::ArrayVec;
use std::fmt; use std::fmt;
use std::hash::Hash; use std::hash::Hash;
use std::iter::FromIterator;
use std::ops::Index; use std::ops::Index;
// For pointer-sized arguments arrays // For pointer-sized arguments arrays

View File

@ -1,6 +1,5 @@
use std::fmt; use std::fmt;
use std::hash::Hash; use std::hash::Hash;
use std::iter::FromIterator;
use super::map::SsoHashMap; use super::map::SsoHashMap;

View File

@ -138,7 +138,7 @@ cfg_if! {
} }
} }
pub use std::iter::Iterator as ParallelIterator; pub use Iterator as ParallelIterator;
pub fn par_iter<T: IntoIterator>(t: T) -> T::IntoIter { pub fn par_iter<T: IntoIterator>(t: T) -> T::IntoIter {
t.into_iter() t.into_iter()

View File

@ -76,7 +76,7 @@ where
fn drop(&mut self) { fn drop(&mut self) {
// No need to drop the tag, as it's Copy // No need to drop the tag, as it's Copy
unsafe { unsafe {
std::mem::drop(P::from_usize(self.raw.pointer_raw())); drop(P::from_usize(self.raw.pointer_raw()));
} }
} }
} }

View File

@ -1,6 +1,5 @@
use std::borrow::Borrow; use std::borrow::Borrow;
use std::fmt::Debug; use std::fmt::Debug;
use std::iter::FromIterator;
use std::slice::Iter; use std::slice::Iter;
use std::vec::IntoIter; use std::vec::IntoIter;

View File

@ -45,7 +45,6 @@ use rustc_target::json::ToJson;
use std::borrow::Cow; use std::borrow::Cow;
use std::cmp::max; use std::cmp::max;
use std::default::Default;
use std::env; use std::env;
use std::ffi::OsString; use std::ffi::OsString;
use std::fs; use std::fs;

View File

@ -55,7 +55,6 @@ wrapper:
``` ```
use std::cell::Cell; use std::cell::Cell;
use std::marker::Sync;
struct NotThreadSafe<T> { struct NotThreadSafe<T> {
value: Cell<T>, value: Cell<T>,

View File

@ -59,7 +59,7 @@ into_diagnostic_arg_using_display!(
i128, i128,
u128, u128,
std::io::Error, std::io::Error,
std::boxed::Box<dyn std::error::Error>, Box<dyn std::error::Error>,
std::num::NonZeroU32, std::num::NonZeroU32,
hir::Target, hir::Target,
Edition, Edition,

View File

@ -34,7 +34,6 @@ use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{BytePos, FileName, RealFileName, Span, DUMMY_SP}; use rustc_span::{BytePos, FileName, RealFileName, Span, DUMMY_SP};
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};
use std::default::Default;
use std::iter; use std::iter;
use std::path::PathBuf; use std::path::PathBuf;
use std::rc::Rc; use std::rc::Rc;

View File

@ -6,7 +6,7 @@ use rustc_span::hygiene::DesugaringKind;
use rustc_span::symbol::Ident; use rustc_span::symbol::Ident;
use rustc_span::Span; use rustc_span::Span;
use std::iter::{Enumerate, ExactSizeIterator}; use std::iter::Enumerate;
pub struct EnumerateAndAdjust<I> { pub struct EnumerateAndAdjust<I> {
enumerate: Enumerate<I>, enumerate: Enumerate<I>,

View File

@ -31,7 +31,6 @@ use rustc_trait_selection::traits::{
}; };
use std::cell::LazyCell; use std::cell::LazyCell;
use std::convert::TryInto;
use std::iter; use std::iter;
use std::ops::{ControlFlow, Deref}; use std::ops::{ControlFlow, Deref};

View File

@ -30,8 +30,6 @@ use rustc_middle::hir::nested_filter;
use rustc_middle::ty::TyCtxt; use rustc_middle::ty::TyCtxt;
use rustc_span::symbol::{sym, Symbol}; use rustc_span::symbol::{sym, Symbol};
use rustc_span::Span; use rustc_span::Span;
use std::iter::FromIterator;
use std::vec::Vec;
const LOADED_FROM_DISK: Symbol = sym::loaded_from_disk; const LOADED_FROM_DISK: Symbol = sym::loaded_from_disk;
const EXCEPT: Symbol = sym::except; const EXCEPT: Symbol = sym::except;

View File

@ -113,7 +113,6 @@ use rustc_span::Symbol;
use std::fs as std_fs; use std::fs as std_fs;
use std::io::{self, ErrorKind}; use std::io::{self, ErrorKind};
use std::mem;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::time::{Duration, SystemTime, UNIX_EPOCH}; 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); 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, // Let's make it explicit that the file lock is released at this point,
// or rather, that we held on to it until here // or rather, that we held on to it until here
mem::drop(lock); drop(lock);
} }
Err(_) => { Err(_) => {
debug!( 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, // Let's make it explicit that the file lock is released at this point,
// or rather, that we held on to it until here // or rather, that we held on to it until here
mem::drop(lock); drop(lock);
} }
Ok(()) Ok(())

View File

@ -4,7 +4,6 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
use std::fmt; use std::fmt;
use std::fmt::Debug; use std::fmt::Debug;
use std::hash::Hash; use std::hash::Hash;
use std::iter::FromIterator;
use std::marker::PhantomData; use std::marker::PhantomData;
use std::ops::{Index, IndexMut, RangeBounds}; use std::ops::{Index, IndexMut, RangeBounds};
use std::slice; use std::slice;

View File

@ -25,7 +25,6 @@ use rustc_target::spec::{CodeModel, LinkerFlavorCli, MergeFunctions, PanicStrate
use rustc_target::spec::{RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, TlsModel}; use rustc_target::spec::{RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, TlsModel};
use std::collections::{BTreeMap, BTreeSet}; use std::collections::{BTreeMap, BTreeSet};
use std::iter::FromIterator;
use std::num::NonZeroUsize; use std::num::NonZeroUsize;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};

View File

@ -34,7 +34,6 @@ pub use crate::cursor::Cursor;
use self::LiteralKind::*; use self::LiteralKind::*;
use self::TokenKind::*; use self::TokenKind::*;
use crate::cursor::EOF_CHAR; use crate::cursor::EOF_CHAR;
use std::convert::TryFrom;
/// Parsed token. /// Parsed token.
/// It doesn't contain information about data that has been parsed, /// It doesn't contain information about data that has been parsed,

View File

@ -16,7 +16,6 @@ use rustc_target::abi::{Abi, Size, WrappingRange};
use rustc_target::abi::{Integer, TagEncoding, Variants}; use rustc_target::abi::{Integer, TagEncoding, Variants};
use rustc_target::spec::abi::Abi as SpecAbi; use rustc_target::spec::abi::Abi as SpecAbi;
use std::cmp;
use std::iter; use std::iter;
use std::ops::ControlFlow; use std::ops::ControlFlow;
@ -531,7 +530,7 @@ impl<'tcx> LateLintPass<'tcx> for TypeLimits {
_ => {} _ => {}
}; };
fn is_valid<T: cmp::PartialOrd>(binop: hir::BinOp, v: T, min: T, max: T) -> bool { fn is_valid<T: PartialOrd>(binop: hir::BinOp, v: T, min: T, max: T) -> bool {
match binop.node { match binop.node {
hir::BinOpKind::Lt => v > min && v <= max, hir::BinOpKind::Lt => v > min && v <= max,
hir::BinOpKind::Le => v >= min && v < max, hir::BinOpKind::Le => v >= min && v < max,

View File

@ -7,7 +7,6 @@ use rustc_middle::ty::ParameterizedOverTcx;
use rustc_serialize::opaque::FileEncoder; use rustc_serialize::opaque::FileEncoder;
use rustc_serialize::Encoder as _; use rustc_serialize::Encoder as _;
use rustc_span::hygiene::MacroKind; use rustc_span::hygiene::MacroKind;
use std::convert::TryInto;
use std::marker::PhantomData; use std::marker::PhantomData;
use std::num::NonZeroUsize; use std::num::NonZeroUsize;

View File

@ -3,7 +3,6 @@
use rustc_macros::HashStable; use rustc_macros::HashStable;
use rustc_span::Symbol; use rustc_span::Symbol;
use std::cmp::Ord;
use std::fmt::{self, Debug, Formatter}; use std::fmt::{self, Debug, Formatter};
rustc_index::newtype_index! { rustc_index::newtype_index! {

View File

@ -95,7 +95,6 @@ mod pointer;
mod queries; mod queries;
mod value; mod value;
use std::convert::TryFrom;
use std::fmt; use std::fmt;
use std::io; use std::io;
use std::io::{Read, Write}; use std::io::{Read, Write};

View File

@ -3,7 +3,6 @@ use super::{AllocId, InterpResult};
use rustc_macros::HashStable; use rustc_macros::HashStable;
use rustc_target::abi::{HasDataLayout, Size}; use rustc_target::abi::{HasDataLayout, Size};
use std::convert::{TryFrom, TryInto};
use std::fmt; use std::fmt;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -1,4 +1,3 @@
use std::convert::{TryFrom, TryInto};
use std::fmt; use std::fmt;
use either::{Either, Left, Right}; use either::{Either, Left, Right};

View File

@ -36,7 +36,6 @@ use rustc_span::{Span, DUMMY_SP};
use either::Either; use either::Either;
use std::borrow::Cow; use std::borrow::Cow;
use std::convert::TryInto;
use std::fmt::{self, Debug, Display, Formatter, Write}; use std::fmt::{self, Debug, Display, Formatter, Write};
use std::ops::{ControlFlow, Index, IndexMut}; use std::ops::{ControlFlow, Index, IndexMut};
use std::{iter, mem}; use std::{iter, mem};

View File

@ -12,7 +12,6 @@ use crate::ty::subst::{GenericArg, SubstsRef};
use crate::ty::{self, Ty, TyCtxt}; use crate::ty::{self, Ty, TyCtxt};
use rustc_hir::def_id::DefId; use rustc_hir::def_id::DefId;
use rustc_span::source_map::Span; use rustc_span::source_map::Span;
use std::iter::FromIterator;
pub mod type_op { pub mod type_op {
use crate::ty::fold::TypeFoldable; use crate::ty::fold::TypeFoldable;

View File

@ -2,7 +2,6 @@ use rustc_apfloat::ieee::{Double, Single};
use rustc_apfloat::Float; use rustc_apfloat::Float;
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
use rustc_target::abi::Size; use rustc_target::abi::Size;
use std::convert::{TryFrom, TryInto};
use std::fmt; use std::fmt;
use std::num::NonZeroU8; use std::num::NonZeroU8;

View File

@ -1,5 +1,3 @@
use std::convert::TryInto;
use super::Const; use super::Const;
use crate::mir; use crate::mir;
use crate::mir::interpret::{AllocId, ConstValue, Scalar}; use crate::mir::interpret::{AllocId, ConstValue, Scalar};

View File

@ -1,6 +1,6 @@
use crate::traits::{ObligationCause, ObligationCauseCode}; use crate::traits::{ObligationCause, ObligationCauseCode};
use crate::ty::diagnostics::suggest_constraining_type_param; 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 crate::ty::{self, BoundRegionKind, Region, Ty, TyCtxt};
use hir::def::DefKind; use hir::def::DefKind;
use rustc_errors::Applicability::{MachineApplicable, MaybeIncorrect}; 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"), RegionsPlaceholderMismatch => write!(f, "one type is more general than the other"),
ArgumentSorts(values, _) | Sorts(values) => ty::tls::with(|tcx| { ArgumentSorts(values, _) | Sorts(values) => ty::tls::with(|tcx| {
report_maybe_different( let (mut expected, mut found) = with_forced_trimmed_paths!((
f, values.expected.sort_string(tcx),
&values.expected.sort_string(tcx), values.found.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| { 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( report_maybe_different(
f, f,
&format!("trait `{}`", tcx.def_path_str(values.expected)), &format!("trait `{expected}`"),
&format!("trait `{}`", tcx.def_path_str(values.found)), &format!("trait `{found}`"),
) )
}), }),
IntMismatch(ref values) => { IntMismatch(ref values) => {
@ -999,14 +1011,16 @@ fn foo(&self) -> Self::T { String::new() }
let mut short; let mut short;
loop { loop {
// Look for the longest properly trimmed path that still fits in lenght_limit. // Look for the longest properly trimmed path that still fits in lenght_limit.
short = FmtPrinter::new_with_limit( short = with_forced_trimmed_paths!(
FmtPrinter::new_with_limit(
self, self,
hir::def::Namespace::TypeNS, hir::def::Namespace::TypeNS,
rustc_session::Limit(type_limit), rustc_session::Limit(type_limit),
) )
.pretty_print_type(ty) .pretty_print_type(ty)
.expect("could not write to `String`") .expect("could not write to `String`")
.into_buffer(); .into_buffer()
);
if short.len() <= length_limit || type_limit == 0 { if short.len() <= length_limit || type_limit == 0 {
break; break;
} }

View File

@ -10,7 +10,7 @@ use rustc_data_structures::sso::SsoHashSet;
use rustc_hir as hir; use rustc_hir as hir;
use rustc_hir::def::{self, CtorKind, DefKind, Namespace}; use rustc_hir::def::{self, CtorKind, DefKind, Namespace};
use rustc_hir::def_id::{DefId, DefIdSet, CRATE_DEF_ID, LOCAL_CRATE}; 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_hir::LangItem;
use rustc_session::config::TrimmedDefPaths; use rustc_session::config::TrimmedDefPaths;
use rustc_session::cstore::{ExternCrate, ExternCrateSource}; use rustc_session::cstore::{ExternCrate, ExternCrateSource};
@ -23,7 +23,6 @@ use smallvec::SmallVec;
use std::cell::Cell; use std::cell::Cell;
use std::char; use std::char;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::convert::TryFrom;
use std::fmt::{self, Write as _}; use std::fmt::{self, Write as _};
use std::iter; use std::iter;
use std::ops::{ControlFlow, Deref, DerefMut}; use std::ops::{ControlFlow, Deref, DerefMut};
@ -63,6 +62,7 @@ thread_local! {
static FORCE_IMPL_FILENAME_LINE: Cell<bool> = const { Cell::new(false) }; static FORCE_IMPL_FILENAME_LINE: Cell<bool> = const { Cell::new(false) };
static SHOULD_PREFIX_WITH_CRATE: Cell<bool> = const { Cell::new(false) }; static SHOULD_PREFIX_WITH_CRATE: Cell<bool> = const { Cell::new(false) };
static NO_TRIMMED_PATH: Cell<bool> = const { Cell::new(false) }; static NO_TRIMMED_PATH: Cell<bool> = const { Cell::new(false) };
static FORCE_TRIMMED_PATH: Cell<bool> = const { Cell::new(false) };
static NO_QUERIES: Cell<bool> = const { Cell::new(false) }; static NO_QUERIES: Cell<bool> = const { Cell::new(false) };
static NO_VISIBLE_PATH: Cell<bool> = const { Cell::new(false) }; static NO_VISIBLE_PATH: Cell<bool> = const { Cell::new(false) };
} }
@ -116,6 +116,7 @@ define_helper!(
/// of various rustc types, for example `std::vec::Vec` would be trimmed to `Vec`, /// of various rustc types, for example `std::vec::Vec` would be trimmed to `Vec`,
/// if no other `Vec` is found. /// if no other `Vec` is found.
fn with_no_trimmed_paths(NoTrimmedGuard, NO_TRIMMED_PATH); 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 /// Prevent selection of visible paths. `Display` impl of DefId will prefer
/// visible (public) reexports of types as paths. /// visible (public) reexports of types as paths.
fn with_no_visible_paths(NoVisibleGuard, NO_VISIBLE_PATH); fn with_no_visible_paths(NoVisibleGuard, NO_VISIBLE_PATH);
@ -295,11 +296,89 @@ pub trait PrettyPrinter<'tcx>:
self.try_print_visible_def_path_recur(def_id, &mut callers) 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. /// Try to see if this path can be trimmed to a unique symbol name.
fn try_print_trimmed_def_path( fn try_print_trimmed_def_path(
mut self, mut self,
def_id: DefId, def_id: DefId,
) -> Result<(Self::Path, bool), Self::Error> { ) -> 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 if !self.tcx().sess.opts.unstable_opts.trim_diagnostic_paths
|| matches!(self.tcx().sess.opts.trimmed_def_paths, TrimmedDefPaths::Never) || matches!(self.tcx().sess.opts.trimmed_def_paths, TrimmedDefPaths::Never)
|| NO_TRIMMED_PATH.with(|flag| flag.get()) || NO_TRIMMED_PATH.with(|flag| flag.get())

View File

@ -1,4 +1,3 @@
use std::convert::TryFrom;
use std::fmt; use std::fmt;
use crate::mir::interpret::{alloc_range, AllocId, Allocation, Pointer, Scalar}; use crate::mir::interpret::{alloc_range, AllocId, Allocation, Pointer, Scalar};

View File

@ -30,7 +30,6 @@ mod test;
mod util; mod util;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::convert::TryFrom;
use std::mem; use std::mem;
impl<'a, 'tcx> Builder<'a, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {

View File

@ -7,7 +7,6 @@ use rustc_middle::thir::*;
use rustc_middle::ty; use rustc_middle::ty;
use rustc_middle::ty::TypeVisitable; use rustc_middle::ty::TypeVisitable;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::convert::TryInto;
impl<'a, 'tcx> Builder<'a, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
pub(crate) fn field_match_pairs<'pat>( pub(crate) fn field_match_pairs<'pat>(

View File

@ -45,7 +45,7 @@
use std::cell::Cell; use std::cell::Cell;
use std::cmp::{self, max, min, Ordering}; use std::cmp::{self, max, min, Ordering};
use std::fmt; use std::fmt;
use std::iter::{once, IntoIterator}; use std::iter::once;
use std::ops::RangeInclusive; use std::ops::RangeInclusive;
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};

View File

@ -26,7 +26,7 @@
//! ## `PartialOrd` //! ## `PartialOrd`
//! //!
//! Given that they represent partially ordered sets, you may be surprised that [`JoinSemiLattice`] //! 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 //! 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 //! 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 //! dataflow analysis, there's no need for a newtype wrapper with a custom `PartialOrd` impl. The

View File

@ -35,7 +35,6 @@ use rustc_middle::mir::visit::{MutVisitor, MutatingUseContext, PlaceContext, Vis
use rustc_middle::mir::*; use rustc_middle::mir::*;
use rustc_middle::ty::TyCtxt; use rustc_middle::ty::TyCtxt;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::convert::TryInto;
pub struct SimplifyCfg { pub struct SimplifyCfg {
label: String, label: String,

View File

@ -20,7 +20,6 @@ use rustc_middle::ty::{
Const, Ty, TyCtxt, Const, Ty, TyCtxt,
}; };
use rustc_span::symbol::sym; use rustc_span::symbol::sym;
use std::convert::TryInto;
use std::ops::ControlFlow; use std::ops::ControlFlow;
use crate::errors::UnusedGenericParams; use crate::errors::UnusedGenericParams;

View File

@ -6,7 +6,6 @@ use rustc_ast::attr;
use rustc_ast::token::{self, Delimiter, Nonterminal}; use rustc_ast::token::{self, Delimiter, Nonterminal};
use rustc_errors::{error_code, fluent, Diagnostic, IntoDiagnostic, PResult}; use rustc_errors::{error_code, fluent, Diagnostic, IntoDiagnostic, PResult};
use rustc_span::{sym, BytePos, Span}; use rustc_span::{sym, BytePos, Span};
use std::convert::TryInto;
// Public for rustfmt usage // Public for rustfmt usage
#[derive(Debug)] #[derive(Debug)]

View File

@ -8,7 +8,6 @@ use rustc_errors::PResult;
use rustc_session::parse::ParseSess; use rustc_session::parse::ParseSess;
use rustc_span::{sym, Span, DUMMY_SP}; use rustc_span::{sym, Span, DUMMY_SP};
use std::convert::TryInto;
use std::ops::Range; use std::ops::Range;
/// A wrapper type to ensure that the parser handles outer attributes correctly. /// A wrapper type to ensure that the parser handles outer attributes correctly.

View File

@ -21,7 +21,6 @@ use rustc_span::lev_distance::lev_distance;
use rustc_span::source_map::{self, Span}; use rustc_span::source_map::{self, Span};
use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::DUMMY_SP; use rustc_span::DUMMY_SP;
use std::convert::TryFrom;
use std::mem; use std::mem;
use thin_vec::ThinVec; use thin_vec::ThinVec;
use tracing::debug; use tracing::debug;

View File

@ -46,7 +46,7 @@ impl DepNodeIndex {
pub const FOREVER_RED_NODE: DepNodeIndex = DepNodeIndex::from_u32(1); pub const FOREVER_RED_NODE: DepNodeIndex = DepNodeIndex::from_u32(1);
} }
impl std::convert::From<DepNodeIndex> for QueryInvocationId { impl From<DepNodeIndex> for QueryInvocationId {
#[inline] #[inline]
fn from(dep_node_index: DepNodeIndex) -> Self { fn from(dep_node_index: DepNodeIndex) -> Self {
QueryInvocationId(dep_node_index.as_u32()) QueryInvocationId(dep_node_index.as_u32())

View File

@ -22,7 +22,6 @@ use rustc_index::vec::{Idx, IndexVec};
use rustc_serialize::opaque::{FileEncodeResult, FileEncoder, IntEncodedWithFixedSize, MemDecoder}; use rustc_serialize::opaque::{FileEncodeResult, FileEncoder, IntEncodedWithFixedSize, MemDecoder};
use rustc_serialize::{Decodable, Decoder, Encodable}; use rustc_serialize::{Decodable, Decoder, Encodable};
use smallvec::SmallVec; use smallvec::SmallVec;
use std::convert::TryInto;
// The maximum value of `SerializedDepNodeIndex` leaves the upper two bits // The maximum value of `SerializedDepNodeIndex` leaves the upper two bits
// unused so that we can store multiple index types in `CompressedHybridIndex`, // unused so that we can store multiple index types in `CompressedHybridIndex`,

View File

@ -9,7 +9,6 @@ use rustc_data_structures::sharded::Sharded;
use rustc_data_structures::sync::Lock; use rustc_data_structures::sync::Lock;
use rustc_data_structures::sync::WorkerLocal; use rustc_data_structures::sync::WorkerLocal;
use rustc_index::vec::{Idx, IndexVec}; use rustc_index::vec::{Idx, IndexVec};
use std::default::Default;
use std::fmt::Debug; use std::fmt::Debug;
use std::hash::Hash; use std::hash::Hash;
use std::marker::PhantomData; use std::marker::PhantomData;

View File

@ -22,8 +22,8 @@ use {
rustc_data_structures::{jobserver, OnDrop}, rustc_data_structures::{jobserver, OnDrop},
rustc_rayon_core as rayon_core, rustc_rayon_core as rayon_core,
rustc_span::DUMMY_SP, rustc_span::DUMMY_SP,
std::iter::{self, FromIterator}, std::iter,
std::{mem, process}, std::process,
}; };
/// Represents a span and a query key. /// Represents a span and a query key.
@ -247,7 +247,7 @@ impl QueryLatch {
jobserver::release_thread(); jobserver::release_thread();
waiter.condvar.wait(&mut info); waiter.condvar.wait(&mut info);
// Release the lock before we potentially block in `acquire_thread` // Release the lock before we potentially block in `acquire_thread`
mem::drop(info); drop(info);
jobserver::acquire_thread(); jobserver::acquire_thread();
} }
} }

View File

@ -36,7 +36,6 @@ use rustc_span::symbol::Ident;
use rustc_span::*; use rustc_span::*;
use std::cell::Cell; use std::cell::Cell;
use std::default::Default;
use std::env; use std::env;
use std::fs::File; use std::fs::File;
use std::io::BufWriter; use std::io::BufWriter;

View File

@ -1,6 +1,5 @@
use crate::leb128::{self, largest_max_leb128_len}; use crate::leb128::{self, largest_max_leb128_len};
use crate::serialize::{Decodable, Decoder, Encodable, Encoder}; use crate::serialize::{Decodable, Decoder, Encodable, Encoder};
use std::convert::TryInto;
use std::fs::File; use std::fs::File;
use std::io::{self, Write}; use std::io::{self, Write};
use std::mem::MaybeUninit; use std::mem::MaybeUninit;

View File

@ -32,7 +32,7 @@ use std::collections::btree_map::{
use std::collections::{BTreeMap, BTreeSet}; use std::collections::{BTreeMap, BTreeSet};
use std::fmt; use std::fmt;
use std::hash::Hash; use std::hash::Hash;
use std::iter::{self, FromIterator}; use std::iter;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::str::{self, FromStr}; use std::str::{self, FromStr};

View File

@ -3,7 +3,6 @@
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};
use std::env; use std::env;
use std::fs; use std::fs;
use std::iter::FromIterator;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use crate::search_paths::{PathKind, SearchPath}; use crate::search_paths::{PathKind, SearchPath};

View File

@ -15,11 +15,10 @@ pub use crate::*;
use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::StableHasher; use rustc_data_structures::stable_hasher::StableHasher;
use rustc_data_structures::sync::{AtomicU32, Lrc, MappedReadGuard, ReadGuard, RwLock}; use rustc_data_structures::sync::{AtomicU32, Lrc, MappedReadGuard, ReadGuard, RwLock};
use std::cmp;
use std::hash::Hash; use std::hash::Hash;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
use std::{clone::Clone, cmp};
use std::{convert::TryFrom, unreachable};
use std::fs; use std::fs;
use std::io; use std::io;

View File

@ -9,7 +9,6 @@ use rustc_data_structures::sync::Lock;
use rustc_macros::HashStable_Generic; use rustc_macros::HashStable_Generic;
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
use std::cmp::{Ord, PartialEq, PartialOrd};
use std::fmt; use std::fmt;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::str; use std::str;
@ -1974,7 +1973,6 @@ pub mod kw {
/// For example `sym::rustfmt` or `sym::u8`. /// For example `sym::rustfmt` or `sym::u8`.
pub mod sym { pub mod sym {
use super::Symbol; use super::Symbol;
use std::convert::TryInto;
#[doc(inline)] #[doc(inline)]
pub use super::sym_generated::*; pub use super::sym_generated::*;

View File

@ -18,7 +18,6 @@
#![deny(rustc::untranslatable_diagnostic)] #![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)] #![deny(rustc::diagnostic_outside_of_impl)]
use std::iter::FromIterator;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
#[macro_use] #[macro_use]

View File

@ -45,9 +45,7 @@ use rustc_span::symbol::{sym, Symbol};
use serde_json::Value; use serde_json::Value;
use std::borrow::Cow; use std::borrow::Cow;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::convert::TryFrom;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::iter::FromIterator;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::str::FromStr; use std::str::FromStr;

View File

@ -36,7 +36,7 @@ use std::fmt;
use super::InferCtxtPrivExt; use super::InferCtxtPrivExt;
use crate::infer::InferCtxtExt as _; use crate::infer::InferCtxtExt as _;
use crate::traits::query::evaluate_obligation::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)] #[derive(Debug)]
pub enum GeneratorInteriorOrUpvar { pub enum GeneratorInteriorOrUpvar {
@ -2412,6 +2412,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
ObligationCauseCode::BindingObligation(item_def_id, span) ObligationCauseCode::BindingObligation(item_def_id, span)
| ObligationCauseCode::ExprBindingObligation(item_def_id, span, ..) => { | ObligationCauseCode::ExprBindingObligation(item_def_id, span, ..) => {
let item_name = tcx.def_path_str(item_def_id); 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 mut multispan = MultiSpan::from(span);
let sm = tcx.sess.source_map(); let sm = tcx.sess.source_map();
if let Some(ident) = tcx.opt_item_ident(item_def_id) { 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"); 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) { 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); multispan.push_span_label(span, msg);
err.span_note(multispan, &descr); err.span_note(multispan, &descr);
} else { } else {

View File

@ -1,6 +1,6 @@
#![allow(rustc::usage_of_ty_tykind)] #![allow(rustc::usage_of_ty_tykind)]
use std::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd}; use std::cmp::Ordering;
use std::{fmt, hash}; use std::{fmt, hash};
use crate::DebruijnIndex; use crate::DebruijnIndex;

View File

@ -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 pathname syntax. For example `--remap-path-prefix foo=bar` will match
`foo/lib.rs` but not `./foo/lib.rs`. `foo/lib.rs` but not `./foo/lib.rs`.
When multiple remappings are given and several of them match, the **last**
matching one is applied.
<a id="option-json"></a> <a id="option-json"></a>
## `--json`: configure json messages printed by the compiler ## `--json`: configure json messages printed by the compiler

View File

@ -246,8 +246,6 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
_ => {} _ => {}
} }
} }
let lines = origtext.lines().filter_map(|l| map_line(l).for_html());
let text = lines.intersperse("\n".into()).collect::<String>();
let parse_result = match kind { let parse_result = match kind {
CodeBlockKind::Fenced(ref lang) => { CodeBlockKind::Fenced(ref lang) => {
@ -260,7 +258,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
<pre class=\"language-{}\"><code>{}</code></pre>\ <pre class=\"language-{}\"><code>{}</code></pre>\
</div>", </div>",
lang, lang,
Escape(&text), Escape(&origtext),
) )
.into(), .into(),
)); ));
@ -270,6 +268,9 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
CodeBlockKind::Indented => Default::default(), CodeBlockKind::Indented => Default::default(),
}; };
let lines = origtext.lines().filter_map(|l| map_line(l).for_html());
let text = lines.intersperse("\n".into()).collect::<String>();
compile_fail = parse_result.compile_fail; compile_fail = parse_result.compile_fail;
should_panic = parse_result.should_panic; should_panic = parse_result.should_panic;
ignore = parse_result.ignore; ignore = parse_result.ignore;

View File

@ -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]);
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
#..#.####.#....#.....##..
#..#.#....#....#....#..#.
####.###..#....#....#..#.
#..#.#....#....#....#..#.
#..#.#....#....#....#..#.
#..#.####.####.####..##..
```"#,
"<div class=\"example-wrap\"><pre class=\"language-ascii\"><code>\
#..#.####.#....#.....##..
#..#.#....#....#....#..#.
####.###..#....#....#..#.
#..#.#....#....#....#..#.
#..#.#....#....#....#..#.
#..#.####.####.####..##..
</code></pre></div>",
);
}

View File

@ -19,7 +19,7 @@ note: required by a bound in `a::bar`
--> $DIR/closure-return-type-must-be-sized.rs:14:19 --> $DIR/closure-return-type-must-be-sized.rs:14:19
| |
LL | pub fn bar<F: FnOnce() -> R, R: ?Sized>() {} LL | pub fn bar<F: FnOnce() -> 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 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 --> $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 --> $DIR/closure-return-type-must-be-sized.rs:28:19
| |
LL | pub fn bar<F: Fn() -> R, R: ?Sized>() {} LL | pub fn bar<F: Fn() -> 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 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 --> $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 --> $DIR/closure-return-type-must-be-sized.rs:42:19
| |
LL | pub fn bar<F: FnMut() -> R, R: ?Sized>() {} LL | pub fn bar<F: FnMut() -> 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 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 --> $DIR/closure-return-type-must-be-sized.rs:70:5

View File

@ -14,7 +14,7 @@ note: required by a bound in `use_trait_impl::assert_impl`
--> $DIR/abstract-const-as-cast-3.rs:14:23 --> $DIR/abstract-const-as-cast-3.rs:14:23
| |
LL | fn assert_impl<T: Trait>() {} LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `use_trait_impl::assert_impl` | ^^^^^ required by this bound in `assert_impl`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/abstract-const-as-cast-3.rs:17:5 --> $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 --> $DIR/abstract-const-as-cast-3.rs:14:23
| |
LL | fn assert_impl<T: Trait>() {} LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `use_trait_impl::assert_impl` | ^^^^^ required by this bound in `assert_impl`
error: unconstrained generic constant error: unconstrained generic constant
--> $DIR/abstract-const-as-cast-3.rs:20:19 --> $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 --> $DIR/abstract-const-as-cast-3.rs:14:23
| |
LL | fn assert_impl<T: Trait>() {} LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `use_trait_impl::assert_impl` | ^^^^^ required by this bound in `assert_impl`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/abstract-const-as-cast-3.rs:20:5 --> $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 --> $DIR/abstract-const-as-cast-3.rs:14:23
| |
LL | fn assert_impl<T: Trait>() {} LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `use_trait_impl::assert_impl` | ^^^^^ required by this bound in `assert_impl`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/abstract-const-as-cast-3.rs:23:5 --> $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 --> $DIR/abstract-const-as-cast-3.rs:14:23
| |
LL | fn assert_impl<T: Trait>() {} LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `use_trait_impl::assert_impl` | ^^^^^ required by this bound in `assert_impl`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/abstract-const-as-cast-3.rs:25:5 --> $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 --> $DIR/abstract-const-as-cast-3.rs:14:23
| |
LL | fn assert_impl<T: Trait>() {} LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `use_trait_impl::assert_impl` | ^^^^^ required by this bound in `assert_impl`
error: unconstrained generic constant error: unconstrained generic constant
--> $DIR/abstract-const-as-cast-3.rs:35:19 --> $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 --> $DIR/abstract-const-as-cast-3.rs:32:23
| |
LL | fn assert_impl<T: Trait>() {} LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` | ^^^^^ required by this bound in `assert_impl`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/abstract-const-as-cast-3.rs:35:5 --> $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 --> $DIR/abstract-const-as-cast-3.rs:32:23
| |
LL | fn assert_impl<T: Trait>() {} LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` | ^^^^^ required by this bound in `assert_impl`
error: unconstrained generic constant error: unconstrained generic constant
--> $DIR/abstract-const-as-cast-3.rs:38:19 --> $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 --> $DIR/abstract-const-as-cast-3.rs:32:23
| |
LL | fn assert_impl<T: Trait>() {} LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` | ^^^^^ required by this bound in `assert_impl`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/abstract-const-as-cast-3.rs:38:5 --> $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 --> $DIR/abstract-const-as-cast-3.rs:32:23
| |
LL | fn assert_impl<T: Trait>() {} LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` | ^^^^^ required by this bound in `assert_impl`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/abstract-const-as-cast-3.rs:41:5 --> $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 --> $DIR/abstract-const-as-cast-3.rs:32:23
| |
LL | fn assert_impl<T: Trait>() {} LL | fn assert_impl<T: Trait>() {}
| ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` | ^^^^^ required by this bound in `assert_impl`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/abstract-const-as-cast-3.rs:43:5 --> $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 --> $DIR/abstract-const-as-cast-3.rs:32:23
| |
LL | fn assert_impl<T: Trait>() {} LL | fn assert_impl<T: Trait>() {}
| ^^^^^ 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 error: aborting due to 12 previous errors

View File

@ -1,9 +1,20 @@
// compile-flags: --diagnostic-width=60 // compile-flags: --diagnostic-width=60
// normalize-stderr-test: "long-type-\d+" -> "long-type-hash" // normalize-stderr-test: "long-type-\d+" -> "long-type-hash"
struct Atype<T, K>(T, K); mod a {
struct Btype<T, K>(T, K); // Force the "short path for unique types" machinery to trip up
struct Ctype<T, K>(T, K); pub struct Atype;
pub struct Btype;
pub struct Ctype;
}
mod b {
pub struct Atype<T, K>(T, K);
pub struct Btype<T, K>(T, K);
pub struct Ctype<T, K>(T, K);
}
use b::*;
fn main() { fn main() {
let x: Atype< let x: Atype<

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/long-E0308.rs:33:9 --> $DIR/long-E0308.rs:44:9
| |
LL | let x: Atype< 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' 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 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... 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' 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 error[E0308]: mismatched types
--> $DIR/long-E0308.rs:77:9 --> $DIR/long-E0308.rs:88:9
| |
LL | let x: Atype< LL | let x: Atype<
| ____________- | ____________-
@ -59,7 +59,7 @@ LL | | > = ();
found unit type `()` found unit type `()`
error[E0308]: mismatched types 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... LL | let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O...
| ____________--___^ | ____________--___^

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/disambiguate-identical-names.rs:13:10 --> $DIR/disambiguate-identical-names.rs:13:10
| |
LL | test(&v); LL | test(&v);
| ---- ^^ expected struct `std::vec::Vec`, found struct `HashMap` | ---- ^^ expected struct `Vec`, found struct `HashMap`
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/no-implicit-dyn-star.rs:6:48 --> $DIR/no-implicit-dyn-star.rs:6:48
| |
LL | dyn_star_foreign::require_dyn_star_display(1usize); 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 | arguments to this function are incorrect
| |

View File

@ -8,7 +8,7 @@ note: required by a bound in `foo_defn::Foo::Bar`
--> $DIR/auxiliary/foo_defn.rs:4:15 --> $DIR/auxiliary/foo_defn.rs:4:15
| |
LL | type Bar: AsRef<()>; 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 error: aborting due to previous error

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | match [5..4, 99..105, 43..44] { LL | match [5..4, 99..105, 43..44] {
| ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]`
LL | [_, 99.., _] => {}, LL | [_, 99.., _] => {},
| ^^ expected struct `std::ops::Range`, found integer | ^^ expected struct `Range`, found integer
| |
= note: expected struct `std::ops::Range<{integer}>` = note: expected struct `std::ops::Range<{integer}>`
found type `{integer}` found type `{integer}`

View File

@ -10,7 +10,7 @@ error[E0308]: mismatched types
LL | match [5..4, 99..105, 43..44] { LL | match [5..4, 99..105, 43..44] {
| ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]`
LL | [_, 99..] => {}, LL | [_, 99..] => {},
| ^^ expected struct `std::ops::Range`, found integer | ^^ expected struct `Range`, found integer
| |
= note: expected struct `std::ops::Range<{integer}>` = note: expected struct `std::ops::Range<{integer}>`
found type `{integer}` found type `{integer}`

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | match [5..4, 99..105, 43..44] { LL | match [5..4, 99..105, 43..44] {
| ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]`
LL | [..9, 99..100, _] => {}, LL | [..9, 99..100, _] => {},
| ^ expected struct `std::ops::Range`, found integer | ^ expected struct `Range`, found integer
| |
= note: expected struct `std::ops::Range<{integer}>` = note: expected struct `std::ops::Range<{integer}>`
found type `{integer}` found type `{integer}`
@ -17,7 +17,7 @@ LL | match [5..4, 99..105, 43..44] {
LL | [..9, 99..100, _] => {}, LL | [..9, 99..100, _] => {},
| ^^ --- this is of type `{integer}` | ^^ --- this is of type `{integer}`
| | | |
| expected struct `std::ops::Range`, found integer | expected struct `Range`, found integer
| |
= note: expected struct `std::ops::Range<{integer}>` = note: expected struct `std::ops::Range<{integer}>`
found type `{integer}` found type `{integer}`
@ -28,7 +28,7 @@ error[E0308]: mismatched types
LL | match [5..4, 99..105, 43..44] { LL | match [5..4, 99..105, 43..44] {
| ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]`
LL | [..9, 99..100, _] => {}, LL | [..9, 99..100, _] => {},
| -- ^^^ expected struct `std::ops::Range`, found integer | -- ^^^ expected struct `Range`, found integer
| | | |
| this is of type `{integer}` | this is of type `{integer}`
| |

View File

@ -15,7 +15,7 @@ LL | type Foo = impl PartialEq<(Foo, i32)>;
LL | fn eq(&self, _other: &(Foo, i32)) -> bool { 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)` | help: change the parameter type to match the trait: `&(a::Bar, i32)`
| |
= note: expected fn pointer `fn(&a::Bar, &(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 { 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)` | help: change the parameter type to match the trait: `&(b::Foo, i32)`
| |
= note: expected fn pointer `fn(&b::Bar, &(b::Foo, i32)) -> _` = note: expected fn pointer `fn(&b::Bar, &(b::Foo, i32)) -> _`

View File

@ -11,7 +11,7 @@ note: required by a bound in `fold`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
| |
LL | F: FnMut(B, Self::Item) -> B, 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 error: aborting due to previous error

View File

@ -18,7 +18,7 @@ note: required by a bound in `cloned`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
| |
LL | Self: Sized + Iterator<Item = &'a T>, LL | Self: Sized + Iterator<Item = &'a T>,
| ^^^^^^^^^^^^ required by this bound in `cloned` | ^^^^^^^^^^^^ required by this bound in `Iterator::cloned`
error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>`, but its trait bounds were not satisfied error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>`, but its trait bounds were not satisfied
--> $DIR/issue-31173.rs:13:10 --> $DIR/issue-31173.rs:13:10

View File

@ -12,7 +12,7 @@ note: required by a bound in `cloned`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
| |
LL | Self: Sized + Iterator<Item = &'a T>, LL | Self: Sized + Iterator<Item = &'a T>,
| ^^^^^^^^^^^^ 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 `(&_, &_)` error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)`
--> $DIR/issue-33941.rs:6:14 --> $DIR/issue-33941.rs:6:14

View File

@ -26,7 +26,7 @@ note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
| |
LL | fn collect<B: FromIterator<Self::Item>>(self) -> B LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -12,7 +12,7 @@ note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
| |
LL | fn collect<B: FromIterator<Self::Item>>(self) -> B LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect`
error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64` error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64`
--> $DIR/issue-66923-show-error-for-correct-call.rs:12:14 --> $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 --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
| |
LL | fn collect<B: FromIterator<Self::Item>>(self) -> B LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -11,7 +11,7 @@ note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
| |
LL | fn collect<B: FromIterator<Self::Item>>(self) -> B LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect`
error: aborting due to previous error error: aborting due to previous error

View File

@ -19,7 +19,7 @@ note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
| |
LL | fn collect<B: FromIterator<Self::Item>>(self) -> B LL | fn collect<B: FromIterator<Self::Item>>(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 error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size
--> $DIR/collect-into-slice.rs:6:30 --> $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 --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
| |
LL | fn collect<B: FromIterator<Self::Item>>(self) -> B LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect`
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View File

@ -11,7 +11,7 @@ note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
| |
LL | fn collect<B: FromIterator<Self::Item>>(self) -> B LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect`
error: aborting due to previous error error: aborting due to previous error

Some files were not shown because too many files have changed in this diff Show More