1
Fork 0

Auto merge of #66141 - Centril:rollup-n2fcvp9, r=Centril

Rollup of 11 pull requests

Successful merges:

 - #65892 (Remove `PartialEq` and `Eq` from the `SpecialDerives`.)
 - #66014 (Show type parameter name and definition in type mismatch error messages )
 - #66027 (Move has_panic_handler to query)
 - #66054 (syntax: Avoid span arithmetic for delimiter tokens)
 - #66068 (use silent emitter for rustdoc highlighting pass)
 - #66081 (let caller of check_ptr_access_align control the error message)
 - #66093 (Do not ICE with a precision flag in formatting str and no format arguments)
 - #66098 (Detect `::` -> `:` typo when involving turbofish)
 - #66101 (Tweak type mismatch caused by break on tail expr)
 - #66106 (Fix typo in explanation of `E0080`)
 - #66115 (rustc: remove "GlobalMetaData" dead code from hir::map::definitions.)

Failed merges:

r? @ghost
This commit is contained in:
bors 2019-11-06 02:29:21 +00:00
commit e4931eaaa3
96 changed files with 453 additions and 466 deletions

View file

@ -335,7 +335,7 @@ This works because `Box` is a pointer, so its size is well-known.
"##,
E0080: r##"
This error indicates that the compiler was unable to sensibly evaluate an
This error indicates that the compiler was unable to sensibly evaluate a
constant expression that had to be evaluated. Attempting to divide by 0
or causing integer overflow are two ways to induce this error. For example:

View file

@ -65,7 +65,6 @@ use syntax::ast;
use syntax::ptr::P as AstP;
use syntax::ast::*;
use syntax::errors;
use syntax::expand::SpecialDerives;
use syntax::print::pprust;
use syntax::parse::token::{self, Nonterminal, Token};
use syntax::tokenstream::{TokenStream, TokenTree};
@ -184,8 +183,6 @@ pub trait Resolver {
ns: Namespace,
) -> (ast::Path, Res<NodeId>);
fn has_derives(&self, node_id: NodeId, derives: SpecialDerives) -> bool;
fn lint_buffer(&mut self) -> &mut lint::LintBuffer;
}

View file

