Auto merge of #6178 - josephlr:sync-from-rust, r=phansch

Sync from rust

Fix rustc breakage by running:
```rust
git subtree push -P src/tools/clippy git@github.com:josephlr/rust-clippy sync-from-rust
```
and then adding a commit that runs `cargo dev fmt`

---

changelog: none
This commit is contained in:
bors 2020-10-16 07:45:42 +00:00
commit a771557ee9
3 changed files with 8 additions and 6 deletions

View File

@ -9,11 +9,11 @@ use rustc_hir::intravisit::FnKind;
use rustc_hir::{Body, FnDecl, HirId, ItemKind, MutTy, Mutability, Node};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty;
use rustc_session::config::Config as SessionConfig;
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::Span;
use rustc_target::abi::LayoutOf;
use rustc_target::spec::abi::Abi;
use rustc_target::spec::Target;
declare_clippy_lint! {
/// **What it does:** Checks for functions taking arguments by reference, where
@ -60,9 +60,9 @@ pub struct TriviallyCopyPassByRef {
}
impl<'tcx> TriviallyCopyPassByRef {
pub fn new(limit: Option<u64>, target: &SessionConfig) -> Self {
pub fn new(limit: Option<u64>, target: &Target) -> Self {
let limit = limit.unwrap_or_else(|| {
let bit_width = u64::from(target.ptr_width);
let bit_width = u64::from(target.pointer_width);
// Cap the calculated bit width at 32-bits to reduce
// portability problems between 32 and 64-bit targets
let bit_width = cmp::min(bit_width, 32);

View File

@ -276,9 +276,9 @@ fn report_clippy_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
// If backtraces are enabled, also print the query stack
let backtrace = env::var_os("RUST_BACKTRACE").map_or(false, |x| &x != "0");
if backtrace {
TyCtxt::try_print_query_stack(&handler);
}
let num_frames = if backtrace { None } else { Some(2) };
TyCtxt::try_print_query_stack(&handler, num_frames);
}
fn toolchain_path(home: Option<String>, toolchain: Option<String>) -> Option<PathBuf> {

View File

@ -9,3 +9,5 @@ note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy
note: Clippy version: foo
query stack during panic:
end of query stack