Merge pull request #5407 from flip1995/rustup
Rustup to rust-lang/rust#70634
This commit is contained in:
commit
7907abea27
@ -2,10 +2,10 @@
|
|||||||
use rustc_hir::{self, Body, FnDecl, HirId, HirIdSet, ItemKind, Node};
|
use rustc_hir::{self, Body, FnDecl, HirId, HirIdSet, ItemKind, Node};
|
||||||
use rustc_infer::infer::TyCtxtInferExt;
|
use rustc_infer::infer::TyCtxtInferExt;
|
||||||
use rustc_lint::{LateContext, LateLintPass};
|
use rustc_lint::{LateContext, LateLintPass};
|
||||||
use rustc_middle::ty::layout::LayoutOf;
|
|
||||||
use rustc_middle::ty::{self, Ty};
|
use rustc_middle::ty::{self, Ty};
|
||||||
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||||
use rustc_span::source_map::Span;
|
use rustc_span::source_map::Span;
|
||||||
|
use rustc_target::abi::LayoutOf;
|
||||||
use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Place, PlaceBase};
|
use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Place, PlaceBase};
|
||||||
|
|
||||||
use crate::utils::span_lint;
|
use crate::utils::span_lint;
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use rustc_hir::{Item, ItemKind, VariantData};
|
use rustc_hir::{Item, ItemKind, VariantData};
|
||||||
use rustc_lint::{LateContext, LateLintPass};
|
use rustc_lint::{LateContext, LateLintPass};
|
||||||
use rustc_middle::ty::layout::LayoutOf;
|
|
||||||
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||||
|
use rustc_target::abi::LayoutOf;
|
||||||
|
|
||||||
declare_clippy_lint! {
|
declare_clippy_lint! {
|
||||||
/// **What it does:** Checks for large size differences between variants on
|
/// **What it does:** Checks for large size differences between variants on
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
use rustc_lint::{LateContext, LateLintPass, LintContext};
|
use rustc_lint::{LateContext, LateLintPass, LintContext};
|
||||||
use rustc_middle::hir::map::Map;
|
use rustc_middle::hir::map::Map;
|
||||||
use rustc_middle::lint::in_external_macro;
|
use rustc_middle::lint::in_external_macro;
|
||||||
use rustc_middle::ty::layout::LayoutOf;
|
|
||||||
use rustc_middle::ty::{self, InferTy, Ty, TyCtxt, TypeckTables};
|
use rustc_middle::ty::{self, InferTy, Ty, TyCtxt, TypeckTables};
|
||||||
use rustc_session::{declare_lint_pass, declare_tool_lint, impl_lint_pass};
|
use rustc_session::{declare_lint_pass, declare_tool_lint, impl_lint_pass};
|
||||||
use rustc_span::hygiene::{ExpnKind, MacroKind};
|
use rustc_span::hygiene::{ExpnKind, MacroKind};
|
||||||
use rustc_span::source_map::Span;
|
use rustc_span::source_map::Span;
|
||||||
use rustc_span::symbol::{sym, Symbol};
|
use rustc_span::symbol::{sym, Symbol};
|
||||||
|
use rustc_target::abi::LayoutOf;
|
||||||
use rustc_target::spec::abi::Abi;
|
use rustc_target::spec::abi::Abi;
|
||||||
use rustc_typeck::hir_ty_to_ty;
|
use rustc_typeck::hir_ty_to_ty;
|
||||||
|
|
||||||
|
@ -41,16 +41,12 @@
|
|||||||
use rustc_lint::{LateContext, Level, Lint, LintContext};
|
use rustc_lint::{LateContext, Level, Lint, LintContext};
|
||||||
use rustc_middle::hir::map::Map;
|
use rustc_middle::hir::map::Map;
|
||||||
use rustc_middle::traits;
|
use rustc_middle::traits;
|
||||||
use rustc_middle::ty::{
|
use rustc_middle::ty::{self, layout::IntegerExt, subst::GenericArg, Binder, Ty, TyCtxt, TypeFoldable};
|
||||||
self,
|
|
||||||
layout::{self, IntegerExt},
|
|
||||||
subst::GenericArg,
|
|
||||||
Binder, Ty, TyCtxt, TypeFoldable,
|
|
||||||
};
|
|
||||||
use rustc_span::hygiene::{ExpnKind, MacroKind};
|
use rustc_span::hygiene::{ExpnKind, MacroKind};
|
||||||
use rustc_span::source_map::original_sp;
|
use rustc_span::source_map::original_sp;
|
||||||
use rustc_span::symbol::{self, kw, Symbol};
|
use rustc_span::symbol::{self, kw, Symbol};
|
||||||
use rustc_span::{BytePos, Pos, Span, DUMMY_SP};
|
use rustc_span::{BytePos, Pos, Span, DUMMY_SP};
|
||||||
|
use rustc_target::abi::Integer;
|
||||||
use rustc_trait_selection::traits::predicate_for_trait_def;
|
use rustc_trait_selection::traits::predicate_for_trait_def;
|
||||||
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
|
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
|
||||||
use rustc_trait_selection::traits::query::normalize::AtExt;
|
use rustc_trait_selection::traits::query::normalize::AtExt;
|
||||||
@ -1080,9 +1076,7 @@ pub fn get_arg_name(pat: &Pat<'_>) -> Option<ast::Name> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn int_bits(tcx: TyCtxt<'_>, ity: ast::IntTy) -> u64 {
|
pub fn int_bits(tcx: TyCtxt<'_>, ity: ast::IntTy) -> u64 {
|
||||||
layout::Integer::from_attr(&tcx, attr::IntType::SignedInt(ity))
|
Integer::from_attr(&tcx, attr::IntType::SignedInt(ity)).size().bits()
|
||||||
.size()
|
|
||||||
.bits()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::cast_possible_wrap)]
|
#[allow(clippy::cast_possible_wrap)]
|
||||||
@ -1101,9 +1095,7 @@ pub fn unsext(tcx: TyCtxt<'_>, u: i128, ity: ast::IntTy) -> u128 {
|
|||||||
|
|
||||||
/// clip unused bytes
|
/// clip unused bytes
|
||||||
pub fn clip(tcx: TyCtxt<'_>, u: u128, ity: ast::UintTy) -> u128 {
|
pub fn clip(tcx: TyCtxt<'_>, u: u128, ity: ast::UintTy) -> u128 {
|
||||||
let bits = layout::Integer::from_attr(&tcx, attr::IntType::UnsignedInt(ity))
|
let bits = Integer::from_attr(&tcx, attr::IntType::UnsignedInt(ity)).size().bits();
|
||||||
.size()
|
|
||||||
.bits();
|
|
||||||
let amt = 128 - bits;
|
let amt = 128 - bits;
|
||||||
(u << amt) >> amt
|
(u << amt) >> amt
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user