1
Fork 0

Auto merge of #120843 - matthiaskrgr:rollup-med37z5, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #113671 (Make privacy visitor use types more (instead of HIR))
 - #120308 (core/time: avoid divisions in Duration::new)
 - #120693 (Invert diagnostic lints.)
 - #120704 (A drive-by rewrite of `give_region_a_name()`)
 - #120809 (Use `transmute_unchecked` in `NonZero::new`.)
 - #120817 (Fix more `ty::Error` ICEs in MIR passes)
 - #120828 (Fix `ErrorGuaranteed` unsoundness with stash/steal.)
 - #120831 (Startup objects disappearing from sysroot)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-02-09 15:34:48 +00:00
commit e28fae52d9
155 changed files with 674 additions and 840 deletions

View file

@ -4374,6 +4374,7 @@ dependencies = [
"rustc_middle", "rustc_middle",
"rustc_session", "rustc_session",
"rustc_span", "rustc_span",
"rustc_ty_utils",
"tracing", "tracing",
] ]

View file

@ -22,8 +22,6 @@
#![cfg_attr(test, feature(test))] #![cfg_attr(test, feature(test))]
#![feature(strict_provenance)] #![feature(strict_provenance)]
#![deny(unsafe_op_in_unsafe_fn)] #![deny(unsafe_op_in_unsafe_fn)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![allow(internal_features)] #![allow(internal_features)]
#![allow(clippy::mut_from_ref)] // Arena allocators are one of the places where this pattern is fine. #![allow(clippy::mut_from_ref)] // Arena allocators are one of the places where this pattern is fine.

View file

@ -18,8 +18,6 @@
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(negative_impls)] #![feature(negative_impls)]
#![feature(stmt_expr_attributes)] #![feature(stmt_expr_attributes)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#[macro_use] #[macro_use]
extern crate rustc_macros; extern crate rustc_macros;

View file

@ -36,8 +36,6 @@
#![feature(assert_matches)] #![feature(assert_matches)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(let_chains)] #![feature(let_chains)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#[macro_use] #[macro_use]
extern crate tracing; extern crate tracing;

View file

@ -11,8 +11,6 @@
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(iter_is_partitioned)] #![feature(iter_is_partitioned)]
#![feature(let_chains)] #![feature(let_chains)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
pub mod ast_validation; pub mod ast_validation;
mod errors; mod errors;

View file

@ -1,8 +1,6 @@
#![allow(internal_features)] #![allow(internal_features)]
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![doc(rust_logo)] #![doc(rust_logo)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![feature(box_patterns)] #![feature(box_patterns)]
mod helpers; mod helpers;

View file

@ -8,8 +8,6 @@
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![doc(rust_logo)] #![doc(rust_logo)]
#![feature(let_chains)] #![feature(let_chains)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#[macro_use] #[macro_use]
extern crate rustc_macros; extern crate rustc_macros;

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use crate::path_utils::allow_two_phase_borrow; use crate::path_utils::allow_two_phase_borrow;
use crate::place_ext::PlaceExt; use crate::place_ext::PlaceExt;
use crate::BorrowIndex; use crate::BorrowIndex;

View file

@ -1,3 +1,6 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use rustc_errors::{codes::*, struct_span_code_err, DiagCtxt, DiagnosticBuilder}; use rustc_errors::{codes::*, struct_span_code_err, DiagCtxt, DiagnosticBuilder};
use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_span::Span; use rustc_span::Span;

View file

@ -1,6 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_data_structures::graph::scc::Sccs; use rustc_data_structures::graph::scc::Sccs;
use rustc_index::{IndexSlice, IndexVec}; use rustc_index::{IndexSlice, IndexVec};
use rustc_middle::mir::ConstraintCategory; use rustc_middle::mir::ConstraintCategory;

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
//! This file provides API for compiler consumers. //! This file provides API for compiler consumers.
use rustc_hir::def_id::LocalDefId; use rustc_hir::def_id::LocalDefId;

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::graph::WithSuccessors; use rustc_data_structures::graph::WithSuccessors;
use rustc_index::bit_set::BitSet; use rustc_index::bit_set::BitSet;

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_middle::mir::visit::{ use rustc_middle::mir::visit::{
MutatingUseContext, NonMutatingUseContext, NonUseContext, PlaceContext, MutatingUseContext, NonMutatingUseContext, NonUseContext, PlaceContext,
}; };

View file

@ -1,6 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_errors::DiagnosticBuilder; use rustc_errors::DiagnosticBuilder;
use rustc_infer::infer::canonical::Canonical; use rustc_infer::infer::canonical::Canonical;
use rustc_infer::infer::error_reporting::nice_region_error::NiceRegionError; use rustc_infer::infer::error_reporting::nice_region_error::NiceRegionError;

View file

@ -1,5 +1,8 @@
// ignore-tidy-filelength // ignore-tidy-filelength
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use either::Either; use either::Either;
use rustc_data_structures::captures::Captures; use rustc_data_structures::captures::Captures;
use rustc_data_structures::fx::FxIndexSet; use rustc_data_structures::fx::FxIndexSet;

View file

@ -1,5 +1,8 @@
//! Print diagnostics to explain why values are borrowed. //! Print diagnostics to explain why values are borrowed.
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use rustc_errors::{Applicability, Diagnostic}; use rustc_errors::{Applicability, Diagnostic};
use rustc_hir as hir; use rustc_hir as hir;
use rustc_hir::intravisit::Visitor; use rustc_hir::intravisit::Visitor;

View file

@ -1,6 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use std::collections::BTreeSet; use std::collections::BTreeSet;
use rustc_middle::mir::visit::{PlaceContext, Visitor}; use rustc_middle::mir::visit::{PlaceContext, Visitor};

View file

@ -1,6 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use std::collections::VecDeque; use std::collections::VecDeque;
use std::rc::Rc; use std::rc::Rc;

View file

@ -1,3 +1,6 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder}; use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder};
use rustc_middle::mir::*; use rustc_middle::mir::*;
use rustc_middle::ty::{self, Ty}; use rustc_middle::ty::{self, Ty};

View file

@ -1,3 +1,6 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use hir::ExprKind; use hir::ExprKind;
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder}; use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder};
use rustc_hir as hir; use rustc_hir as hir;

View file

@ -1,6 +1,9 @@
//! Contains utilities for generating suggestions for borrowck errors related to unsatisfied //! Contains utilities for generating suggestions for borrowck errors related to unsatisfied
//! outlives constraints. //! outlives constraints.
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use rustc_data_structures::fx::FxIndexSet; use rustc_data_structures::fx::FxIndexSet;
use rustc_errors::Diagnostic; use rustc_errors::Diagnostic;
use rustc_middle::ty::RegionVid; use rustc_middle::ty::RegionVid;

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
//! Error reporting machinery for lifetime errors. //! Error reporting machinery for lifetime errors.
use rustc_data_structures::fx::FxIndexSet; use rustc_data_structures::fx::FxIndexSet;

View file