@ -18,7 +18,6 @@ use smallvec::SmallVec;
use syntax::attr;
use syntax::ast::*;
use syntax::visit::{self, Visitor};
use syntax::expand::SpecialDerives;
use syntax::source_map::{respan, DesugaringKind, Spanned};
use syntax::symbol::{kw, sym};
use syntax_pos::Span;
@ -227,13 +226,7 @@ impl LoweringContext<'_> {
pub fn lower_item(&mut self, i: &Item) -> Option<hir::Item> {
let mut ident = i.ident;
let mut vis = self.lower_visibility(&i.vis, None);
let mut attrs = self.lower_attrs_extendable(&i.attrs);
if self.resolver.has_derives(i.id, SpecialDerives::PARTIAL_EQ | SpecialDerives::EQ) {
// Add `#[structural_match]` if the item derived both `PartialEq` and `Eq`.
let ident = Ident::new(sym::structural_match, i.span);
attrs.push(attr::mk_attr_outer(attr::mk_word_item(ident)));
}
let attrs = attrs.into();
let attrs = self.lower_attrs(&i.attrs);
if let ItemKind::MacroDef(ref def) = i.kind {
if !def.legacy || attr::contains_name(&i.attrs, sym::macro_export) {

View file

@ -19,7 +19,7 @@ use std::hash::Hash;
use syntax::ast;
use syntax_pos::symbol::{Symbol, sym};
use syntax_pos::hygiene::ExpnId;
use syntax_pos::{Span, DUMMY_SP};
use syntax_pos::Span;
/// The `DefPathTable` maps `DefIndex`es to `DefKey`s and vice versa.
/// Internally the `DefPathTable` holds a tree of `DefKey`s, where each `DefKey`
@ -310,10 +310,6 @@ pub enum DefPathData {
AnonConst,
/// An `impl Trait` type node.
ImplTrait,
/// Identifies a piece of crate metadata that is global to a whole crate
/// (as opposed to just one item). `GlobalMetaData` components are only
/// supposed to show up right below the crate root.
GlobalMetaData(Symbol),
}
#[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Debug,
@ -444,9 +440,6 @@ impl Definitions {
self.node_to_def_index.insert(ast::CRATE_NODE_ID, root_index);
self.set_invocation_parent(ExpnId::root(), root_index);
// Allocate some other `DefIndex`es that always must exist.
GlobalMetaDataKind::allocate_def_indices(self);
root_index
}
@ -553,8 +546,7 @@ impl DefPathData {
TypeNs(name) |
ValueNs(name) |
MacroNs(name) |
LifetimeNs(name) |
GlobalMetaData(name) => Some(name),
LifetimeNs(name) => Some(name),
Impl |
CrateRoot |
@ -572,8 +564,7 @@ impl DefPathData {
TypeNs(name) |
ValueNs(name) |
MacroNs(name) |
LifetimeNs(name) |
GlobalMetaData(name) => {
LifetimeNs(name) => {
name
}
// Note that this does not show up in user print-outs.
@ -591,78 +582,3 @@ impl DefPathData {
self.as_symbol().to_string()
}
}
// We define the `GlobalMetaDataKind` enum with this macro because we want to
// make sure that we exhaustively iterate over all variants when registering
// the corresponding `DefIndex`es in the `DefTable`.
macro_rules! define_global_metadata_kind {
(pub enum GlobalMetaDataKind {
$($variant:ident),*
}) => (
pub enum GlobalMetaDataKind {
$($variant),*
}
impl GlobalMetaDataKind {
fn allocate_def_indices(definitions: &mut Definitions) {
$({
let instance = GlobalMetaDataKind::$variant;
definitions.create_def_with_parent(
CRATE_DEF_INDEX,
ast::DUMMY_NODE_ID,
DefPathData::GlobalMetaData(instance.name()),
ExpnId::root(),
DUMMY_SP
);
// Make sure calling `def_index` does not crash.
instance.def_index(&definitions.table);
})*
}
pub fn def_index(&self, def_path_table: &DefPathTable) -> DefIndex {
let def_key = DefKey {
parent: Some(CRATE_DEF_INDEX),
disambiguated_data: DisambiguatedDefPathData {
data: DefPathData::GlobalMetaData(self.name()),
disambiguator: 0,
}
};
// These `DefKey`s are all right after the root,
// so a linear search is fine.
let index = def_path_table.index_to_key
.iter()
.position(|k| *k == def_key)
.unwrap();
DefIndex::from(index)
}
fn name(&self) -> Symbol {
let string = match *self {
$(
GlobalMetaDataKind::$variant => {
concat!("{{GlobalMetaData::", stringify!($variant), "}}")
}
)*
};
Symbol::intern(string)
}
}
)
}
define_global_metadata_kind!(pub enum GlobalMetaDataKind {
Krate,
CrateDeps,
DylibDependencyFormats,
LangItems,
LangItemsMissing,
NativeLibraries,
SourceMap,
Impls,
ExportedSymbols
});

View file

@ -1234,8 +1234,16 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
}
}
// In some (most?) cases cause.body_id points to actual body, but in some cases
// it's a actual definition. According to the comments (e.g. in
// librustc_typeck/check/compare_method.rs:compare_predicate_entailment) the latter
// is relied upon by some other code. This might (or might not) need cleanup.
let body_owner_def_id = self.tcx.hir().opt_local_def_id(cause.body_id)
.unwrap_or_else(|| {
self.tcx.hir().body_owner_def_id(hir::BodyId { hir_id: cause.body_id })
});
self.check_and_note_conflicting_crates(diag, terr, span);
self.tcx.note_and_explain_type_err(diag, terr, span);
self.tcx.note_and_explain_type_err(diag, terr, span, body_owner_def_id);
// It reads better to have the error origin as the final
// thing.

View file

@ -148,9 +148,6 @@ pub struct Session {
/// Metadata about the allocators for the current crate being compiled.
pub has_global_allocator: Once<bool>,
/// Metadata about the panic handlers for the current crate being compiled.
pub has_panic_handler: Once<bool>,
/// Cap lint level specified by a driver specifically.
pub driver_lint_caps: FxHashMap<lint::LintId, lint::Level>,
@ -1211,7 +1208,6 @@ fn build_session_(
print_fuel,
jobserver: jobserver::client(),
has_global_allocator: Once::new(),
has_panic_handler: Once::new(),
driver_lint_caps,
trait_methods_not_found: Lock::new(Default::default()),
confused_type_with_std_module: Lock::new(Default::default()),

View file

@ -1231,7 +1231,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
fn suggest_fn_call(
&self,
obligation: &PredicateObligation<'tcx>,
err: &mut DiagnosticBuilder<'tcx>,
err: &mut DiagnosticBuilder<'_>,
trait_ref: &ty::Binder<ty::TraitRef<'tcx>>,
points_at_arg: bool,
) {

View file

@ -3045,4 +3045,9 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
assert_eq!(cnum, LOCAL_CRATE);
attr::contains_name(tcx.hir().krate_attrs(), sym::compiler_builtins)
};
providers.has_panic_handler = |tcx, cnum| {
assert_eq!(cnum, LOCAL_CRATE);
// We want to check if the panic handler was defined in this crate
tcx.lang_items().panic_impl().map_or(false, |did| did.is_local())
};
}

View file

@ -241,7 +241,7 @@ impl<'tcx> ty::TyS<'tcx> {
ty::Infer(ty::FreshFloatTy(_)) => "fresh floating-point type".into(),
ty::Projection(_) => "associated type".into(),
ty::UnnormalizedProjection(_) => "non-normalized associated type".into(),
ty::Param(_) => "type parameter".into(),
ty::Param(p) => format!("type parameter `{}`", p).into(),
ty::Opaque(..) => "opaque type".into(),
ty::Error => "type error".into(),
}
@ -254,6 +254,7 @@ impl<'tcx> TyCtxt<'tcx> {
db: &mut DiagnosticBuilder<'_>,
err: &TypeError<'tcx>,
sp: Span,
body_owner_def_id: DefId,
) {
use self::TypeError::*;
@ -288,7 +289,16 @@ impl<'tcx> TyCtxt<'tcx> {
);
}
},
(ty::Param(_), ty::Param(_)) => {
(ty::Param(expected), ty::Param(found)) => {
let generics = self.generics_of(body_owner_def_id);
let e_span = self.def_span(generics.type_param(expected, self).def_id);
if !sp.contains(e_span) {
db.span_label(e_span, "expected type parameter");
}
let f_span = self.def_span(generics.type_param(found, self).def_id);
if !sp.contains(f_span) {
db.span_label(f_span, "found type parameter");
}
db.note("a type parameter was expected, but a different one was found; \
you might be missing a type parameter or trait bound");
db.note("for more information, visit \
@ -301,7 +311,12 @@ impl<'tcx> TyCtxt<'tcx> {
(ty::Param(_), ty::Projection(_)) | (ty::Projection(_), ty::Param(_)) => {
db.note("you might be missing a type parameter or trait bound");
}
(ty::Param(_), _) | (_, ty::Param(_)) => {
(ty::Param(p), _) | (_, ty::Param(p)) => {
let generics = self.generics_of(body_owner_def_id);
let p_span = self.def_span(generics.type_param(p, self).def_id);
if !sp.contains(p_span) {
db.span_label(p_span, "this type parameter");
}
db.help("type parameters must be constrained to match other types");
if self.sess.teach(&db.get_code().unwrap()) {
db.help("given a type parameter `T` and a method `foo`:

View file

@ -601,8 +601,7 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
| DefPathData::Misc
| DefPathData::Impl
| DefPathData::MacroNs(_)
| DefPathData::LifetimeNs(_)
| DefPathData::GlobalMetaData(_) => {
| DefPathData::LifetimeNs(_) => {
bug!("symbol_names: unexpected DefPathData: {:?}", disambiguated_data.data)
}
};

View file

@ -424,6 +424,14 @@ impl Emitter for EmitterWriter {
}
}
/// An emitter that does nothing when emitting a diagnostic.
pub struct SilentEmitter;
impl Emitter for SilentEmitter {
fn source_map(&self) -> Option<&Lrc<SourceMapperDyn>> { None }
fn emit_diagnostic(&mut self, _: &Diagnostic) {}
}
/// maximum number of lines we will print for each error; arbitrary.
pub const MAX_HIGHLIGHT_LINES: usize = 6;
/// maximum number of suggestions to be shown

View file

@ -17,10 +17,9 @@ use std::sync::{Arc, Mutex};
use syntax::{self, parse};
use syntax::ast::{self, MetaItemKind};
use syntax::parse::token;
use syntax::source_map::{FileName, FilePathMapping, FileLoader, SourceMap};
use syntax::source_map::{FileName, FileLoader, SourceMap};
use syntax::sess::ParseSess;
use syntax_pos::edition;
use rustc_errors::{Diagnostic, emitter::Emitter, Handler, SourceMapperDyn};
pub type Result<T> = result::Result<T, ErrorReported>;
@ -63,18 +62,9 @@ impl Compiler {
/// Converts strings provided as `--cfg [cfgspec]` into a `crate_cfg`.
pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String>)> {
struct NullEmitter;
impl Emitter for NullEmitter {
fn emit_diagnostic(&mut self, _: &Diagnostic) {}
fn source_map(&self) -> Option<&Lrc<SourceMapperDyn>> { None }
}
syntax::with_default_globals(move || {
let cfg = cfgspecs.into_iter().map(|s| {
let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let handler = Handler::with_emitter(false, None, Box::new(NullEmitter));
let sess = ParseSess::with_span_handler(handler, cm);
let sess = ParseSess::with_silent_emitter();
let filename = FileName::cfg_spec_source_code(&s);
let mut parser = parse::new_parser_from_source_str(&sess, filename, s.to_string());

View file

@ -542,7 +542,6 @@ impl<'tcx> EncodeContext<'tcx> {
let attrs = tcx.hir().krate_attrs();
let has_default_lib_allocator = attr::contains_name(&attrs, sym::default_lib_allocator);
let has_global_allocator = *tcx.sess.has_global_allocator.get();
let has_panic_handler = *tcx.sess.has_panic_handler.try_get().unwrap_or(&false);
let root = self.lazy(CrateRoot {
name: tcx.crate_name(LOCAL_CRATE),
@ -553,7 +552,7 @@ impl<'tcx> EncodeContext<'tcx> {
panic_strategy: tcx.sess.panic_strategy(),
edition: tcx.sess.edition(),
has_global_allocator: has_global_allocator,
has_panic_handler: has_panic_handler,
has_panic_handler: tcx.has_panic_handler(LOCAL_CRATE),
has_default_lib_allocator: has_default_lib_allocator,
plugin_registrar_fn: tcx.plugin_registrar_fn(LOCAL_CRATE).map(|id| id.index),
proc_macro_decls_static: if is_proc_macro {

View file

@ -314,16 +314,18 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
align: Align,
) -> InterpResult<'tcx, Option<Pointer<M::PointerTag>>> {
let align = if M::CHECK_ALIGN { Some(align) } else { None };
self.check_ptr_access_align(sptr, size, align)
self.check_ptr_access_align(sptr, size, align, CheckInAllocMsg::MemoryAccessTest)
}
/// Like `check_ptr_access`, but *definitely* checks alignment when `align`
/// is `Some` (overriding `M::CHECK_ALIGN`).
pub(super) fn check_ptr_access_align(
/// is `Some` (overriding `M::CHECK_ALIGN`). Also lets the caller control
/// the error message for the out-of-bounds case.
pub fn check_ptr_access_align(
&self,
sptr: Scalar<M::PointerTag>,
size: Size,
align: Option<Align>,
msg: CheckInAllocMsg,
) -> InterpResult<'tcx, Option<Pointer<M::PointerTag>>> {
fn check_offset_align(offset: u64, align: Align) -> InterpResult<'static> {
if offset % align.bytes() == 0 {
@ -368,7 +370,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
// It is sufficient to check this for the end pointer. The addition
// checks for overflow.
let end_ptr = ptr.offset(size, self)?;
end_ptr.check_inbounds_alloc(allocation_size, CheckInAllocMsg::MemoryAccessTest)?;
end_ptr.check_inbounds_alloc(allocation_size, msg)?;
// Test align. Check this last; if both bounds and alignment are violated
// we want the error to be about the bounds.
if let Some(align) = align {

View file

@ -16,7 +16,7 @@ use rustc_data_structures::fx::FxHashSet;
use std::hash::Hash;
use super::{
GlobalAlloc, InterpResult,
GlobalAlloc, InterpResult, CheckInAllocMsg,
Scalar, OpTy, Machine, InterpCx, ValueVisitor, MPlaceTy,
};
@ -424,7 +424,12 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
// alignment should take attributes into account).
.unwrap_or_else(|| (layout.size, layout.align.abi));
let ptr: Option<_> = match
self.ecx.memory.check_ptr_access_align(ptr, size, Some(align))
self.ecx.memory.check_ptr_access_align(
ptr,
size,
Some(align),
CheckInAllocMsg::InboundsTest,
)
{
Ok(ptr) => ptr,
Err(err) => {

View file

@ -36,7 +36,6 @@ use rustc_metadata::creader::CrateLoader;
use rustc_metadata::cstore::CStore;
use syntax::{struct_span_err, unwrap_or};
use syntax::expand::SpecialDerives;
use syntax::ast::{self, Name, NodeId, Ident, FloatTy, IntTy, UintTy};
use syntax::ast::{CRATE_NODE_ID, Crate};
use syntax::ast::{ItemKind, Path};
@ -934,12 +933,10 @@ pub struct Resolver<'a> {
multi_segment_macro_resolutions: Vec<(Vec<Segment>, Span, MacroKind, ParentScope<'a>,
Option<Res>)>,
builtin_attrs: Vec<(Ident, ParentScope<'a>)>,
/// Some built-in derives mark items they are applied to so they are treated specially later.
/// `derive(Copy)` marks items they are applied to so they are treated specially later.
/// Derive macros cannot modify the item themselves and have to store the markers in the global
/// context, so they attach the markers to derive container IDs using this resolver table.
/// FIXME: Find a way for `PartialEq` and `Eq` to emulate `#[structural_match]`
/// by marking the produced impls rather than the original items.
special_derives: FxHashMap<ExpnId, SpecialDerives>,
containers_deriving_copy: FxHashSet<ExpnId>,
/// Parent scopes in which the macros were invoked.
/// FIXME: `derives` are missing in these parent scopes and need to be taken from elsewhere.
invocation_parent_scopes: FxHashMap<ExpnId, ParentScope<'a>>,
@ -1078,12 +1075,6 @@ impl<'a> hir::lowering::Resolver for Resolver<'a> {
&mut self.definitions
}
fn has_derives(&self, node_id: NodeId, derives: SpecialDerives) -> bool {
let def_id = self.definitions.local_def_id(node_id);
let expn_id = self.definitions.expansion_that_defined(def_id.index);
self.has_derives(expn_id, derives)
}
fn lint_buffer(&mut self) -> &mut lint::LintBuffer {
&mut self.lint_buffer
}
@ -1228,7 +1219,7 @@ impl<'a> Resolver<'a> {
single_segment_macro_resolutions: Default::default(),
multi_segment_macro_resolutions: Default::default(),
builtin_attrs: Default::default(),
special_derives: Default::default(),
containers_deriving_copy: Default::default(),
active_features:
features.declared_lib_features.iter().map(|(feat, ..)| *feat)
.chain(features.declared_lang_features.iter().map(|(feat, ..)| *feat))
@ -1314,10 +1305,6 @@ impl<'a> Resolver<'a> {
}
}
fn has_derives(&self, expn_id: ExpnId, markers: SpecialDerives) -> bool {
self.special_derives.get(&expn_id).map_or(false, |m| m.contains(markers))
}
/// Entry point to crate resolution.
pub fn resolve_crate(&mut self, krate: &Crate) {
let _prof_timer =

View file

@ -14,7 +14,6 @@ use rustc::{ty, lint, span_bug};
use syntax::ast::{self, NodeId, Ident};
use syntax::attr::StabilityLevel;
use syntax::edition::Edition;
use syntax::expand::SpecialDerives;
use syntax::feature_gate::{emit_feature_err, is_builtin_attr_name};
use syntax::feature_gate::GateIssue;
use syntax::print::pprust;
@ -255,12 +254,12 @@ impl<'a> base::Resolver for Resolver<'a> {
}
}
fn has_derives(&self, expn_id: ExpnId, derives: SpecialDerives) -> bool {
self.has_derives(expn_id, derives)
fn has_derive_copy(&self, expn_id: ExpnId) -> bool {
self.containers_deriving_copy.contains(&expn_id)
}
fn add_derives(&mut self, expn_id: ExpnId, derives: SpecialDerives) {
*self.special_derives.entry(expn_id).or_default() |= derives;
fn add_derive_copy(&mut self, expn_id: ExpnId) {
self.containers_deriving_copy.insert(expn_id);
}
}

View file

@ -553,7 +553,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
pub fn check_for_cast(
&self,
err: &mut DiagnosticBuilder<'tcx>,
err: &mut DiagnosticBuilder<'_>,
expr: &hir::Expr,
checked_ty: Ty<'tcx>,
expected_ty: Ty<'tcx>,

View file

@ -583,7 +583,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} else {
assert!(e_ty.is_unit());
let ty = coerce.expected_ty();
coerce.coerce_forced_unit(self, &cause, &mut |err| {
coerce.coerce_forced_unit(self, &cause, &mut |mut err| {
self.suggest_mismatched_types_on_tail(
&mut err,
expr,
ty,
e_ty,
cause.span,
target_id,
);
let val = match ty.kind {
ty::Bool => "true",
ty::Char => "'a'",

View file

@ -1267,11 +1267,6 @@ fn check_fn<'a, 'tcx>(
if let Some(panic_impl_did) = fcx.tcx.lang_items().panic_impl() {
if panic_impl_did == fcx.tcx.hir().local_def_id(fn_id) {
if let Some(panic_info_did) = fcx.tcx.lang_items().panic_info() {
// at this point we don't care if there are duplicate handlers or if the handler has
// the wrong signature as this value we'll be used when writing metadata and that
// only happens if compilation succeeded
fcx.tcx.sess.has_panic_handler.try_set_same(true);
if declared_ret_ty.kind != ty::Never {
fcx.tcx.sess.span_err(
decl.output.span(),
@ -4250,7 +4245,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// - Possible missing return type if the return type is the default, and not `fn main()`.
pub fn suggest_mismatched_types_on_tail(
&self,
err: &mut DiagnosticBuilder<'tcx>,
err: &mut DiagnosticBuilder<'_>,
expr: &'tcx hir::Expr,
expected: Ty<'tcx>,
found: Ty<'tcx>,
@ -4277,7 +4272,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// ```
fn suggest_fn_call(
&self,
err: &mut DiagnosticBuilder<'tcx>,
err: &mut DiagnosticBuilder<'_>,
expr: &hir::Expr,
expected: Ty<'tcx>,
found: Ty<'tcx>,
@ -4390,7 +4385,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
pub fn suggest_ref_or_into(
&self,
err: &mut DiagnosticBuilder<'tcx>,
err: &mut DiagnosticBuilder<'_>,
expr: &hir::Expr,
expected: Ty<'tcx>,
found: Ty<'tcx>,
@ -4458,7 +4453,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// in the heap by calling `Box::new()`.
fn suggest_boxing_when_appropriate(
&self,
err: &mut DiagnosticBuilder<'tcx>,
err: &mut DiagnosticBuilder<'_>,
expr: &hir::Expr,
expected: Ty<'tcx>,
found: Ty<'tcx>,
@ -4502,7 +4497,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// it suggests adding a semicolon.
fn suggest_missing_semicolon(
&self,
err: &mut DiagnosticBuilder<'tcx>,
err: &mut DiagnosticBuilder<'_>,
expression: &'tcx hir::Expr,
expected: Ty<'tcx>,
cause_span: Span,
@ -4541,7 +4536,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// type.
fn suggest_missing_return_type(
&self,
err: &mut DiagnosticBuilder<'tcx>,
err: &mut DiagnosticBuilder<'_>,
fn_decl: &hir::FnDecl,
expected: Ty<'tcx>,
found: Ty<'tcx>,
@ -4607,7 +4602,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// `.await` to the tail of the expression.
fn suggest_missing_await(
&self,
err: &mut DiagnosticBuilder<'tcx>,
err: &mut DiagnosticBuilder<'_>,
expr: &hir::Expr,
expected: Ty<'tcx>,
found: Ty<'tcx>,

View file

@ -11,7 +11,7 @@ use std::fmt::Display;
use std::io;
use std::io::prelude::*;
use syntax::source_map::{SourceMap, FilePathMapping};
use syntax::source_map::SourceMap;
use syntax::parse::lexer;
use syntax::parse::token::{self, Token};
use syntax::sess::ParseSess;
@ -33,7 +33,7 @@ pub fn render_with_highlighting(
class, tooltip).unwrap();
}
let sess = ParseSess::new(FilePathMapping::empty());
let sess = ParseSess::with_silent_emitter();
let fm = sess.source_map().new_source_file(
FileName::Custom(String::from("rustdoc-highlighting")),
src.to_owned(),

View file

@ -5,16 +5,6 @@ use syntax_pos::symbol::sym;
pub mod allocator;
bitflags::bitflags! {
/// Built-in derives that need some extra tracking beyond the usual macro functionality.
#[derive(Default)]
pub struct SpecialDerives: u8 {
const PARTIAL_EQ = 1 << 0;
const EQ = 1 << 1;
const COPY = 1 << 2;
}
}
pub fn is_proc_macro_attr(attr: &Attribute) -> bool {
[sym::proc_macro, sym::proc_macro_attribute, sym::proc_macro_derive]
.iter().any(|kind| attr.check_name(*kind))

View file

@ -209,12 +209,12 @@ impl TokenCursor {
loop {
let tree = if !self.frame.open_delim {
self.frame.open_delim = true;
TokenTree::open_tt(self.frame.span.open, self.frame.delim)
TokenTree::open_tt(self.frame.span, self.frame.delim)
} else if let Some(tree) = self.frame.tree_cursor.next() {
tree
} else if !self.frame.close_delim {
self.frame.close_delim = true;
TokenTree::close_tt(self.frame.span.close, self.frame.delim)
TokenTree::close_tt(self.frame.span, self.frame.delim)
} else if let Some(frame) = self.stack.pop() {
self.frame = frame;
continue

View file

@ -360,11 +360,11 @@ impl<'a> Parser<'a> {
}
pub fn maybe_annotate_with_ascription(
&self,
&mut self,
err: &mut DiagnosticBuilder<'_>,
maybe_expected_semicolon: bool,
) {
if let Some((sp, likely_path)) = self.last_type_ascription {
if let Some((sp, likely_path)) = self.last_type_ascription.take() {
let sm = self.sess.source_map();
let next_pos = sm.lookup_char_pos(self.token.span.lo());
let op_pos = sm.lookup_char_pos(sp.hi());
@ -1088,8 +1088,15 @@ impl<'a> Parser<'a> {
}
pub(super) fn could_ascription_be_path(&self, node: &ast::ExprKind) -> bool {
self.token.is_ident() &&
if let ast::ExprKind::Path(..) = node { true } else { false } &&
(self.token == token::Lt && // `foo:<bar`, likely a typoed turbofish.
self.look_ahead(1, |t| t.is_ident() && !t.is_reserved_ident())
) ||
self.token.is_ident() &&
match node {
// `foo::` → `foo:` or `foo.bar::` → `foo.bar:`
ast::ExprKind::Path(..) | ast::ExprKind::Field(..) => true,
_ => false,
} &&
!self.token.is_reserved_ident() && // v `foo:bar(baz)`
self.look_ahead(1, |t| t == &token::OpenDelim(token::Paren)) ||
self.look_ahead(1, |t| t == &token::Lt) && // `foo:bar<baz`

View file

@ -397,6 +397,7 @@ impl<'a> Parser<'a> {
}
let stmt = match self.parse_full_stmt(false) {
Err(mut err) => {
self.maybe_annotate_with_ascription(&mut err, false);
err.emit();
self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore);
Some(Stmt {

View file

@ -6,7 +6,7 @@ use crate::early_buffered_lints::{BufferedEarlyLint, BufferedEarlyLintId};
use crate::source_map::{SourceMap, FilePathMapping};
use crate::feature_gate::UnstableFeatures;
use errors::{Applicability, Handler, ColorConfig, DiagnosticBuilder};
use errors::{Applicability, emitter::SilentEmitter, Handler, ColorConfig, DiagnosticBuilder};
use rustc_data_structures::fx::{FxHashSet, FxHashMap};
use rustc_data_structures::sync::{Lrc, Lock, Once};
use syntax_pos::{Symbol, Span, MultiSpan};
@ -107,6 +107,12 @@ impl ParseSess {
}
}
pub fn with_silent_emitter() -> Self {
let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let handler = Handler::with_emitter(false, None, Box::new(SilentEmitter));
ParseSess::with_span_handler(handler, cm)
}
#[inline]
pub fn source_map(&self) -> &SourceMap {
&self.source_map

View file

@ -15,7 +15,7 @@
use crate::parse::token::{self, DelimToken, Token, TokenKind};
use syntax_pos::{BytePos, Span, DUMMY_SP};
use syntax_pos::{Span, DUMMY_SP};
#[cfg(target_arch = "x86_64")]
use rustc_data_structures::static_assert_size;
use rustc_data_structures::sync::Lrc;
@ -110,23 +110,13 @@ impl TokenTree {
}
/// Returns the opening delimiter as a token tree.
pub fn open_tt(span: Span, delim: DelimToken) -> TokenTree {
let open_span = if span.is_dummy() {
span
} else {
span.with_hi(span.lo() + BytePos(delim.len() as u32))
};
TokenTree::token(token::OpenDelim(delim), open_span)
pub fn open_tt(span: DelimSpan, delim: DelimToken) -> TokenTree {
TokenTree::token(token::OpenDelim(delim), span.open)
}
/// Returns the closing delimiter as a token tree.
pub fn close_tt(span: Span, delim: DelimToken) -> TokenTree {
let close_span = if span.is_dummy() {
span
} else {
span.with_lo(span.hi() - BytePos(delim.len() as u32))
};
TokenTree::token(token::CloseDelim(delim), close_span)
pub fn close_tt(span: DelimSpan, delim: DelimToken) -> TokenTree {
TokenTree::token(token::CloseDelim(delim), span.close)
}
}

View file

@ -13,7 +13,6 @@ use syntax::symbol::{kw, sym, Ident, Symbol};
use syntax::{ThinVec, MACRO_ARGUMENTS};
use syntax::tokenstream::{self, TokenStream};
use syntax::visit::Visitor;
crate use syntax::expand::SpecialDerives;
use errors::{DiagnosticBuilder, DiagnosticId};
use smallvec::{smallvec, SmallVec};
@ -860,8 +859,8 @@ pub trait Resolver {
fn check_unused_macros(&mut self);
fn has_derives(&self, expn_id: ExpnId, derives: SpecialDerives) -> bool;
fn add_derives(&mut self, expn_id: ExpnId, derives: SpecialDerives);
fn has_derive_copy(&self, expn_id: ExpnId) -> bool;
fn add_derive_copy(&mut self, expn_id: ExpnId);
}
#[derive(Clone)]

View file

@ -432,7 +432,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
// can be in scope for all code produced by that container's expansion.
item.visit_with(&mut MarkAttrs(&helper_attrs));
if has_copy {
self.cx.resolver.add_derives(invoc.expansion_data.id, SpecialDerives::COPY);
self.cx.resolver.add_derive_copy(invoc.expansion_data.id);
}
let mut derive_placeholders = Vec::with_capacity(derives.len());

View file

@ -13,7 +13,7 @@ use syntax::ast;
use syntax::parse::token::{self, Token, TokenKind};
use syntax::tokenstream::{DelimSpan};
use syntax_pos::{BytePos, Span};
use syntax_pos::Span;
use rustc_data_structures::sync::Lrc;
@ -27,23 +27,13 @@ struct Delimited {
impl Delimited {
/// Returns a `self::TokenTree` with a `Span` corresponding to the opening delimiter.
fn open_tt(&self, span: Span) -> TokenTree {
let open_span = if span.is_dummy() {
span
} else {
span.with_hi(span.lo() + BytePos(self.delim.len() as u32))
};
TokenTree::token(token::OpenDelim(self.delim), open_span)
fn open_tt(&self, span: DelimSpan) -> TokenTree {
TokenTree::token(token::OpenDelim(self.delim), span.open)
}
/// Returns a `self::TokenTree` with a `Span` corresponding to the closing delimiter.
fn close_tt(&self, span: Span) -> TokenTree {
let close_span = if span.is_dummy() {
span
} else {
span.with_lo(span.hi() - BytePos(self.delim.len() as u32))
};
TokenTree::token(token::CloseDelim(self.delim), close_span)
fn close_tt(&self, span: DelimSpan) -> TokenTree {
TokenTree::token(token::CloseDelim(self.delim), span.close)
}
}
@ -138,10 +128,10 @@ impl TokenTree {
}
(&TokenTree::Delimited(span, ref delimed), _) => {
if index == 0 {
return delimed.open_tt(span.open);
return delimed.open_tt(span);
}
if index == delimed.tts.len() + 1 {
return delimed.close_tt(span.close);
return delimed.close_tt(span);
}
delimed.tts[index - 1].clone()
}

View file

@ -566,7 +566,7 @@ impl FirstSets {
}
TokenTree::Delimited(span, ref delimited) => {
build_recur(sets, &delimited.tts[..]);
first.replace_with(delimited.open_tt(span.open));
first.replace_with(delimited.open_tt(span));
}
TokenTree::Sequence(sp, ref seq_rep) => {
let subfirst = build_recur(sets, &seq_rep.tts[..]);
@ -628,7 +628,7 @@ impl FirstSets {
return first;
}
TokenTree::Delimited(span, ref delimited) => {
first.add_one(delimited.open_tt(span.open));
first.add_one(delimited.open_tt(span));
return first;
}
TokenTree::Sequence(sp, ref seq_rep) => {
@ -826,7 +826,7 @@ fn check_matcher_core(
}
}
TokenTree::Delimited(span, ref d) => {
let my_suffix = TokenSet::singleton(d.close_tt(span.close));
let my_suffix = TokenSet::singleton(d.close_tt(span));
check_matcher_core(sess, features, attrs, first_sets, &d.tts, &my_suffix);
// don't track non NT tokens
last.replace_with_irrelevant();

View file

@ -3,7 +3,6 @@ use crate::deriving::generic::*;
use crate::deriving::generic::ty::*;
use syntax::ast::{self, Expr, GenericArg, Generics, ItemKind, MetaItem, VariantData};
use syntax::expand::SpecialDerives;
use syntax_expand::base::{Annotatable, ExtCtxt};
use syntax::ptr::P;
use syntax::symbol::{kw, sym, Symbol};
@ -37,7 +36,7 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt<'_>,
ItemKind::Struct(_, Generics { ref params, .. }) |
ItemKind::Enum(_, Generics { ref params, .. }) => {
let container_id = cx.current_expansion.id.expn_data().parent;
if cx.resolver.has_derives(container_id, SpecialDerives::COPY) &&
if cx.resolver.has_derive_copy(container_id) &&
!params.iter().any(|param| match param.kind {
ast::GenericParamKind::Type { .. } => true,
_ => false,

View file

@ -3,7 +3,6 @@ use crate::deriving::generic::*;
use crate::deriving::generic::ty::*;
use syntax::ast::{self, Ident, Expr, MetaItem, GenericArg};
use syntax::expand::SpecialDerives;
use syntax::ptr::P;
use syntax::symbol::{sym, Symbol};
use syntax_expand::base::{Annotatable, ExtCtxt};
@ -14,8 +13,6 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt<'_>,
mitem: &MetaItem,
item: &Annotatable,
push: &mut dyn FnMut(Annotatable)) {
cx.resolver.add_derives(cx.current_expansion.id.expn_data().parent, SpecialDerives::EQ);
let inline = cx.meta_word(span, sym::inline);
let hidden = syntax::attr::mk_nested_word_item(Ident::new(sym::hidden, span));
let doc = syntax::attr::mk_list_item(Ident::new(sym::doc, span), vec![hidden]);

View file

@ -3,7 +3,6 @@ use crate::deriving::generic::*;
use crate::deriving::generic::ty::*;
use syntax::ast::{BinOpKind, Expr, MetaItem};
use syntax::expand::SpecialDerives;
use syntax::ptr::P;
use syntax::symbol::sym;
use syntax_expand::base::{Annotatable, ExtCtxt};
@ -14,8 +13,6 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt<'_>,
mitem: &MetaItem,
item: &Annotatable,
push: &mut dyn FnMut(Annotatable)) {
cx.resolver.add_derives(cx.current_expansion.id.expn_data().parent, SpecialDerives::PARTIAL_EQ);
// structures are equal if all fields are equal, and non equal, if
// any fields are not equal or if the enum variants are different
fn cs_op(cx: &mut ExtCtxt<'_>,

View file

@ -186,7 +186,6 @@ use rustc_target::spec::abi::Abi;
use syntax::ast::{self, BinOpKind, EnumDef, Expr, Generics, Ident, PatKind};
use syntax::ast::{VariantData, GenericParamKind, GenericArg};
use syntax::attr;
use syntax::expand::SpecialDerives;
use syntax::source_map::respan;
use syntax::util::map_in_place::MapInPlace;
use syntax::ptr::P;
@ -427,10 +426,8 @@ impl<'a> TraitDef<'a> {
}
};
let container_id = cx.current_expansion.id.expn_data().parent;
let is_always_copy =
cx.resolver.has_derives(container_id, SpecialDerives::COPY) &&
has_no_type_params;
let use_temporaries = is_packed && is_always_copy;
let always_copy = has_no_type_params && cx.resolver.has_derive_copy(container_id);
let use_temporaries = is_packed && always_copy;
let newitem = match item.kind {
ast::ItemKind::Struct(ref struct_def, ref generics) => {

View file

@ -374,10 +374,12 @@ impl<'a, 'b> Context<'a, 'b> {
format!("are {} arguments", count)
},
));
e.span_label(
self.args[pos].span,
"this parameter corresponds to the precision flag",
);
if let Some(arg) = self.args.get(pos) {
e.span_label(
arg.span,
"this parameter corresponds to the precision flag",
);
}
zero_based_note = true;
}
_ => {}

View file

@ -7,14 +7,14 @@ fn main() {}
// END RUST SOURCE
// START rustc.main.mir_map.0.dot
// digraph Mir_0_12 { // The name here MUST be an ASCII identifier.
// digraph Mir_0_3 { // The name here MUST be an ASCII identifier.
// graph [fontname="monospace"];
// node [fontname="monospace"];
// edge [fontname="monospace"];
// label=<fn main() -&gt; ()<br align="left"/>>;
// bb0__0_12 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">0</td></tr><tr><td align="left" balign="left">_0 = ()<br/></td></tr><tr><td align="left">goto</td></tr></table>>];
// bb1__0_12 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">1</td></tr><tr><td align="left">resume</td></tr></table>>];
// bb2__0_12 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">2</td></tr><tr><td align="left">return</td></tr></table>>];
// bb0__0_12 -> bb2__0_12 [label=""];
// bb0__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">0</td></tr><tr><td align="left" balign="left">_0 = ()<br/></td></tr><tr><td align="left">goto</td></tr></table>>];
// bb1__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">1</td></tr><tr><td align="left">resume</td></tr></table>>];
// bb2__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">2</td></tr><tr><td align="left">return</td></tr></table>>];
// bb0__0_3 -> bb2__0_3 [label=""];
// }
// END rustc.main.mir_map.0.dot

View file

@ -20,7 +20,7 @@ fn foo<T: Copy>(_t: T, q: &i32) -> i32 {
// ...
// bb0: {
// ...
// _3 = [closure@HirId { owner: DefIndex(13), local_id: 31 }];
// _3 = [closure@HirId { owner: DefIndex(4), local_id: 31 }];
// ...
// _4 = &_3;
// ...

View file

@ -16,7 +16,7 @@ fn foo<T: Copy>(_t: T, q: i32) -> i32 {
// ...
// bb0: {
// ...
// _3 = [closure@HirId { owner: DefIndex(13), local_id: 15 }];
// _3 = [closure@HirId { owner: DefIndex(4), local_id: 15 }];
// ...
// _4 = &_3;
// ...

View file

@ -100,7 +100,7 @@ fn main() {
// }
// END rustc.main.EraseRegions.after.mir
// START rustc.main-{{closure}}.EraseRegions.after.mir
// fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(22), local_id: 72 }], _2: &i32) -> &i32 {
// fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(13), local_id: 72 }], _2: &i32) -> &i32 {
// ...
// bb0: {
// Retag([fn entry] _1);

View file

@ -222,67 +222,3 @@ warning: could not parse code block as Rust code
LL | /// \____/
| ^^^^^^
error: unknown start of token: \
--> <rustdoc-highlighting>:1:1
|
1 | \____/
| ^
error: unknown start of token: \
--> <rustdoc-highlighting>:1:1
|
1 | \_
| ^
error: unknown start of token: \
--> <rustdoc-highlighting>:1:1
|
1 | \_
| ^
error: unknown start of token: `
--> <rustdoc-highlighting>:1:1
|
1 | ```
| ^
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
1 | '``
| ^
error: unknown start of token: \
--> <rustdoc-highlighting>:2:1
|
2 | \_
| ^
error: unknown start of token: \
--> <rustdoc-highlighting>:1:1
|
1 | \_
| ^
error: unknown start of token: \
--> <rustdoc-highlighting>:1:1
|
1 | \_
| ^
error: unknown start of token: `
--> <rustdoc-highlighting>:3:30
|
3 | | ^^^^^^ did you mean `baz::foobar`?
| ^
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
3 | | ^^^^^^ did you mean 'baz::foobar`?
| ^
error: unknown start of token: \
--> <rustdoc-highlighting>:1:1
|
1 | \__________pkt->size___________/ \_result->size_/ \__pkt->size__/
| ^

View file

@ -4,8 +4,11 @@ error[E0271]: type mismatch resolving `<Adapter<I> as Iterator>::Item == std::op
LL | fn is_iterator_of<A, I: Iterator<Item=A>>(_: &I) {}
| -------------- ------ required by this bound in `is_iterator_of`
...
LL | fn test_adapter<T, I: Iterator<Item=Option<T>>>(it: I) {
| - this type parameter
...
LL | is_iterator_of::<Option<T>, _>(&adapter);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found type parameter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found type parameter `T`
|
= note: expected type `std::option::Option<T>`
found type `T`

View file

@ -5,7 +5,10 @@ LL | fn b<C:Clone,D>(&self, x: C) -> C;
| - type in trait
...
LL | fn b<F:Clone,G>(&self, _x: G) -> G { panic!() }
| ^ expected type parameter, found a different type parameter
| - - ^ expected type parameter `F`, found type parameter `G`
| | |
| | found type parameter
| expected type parameter
|
= note: expected type `fn(&E, F) -> F`
found type `fn(&E, G) -> G`

View file

@ -86,4 +86,9 @@ tenth number: {}",
println!("{:foo}", 1); //~ ERROR unknown format trait `foo`
println!("{5} {:4$} {6:7$}", 1);
//~^ ERROR invalid reference to positional arguments 4, 5, 6 and 7 (there is 1 argument)
// We used to ICE here because we tried to unconditionally access the first argument, which
// doesn't exist.
println!("{:.*}");
//~^ ERROR 2 positional arguments in format string, but no arguments were given
}

View file

@ -285,6 +285,17 @@ LL | println!("{5} {:4$} {6:7$}", 1);
= note: positional arguments are zero-based
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
error: 2 positional arguments in format string, but no arguments were given
--> $DIR/ifmt-bad-arg.rs:92:15
|
LL | println!("{:.*}");
| ^^--^
| |
| this precision flag adds an extra required argument at position 0, which is why there are 2 arguments expected
|
= note: positional arguments are zero-based
= note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html
error[E0308]: mismatched types
--> $DIR/ifmt-bad-arg.rs:78:32
|
@ -303,6 +314,6 @@ LL | println!("{} {:07$.*} {}", 1, 3.2, 4);
= note: expected type `&usize`
found type `&{float}`
error: aborting due to 35 previous errors
error: aborting due to 36 previous errors
For more information about this error, try `rustc --explain E0308`.

View file

@ -5,7 +5,9 @@ LL | fn foo<A: Debug>(&self, a: &A, b: &impl Debug);
| -- type in trait
...
LL | fn foo<B: Debug>(&self, a: &impl Debug, b: &B) { }
| ^^^^^^^^^^^ expected type parameter, found a different type parameter
| - ^^^^^^^^^^^ expected type parameter `B`, found type parameter `impl Debug`
| |
| expected type parameter
|
= note: expected type `fn(&(), &B, &impl Debug)`
found type `fn(&(), &impl Debug, &B)`

View file

@ -2,9 +2,11 @@ error[E0308]: mismatched types
--> $DIR/universal-mismatched-type.rs:4:5
|
LL | fn foo(x: impl Debug) -> String {
| ------ expected `std::string::String` because of return type
| ---------- ------ expected `std::string::String` because of return type
| |
| this type parameter
LL | x
| ^ expected struct `std::string::String`, found type parameter
| ^ expected struct `std::string::String`, found type parameter `impl Debug`
|
= note: expected type `std::string::String`
found type `impl Debug`

View file

@ -1,11 +1,16 @@
error[E0308]: mismatched types
--> $DIR/universal-two-impl-traits.rs:5:9
|
LL | fn foo(x: impl Debug, y: impl Debug) -> String {
| ---------- ---------- found type parameter
| |
| expected type parameter
LL | let mut a = x;
LL | a = y;
| ^ expected type parameter, found a different type parameter
| ^ expected type parameter `impl Debug`, found a different type parameter `impl Debug`
|
= note: expected type `impl Debug` (type parameter)
found type `impl Debug` (type parameter)
= note: expected type `impl Debug` (type parameter `impl Debug`)
found type `impl Debug` (type parameter `impl Debug`)
= note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters

View file

@ -2,7 +2,7 @@ error: expected one of `::`, `;`, or `as`, found `{`
--> $DIR/import-prefix-macro-1.rs:11:27
|
LL | ($p: path) => (use $p {S, Z});
| ^ expected one of `::`, `;`, or `as` here
| ^^^^^^ expected one of `::`, `;`, or `as` here
...
LL | import! { a::b::c }
| ------------------- in this macro invocation

View file

@ -2,10 +2,10 @@ error[E0308]: mismatched types
--> $DIR/issue-13853.rs:14:9
|
LL | fn nodes<'a, I: Iterator<Item=&'a N>>(&self) -> I
| - expected `I` because of return type
| - this type parameter - expected `I` because of return type
...
LL | self.iter()
| ^^^^^^^^^^^ expected type parameter, found struct `std::slice::Iter`
| ^^^^^^^^^^^ expected type parameter `I`, found struct `std::slice::Iter`
|
= note: expected type `I`
found type `std::slice::Iter<'_, N>`

View file

@ -1,8 +1,10 @@
error[E0053]: method `call` has an incompatible type for trait
--> $DIR/issue-20225.rs:6:3
|
LL | impl<'a, T> Fn<(&'a T,)> for Foo {
| - this type parameter
LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter `T`
|
= note: expected type `extern "rust-call" fn(&Foo, (&'a T,))`
found type `extern "rust-call" fn(&Foo, (T,))`
@ -12,8 +14,10 @@ LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
error[E0053]: method `call_mut` has an incompatible type for trait
--> $DIR/issue-20225.rs:12:3
|
LL | impl<'a, T> FnMut<(&'a T,)> for Foo {
| - this type parameter
LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter `T`
|
= note: expected type `extern "rust-call" fn(&mut Foo, (&'a T,))`
found type `extern "rust-call" fn(&mut Foo, (T,))`
@ -23,8 +27,11 @@ LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
error[E0053]: method `call_once` has an incompatible type for trait
--> $DIR/issue-20225.rs:20:3
|
LL | impl<'a, T> FnOnce<(&'a T,)> for Foo {
| - this type parameter
...
LL | extern "rust-call" fn call_once(self, (_,): (T,)) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter `T`
|
= note: expected type `extern "rust-call" fn(Foo, (&'a T,))`
found type `extern "rust-call" fn(Foo, (T,))`

View file

@ -5,7 +5,7 @@ LL | trait Trait: Sized {
| ------------------ required by `Trait`
...
LL | fn test<T: Trait<B=i32>>(b: i32) -> T where T::A: MultiDispatch<i32> { T::new(b) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter, found associated type
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found associated type
|
= note: expected type `T`
found type `<<T as Trait>::A as MultiDispatch<i32>>::O`

View file

@ -4,7 +4,7 @@ fn foo<T, U>(x: T, y: U) {
//~^ ERROR mismatched types
//~| expected type `T`
//~| found type `U`
//~| expected type parameter, found a different type parameter
//~| expected type parameter `T`, found type parameter `U`
}
fn main() {

View file

@ -1,8 +1,13 @@
error[E0308]: mismatched types
--> $DIR/issue-2951.rs:3:10
|
LL | fn foo<T, U>(x: T, y: U) {
| - - found type parameter
| |
| expected type parameter
LL | let mut xx = x;
LL | xx = y;
| ^ expected type parameter, found a different type parameter
| ^ expected type parameter `T`, found type parameter `U`
|
= note: expected type `T`
found type `U`

View file

@ -2,7 +2,7 @@ error: expected `{`, found `foo`
--> $DIR/issue-39848.rs:8:19
|
LL | if $tgt.has_$field() {}
| -- - help: try placing this code inside a block: `{ ) }`
| -- -- help: try placing this code inside a block: `{ () }`
| |
| this `if` statement has a condition, but no block
...

View file

@ -1,10 +1,13 @@
error[E0308]: mismatched types
--> $DIR/issue-35030.rs:9:14
|
LL | impl<bool> Parser<bool> for bool {
| ---- this type parameter
LL | fn parse(text: &str) -> Option<bool> {
LL | Some(true)
| ^^^^ expected type parameter, found bool
| ^^^^ expected type parameter `bool`, found bool
|
= note: expected type `bool` (type parameter)
= note: expected type `bool` (type parameter `bool`)
found type `bool` (bool)
= help: type parameters must be constrained to match other types
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters

View file

@ -4,7 +4,7 @@ note: No external requirements
LL | let mut closure = expect_sig(|p, y| *p = y);
| ^^^^^^^^^^^^^
|
= note: defining type: DefId(0:13 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:4 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]) with closure substs [
i16,
for<'r, 's, 't0> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) mut &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) i32)),
]
@ -30,7 +30,7 @@ LL | | deref(p);
LL | | }
| |_^
|
= note: defining type: DefId(0:12 ~ escape_argument_callee[317d]::test[0]) with substs []
= note: defining type: DefId(0:3 ~ escape_argument_callee[317d]::test[0]) with substs []
error: aborting due to previous error

View file

@ -4,7 +4,7 @@ note: No external requirements
LL | let mut closure = expect_sig(|p, y| *p = y);
| ^^^^^^^^^^^^^
|
= note: defining type: DefId(0:13 ~ escape_argument[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:4 ~ escape_argument[317d]::test[0]::{{closure}}[0]) with closure substs [
i16,
for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) mut &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32)),
]
@ -21,7 +21,7 @@ LL | | deref(p);
LL | | }
| |_^
|
= note: defining type: DefId(0:12 ~ escape_argument[317d]::test[0]) with substs []
= note: defining type: DefId(0:3 ~ escape_argument[317d]::test[0]) with substs []
error[E0597]: `y` does not live long enough
--> $DIR/escape-argument.rs:27:25

View file

@ -4,7 +4,7 @@ note: External requirements
LL | let mut closure1 = || p = &y;
| ^^^^^^^^^
|
= note: defining type: DefId(0:14 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:5 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]::{{closure}}[0]) with closure substs [
i16,
extern "rust-call" fn(()),
&'_#1r i32,
@ -23,7 +23,7 @@ LL | | closure1();
LL | | };
| |_________^
|
= note: defining type: DefId(0:13 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:4 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]) with closure substs [
i16,
extern "rust-call" fn(()),
&'_#1r i32,
@ -44,7 +44,7 @@ LL | | deref(p);
LL | | }
| |_^
|
= note: defining type: DefId(0:12 ~ escape_upvar_nested[317d]::test[0]) with substs []
= note: defining type: DefId(0:3 ~ escape_upvar_nested[317d]::test[0]) with substs []
error[E0597]: `y` does not live long enough
--> $DIR/escape-upvar-nested.rs:21:40

View file

@ -4,7 +4,7 @@ note: External requirements
LL | let mut closure = || p = &y;
| ^^^^^^^^^
|
= note: defining type: DefId(0:13 ~ escape_upvar_ref[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:4 ~ escape_upvar_ref[317d]::test[0]::{{closure}}[0]) with closure substs [
i16,
extern "rust-call" fn(()),
&'_#1r i32,
@ -25,7 +25,7 @@ LL | | deref(p);
LL | | }
| |_^
|
= note: defining type: DefId(0:12 ~ escape_upvar_ref[317d]::test[0]) with substs []
= note: defining type: DefId(0:3 ~ escape_upvar_ref[317d]::test[0]) with substs []
error[E0597]: `y` does not live long enough
--> $DIR/escape-upvar-ref.rs:23:35

View file

@ -8,7 +8,7 @@ LL | | demand_y(x, y, p)
LL | | },
| |_________^
|
= note: defining type: DefId(0:27 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:18 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16,
for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)),
]
@ -39,7 +39,7 @@ LL | | );
LL | | }
| |_^
|
= note: defining type: DefId(0:23 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]) with substs []
= note: defining type: DefId(0:14 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]) with substs []
error: aborting due to previous error

View file

@ -9,7 +9,7 @@ LL | |
LL | | });
| |_____^
|
= note: defining type: DefId(0:25 ~ propagate_approximated_ref[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:16 ~ propagate_approximated_ref[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16,
for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>)),
]
@ -30,7 +30,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:22 ~ propagate_approximated_ref[317d]::supply[0]) with substs []
= note: defining type: DefId(0:13 ~ propagate_approximated_ref[317d]::supply[0]) with substs []
error: lifetime may not live long enough
--> $DIR/propagate-approximated-ref.rs:45:9

View file

@ -8,7 +8,7 @@ LL | |
LL | | })
| |_____^
|
= note: defining type: DefId(0:18 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:9 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [
i32,
for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>)),
]
@ -35,7 +35,7 @@ LL | | })
LL | | }
| |_^
|
= note: defining type: DefId(0:17 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs []
= note: defining type: DefId(0:8 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs []
note: External requirements
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:35:15
@ -46,7 +46,7 @@ LL | | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static
LL | | })
| |_____^
|
= note: defining type: DefId(0:20 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:11 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [
i32,
for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>)),
]
@ -65,7 +65,7 @@ LL | | })
LL | | }
| |_^
|
= note: defining type: DefId(0:19 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs []
= note: defining type: DefId(0:10 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs []
error[E0597]: `a` does not live long enough
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26

View file

@ -10,7 +10,7 @@ LL | | demand_y(x, y, x.get())
LL | | });
| |_____^
|
= note: defining type: DefId(0:25 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:16 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16,
for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) u32>)),
]
@ -31,7 +31,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:22 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]) with substs []
= note: defining type: DefId(0:13 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]) with substs []
error[E0521]: borrowed data escapes outside of function
--> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:32:5

View file

@ -10,7 +10,7 @@ LL | | demand_y(x, y, x.get())
LL | | });
| |_____^
|
= note: defining type: DefId(0:25 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:16 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16,
for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>)),
]
@ -31,7 +31,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:22 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]) with substs []
= note: defining type: DefId(0:13 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]) with substs []
error[E0521]: borrowed data escapes outside of function
--> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:35:5

View file

@ -9,7 +9,7 @@ LL | |
LL | | });
| |_____^
|
= note: defining type: DefId(0:25 ~ propagate_approximated_val[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:16 ~ propagate_approximated_val[317d]::test[0]::{{closure}}[0]) with closure substs [
i16,
for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)),
]
@ -30,7 +30,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:22 ~ propagate_approximated_val[317d]::test[0]) with substs []
= note: defining type: DefId(0:13 ~ propagate_approximated_val[317d]::test[0]) with substs []
error: lifetime may not live long enough
--> $DIR/propagate-approximated-val.rs:38:9

View file

@ -8,7 +8,7 @@ LL | | demand_y(x, y, p)
LL | | },
| |_________^
|
= note: defining type: DefId(0:23 ~ propagate_despite_same_free_region[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:14 ~ propagate_despite_same_free_region[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16,
for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)),
]
@ -28,5 +28,5 @@ LL | | );
LL | | }
| |_^
|
= note: defining type: DefId(0:21 ~ propagate_despite_same_free_region[317d]::supply[0]) with substs []
= note: defining type: DefId(0:12 ~ propagate_despite_same_free_region[317d]::supply[0]) with substs []

View file

@ -9,7 +9,7 @@ LL | |
LL | | });
| |_____^
|
= note: defining type: DefId(0:25 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:16 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16,
for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)),
]
@ -39,7 +39,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:22 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]) with substs []
= note: defining type: DefId(0:13 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]) with substs []
error: aborting due to previous error

View file

@ -9,7 +9,7 @@ LL | |
LL | | });
| |_____^
|
= note: defining type: DefId(0:25 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:16 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16,
for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>)),
]
@ -39,7 +39,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:22 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]) with substs []
= note: defining type: DefId(0:13 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]) with substs []
error: aborting due to previous error

View file

@ -11,7 +11,7 @@ LL | | require(value);
LL | | });
| |_____^
|
= note: defining type: DefId(0:23 ~ propagate_from_trait_match[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:14 ~ propagate_from_trait_match[317d]::supply[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
@ -32,7 +32,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:20 ~ propagate_from_trait_match[317d]::supply[0]) with substs [
= note: defining type: DefId(0:11 ~ propagate_from_trait_match[317d]::supply[0]) with substs [
'_#1r,
T,
]

View file

@ -4,7 +4,7 @@ note: No external requirements
LL | expect_sig(|a, b| b); // ought to return `a`
| ^^^^^^^^
|
= note: defining type: DefId(0:13 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:4 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]) with closure substs [
i16,
for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32)) -> &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) i32,
]
@ -27,7 +27,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:12 ~ return_wrong_bound_region[317d]::test[0]) with substs []
= note: defining type: DefId(0:3 ~ return_wrong_bound_region[317d]::test[0]) with substs []
error: aborting due to previous error

View file

@ -4,7 +4,7 @@ note: External requirements
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:22 ~ projection_no_regions_closure[317d]::no_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:13 ~ projection_no_regions_closure[317d]::no_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
@ -25,7 +25,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:19 ~ projection_no_regions_closure[317d]::no_region[0]) with substs [
= note: defining type: DefId(0:10 ~ projection_no_regions_closure[317d]::no_region[0]) with substs [
'_#1r,
T,
]
@ -44,7 +44,7 @@ note: External requirements
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:26 ~ projection_no_regions_closure[317d]::correct_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:17 ~ projection_no_regions_closure[317d]::correct_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
@ -64,7 +64,7 @@ LL | | with_signature(x, |mut y| Box::new(y.next()))
LL | | }
| |_^
|
= note: defining type: DefId(0:23 ~ projection_no_regions_closure[317d]::correct_region[0]) with substs [
= note: defining type: DefId(0:14 ~ projection_no_regions_closure[317d]::correct_region[0]) with substs [
'_#1r,
T,
]
@ -75,7 +75,7 @@ note: External requirements
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:31 ~ projection_no_regions_closure[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:22 ~ projection_no_regions_closure[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
@ -97,7 +97,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:27 ~ projection_no_regions_closure[317d]::wrong_region[0]) with substs [
= note: defining type: DefId(0:18 ~ projection_no_regions_closure[317d]::wrong_region[0]) with substs [
'_#1r,
'_#2r,
T,
@ -117,7 +117,7 @@ note: External requirements
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:36 ~ projection_no_regions_closure[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:27 ~ projection_no_regions_closure[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
@ -139,7 +139,7 @@ LL | | with_signature(x, |mut y| Box::new(y.next()))
LL | | }
| |_^
|
= note: defining type: DefId(0:32 ~ projection_no_regions_closure[317d]::outlives_region[0]) with substs [
= note: defining type: DefId(0:23 ~ projection_no_regions_closure[317d]::outlives_region[0]) with substs [
'_#1r,
'_#2r,
T,

View file

@ -4,7 +4,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:28 ~ projection_one_region_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:19 ~ projection_one_region_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
@ -27,7 +27,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:24 ~ projection_one_region_closure[317d]::no_relationships_late[0]) with substs [
= note: defining type: DefId(0:15 ~ projection_one_region_closure[317d]::no_relationships_late[0]) with substs [
'_#1r,
T,
]
@ -38,7 +38,7 @@ error[E0309]: the parameter type `T` may not live long enough
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:24 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(25), 'a))`...
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:15 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(16), 'a))`...
error: lifetime may not live long enough
--> $DIR/projection-one-region-closure.rs:45:39
@ -57,7 +57,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:33 ~ projection_one_region_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:24 ~ projection_one_region_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
@ -80,7 +80,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:29 ~ projection_one_region_closure[317d]::no_relationships_early[0]) with substs [
= note: defining type: DefId(0:20 ~ projection_one_region_closure[317d]::no_relationships_early[0]) with substs [
'_#1r,
'_#2r,
T,
@ -111,7 +111,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:38 ~ projection_one_region_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:29 ~ projection_one_region_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
@ -133,7 +133,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:34 ~ projection_one_region_closure[317d]::projection_outlives[0]) with substs [
= note: defining type: DefId(0:25 ~ projection_one_region_closure[317d]::projection_outlives[0]) with substs [
'_#1r,
'_#2r,
T,
@ -145,7 +145,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:43 ~ projection_one_region_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:34 ~ projection_one_region_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
@ -168,7 +168,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:39 ~ projection_one_region_closure[317d]::elements_outlive[0]) with substs [
= note: defining type: DefId(0:30 ~ projection_one_region_closure[317d]::elements_outlive[0]) with substs [
'_#1r,
'_#2r,
T,

View file

@ -4,7 +4,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:28 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:19 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
@ -26,7 +26,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:24 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [
= note: defining type: DefId(0:15 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [
'_#1r,
T,
]
@ -48,7 +48,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:33 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:24 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
@ -70,7 +70,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:29 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [
= note: defining type: DefId(0:20 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [
'_#1r,
'_#2r,
T,
@ -93,7 +93,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:38 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:29 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
@ -115,7 +115,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:34 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [
= note: defining type: DefId(0:25 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [
'_#1r,
'_#2r,
T,
@ -127,7 +127,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:43 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:34 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
@ -149,7 +149,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:39 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]) with substs [
= note: defining type: DefId(0:30 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]) with substs [
'_#1r,
'_#2r,
T,
@ -161,7 +161,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:47 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:38 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
@ -182,7 +182,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:44 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]) with substs [
= note: defining type: DefId(0:35 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]) with substs [
'_#1r,
T,
]

View file

@ -4,7 +4,7 @@ note: No external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:28 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:19 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
@ -23,7 +23,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:24 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]) with substs [
= note: defining type: DefId(0:15 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]) with substs [
'_#1r,
T,
]
@ -34,7 +34,7 @@ note: No external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:33 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:24 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
@ -54,7 +54,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:29 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]) with substs [
= note: defining type: DefId(0:20 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]) with substs [
'_#1r,
'_#2r,
T,
@ -66,7 +66,7 @@ note: No external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:38 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:29 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
@ -86,7 +86,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:34 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]) with substs [
= note: defining type: DefId(0:25 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]) with substs [
'_#1r,
'_#2r,
T,
@ -98,7 +98,7 @@ note: No external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:43 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:34 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
@ -118,7 +118,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:39 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]) with substs [
= note: defining type: DefId(0:30 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]) with substs [
'_#1r,
'_#2r,
T,
@ -130,7 +130,7 @@ note: No external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:47 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:38 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
@ -149,7 +149,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:44 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]) with substs [
= note: defining type: DefId(0:35 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]) with substs [
'_#1r,
T,
]

View file

@ -4,7 +4,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:31 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:22 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
@ -27,7 +27,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:26 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [
= note: defining type: DefId(0:17 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [
'_#1r,
'_#2r,
T,
@ -39,7 +39,7 @@ error[E0309]: the associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `<T as Anything<'_#5r, '_#6r>>::AssocType: ReFree(DefId(0:26 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(27), 'a))`...
= help: consider adding an explicit lifetime bound `<T as Anything<'_#5r, '_#6r>>::AssocType: ReFree(DefId(0:17 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(18), 'a))`...
note: External requirements
--> $DIR/projection-two-region-trait-bound-closure.rs:48:29
@ -47,7 +47,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:37 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:28 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
'_#3r,
@ -70,7 +70,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:32 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [
= note: defining type: DefId(0:23 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [
'_#1r,
'_#2r,
'_#3r,
@ -91,7 +91,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:43 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:34 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
'_#3r,
@ -114,7 +114,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:38 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [
= note: defining type: DefId(0:29 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [
'_#1r,
'_#2r,
'_#3r,
@ -127,7 +127,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:49 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:40 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
'_#3r,
@ -150,7 +150,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:44 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]) with substs [
= note: defining type: DefId(0:35 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]) with substs [
'_#1r,
'_#2r,
'_#3r,
@ -163,7 +163,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:55 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:46 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
'_#3r,
@ -186,7 +186,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:50 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]) with substs [
= note: defining type: DefId(0:41 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]) with substs [
'_#1r,
'_#2r,
'_#3r,
@ -199,7 +199,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:60 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:51 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
@ -221,7 +221,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:56 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]) with substs [
= note: defining type: DefId(0:47 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]) with substs [
'_#1r,
T,
]
@ -243,7 +243,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:65 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:56 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
@ -265,7 +265,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:61 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]) with substs [
= note: defining type: DefId(0:52 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]) with substs [
'_#1r,
'_#2r,
T,
@ -277,7 +277,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:69 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:60 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
@ -298,7 +298,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t));
LL | | }
| |_^
|
= note: defining type: DefId(0:66 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]) with substs [
= note: defining type: DefId(0:57 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]) with substs [
'_#1r,
T,
]

View file

@ -4,7 +4,7 @@ note: External requirements
LL | twice(cell, value, |a, b| invoke(a, b));
| ^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:20 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:11 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]::{{closure}}[0]) with closure substs [
T,
i16,
for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) ()>>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) T)),
@ -21,7 +21,7 @@ LL | | twice(cell, value, |a, b| invoke(a, b));
LL | | }
| |_^
|
= note: defining type: DefId(0:18 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]) with substs [
= note: defining type: DefId(0:9 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]) with substs [
T,
]
@ -31,7 +31,7 @@ note: External requirements
LL | twice(cell, value, |a, b| invoke(a, b));
| ^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:24 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:15 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]::{{closure}}[0]) with closure substs [
T,
i16,
for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) ()>>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) T)),
@ -49,7 +49,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:21 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]) with substs [
= note: defining type: DefId(0:12 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]) with substs [
T,
]
@ -59,7 +59,7 @@ error[E0309]: the parameter type `T` may not live long enough
LL | twice(cell, value, |a, b| invoke(a, b));
| ^^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:21 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]), BrNamed(crate0:DefIndex(22), 'a))`...
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:12 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]), BrNamed(crate0:DefIndex(13), 'a))`...
error: aborting due to previous error

View file

@ -4,7 +4,7 @@ note: External requirements
LL | with_signature(x, |y| y)
| ^^^^^
|
= note: defining type: DefId(0:20 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:11 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
@ -25,7 +25,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:17 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]) with substs [
= note: defining type: DefId(0:8 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]) with substs [
'_#1r,
T,
]

