mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 12:13:43 +00:00
Deny internal lints in librustc
This commit is contained in:
parent
dfcd1ef102
commit
69f74df429
@ -9,7 +9,6 @@ use crate::session::Session;
|
||||
|
||||
use std::cmp::Ord;
|
||||
use std::hash as std_hash;
|
||||
use std::collections::HashMap;
|
||||
use std::cell::RefCell;
|
||||
|
||||
use syntax::ast;
|
||||
@ -394,13 +393,12 @@ impl<'a> HashStable<StableHashingContext<'a>> for DelimSpan {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn hash_stable_trait_impls<'a, 'gcx, W, R>(
|
||||
pub fn hash_stable_trait_impls<'a, 'gcx, W>(
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>,
|
||||
blanket_impls: &[DefId],
|
||||
non_blanket_impls: &HashMap<fast_reject::SimplifiedType, Vec<DefId>, R>)
|
||||
where W: StableHasherResult,
|
||||
R: std_hash::BuildHasher,
|
||||
non_blanket_impls: &FxHashMap<fast_reject::SimplifiedType, Vec<DefId>>)
|
||||
where W: StableHasherResult
|
||||
{
|
||||
{
|
||||
let mut blanket_impls: SmallVec<[_; 8]> = blanket_impls
|
||||
|
@ -56,7 +56,7 @@ use crate::hir::Node;
|
||||
use crate::middle::region;
|
||||
use crate::traits::{ObligationCause, ObligationCauseCode};
|
||||
use crate::ty::error::TypeError;
|
||||
use crate::ty::{self, subst::{Subst, SubstsRef}, Region, Ty, TyCtxt, TyKind, TypeFoldable};
|
||||
use crate::ty::{self, subst::{Subst, SubstsRef}, Region, Ty, TyCtxt, TypeFoldable};
|
||||
use errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString};
|
||||
use std::{cmp, fmt};
|
||||
use syntax_pos::{Pos, Span};
|
||||
@ -1094,14 +1094,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||
(_, false, _) => {
|
||||
if let Some(exp_found) = exp_found {
|
||||
let (def_id, ret_ty) = match exp_found.found.sty {
|
||||
TyKind::FnDef(def, _) => {
|
||||
ty::FnDef(def, _) => {
|
||||
(Some(def), Some(self.tcx.fn_sig(def).output()))
|
||||
}
|
||||
_ => (None, None),
|
||||
};
|
||||
|
||||
let exp_is_struct = match exp_found.expected.sty {
|
||||
TyKind::Adt(def, _) => def.is_struct(),
|
||||
ty::Adt(def, _) => def.is_struct(),
|
||||
_ => false,
|
||||
};
|
||||
|
||||
@ -1140,8 +1140,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||
diag: &mut DiagnosticBuilder<'tcx>,
|
||||
) {
|
||||
match (&exp_found.expected.sty, &exp_found.found.sty) {
|
||||
(TyKind::Adt(exp_def, exp_substs), TyKind::Ref(_, found_ty, _)) => {
|
||||
if let TyKind::Adt(found_def, found_substs) = found_ty.sty {
|
||||
(ty::Adt(exp_def, exp_substs), ty::Ref(_, found_ty, _)) => {
|
||||
if let ty::Adt(found_def, found_substs) = found_ty.sty {
|
||||
let path_str = format!("{:?}", exp_def);
|
||||
if exp_def == &found_def {
|
||||
let opt_msg = "you can convert from `&Option<T>` to `Option<&T>` using \
|
||||
@ -1164,17 +1164,17 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||
let mut show_suggestion = true;
|
||||
for (exp_ty, found_ty) in exp_substs.types().zip(found_substs.types()) {
|
||||
match exp_ty.sty {
|
||||
TyKind::Ref(_, exp_ty, _) => {
|
||||
ty::Ref(_, exp_ty, _) => {
|
||||
match (&exp_ty.sty, &found_ty.sty) {
|
||||
(_, TyKind::Param(_)) |
|
||||
(_, TyKind::Infer(_)) |
|
||||
(TyKind::Param(_), _) |
|
||||
(TyKind::Infer(_), _) => {}
|
||||
(_, ty::Param(_)) |
|
||||
(_, ty::Infer(_)) |
|
||||
(ty::Param(_), _) |
|
||||
(ty::Infer(_), _) => {}
|
||||
_ if ty::TyS::same_type(exp_ty, found_ty) => {}
|
||||
_ => show_suggestion = false,
|
||||
};
|
||||
}
|
||||
TyKind::Param(_) | TyKind::Infer(_) => {}
|
||||
ty::Param(_) | ty::Infer(_) => {}
|
||||
_ => show_suggestion = false,
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
||||
#![deny(rust_2018_idioms)]
|
||||
#![cfg_attr(not(stage0), deny(internal))]
|
||||
#![allow(explicit_outlives_requirements)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
|
@ -36,7 +36,7 @@ impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> {
|
||||
pub fn field_ty(self, tcx: TyCtxt<'a, 'gcx, 'tcx>, f: &Field) -> Ty<'tcx>
|
||||
{
|
||||
let answer = match self.ty.sty {
|
||||
ty::TyKind::Adt(adt_def, substs) => {
|
||||
ty::Adt(adt_def, substs) => {
|
||||
let variant_def = match self.variant_index {
|
||||
None => adt_def.non_enum_variant(),
|
||||
Some(variant_index) => {
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![cfg_attr(not(stage0), allow(usage_of_ty_tykind))]
|
||||
|
||||
pub use self::Variance::*;
|
||||
pub use self::AssociatedItemContainer::*;
|
||||
pub use self::BorrowKind::*;
|
||||
|
@ -1,11 +1,10 @@
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
use rustc_data_structures::sync::Lock;
|
||||
use rustc_data_structures::{fx::FxHashMap, sync::Lock};
|
||||
|
||||
use std::cell::{RefCell, Cell};
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::Debug;
|
||||
use std::hash::{Hash, BuildHasher};
|
||||
use std::hash::Hash;
|
||||
use std::panic;
|
||||
use std::env;
|
||||
use std::time::{Duration, Instant};
|
||||
@ -341,8 +340,8 @@ pub trait MemoizationMap {
|
||||
where OP: FnOnce() -> Self::Value;
|
||||
}
|
||||
|
||||
impl<K, V, S> MemoizationMap for RefCell<HashMap<K,V,S>>
|
||||
where K: Hash+Eq+Clone, V: Clone, S: BuildHasher
|
||||
impl<K, V> MemoizationMap for RefCell<FxHashMap<K,V>>
|
||||
where K: Hash+Eq+Clone, V: Clone
|
||||
{
|
||||
type Key = K;
|
||||
type Value = V;
|
||||
|
Loading…
Reference in New Issue
Block a user