@ -1,6 +1,10 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use std::fmt::{self, Display}; use std::fmt::{self, Display};
use std::iter; use std::iter;
use rustc_data_structures::fx::IndexEntry;
use rustc_errors::Diagnostic; use rustc_errors::Diagnostic;
use rustc_hir as hir; use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res}; use rustc_hir::def::{DefKind, Res};
@ -14,7 +18,7 @@ use crate::{universal_regions::DefiningTy, MirBorrowckCtxt};
/// A name for a particular region used in emitting diagnostics. This name could be a generated /// A name for a particular region used in emitting diagnostics. This name could be a generated
/// name like `'1`, a name used by the user like `'a`, or a name like `'static`. /// name like `'1`, a name used by the user like `'a`, or a name like `'static`.
#[derive(Debug, Clone)] #[derive(Debug, Clone, Copy)]
pub(crate) struct RegionName { pub(crate) struct RegionName {
/// The name of the region (interned). /// The name of the region (interned).
pub(crate) name: Symbol, pub(crate) name: Symbol,
@ -25,7 +29,7 @@ pub(crate) struct RegionName {
/// Denotes the source of a region that is named by a `RegionName`. For example, a free region that /// Denotes the source of a region that is named by a `RegionName`. For example, a free region that
/// was named by the user would get `NamedLateParamRegion` and `'static` lifetime would get `Static`. /// was named by the user would get `NamedLateParamRegion` and `'static` lifetime would get `Static`.
/// This helps to print the right kinds of diagnostics. /// This helps to print the right kinds of diagnostics.
#[derive(Debug, Clone)] #[derive(Debug, Clone, Copy)]
pub(crate) enum RegionNameSource { pub(crate) enum RegionNameSource {
/// A bound (not free) region that was instantiated at the def site (not an HRTB). /// A bound (not free) region that was instantiated at the def site (not an HRTB).
NamedEarlyParamRegion(Span), NamedEarlyParamRegion(Span),
@ -42,7 +46,7 @@ pub(crate) enum RegionNameSource {
/// The region corresponding to the return type of a closure. /// The region corresponding to the return type of a closure.
AnonRegionFromOutput(RegionNameHighlight, &'static str), AnonRegionFromOutput(RegionNameHighlight, &'static str),
/// The region from a type yielded by a coroutine. /// The region from a type yielded by a coroutine.
AnonRegionFromYieldTy(Span, String), AnonRegionFromYieldTy(Span, Symbol),
/// An anonymous region from an async fn. /// An anonymous region from an async fn.
AnonRegionFromAsyncFn(Span), AnonRegionFromAsyncFn(Span),
/// An anonymous region from an impl self type or trait /// An anonymous region from an impl self type or trait
@ -51,7 +55,7 @@ pub(crate) enum RegionNameSource {
/// Describes what to highlight to explain to the user that we're giving an anonymous region a /// Describes what to highlight to explain to the user that we're giving an anonymous region a
/// synthesized name, and how to highlight it. /// synthesized name, and how to highlight it.
#[derive(Debug, Clone)] #[derive(Debug, Clone, Copy)]
pub(crate) enum RegionNameHighlight { pub(crate) enum RegionNameHighlight {
/// The anonymous region corresponds to a reference that was found by traversing the type in the HIR. /// The anonymous region corresponds to a reference that was found by traversing the type in the HIR.
MatchedHirTy(Span), MatchedHirTy(Span),
@ -59,11 +63,11 @@ pub(crate) enum RegionNameHighlight {
MatchedAdtAndSegment(Span), MatchedAdtAndSegment(Span),
/// The anonymous region corresponds to a region where the type annotation is completely missing /// The anonymous region corresponds to a region where the type annotation is completely missing
/// from the code, e.g. in a closure arguments `|x| { ... }`, where `x` is a reference. /// from the code, e.g. in a closure arguments `|x| { ... }`, where `x` is a reference.
CannotMatchHirTy(Span, String), CannotMatchHirTy(Span, Symbol),
/// The anonymous region corresponds to a region where the type annotation is completely missing /// The anonymous region corresponds to a region where the type annotation is completely missing
/// from the code, and *even if* we print out the full name of the type, the region name won't /// from the code, and *even if* we print out the full name of the type, the region name won't
/// be included. This currently occurs for opaque types like `impl Future`. /// be included. This currently occurs for opaque types like `impl Future`.
Occluded(Span, String), Occluded(Span, Symbol),
} }
impl RegionName { impl RegionName {
@ -247,25 +251,28 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
assert!(self.regioncx.universal_regions().is_universal_region(fr)); assert!(self.regioncx.universal_regions().is_universal_region(fr));
if let Some(value) = self.region_names.try_borrow_mut().unwrap().get(&fr) { match self.region_names.borrow_mut().entry(fr) {
return Some(value.clone()); IndexEntry::Occupied(precomputed_name) => Some(*precomputed_name.get()),
} IndexEntry::Vacant(slot) => {
let new_name = self
let value = self
.give_name_from_error_region(fr) .give_name_from_error_region(fr)
.or_else(|| self.give_name_if_anonymous_region_appears_in_arguments(fr)) .or_else(|| self.give_name_if_anonymous_region_appears_in_arguments(fr))
.or_else(|| self.give_name_if_anonymous_region_appears_in_upvars(fr)) .or_else(|| self.give_name_if_anonymous_region_appears_in_upvars(fr))
.or_else(|| self.give_name_if_anonymous_region_appears_in_output(fr)) .or_else(|| self.give_name_if_anonymous_region_appears_in_output(fr))
.or_else(|| self.give_name_if_anonymous_region_appears_in_yield_ty(fr)) .or_else(|| self.give_name_if_anonymous_region_appears_in_yield_ty(fr))
.or_else(|| self.give_name_if_anonymous_region_appears_in_impl_signature(fr)) .or_else(|| self.give_name_if_anonymous_region_appears_in_impl_signature(fr))
.or_else(|| self.give_name_if_anonymous_region_appears_in_arg_position_impl_trait(fr)); .or_else(|| {
self.give_name_if_anonymous_region_appears_in_arg_position_impl_trait(fr)
});
if let Some(value) = &value { if let Some(new_name) = new_name {
self.region_names.try_borrow_mut().unwrap().insert(fr, value.clone()); slot.insert(new_name);
} }
debug!("give_region_a_name: gave name {:?}", new_name);
debug!("give_region_a_name: gave name {:?}", value); new_name
value }
}
} }
/// Checks for the case where `fr` maps to something that the /// Checks for the case where `fr` maps to something that the
@ -457,9 +464,9 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
); );
if type_name.contains(&format!("'{counter}")) { if type_name.contains(&format!("'{counter}")) {
// Only add a label if we can confirm that a region was labelled. // Only add a label if we can confirm that a region was labelled.
RegionNameHighlight::CannotMatchHirTy(span, type_name) RegionNameHighlight::CannotMatchHirTy(span, Symbol::intern(&type_name))
} else { } else {
RegionNameHighlight::Occluded(span, type_name) RegionNameHighlight::Occluded(span, Symbol::intern(&type_name))
} }
} }
@ -888,7 +895,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
Some(RegionName { Some(RegionName {
name: self.synthesize_region_name(), name: self.synthesize_region_name(),
source: RegionNameSource::AnonRegionFromYieldTy(yield_span, type_name), source: RegionNameSource::AnonRegionFromYieldTy(yield_span, Symbol::intern(&type_name)),
}) })
} }
@ -980,7 +987,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
Some(RegionName { Some(RegionName {
name: region_name, name: region_name,
source: RegionNameSource::AnonRegionFromArgument( source: RegionNameSource::AnonRegionFromArgument(
RegionNameHighlight::CannotMatchHirTy(arg_span, arg_name?.to_string()), RegionNameHighlight::CannotMatchHirTy(arg_span, arg_name?),
), ),
}) })
} else { } else {

View file

@ -1,6 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use crate::region_infer::RegionInferenceContext; use crate::region_infer::RegionInferenceContext;
use rustc_index::IndexSlice; use rustc_index::IndexSlice;
use rustc_middle::mir::{Body, Local}; use rustc_middle::mir::{Body, Local};

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use crate::location::{LocationIndex, LocationTable}; use crate::location::{LocationIndex, LocationTable};
use crate::BorrowIndex; use crate::BorrowIndex;
use polonius_engine::AllFacts as PoloniusFacts; use polonius_engine::AllFacts as PoloniusFacts;

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_index::IndexVec; use rustc_index::IndexVec;
use rustc_middle::mir::{BasicBlock, Body, Location}; use rustc_middle::mir::{BasicBlock, Body, Location};

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_data_structures::captures::Captures; use rustc_data_structures::captures::Captures;
use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::fx::FxIndexMap;
use rustc_index::{IndexSlice, IndexVec}; use rustc_index::{IndexSlice, IndexVec};

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
//! The entry point of the NLL borrow checker. //! The entry point of the NLL borrow checker.
use polonius_engine::{Algorithm, Output}; use polonius_engine::{Algorithm, Output};

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use crate::borrow_set::{BorrowData, BorrowSet, TwoPhaseActivation}; use crate::borrow_set::{BorrowData, BorrowSet, TwoPhaseActivation};
use crate::places_conflict; use crate::places_conflict;
use crate::AccessDepth; use crate::AccessDepth;

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use crate::borrow_set::LocalsStateAtExit; use crate::borrow_set::LocalsStateAtExit;
use rustc_hir as hir; use rustc_hir as hir;
use rustc_middle::mir::ProjectionElem; use rustc_middle::mir::ProjectionElem;

View file

@ -50,8 +50,6 @@
//! and either equal or disjoint. //! and either equal or disjoint.
//! - If we did run out of access, the borrow can access a part of it. //! - If we did run out of access, the borrow can access a part of it.
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use crate::ArtificialField; use crate::ArtificialField;
use crate::Overlap; use crate::Overlap;
use crate::{AccessDepth, Deep, Shallow}; use crate::{AccessDepth, Deep, Shallow};

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_data_structures::graph::dominators::Dominators; use rustc_data_structures::graph::dominators::Dominators;
use rustc_middle::mir::visit::Visitor; use rustc_middle::mir::visit::Visitor;
use rustc_middle::mir::{self, BasicBlock, Body, Location, NonDivergingIntrinsic, Place, Rvalue}; use rustc_middle::mir::{self, BasicBlock, Body, Location, NonDivergingIntrinsic, Place, Rvalue};

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_middle::mir::visit::Visitor; use rustc_middle::mir::visit::Visitor;
use rustc_middle::mir::{ use rustc_middle::mir::{
Body, Local, Location, Place, PlaceRef, ProjectionElem, Rvalue, Statement, StatementKind, Body, Local, Location, Place, PlaceRef, ProjectionElem, Rvalue, Statement, StatementKind,

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
//! From the NLL RFC: "The deep [aka 'supporting'] prefixes for an //! From the NLL RFC: "The deep [aka 'supporting'] prefixes for an
//! place are formed by stripping away fields and derefs, except that //! place are formed by stripping away fields and derefs, except that
//! we stop when we reach the deref of a shared reference. [...] " //! we stop when we reach the deref of a shared reference. [...] "

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
//! As part of generating the regions, if you enable `-Zdump-mir=nll`, //! As part of generating the regions, if you enable `-Zdump-mir=nll`,
//! we will generate an annotated copy of the MIR that includes the //! we will generate an annotated copy of the MIR that includes the
//! state of region inference. This code handles emitting the region //! state of region inference. This code handles emitting the region

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
//! This module provides linkage between RegionInferenceContext and //! This module provides linkage between RegionInferenceContext and
//! `rustc_graphviz` traits, specialized to attaching borrowck analysis //! `rustc_graphviz` traits, specialized to attaching borrowck analysis
//! data to rendered labels. //! data to rendered labels.

View file

@ -418,6 +418,8 @@ fn check_opaque_type_parameter_valid(
.into_iter() .into_iter()
.map(|i| tcx.def_span(opaque_generics.param_at(i, tcx).def_id)) .map(|i| tcx.def_span(opaque_generics.param_at(i, tcx).def_id))
.collect(); .collect();
#[allow(rustc::diagnostic_outside_of_impl)]
#[allow(rustc::untranslatable_diagnostic)]
return Err(tcx return Err(tcx
.dcx() .dcx()
.struct_span_err(span, "non-defining opaque type use in defining scope") .struct_span_err(span, "non-defining opaque type use in defining scope")

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use crate::constraints::ConstraintSccIndex; use crate::constraints::ConstraintSccIndex;
use crate::RegionInferenceContext; use crate::RegionInferenceContext;
use itertools::Itertools; use itertools::Itertools;

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::fx::FxIndexSet; use rustc_data_structures::fx::FxIndexSet;
use rustc_index::bit_set::SparseBitMatrix; use rustc_index::bit_set::SparseBitMatrix;

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use crate::BorrowckInferCtxt; use crate::BorrowckInferCtxt;
use rustc_index::IndexSlice; use rustc_index::IndexSlice;
use rustc_infer::infer::NllRegionVariableOrigin; use rustc_infer::infer::NllRegionVariableOrigin;

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
//! This pass type-checks the MIR to ensure it is not broken. //! This pass type-checks the MIR to ensure it is not broken.
use std::rc::Rc; use std::rc::Rc;

View file

@ -12,6 +12,9 @@
//! The code in this file doesn't *do anything* with those results; it //! The code in this file doesn't *do anything* with those results; it
//! just returns them for other code to use. //! just returns them for other code to use.
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::fx::FxHashMap;
use rustc_errors::Diagnostic; use rustc_errors::Diagnostic;
use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::def_id::{DefId, LocalDefId};

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_data_structures::fx::FxIndexSet; use rustc_data_structures::fx::FxIndexSet;
use rustc_middle::mir::visit::{PlaceContext, Visitor}; use rustc_middle::mir::visit::{PlaceContext, Visitor};
use rustc_middle::mir::{ use rustc_middle::mir::{

View file

@ -2,6 +2,8 @@
//! injecting code into the crate before it is lowered to HIR. //! injecting code into the crate before it is lowered to HIR.
#![allow(internal_features)] #![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![doc(rust_logo)] #![doc(rust_logo)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]

View file

@ -3,6 +3,8 @@
#![cfg_attr(doc, doc(rust_logo))] #![cfg_attr(doc, doc(rust_logo))]
#![feature(rustc_private)] #![feature(rustc_private)]
// Note: please avoid adding other feature gates where possible // Note: please avoid adding other feature gates where possible
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![warn(rust_2018_idioms)] #![warn(rust_2018_idioms)]
#![warn(unused_lifetimes)] #![warn(unused_lifetimes)]
#![warn(unreachable_pub)] #![warn(unreachable_pub)]

View file

@ -27,8 +27,6 @@
#![recursion_limit="256"] #![recursion_limit="256"]
#![warn(rust_2018_idioms)] #![warn(rust_2018_idioms)]
#![warn(unused_lifetimes)] #![warn(unused_lifetimes)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
extern crate rustc_apfloat; extern crate rustc_apfloat;
extern crate rustc_ast; extern crate rustc_ast;

View file

@ -15,8 +15,6 @@
#![feature(let_chains)] #![feature(let_chains)]
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(impl_trait_in_assoc_type)] #![feature(impl_trait_in_assoc_type)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#[macro_use] #[macro_use]
extern crate rustc_macros; extern crate rustc_macros;

View file

@ -2,6 +2,8 @@
#![doc(rust_logo)] #![doc(rust_logo)]
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![allow(internal_features)] #![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(associated_type_bounds)] #![feature(associated_type_bounds)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(if_let_guard)] #![feature(if_let_guard)]

View file

@ -5,9 +5,9 @@ Rust MIR: a lowered representation of Rust.
*/ */
#![allow(internal_features)] #![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![doc(rust_logo)] #![doc(rust_logo)]
#![deny(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)] #![feature(assert_matches)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(decl_macro)] #![feature(decl_macro)]

View file

@ -60,6 +60,8 @@ impl<'tcx> MirPass<'tcx> for Validator {
ty::Closure(..) => Abi::RustCall, ty::Closure(..) => Abi::RustCall,
ty::CoroutineClosure(..) => Abi::RustCall, ty::CoroutineClosure(..) => Abi::RustCall,
ty::Coroutine(..) => Abi::Rust, ty::Coroutine(..) => Abi::Rust,
// No need to do MIR validation on error bodies
ty::Error(_) => return,
_ => { _ => {
span_bug!(body.span, "unexpected body ty: {:?} phase {:?}", body_ty, mir_phase) span_bug!(body.span, "unexpected body ty: {:?} phase {:?}", body_ty, mir_phase)
} }

View file

@ -11,8 +11,6 @@
#![allow(rustc::default_hash_types)] #![allow(rustc::default_hash_types)]
#![allow(rustc::potential_query_instability)] #![allow(rustc::potential_query_instability)]
#![cfg_attr(not(parallel_compiler), feature(cell_leak))] #![cfg_attr(not(parallel_compiler), feature(cell_leak))]
#![deny(rustc::diagnostic_outside_of_impl)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(unsafe_op_in_unsafe_fn)] #![deny(unsafe_op_in_unsafe_fn)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)] #![doc(rust_logo)]

View file

@ -12,8 +12,6 @@
#![feature(let_chains)] #![feature(let_chains)]
#![feature(panic_update_hook)] #![feature(panic_update_hook)]
#![feature(result_flattening)] #![feature(result_flattening)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#[macro_use] #[macro_use]
extern crate tracing; extern crate tracing;

View file

@ -5,8 +5,6 @@
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![doc(rust_logo)] #![doc(rust_logo)]
#![deny(rustdoc::invalid_codeblock_attributes)] #![deny(rustdoc::invalid_codeblock_attributes)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
// This higher-order macro defines the error codes that are in use. It is used // This higher-order macro defines the error codes that are in use. It is used
// in the `rustc_errors` crate. Removed error codes are listed in the comment // in the `rustc_errors` crate. Removed error codes are listed in the comment

View file

@ -3,8 +3,6 @@
#![feature(lazy_cell)] #![feature(lazy_cell)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![allow(internal_features)] #![allow(internal_features)]
#[macro_use] #[macro_use]

View file

@ -5,6 +5,8 @@
// tidy-alphabetical-start // tidy-alphabetical-start
#![allow(incomplete_features)] #![allow(incomplete_features)]
#![allow(internal_features)] #![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)] #![doc(rust_logo)]
#![feature(array_windows)] #![feature(array_windows)]
@ -431,6 +433,10 @@ struct DiagCtxtInner {
/// The number of non-lint errors that have been emitted, including duplicates. /// The number of non-lint errors that have been emitted, including duplicates.
err_count: usize, err_count: usize,
/// The number of stashed errors. Unlike the other counts, this can go up
/// and down, so it doesn't guarantee anything.
stashed_err_count: usize,
/// The error count shown to the user at the end. /// The error count shown to the user at the end.
deduplicated_err_count: usize, deduplicated_err_count: usize,
/// The warning count shown to the user at the end. /// The warning count shown to the user at the end.
@ -600,6 +606,7 @@ impl DiagCtxt {
flags: DiagCtxtFlags { can_emit_warnings: true, ..Default::default() }, flags: DiagCtxtFlags { can_emit_warnings: true, ..Default::default() },
lint_err_count: 0, lint_err_count: 0,
err_count: 0, err_count: 0,
stashed_err_count: 0,
deduplicated_err_count: 0, deduplicated_err_count: 0,
deduplicated_warn_count: 0, deduplicated_warn_count: 0,
has_printed: false, has_printed: false,
@ -656,6 +663,7 @@ impl DiagCtxt {
let mut inner = self.inner.borrow_mut(); let mut inner = self.inner.borrow_mut();
inner.lint_err_count = 0; inner.lint_err_count = 0;
inner.err_count = 0; inner.err_count = 0;
inner.stashed_err_count = 0;
inner.deduplicated_err_count = 0; inner.deduplicated_err_count = 0;
inner.deduplicated_warn_count = 0; inner.deduplicated_warn_count = 0;
inner.has_printed = false; inner.has_printed = false;
@ -677,10 +685,8 @@ impl DiagCtxt {
let key = (span.with_parent(None), key); let key = (span.with_parent(None), key);
if diag.is_error() { if diag.is_error() {
if diag.is_lint.is_some() { if diag.is_lint.is_none() {
inner.lint_err_count += 1; inner.stashed_err_count += 1;
} else {
inner.err_count += 1;
} }
} }
@ -696,10 +702,8 @@ impl DiagCtxt {
let key = (span.with_parent(None), key); let key = (span.with_parent(None), key);
let diag = inner.stashed_diagnostics.remove(&key)?; let diag = inner.stashed_diagnostics.remove(&key)?;
if diag.is_error() { if diag.is_error() {
if diag.is_lint.is_some() { if diag.is_lint.is_none() {
inner.lint_err_count -= 1; inner.stashed_err_count -= 1;
} else {
inner.err_count -= 1;
} }
} }
Some(DiagnosticBuilder::new_diagnostic(self, diag)) Some(DiagnosticBuilder::new_diagnostic(self, diag))
@ -925,13 +929,22 @@ impl DiagCtxt {
self.struct_bug(msg).emit() self.struct_bug(msg).emit()
} }
/// This excludes lint errors and delayed bugs. /// This excludes lint errors, delayed bugs, and stashed errors.
#[inline] #[inline]
pub fn err_count(&self) -> usize { pub fn err_count(&self) -> usize {
self.inner.borrow().err_count self.inner.borrow().err_count
} }
/// This excludes lint errors and delayed bugs. /// This excludes normal errors, lint errors and delayed bugs. Unless
/// absolutely necessary, avoid using this. It's dubious because stashed
/// errors can later be cancelled, so the presence of a stashed error at
/// some point of time doesn't guarantee anything -- there are no
/// `ErrorGuaranteed`s here.
pub fn stashed_err_count(&self) -> usize {
self.inner.borrow().stashed_err_count
}
/// This excludes lint errors, delayed bugs, and stashed errors.
pub fn has_errors(&self) -> Option<ErrorGuaranteed> { pub fn has_errors(&self) -> Option<ErrorGuaranteed> {
self.inner.borrow().has_errors().then(|| { self.inner.borrow().has_errors().then(|| {
// FIXME(nnethercote) find a way to store an `ErrorGuaranteed`. // FIXME(nnethercote) find a way to store an `ErrorGuaranteed`.
@ -940,8 +953,8 @@ impl DiagCtxt {
}) })
} }
/// This excludes delayed bugs. Unless absolutely necessary, prefer /// This excludes delayed bugs and stashed errors. Unless absolutely
/// `has_errors` to this method. /// necessary, prefer `has_errors` to this method.
pub fn has_errors_or_lint_errors(&self) -> Option<ErrorGuaranteed> { pub fn has_errors_or_lint_errors(&self) -> Option<ErrorGuaranteed> {
let inner = self.inner.borrow(); let inner = self.inner.borrow();
let result = inner.has_errors() || inner.lint_err_count > 0; let result = inner.has_errors() || inner.lint_err_count > 0;
@ -952,8 +965,8 @@ impl DiagCtxt {
}) })
} }
/// Unless absolutely necessary, prefer `has_errors` or /// This excludes stashed errors. Unless absolutely necessary, prefer
/// `has_errors_or_lint_errors` to this method. /// `has_errors` or `has_errors_or_lint_errors` to this method.
pub fn has_errors_or_lint_errors_or_delayed_bugs(&self) -> Option<ErrorGuaranteed> { pub fn has_errors_or_lint_errors_or_delayed_bugs(&self) -> Option<ErrorGuaranteed> {
let inner = self.inner.borrow(); let inner = self.inner.borrow();
let result = let result =
@ -1227,10 +1240,8 @@ impl DiagCtxtInner {
for (_, diag) in std::mem::take(&mut self.stashed_diagnostics).into_iter() { for (_, diag) in std::mem::take(&mut self.stashed_diagnostics).into_iter() {
// Decrement the count tracking the stash; emitting will increment it. // Decrement the count tracking the stash; emitting will increment it.
if diag.is_error() { if diag.is_error() {
if diag.is_lint.is_some() { if diag.is_lint.is_none() {
self.lint_err_count -= 1; self.stashed_err_count -= 1;
} else {
self.err_count -= 1;
} }
} else { } else {
// Unless they're forced, don't flush stashed warnings when // Unless they're forced, don't flush stashed warnings when

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
use crate::base::ast::NestedMetaItem; use crate::base::ast::NestedMetaItem;
use crate::errors; use crate::errors;
use crate::expand::{self, AstFragment, Invocation}; use crate::expand::{self, AstFragment, Invocation};

View file

@ -10,7 +10,7 @@
#![feature(proc_macro_internals)] #![feature(proc_macro_internals)]
#![feature(proc_macro_span)] #![feature(proc_macro_span)]
#![feature(try_blocks)] #![feature(try_blocks)]
#![deny(rustc::untranslatable_diagnostic)] #![allow(rustc::diagnostic_outside_of_impl)]
#![allow(internal_features)] #![allow(internal_features)]
#[macro_use] #[macro_use]

View file

@ -15,8 +15,6 @@
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![doc(rust_logo)] #![doc(rust_logo)]
#![feature(lazy_cell)] #![feature(lazy_cell)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
mod accepted; mod accepted;
mod builtin_attrs; mod builtin_attrs;

View file

@ -4,8 +4,6 @@
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![feature(proc_macro_diagnostic)] #![feature(proc_macro_diagnostic)]
#![feature(proc_macro_span)] #![feature(proc_macro_span)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::default_hash_types)] #![allow(rustc::default_hash_types)]
use proc_macro::TokenStream; use proc_macro::TokenStream;

View file

@ -1,6 +1,4 @@
#![feature(absolute_path)] #![feature(absolute_path)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use std::ffi::CString; use std::ffi::CString;
use std::fs; use std::fs;

View file

@ -276,8 +276,6 @@
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![doc(rust_logo)] #![doc(rust_logo)]
#![allow(internal_features)] #![allow(internal_features)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use LabelText::*; use LabelText::*;

View file

@ -9,8 +9,6 @@
#![feature(never_type)] #![feature(never_type)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![feature(variant_count)] #![feature(variant_count)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![allow(internal_features)] #![allow(internal_features)]
#[macro_use] #[macro_use]

View file

@ -55,7 +55,9 @@ This API is completely unstable and subject to change.
*/ */
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::potential_query_instability)] #![allow(rustc::potential_query_instability)]
#![allow(rustc::untranslatable_diagnostic)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)] #![doc(rust_logo)]
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]

View file

@ -2,8 +2,6 @@
//! the definitions in this file have equivalents in `rustc_ast_pretty`. //! the definitions in this file have equivalents in `rustc_ast_pretty`.
#![recursion_limit = "256"] #![recursion_limit = "256"]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_ast as ast; use rustc_ast as ast;
use rustc_ast::util::parser::{self, AssocOp, Fixity}; use rustc_ast::util::parser::{self, AssocOp, Fixity};

View file

@ -1,3 +1,5 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(let_chains)] #![feature(let_chains)]
#![feature(try_blocks)] #![feature(try_blocks)]

View file

@ -753,10 +753,14 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
} }
fn report_error(&self, p: impl Into<ty::GenericArg<'tcx>>) -> ErrorGuaranteed { fn report_error(&self, p: impl Into<ty::GenericArg<'tcx>>) -> ErrorGuaranteed {
match self.fcx.dcx().has_errors() { if let Some(guar) = self.fcx.dcx().has_errors() {
Some(e) => e, guar
None => self } else if self.fcx.dcx().stashed_err_count() > 0 {
.fcx // Without this case we sometimes get uninteresting and extraneous
// "type annotations needed" errors.
self.fcx.dcx().delayed_bug("error in Resolver")
} else {
self.fcx
.err_ctxt() .err_ctxt()
.emit_inference_failure_err( .emit_inference_failure_err(
self.fcx.tcx.hir().body_owner_def_id(self.body.id()), self.fcx.tcx.hir().body_owner_def_id(self.body.id()),
@ -765,7 +769,7 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
E0282, E0282,
false, false,
) )
.emit(), .emit()
} }
} }

View file

@ -5,8 +5,6 @@
#![doc(rust_logo)] #![doc(rust_logo)]
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![allow(internal_features)] #![allow(internal_features)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#[macro_use] #[macro_use]
extern crate rustc_middle; extern crate rustc_middle;

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![cfg_attr( #![cfg_attr(
feature = "nightly", feature = "nightly",
feature(extend_one, min_specialization, new_uninit, step_trait, test) feature(extend_one, min_specialization, new_uninit, step_trait, test)

View file

@ -87,6 +87,7 @@ impl<'tcx> InferCtxt<'tcx> {
reported_signature_mismatch: self.reported_signature_mismatch.clone(), reported_signature_mismatch: self.reported_signature_mismatch.clone(),
tainted_by_errors: self.tainted_by_errors.clone(), tainted_by_errors: self.tainted_by_errors.clone(),
err_count_on_creation: self.err_count_on_creation, err_count_on_creation: self.err_count_on_creation,
stashed_err_count_on_creation: self.stashed_err_count_on_creation,
universe: self.universe.clone(), universe: self.universe.clone(),
intercrate, intercrate,
next_trait_solver: self.next_trait_solver, next_trait_solver: self.next_trait_solver,

View file

@ -306,6 +306,12 @@ pub struct InferCtxt<'tcx> {
// FIXME(matthewjasper) Merge into `tainted_by_errors` // FIXME(matthewjasper) Merge into `tainted_by_errors`
err_count_on_creation: usize, err_count_on_creation: usize,
/// Track how many errors were stashed when this infcx is created.
/// Used for the same purpose as `err_count_on_creation`, even
/// though it's weaker because the count can go up and down.
// FIXME(matthewjasper) Merge into `tainted_by_errors`
stashed_err_count_on_creation: usize,
/// What is the innermost universe we have created? Starts out as /// What is the innermost universe we have created? Starts out as
/// `UniverseIndex::root()` but grows from there as we enter /// `UniverseIndex::root()` but grows from there as we enter
/// universal quantifiers. /// universal quantifiers.
@ -711,6 +717,7 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
reported_signature_mismatch: Default::default(), reported_signature_mismatch: Default::default(),
tainted_by_errors: Cell::new(None), tainted_by_errors: Cell::new(None),
err_count_on_creation: tcx.dcx().err_count(), err_count_on_creation: tcx.dcx().err_count(),
stashed_err_count_on_creation: tcx.dcx().stashed_err_count(),
universe: Cell::new(ty::UniverseIndex::ROOT), universe: Cell::new(ty::UniverseIndex::ROOT),
intercrate, intercrate,
next_trait_solver, next_trait_solver,
@ -1262,27 +1269,25 @@ impl<'tcx> InferCtxt<'tcx> {
/// inference variables, regionck errors). /// inference variables, regionck errors).
#[must_use = "this method does not have any side effects"] #[must_use = "this method does not have any side effects"]
pub fn tainted_by_errors(&self) -> Option<ErrorGuaranteed> { pub fn tainted_by_errors(&self) -> Option<ErrorGuaranteed> {
debug!( if let Some(guar) = self.tainted_by_errors.get() {
"is_tainted_by_errors(err_count={}, err_count_on_creation={}, \ Some(guar)
tainted_by_errors={})", } else if self.dcx().err_count() > self.err_count_on_creation {
self.dcx().err_count(), // Errors reported since this infcx was made.
self.err_count_on_creation, let guar = self.dcx().has_errors().unwrap();
self.tainted_by_errors.get().is_some() self.set_tainted_by_errors(guar);
); Some(guar)
} else if self.dcx().stashed_err_count() > self.stashed_err_count_on_creation {
if let Some(e) = self.tainted_by_errors.get() { // Errors stashed since this infcx was made. Not entirely reliable
return Some(e); // because the count of stashed errors can go down. But without
} // this case we get a moderate number of uninteresting and
// extraneous "type annotations needed" errors.
if self.dcx().err_count() > self.err_count_on_creation { let guar = self.dcx().delayed_bug("tainted_by_errors: stashed bug awaiting emission");
// errors reported since this infcx was made self.set_tainted_by_errors(guar);
let e = self.dcx().has_errors().unwrap(); Some(guar)
self.set_tainted_by_errors(e); } else {
return Some(e);
}
None None
} }
}
/// Set the "tainted by errors" flag to true. We call this when we /// Set the "tainted by errors" flag to true. We call this when we
/// observe an error from a prior pass. /// observe an error from a prior pass.

View file

@ -16,6 +16,8 @@
#![doc(rust_logo)] #![doc(rust_logo)]
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]
#![allow(internal_features)] #![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(associated_type_bounds)] #![feature(associated_type_bounds)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(extend_one)] #![feature(extend_one)]

View file

@ -4,8 +4,6 @@
#![feature(let_chains)] #![feature(let_chains)]
#![feature(thread_spawn_unchecked)] #![feature(thread_spawn_unchecked)]
#![feature(try_blocks)] #![feature(try_blocks)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#[macro_use] #[macro_use]
extern crate tracing; extern crate tracing;

View file

@ -778,6 +778,10 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
// kindck is gone now). -nmatsakis // kindck is gone now). -nmatsakis
if let Some(reported) = sess.dcx().has_errors() { if let Some(reported) = sess.dcx().has_errors() {
return Err(reported); return Err(reported);
} else if sess.dcx().stashed_err_count() > 0 {
// Without this case we sometimes get delayed bug ICEs and I don't
// understand why. -nnethercote
return Err(sess.dcx().delayed_bug("some stashed error is waiting for use"));
} }
sess.time("misc_checking_3", || { sess.time("misc_checking_3", || {

View file

@ -18,8 +18,7 @@
//! lexeme types. //! lexeme types.
//! //!
//! [`rustc_parse::lexer`]: ../rustc_parse/lexer/index.html //! [`rustc_parse::lexer`]: ../rustc_parse/lexer/index.html
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
// We want to be able to build this crate with a stable compiler, // We want to be able to build this crate with a stable compiler,
// so no `#![feature]` attributes should be added. // so no `#![feature]` attributes should be added.
#![deny(unstable_features)] #![deny(unstable_features)]

View file

@ -345,7 +345,7 @@ declare_tool_lint! {
/// ///
/// More details on translatable diagnostics can be found [here](https://rustc-dev-guide.rust-lang.org/diagnostics/translation.html). /// More details on translatable diagnostics can be found [here](https://rustc-dev-guide.rust-lang.org/diagnostics/translation.html).
pub rustc::UNTRANSLATABLE_DIAGNOSTIC, pub rustc::UNTRANSLATABLE_DIAGNOSTIC,
Allow, Deny,
"prevent creation of diagnostics which cannot be translated", "prevent creation of diagnostics which cannot be translated",
report_in_external_macro: true report_in_external_macro: true
} }
@ -357,7 +357,7 @@ declare_tool_lint! {
/// ///
/// More details on diagnostics implementations can be found [here](https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html). /// More details on diagnostics implementations can be found [here](https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html).
pub rustc::DIAGNOSTIC_OUTSIDE_OF_IMPL, pub rustc::DIAGNOSTIC_OUTSIDE_OF_IMPL,
Allow, Deny,
"prevent creation of diagnostics outside of `IntoDiagnostic`/`AddToDiagnostic` impls", "prevent creation of diagnostics outside of `IntoDiagnostic`/`AddToDiagnostic` impls",
report_in_external_macro: true report_in_external_macro: true
} }

View file

@ -37,8 +37,6 @@
#![cfg_attr(not(bootstrap), feature(trait_upcasting))] #![cfg_attr(not(bootstrap), feature(trait_upcasting))]
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![allow(internal_features)] #![allow(internal_features)]
#[macro_use] #[macro_use]

View file

@ -1,5 +1,6 @@
#![allow(rustc::untranslatable_diagnostic)]
#![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
use std::num::NonZeroU32; use std::num::NonZeroU32;
use crate::errors::RequestedLevel; use crate::errors::RequestedLevel;

View file

@ -1,6 +1,4 @@
#![feature(min_specialization)] #![feature(min_specialization)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#[macro_use] #[macro_use]
extern crate rustc_macros; extern crate rustc_macros;

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)] #![doc(rust_logo)]
#![feature(rustdoc_internals)] #![feature(rustdoc_internals)]

View file

@ -38,9 +38,6 @@
//! debugging, you can make changes inside those crates and quickly run main.rs //! debugging, you can make changes inside those crates and quickly run main.rs
//! to read the debug logs. //! to read the debug logs.
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
use std::env::{self, VarError}; use std::env::{self, VarError};
use std::fmt::{self, Display}; use std::fmt::{self, Display};
use std::io::{self, IsTerminal}; use std::io::{self, IsTerminal};

View file

@ -6,8 +6,6 @@
#![feature(proc_macro_span)] #![feature(proc_macro_span)]
#![feature(proc_macro_tracked_env)] #![feature(proc_macro_tracked_env)]
#![allow(rustc::default_hash_types)] #![allow(rustc::default_hash_types)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![allow(internal_features)] #![allow(internal_features)]
use synstructure::decl_derive; use synstructure::decl_derive;

View file

@ -15,8 +15,6 @@
#![feature(try_blocks)] #![feature(try_blocks)]
#![feature(never_type)] #![feature(never_type)]
#![allow(rustc::potential_query_instability)] #![allow(rustc::potential_query_instability)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
extern crate proc_macro; extern crate proc_macro;

View file

@ -58,8 +58,10 @@
#![feature(const_option)] #![feature(const_option)]
#![feature(ptr_alignment_type)] #![feature(ptr_alignment_type)]
#![feature(macro_metavar_expr)] #![feature(macro_metavar_expr)]
#![allow(rustc::potential_query_instability)]
#![allow(internal_features)] #![allow(internal_features)]
#![allow(rustc::potential_query_instability)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#[macro_use] #[macro_use]
extern crate bitflags; extern crate bitflags;

View file

@ -675,16 +675,32 @@ fn construct_error(tcx: TyCtxt<'_>, def_id: LocalDefId, guar: ErrorGuaranteed) -
))), ))),
) )
} }
ty::CoroutineClosure(did, _args) => { ty::CoroutineClosure(did, args) => {
// FIXME(async_closures): Recover the proper error signature let args = args.as_coroutine_closure();
let inputs = tcx let sig = tcx.liberate_late_bound_regions(
.closure_user_provided_sig(did.expect_local()) def_id.to_def_id(),
.value args.coroutine_closure_sig(),
.skip_binder() );
.inputs(); let self_ty = match args.kind() {
ty::ClosureKind::Fn => {
let err = Ty::new_error(tcx, guar); Ty::new_imm_ref(tcx, tcx.lifetimes.re_erased, closure_ty)
(inputs.iter().map(|_| err).collect(), err, None) }
ty::ClosureKind::FnMut => {
Ty::new_mut_ref(tcx, tcx.lifetimes.re_erased, closure_ty)
}
ty::ClosureKind::FnOnce => closure_ty,
};
(
[self_ty].into_iter().chain(sig.tupled_inputs_ty.tuple_fields()).collect(),
sig.to_coroutine(
tcx,
args.parent_args(),
args.kind_ty(),
tcx.coroutine_for_closure(*did),
Ty::new_error(tcx, guar),
),
None,
)
} }
ty::Error(_) => (vec![closure_ty, closure_ty], closure_ty, None), ty::Error(_) => (vec![closure_ty, closure_ty], closure_ty, None),
kind => { kind => {

View file

@ -1,6 +1,9 @@
//! Construction of MIR from HIR. //! Construction of MIR from HIR.
//! //!
//! This crate also contains the match exhaustiveness and usefulness checking. //! This crate also contains the match exhaustiveness and usefulness checking.
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(assert_matches)] #![feature(assert_matches)]
#![feature(associated_type_bounds)] #![feature(associated_type_bounds)]
#![feature(box_patterns)] #![feature(box_patterns)]

View file

@ -4,8 +4,6 @@
#![feature(let_chains)] #![feature(let_chains)]
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(try_blocks)] #![feature(try_blocks)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#[macro_use] #[macro_use]
extern crate tracing; extern crate tracing;

View file

@ -7,7 +7,7 @@ use rustc_data_structures::fx::FxIndexSet;
use rustc_hir as hir; use rustc_hir as hir;
use rustc_middle::mir::visit::MutVisitor; use rustc_middle::mir::visit::MutVisitor;
use rustc_middle::mir::{self, dump_mir, MirPass}; use rustc_middle::mir::{self, dump_mir, MirPass};
use rustc_middle::ty::{self, InstanceDef, Ty, TyCtxt}; use rustc_middle::ty::{self, InstanceDef, Ty, TyCtxt, TypeVisitableExt};
use rustc_target::abi::FieldIdx; use rustc_target::abi::FieldIdx;
pub struct ByMoveBody; pub struct ByMoveBody;
@ -23,7 +23,10 @@ impl<'tcx> MirPass<'tcx> for ByMoveBody {
return; return;
}; };
let coroutine_ty = body.local_decls[ty::CAPTURE_STRUCT_LOCAL].ty; let coroutine_ty = body.local_decls[ty::CAPTURE_STRUCT_LOCAL].ty;
let ty::Coroutine(_, args) = *coroutine_ty.kind() else { bug!() }; if coroutine_ty.references_error() {
return;
}
let ty::Coroutine(_, args) = *coroutine_ty.kind() else { bug!("{body:#?}") };
let coroutine_kind = args.as_coroutine().kind_ty().to_opt_closure_kind().unwrap(); let coroutine_kind = args.as_coroutine().kind_ty().to_opt_closure_kind().unwrap();
if coroutine_kind == ty::ClosureKind::FnOnce { if coroutine_kind == ty::ClosureKind::FnOnce {

View file

@ -1,5 +1,3 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![feature(assert_matches)] #![feature(assert_matches)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(const_type_name)] #![feature(const_type_name)]

View file

@ -1,8 +1,6 @@
#![feature(array_windows)] #![feature(array_windows)]
#![feature(is_sorted)] #![feature(is_sorted)]
#![allow(rustc::potential_query_instability)] #![allow(rustc::potential_query_instability)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#[macro_use] #[macro_use]
extern crate tracing; extern crate tracing;

View file

@ -1,11 +1,13 @@
//! The main parser interface. //! The main parser interface.
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![feature(array_windows)] #![feature(array_windows)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(iter_intersperse)] #![feature(iter_intersperse)]
#![feature(let_chains)] #![feature(let_chains)]
#![allow(internal_features)]
#[macro_use] #[macro_use]
extern crate tracing; extern crate tracing;

View file

@ -9,8 +9,6 @@
html_playground_url = "https://play.rust-lang.org/", html_playground_url = "https://play.rust-lang.org/",
test(attr(deny(warnings))) test(attr(deny(warnings)))
)] )]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
// We want to be able to build this crate with a stable compiler, // We want to be able to build this crate with a stable compiler,
// so no `#![feature]` attributes should be added. // so no `#![feature]` attributes should be added.
#![deny(unstable_features)] #![deny(unstable_features)]

View file

@ -12,8 +12,6 @@
#![feature(map_try_insert)] #![feature(map_try_insert)]
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(try_blocks)] #![feature(try_blocks)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#[macro_use] #[macro_use]
extern crate rustc_middle; extern crate rustc_middle;