View file

@ -11,7 +11,7 @@ LL | | require(&x, &y)
LL | | })
| |_____^
|
= note: defining type: DefId(0:23 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:14 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]::{{closure}}[0]) with closure substs [
T,
i32,
extern "rust-call" fn((std::cell::Cell<&'_#1r ()>, T)),
@ -32,7 +32,7 @@ LL | | })
LL | | }
| |_^
|
= note: defining type: DefId(0:20 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]) with substs [
= note: defining type: DefId(0:11 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]) with substs [
T,
]
@ -49,7 +49,7 @@ LL | | require(&x, &y)
LL | | })
| |_____^
|
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:20 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(crate0:DefIndex(21), 'a))`...
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:11 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(crate0:DefIndex(12), 'a))`...
note: External requirements
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:43:26
@ -64,7 +64,7 @@ LL | | require(&x, &y)
LL | | })
| |_____^
|
= note: defining type: DefId(0:27 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:18 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
@ -85,7 +85,7 @@ LL | | })
LL | | }
| |_^
|
= note: defining type: DefId(0:24 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]) with substs [
= note: defining type: DefId(0:15 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]) with substs [
'_#1r,
T,
]
@ -101,7 +101,7 @@ LL | | require(&x, &y)
LL | | })
| |_____^
|
= note: defining type: DefId(0:32 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:23 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
T,
i32,
@ -123,7 +123,7 @@ LL | | })
LL | | }
| |_^
|
= note: defining type: DefId(0:28 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]) with substs [
= note: defining type: DefId(0:19 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]) with substs [
'_#1r,
T,
]
@ -139,7 +139,7 @@ LL | | require(&x, &y)
LL | | })
| |_____^
|
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:28 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(crate0:DefIndex(29), 'a))`...
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:19 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(crate0:DefIndex(20), 'a))`...
note: External requirements
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:77:26
@ -151,7 +151,7 @@ LL | | require(&x, &y)
LL | | })
| |_____^
|
= note: defining type: DefId(0:37 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:28 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [
'_#1r,
'_#2r,
T,
@ -173,7 +173,7 @@ LL | | })
LL | | }
| |_^
|
= note: defining type: DefId(0:33 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]) with substs [
= note: defining type: DefId(0:24 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]) with substs [
'_#1r,
'_#2r,
T,

View file

@ -36,13 +36,13 @@ LL | )
|
error: expected one of `.`, `?`, `{`, or an operator, found `}`
--> $DIR/issue-62973.rs:8:1
--> $DIR/issue-62973.rs:8:2
|
LL | fn p() { match s { v, E { [) {) }
| ----- while parsing this match expression
LL |
LL |
| ^ expected one of `.`, `?`, `{`, or an operator here
| ^ expected one of `.`, `?`, `{`, or an operator here
error: incorrect close delimiter: `)`
--> $DIR/issue-62973.rs:6:28

View file

@ -23,16 +23,16 @@ LL | fn i(n{...,f #
| `..` must be at the end and cannot have a trailing comma
error: expected `[`, found `}`
--> $DIR/issue-63135.rs:3:15
--> $DIR/issue-63135.rs:3:16
|
LL | fn i(n{...,f #
| ^ expected `[`
| ^ expected `[`
error: expected one of `:` or `|`, found `)`
--> $DIR/issue-63135.rs:3:15
--> $DIR/issue-63135.rs:3:16
|
LL | fn i(n{...,f #
| ^ expected one of `:` or `|` here
| ^ expected one of `:` or `|` here
error: aborting due to 5 previous errors

View file

@ -5,7 +5,7 @@ LL | macro_rules! inner {
| ------------------ when calling this macro
...
LL | /// Outer
| ^ no rules expected this token in macro call
| ^^^^^^^^^ no rules expected this token in macro call
error: aborting due to previous error

View file

@ -0,0 +1,3 @@
// ignore-tidy-trailing-newlines
// error-pattern: aborting due to 2 previous errors
fn main((ؼ

View file

@ -0,0 +1,17 @@
error: this file contains an un-closed delimiter
--> $DIR/missing_right_paren.rs:3:11
|
LL | fn main((ؼ
| -- ^
| ||
| |un-closed delimiter
| un-closed delimiter
error: expected one of `:` or `|`, found `)`
--> $DIR/missing_right_paren.rs:3:11
|
LL | fn main((ؼ
| ^ expected one of `:` or `|` here
error: aborting due to 2 previous errors

View file

@ -7,8 +7,13 @@ LL | Self { inner: 1.5f32 };
error[E0308]: mismatched types
--> $DIR/struct-path-self-type-mismatch.rs:15:20
|
LL | impl<T> Foo<T> {
| - expected type parameter
LL | fn new<U>(u: U) -> Foo<U> {
| - found type parameter
...
LL | inner: u
| ^ expected type parameter, found a different type parameter
| ^ expected type parameter `T`, found type parameter `U`
|
= note: expected type `T`
found type `U`
@ -18,14 +23,18 @@ LL | inner: u
error[E0308]: mismatched types
--> $DIR/struct-path-self-type-mismatch.rs:13:9
|
LL | impl<T> Foo<T> {
| - found type parameter
LL | fn new<U>(u: U) -> Foo<U> {
| ------ expected `Foo<U>` because of return type
| - ------ expected `Foo<U>` because of return type
| |
| expected type parameter
LL | / Self {
LL | |
LL | | inner: u
LL | |
LL | | }
| |_________^ expected type parameter, found a different type parameter
| |_________^ expected type parameter `U`, found type parameter `T`
|
= note: expected type `Foo<U>`
found type `Foo<T>`

View file

@ -1,4 +1,4 @@
error[E0071]: expected struct, variant or union type, found type parameter
error[E0071]: expected struct, variant or union type, found type parameter `Self`
--> $DIR/struct-path-self.rs:5:17
|
LL | let s = Self {};
@ -10,13 +10,13 @@ error[E0109]: type arguments are not allowed for this type
LL | let z = Self::<u8> {};
| ^^ type argument not allowed
error[E0071]: expected struct, variant or union type, found type parameter
error[E0071]: expected struct, variant or union type, found type parameter `Self`
--> $DIR/struct-path-self.rs:7:17
|
LL | let z = Self::<u8> {};
| ^^^^^^^^^^ not a struct
error[E0071]: expected struct, variant or union type, found type parameter
error[E0071]: expected struct, variant or union type, found type parameter `Self`
--> $DIR/struct-path-self.rs:11:13
|
LL | Self { .. } => {}

View file

@ -0,0 +1,5 @@
fn main() -> Result<(), ()> {
vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?;
//~^ ERROR expected `::`, found `(`
Ok(())
}

View file

@ -0,0 +1,13 @@
error: expected `::`, found `(`
--> $DIR/type-ascription-instead-of-path-2.rs:2:55
|
LL | vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?;
| - ^ expected `::`
| |
| help: maybe write a path separator here: `::`
|
= note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
= note: for more information, see https://github.com/rust-lang/rust/issues/23416
error: aborting due to previous error

View file

@ -1,8 +1,11 @@
error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:13:25
|
LL | impl<T> Enum<T> {
| - this type parameter
LL | fn ts_variant() {
LL | Self::TSVariant(());
| ^^ expected type parameter, found ()
| ^^ expected type parameter `T`, found ()
|
= note: expected type `T`
found type `()`
@ -24,8 +27,11 @@ LL | Self::<()>::TSVariant(());
error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:17:31
|
LL | impl<T> Enum<T> {
| - this type parameter
...
LL | Self::<()>::TSVariant(());
| ^^ expected type parameter, found ()
| ^^ expected type parameter `T`, found ()
|
= note: expected type `T`
found type `()`
@ -47,8 +53,11 @@ LL | Self::<()>::TSVariant::<()>(());
error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:26:29
|
LL | impl<T> Enum<T> {
| - this type parameter
...
LL | Self::SVariant { v: () };
| ^^ expected type parameter, found ()
| ^^ expected type parameter `T`, found ()
|
= note: expected type `T`
found type `()`
@ -64,8 +73,11 @@ LL | Self::SVariant::<()> { v: () };
error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:28:35
|
LL | impl<T> Enum<T> {
| - this type parameter
...
LL | Self::SVariant::<()> { v: () };
| ^^ expected type parameter, found ()
| ^^ expected type parameter `T`, found ()
|
= note: expected type `T`
found type `()`
@ -81,8 +93,11 @@ LL | Self::<()>::SVariant { v: () };
error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:31:35
|
LL | impl<T> Enum<T> {
| - this type parameter
...
LL | Self::<()>::SVariant { v: () };
| ^^ expected type parameter, found ()
| ^^ expected type parameter `T`, found ()
|
= note: expected type `T`
found type `()`
@ -104,8 +119,11 @@ LL | Self::<()>::SVariant::<()> { v: () };
error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:34:41
|
LL | impl<T> Enum<T> {
| - this type parameter
...
LL | Self::<()>::SVariant::<()> { v: () };
| ^^ expected type parameter, found ()
| ^^ expected type parameter `T`, found ()
|
= note: expected type `T`
found type `()`

View file

@ -0,0 +1,8 @@
fn loop_ending() -> i32 {
loop {
if false { break; } //~ ERROR mismatched types
return 42;
}
}
fn main() {}

View file

@ -0,0 +1,18 @@
error[E0308]: mismatched types
--> $DIR/type-error-break-tail.rs:3:20
|
LL | fn loop_ending() -> i32 {
| --- expected `i32` because of return type
LL | loop {
LL | if false { break; }
| ^^^^^
| |
| expected i32, found ()
| help: give it a value of the expected type: `break 42`
|
= note: expected type `i32`
found type `()`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.

View file

@ -6,7 +6,7 @@ fn foo<Foo, Bar>(x: Foo) -> Bar {
//~^ ERROR mismatched types
//~| expected type `Bar`
//~| found type `Foo`
//~| expected type parameter, found a different type parameter
//~| expected type parameter `Bar`, found type parameter `Foo`
}
fn main() {}

View file

@ -2,9 +2,12 @@ error[E0308]: mismatched types
--> $DIR/type-parameter-names.rs:5:5
|
LL | fn foo<Foo, Bar>(x: Foo) -> Bar {
| --- expected `Bar` because of return type
| --- --- --- expected `Bar` because of return type
| | |
| | expected type parameter
| found type parameter
LL | x
| ^ expected type parameter, found a different type parameter
| ^ expected type parameter `Bar`, found type parameter `Foo`
|
= note: expected type `Bar`
found type `Foo`

View file

@ -5,7 +5,7 @@ trait BrokenAdd: Copy + Add<Output=Self> {
*self + rhs //~ ERROR mismatched types
//~| expected type `Self`
//~| found type `T`
//~| expected type parameter, found a different type parameter
//~| expected type parameter `Self`, found type parameter `T`
}
}

View file

@ -1,8 +1,16 @@
error[E0308]: mismatched types
--> $DIR/type-params-in-different-spaces-1.rs:5:17
|
LL | *self + rhs
| ^^^ expected type parameter, found a different type parameter
LL | / trait BrokenAdd: Copy + Add<Output=Self> {
LL | | fn broken_add<T>(&self, rhs: T) -> Self {
| | - found type parameter
LL | | *self + rhs
| | ^^^ expected type parameter `Self`, found type parameter `T`
LL | |
... |
LL | | }
LL | | }
| |_- expected type parameter
|
= note: expected type `Self`
found type `T`

View file

@ -1,10 +1,16 @@
error[E0308]: mismatched types
--> $DIR/type-params-in-different-spaces-3.rs:3:9
|
LL | fn test<X>(u: X) -> Self {
| ---- expected `Self` because of return type
LL | u
| ^ expected type parameter, found a different type parameter
LL | / trait Tr : Sized {
LL | | fn test<X>(u: X) -> Self {
| | - ---- expected `Self` because of return type
| | |
| | found type parameter
LL | | u
| | ^ expected type parameter `Self`, found type parameter `X`
LL | | }
LL | | }
| |_- expected type parameter
|
= note: expected type `Self`
found type `X`