View file

@ -1,5 +1,8 @@
//! Analysis of patterns, notably match exhaustiveness checking. //! Analysis of patterns, notably match exhaustiveness checking.
#![allow(rustc::untranslatable_diagnostic)]
#![allow(rustc::diagnostic_outside_of_impl)]
pub mod constructor; pub mod constructor;
#[cfg(feature = "rustc")] #[cfg(feature = "rustc")]
pub mod errors; pub mod errors;

View file

@ -16,5 +16,6 @@ rustc_macros = { path = "../rustc_macros" }
rustc_middle = { path = "../rustc_middle" } rustc_middle = { path = "../rustc_middle" }
rustc_session = { path = "../rustc_session" } rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" } rustc_span = { path = "../rustc_span" }
rustc_ty_utils = { path = "../rustc_ty_utils" }
tracing = "0.1" tracing = "0.1"
# tidy-alphabetical-end # tidy-alphabetical-end

View file

@ -5,8 +5,6 @@
#![feature(associated_type_defaults)] #![feature(associated_type_defaults)]
#![feature(try_blocks)] #![feature(try_blocks)]
#![feature(let_chains)] #![feature(let_chains)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#[macro_use] #[macro_use]
extern crate tracing; extern crate tracing;
@ -21,7 +19,7 @@ use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res}; use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId, CRATE_DEF_ID}; use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId, CRATE_DEF_ID};
use rustc_hir::intravisit::{self, Visitor}; use rustc_hir::intravisit::{self, Visitor};
use rustc_hir::{AssocItemKind, ForeignItemKind, ItemId, PatKind}; use rustc_hir::{AssocItemKind, ForeignItemKind, ItemId, ItemKind, PatKind};
use rustc_middle::middle::privacy::{EffectiveVisibilities, EffectiveVisibility, Level}; use rustc_middle::middle::privacy::{EffectiveVisibilities, EffectiveVisibility, Level};
use rustc_middle::query::Providers; use rustc_middle::query::Providers;
use rustc_middle::ty::GenericArgs; use rustc_middle::ty::GenericArgs;
@ -98,9 +96,6 @@ trait DefIdVisitor<'tcx> {
fn visit_trait(&mut self, trait_ref: TraitRef<'tcx>) -> ControlFlow<Self::BreakTy> { fn visit_trait(&mut self, trait_ref: TraitRef<'tcx>) -> ControlFlow<Self::BreakTy> {
self.skeleton().visit_trait(trait_ref) self.skeleton().visit_trait(trait_ref)
} }
fn visit_projection_ty(&mut self, projection: ty::AliasTy<'tcx>) -> ControlFlow<Self::BreakTy> {
self.skeleton().visit_projection_ty(projection)
}
fn visit_predicates( fn visit_predicates(
&mut self, &mut self,
predicates: ty::GenericPredicates<'tcx>, predicates: ty::GenericPredicates<'tcx>,
@ -173,6 +168,10 @@ where
{ {
type BreakTy = V::BreakTy; type BreakTy = V::BreakTy;
fn visit_predicate(&mut self, p: ty::Predicate<'tcx>) -> ControlFlow<Self::BreakTy> {
self.visit_clause(p.as_clause().unwrap())
}
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<V::BreakTy> { fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<V::BreakTy> {
let tcx = self.def_id_visitor.tcx(); let tcx = self.def_id_visitor.tcx();
// GenericArgs are not visited here because they are visited below // GenericArgs are not visited here because they are visited below
@ -1076,6 +1075,14 @@ impl<'tcx> TypePrivacyVisitor<'tcx> {
} }
} }
impl<'tcx> rustc_ty_utils::sig_types::SpannedTypeVisitor<'tcx> for TypePrivacyVisitor<'tcx> {
type BreakTy = ();
fn visit(&mut self, span: Span, value: impl TypeVisitable<TyCtxt<'tcx>>) -> ControlFlow<()> {
self.span = span;
value.visit_with(&mut self.skeleton())
}
}
impl<'tcx> Visitor<'tcx> for TypePrivacyVisitor<'tcx> { impl<'tcx> Visitor<'tcx> for TypePrivacyVisitor<'tcx> {
fn visit_nested_body(&mut self, body_id: hir::BodyId) { fn visit_nested_body(&mut self, body_id: hir::BodyId) {
let old_maybe_typeck_results = let old_maybe_typeck_results =
@ -1086,75 +1093,36 @@ impl<'tcx> Visitor<'tcx> for TypePrivacyVisitor<'tcx> {
fn visit_ty(&mut self, hir_ty: &'tcx hir::Ty<'tcx>) { fn visit_ty(&mut self, hir_ty: &'tcx hir::Ty<'tcx>) {
self.span = hir_ty.span; self.span = hir_ty.span;
if let Some(typeck_results) = self.maybe_typeck_results { if self
// Types in bodies. .visit(
if self.visit(typeck_results.node_type(hir_ty.hir_id)).is_break() { self.maybe_typeck_results
.unwrap_or_else(|| span_bug!(hir_ty.span, "`hir::Ty` outside of a body"))
.node_type(hir_ty.hir_id),
)
.is_break()
{
return; return;
} }
} else {
// Types in signatures.
// FIXME: This is very ineffective. Ideally each HIR type should be converted
// into a semantic type only once and the result should be cached somehow.
if self.visit(rustc_hir_analysis::hir_ty_to_ty(self.tcx, hir_ty)).is_break() {
return;
}
}
intravisit::walk_ty(self, hir_ty); intravisit::walk_ty(self, hir_ty);
} }
fn visit_infer(&mut self, inf: &'tcx hir::InferArg) { fn visit_infer(&mut self, inf: &'tcx hir::InferArg) {
self.span = inf.span; self.span = inf.span;
if let Some(typeck_results) = self.maybe_typeck_results { if let Some(ty) = self
if let Some(ty) = typeck_results.node_type_opt(inf.hir_id) { .maybe_typeck_results
.unwrap_or_else(|| span_bug!(inf.span, "`hir::InferArg` outside of a body"))
.node_type_opt(inf.hir_id)
{
if self.visit(ty).is_break() { if self.visit(ty).is_break() {
return; return;
} }
} else { } else {
// FIXME: check types of const infers here. // FIXME: check types of const infers here.
} }
} else {
span_bug!(self.span, "`hir::InferArg` outside of a body");
}
intravisit::walk_inf(self, inf); intravisit::walk_inf(self, inf);
} }
fn visit_trait_ref(&mut self, trait_ref: &'tcx hir::TraitRef<'tcx>) {
self.span = trait_ref.path.span;
if self.maybe_typeck_results.is_some() {
// Privacy of traits in bodies is checked as a part of trait object types.
} else {
let bounds = rustc_hir_analysis::hir_trait_to_predicates(
self.tcx,
trait_ref,
// NOTE: This isn't really right, but the actual type doesn't matter here. It's
// just required by `ty::TraitRef`.
self.tcx.types.never,
);
for (clause, _) in bounds.clauses() {
match clause.kind().skip_binder() {
ty::ClauseKind::Trait(trait_predicate) => {
if self.visit_trait(trait_predicate.trait_ref).is_break() {
return;
}
}
ty::ClauseKind::Projection(proj_predicate) => {
let term = self.visit(proj_predicate.term);
if term.is_break()
|| self.visit_projection_ty(proj_predicate.projection_ty).is_break()
{
return;
}
}
_ => {}
}
}
}
intravisit::walk_trait_ref(self, trait_ref);
}
// Check types of expressions // Check types of expressions
fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) { fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) {
if self.check_expr_pat_type(expr.hir_id, expr.span) { if self.check_expr_pat_type(expr.hir_id, expr.span) {
@ -1727,7 +1695,26 @@ fn check_mod_privacy(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) {
// inferred types of expressions and patterns. // inferred types of expressions and patterns.
let span = tcx.def_span(module_def_id); let span = tcx.def_span(module_def_id);
let mut visitor = TypePrivacyVisitor { tcx, module_def_id, maybe_typeck_results: None, span }; let mut visitor = TypePrivacyVisitor { tcx, module_def_id, maybe_typeck_results: None, span };
tcx.hir().visit_item_likes_in_module(module_def_id, &mut visitor);
let module = tcx.hir_module_items(module_def_id);
for def_id in module.definitions() {
rustc_ty_utils::sig_types::walk_types(tcx, def_id, &mut visitor);
if let Some(body_id) = tcx.hir().maybe_body_owned_by(def_id) {
visitor.visit_nested_body(body_id);
}
}
for id in module.items() {
if let ItemKind::Impl(i) = tcx.hir().item(id).kind {
if let Some(item) = i.of_trait {
let trait_ref = tcx.impl_trait_ref(id.owner_id.def_id).unwrap();
let trait_ref = trait_ref.instantiate_identity();
visitor.span = item.path.span;
visitor.visit_def_id(trait_ref.def_id, "trait", &trait_ref.print_only_trait_path());
}
}
}
} }
fn effective_visibilities(tcx: TyCtxt<'_>, (): ()) -> &EffectiveVisibilities { fn effective_visibilities(tcx: TyCtxt<'_>, (): ()) -> &EffectiveVisibilities {

View file

@ -6,8 +6,6 @@
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![allow(rustc::potential_query_instability, unused_parens)] #![allow(rustc::potential_query_instability, unused_parens)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![allow(internal_features)] #![allow(internal_features)]
#[macro_use] #[macro_use]

View file

@ -4,8 +4,6 @@
#![feature(min_specialization)] #![feature(min_specialization)]
#![feature(let_chains)] #![feature(let_chains)]
#![allow(rustc::potential_query_instability, internal_features)] #![allow(rustc::potential_query_instability, internal_features)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#[macro_use] #[macro_use]
extern crate tracing; extern crate tracing;

View file

@ -17,7 +17,9 @@
#![feature(let_chains)] #![feature(let_chains)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![allow(rustdoc::private_intra_doc_links)] #![allow(rustdoc::private_intra_doc_links)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::potential_query_instability)] #![allow(rustc::potential_query_instability)]
#![allow(rustc::untranslatable_diagnostic)]
#![allow(internal_features)] #![allow(internal_features)]
#[macro_use] #[macro_use]

View file

@ -17,8 +17,6 @@
#![feature(ptr_sub_ptr)] #![feature(ptr_sub_ptr)]
#![cfg_attr(test, feature(test))] #![cfg_attr(test, feature(test))]
#![allow(rustc::internal)] #![allow(rustc::internal)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
pub use self::serialize::{Decodable, Decoder, Encodable, Encoder}; pub use self::serialize::{Decodable, Decoder, Encodable, Encoder};

View file

@ -4,8 +4,6 @@
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![feature(map_many_mut)] #![feature(map_many_mut)]
#![feature(iter_intersperse)] #![feature(iter_intersperse)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![allow(internal_features)] #![allow(internal_features)]
#[macro_use] #[macro_use]

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