Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 12 pull requests #77509

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
96a8048
rustc_ast_passes: allow c-variadic associated fns
dlrobertson Sep 18, 2020
43c181b
Use `tracing` spans to trace the entire MIR interp stack
oli-obk Aug 4, 2020
916d236
updated p! macro to accept literals
jakevossen5 Sep 30, 2020
d103fe1
Fixed more write literals after master merge
jakevossen5 Sep 30, 2020
f69a88b
updated p! macro to accept literals
jakevossen5 Sep 30, 2020
5032674
fixed merge conflicts
jakevossen5 Sep 30, 2020
dffb9d6
cargo fmt
jakevossen5 Sep 30, 2020
c1e17f5
Add a regression test for issue-66501
JohnTitor Oct 1, 2020
8631e1c
Add a regression test for issue-68951
JohnTitor Oct 1, 2020
50ffd6b
Add a regression test for issue-72565
JohnTitor Oct 1, 2020
d4fdf6e
Add a regression test for issue-74244
JohnTitor Oct 1, 2020
38f460f
Add a regression test for issue-75299
JohnTitor Oct 1, 2020
8f9472c
Only mention that a stack frame is being popped when starting to do so
oli-obk Oct 1, 2020
cd159fd
Uplift drop-bounds lint from clippy
notriddle Aug 19, 2020
e87d391
BTreeMap: complete the compile-time test_variance test case
ssomers Oct 2, 2020
90c8b43
BTreeMap: document DrainFilterInner better
ssomers Sep 26, 2020
dceb81a
Deprecate clippy lint
notriddle Oct 2, 2020
3ea96b8
made multiline macro calls into single line
jakevossen5 Oct 2, 2020
4c9bcf3
Fix test name
camelid Oct 2, 2020
87f3f81
Improve rustdoc error for failed intra-doc link resolution
camelid Oct 2, 2020
0193a88
Remove unhelpful help message
camelid Oct 2, 2020
21fb9df
Use old error when there's partial resolution
camelid Oct 3, 2020
aa9b718
Improve error messages
camelid Oct 3, 2020
f296163
Place all-targets checking behind a flag
Mark-Simulacrum Oct 2, 2020
bcab97c
Check all Cargo targets on CI
Mark-Simulacrum Oct 2, 2020
b22e039
Set `deny-warnings = false` in contributor defaults
jyn514 Oct 3, 2020
eaa0186
Add quotes around command in CHANGELOG
ecstatic-morse Oct 3, 2020
018d587
fixed going over 100 chars in line
jakevossen5 Oct 3, 2020
e41a144
Support vectors with fewer than 8 elements for simd_select_bitmask
Amanieu Oct 3, 2020
acfafb5
Rollup merge of #74765 - dlrobertson:c-variadic-assoc-fn, r=joshtriplett
jonas-schievink Oct 3, 2020
8003ac6
Rollup merge of #75143 - oli-obk:tracing, r=RalfJung
jonas-schievink Oct 3, 2020
b85a3f7
Rollup merge of #75699 - notriddle:drop-bounds-lint, r=petrochenkov
jonas-schievink Oct 3, 2020
ab940e2
Rollup merge of #77190 - jakevossen5:master, r=eddyb
jonas-schievink Oct 3, 2020
31b0f10
Rollup merge of #77388 - JohnTitor:add-tests, r=Dylan-DPC
jonas-schievink Oct 3, 2020
58585a3
Rollup merge of #77445 - ssomers:btree_cleanup_7, r=Mark-Simulacrum
jonas-schievink Oct 3, 2020
f990bba
Rollup merge of #77447 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
jonas-schievink Oct 3, 2020
40d1dc9
Rollup merge of #77468 - camelid:fix-test-name, r=Dylan-DPC
jonas-schievink Oct 3, 2020
5c5d2f8
Rollup merge of #77469 - camelid:rustdoc-better-failed-res-error, r=j…
jonas-schievink Oct 3, 2020
85c1966
Rollup merge of #77473 - Mark-Simulacrum:check-limited, r=ecstatic-morse
jonas-schievink Oct 3, 2020
317d122
Rollup merge of #77492 - jyn514:no-deny, r=nagisa
jonas-schievink Oct 3, 2020
5efe9be
Rollup merge of #77504 - Amanieu:select_simd_bitmask, r=ecstatic-morse
jonas-schievink Oct 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1726,15 +1726,6 @@ dependencies = [
"cfg-if",
]

[[package]]
name = "log_settings"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19af41f0565d7c19b2058153ad0b42d4d5ce89ec4dbf06ed6741114a8b63e7cd"
dependencies = [
"lazy_static",
]

[[package]]
name = "lsp-codec"
version = "0.1.2"
Expand Down Expand Up @@ -3523,6 +3514,7 @@ dependencies = [
"rustc_target",
"tracing",
"tracing-subscriber",
"tracing-tree",
"winapi 0.3.9",
]

Expand Down Expand Up @@ -3810,7 +3802,6 @@ version = "0.0.0"
dependencies = [
"either",
"itertools 0.9.0",
"log_settings",
"polonius-engine",
"regex",
"rustc_apfloat",
Expand Down Expand Up @@ -5105,9 +5096,9 @@ dependencies = [

[[package]]
name = "tracing-tree"
version = "0.1.5"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1a3dc4774db3a6b2d66a4f8d8de670e874ec3ed55615860c994927419b32c5f"
checksum = "43aac8afb493b08e1e1904956f7407c1e671b9c83b26a17e1bd83d6a3520e350"
dependencies = [
"ansi_term 0.12.1",
"atty",
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_ast_passes/src/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,8 @@ impl<'a> AstValidator<'a> {
fn check_c_varadic_type(&self, fk: FnKind<'a>) {
match (fk.ctxt(), fk.header()) {
(Some(FnCtxt::Foreign), _) => return,
(Some(FnCtxt::Free), Some(header)) => match header.ext {
(Some(FnCtxt::Free), Some(header))
| (Some(FnCtxt::Assoc(AssocCtxt::Impl)), Some(header)) => match header.ext {
Extern::Explicit(StrLit { symbol_unescaped: sym::C, .. }) | Extern::Implicit
if matches!(header.unsafety, Unsafe::Yes(_)) =>
{
Expand Down
10 changes: 7 additions & 3 deletions compiler/rustc_codegen_llvm/src/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,14 +793,18 @@ fn generic_simd_intrinsic(
require_simd!(arg_tys[1], "argument");
let v_len = arg_tys[1].simd_size(tcx);
require!(
m_len == v_len,
// Allow masks for vectors with fewer than 8 elements to be
// represented with a u8 or i8.
m_len == v_len || (m_len == 8 && v_len < 8),
"mismatched lengths: mask length `{}` != other vector length `{}`",
m_len,
v_len
);
let i1 = bx.type_i1();
let i1xn = bx.type_vector(i1, m_len);
let m_i1s = bx.bitcast(args[0].immediate(), i1xn);
let im = bx.type_ix(v_len);
let i1xn = bx.type_vector(i1, v_len);
let m_im = bx.trunc(args[0].immediate(), im);
let m_i1s = bx.bitcast(m_im, i1xn);
return Ok(bx.select(m_i1s, args[1].immediate(), args[2].immediate()));
}

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ crate-type = ["dylib"]
libc = "0.2"
tracing = { version = "0.1.18" }
tracing-subscriber = { version = "0.2.10", default-features = false, features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"] }
tracing-tree = "0.1.6"
rustc_middle = { path = "../rustc_middle" }
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_target = { path = "../rustc_target" }
Expand Down
20 changes: 15 additions & 5 deletions compiler/rustc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1251,11 +1251,21 @@ pub fn init_env_logger(env: &str) {
Ok(s) if s.is_empty() => return,
Ok(_) => {}
}
let builder = tracing_subscriber::FmtSubscriber::builder();

let builder = builder.with_env_filter(tracing_subscriber::EnvFilter::from_env(env));

builder.init()
let filter = tracing_subscriber::EnvFilter::from_env(env);
let layer = tracing_tree::HierarchicalLayer::default()
.with_indent_lines(true)
.with_ansi(true)
.with_targets(true)
.with_thread_ids(true)
.with_thread_names(true)
.with_wraparound(10)
.with_verbose_exit(true)
.with_verbose_entry(true)
.with_indent_amount(2);

use tracing_subscriber::layer::SubscriberExt;
let subscriber = tracing_subscriber::Registry::default().with(filter).with(layer);
tracing::subscriber::set_global_default(subscriber).unwrap();
}

pub fn main() -> ! {
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ mod non_ascii_idents;
mod nonstandard_style;
mod passes;
mod redundant_semicolon;
mod traits;
mod types;
mod unused;

Expand All @@ -75,6 +76,7 @@ use internal::*;
use non_ascii_idents::*;
use nonstandard_style::*;
use redundant_semicolon::*;
use traits::*;
use types::*;
use unused::*;

Expand Down Expand Up @@ -157,6 +159,7 @@ macro_rules! late_lint_passes {
MissingDebugImplementations: MissingDebugImplementations::default(),
ArrayIntoIter: ArrayIntoIter,
ClashingExternDeclarations: ClashingExternDeclarations::new(),
DropTraitConstraints: DropTraitConstraints,
]
);
};
Expand Down
79 changes: 79 additions & 0 deletions compiler/rustc_lint/src/traits.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
use crate::LateContext;
use crate::LateLintPass;
use crate::LintContext;
use rustc_hir as hir;
use rustc_span::symbol::sym;

declare_lint! {
/// The `drop_bounds` lint checks for generics with `std::ops::Drop` as
/// bounds.
///
/// ### Example
///
/// ```rust
/// fn foo<T: Drop>() {}
/// ```
///
/// {{produces}}
///
/// ### Explanation
///
/// `Drop` bounds do not really accomplish anything. A type may have
/// compiler-generated drop glue without implementing the `Drop` trait
/// itself. The `Drop` trait also only has one method, `Drop::drop`, and
/// that function is by fiat not callable in user code. So there is really
/// no use case for using `Drop` in trait bounds.
///
/// The most likely use case of a drop bound is to distinguish between
/// types that have destructors and types that don't. Combined with
/// specialization, a naive coder would write an implementation that
/// assumed a type could be trivially dropped, then write a specialization
/// for `T: Drop` that actually calls the destructor. Except that doing so
/// is not correct; String, for example, doesn't actually implement Drop,
/// but because String contains a Vec, assuming it can be trivially dropped
/// will leak memory.
pub DROP_BOUNDS,
Warn,
"bounds of the form `T: Drop` are useless"
}

declare_lint_pass!(
/// Lint for bounds of the form `T: Drop`, which usually
/// indicate an attempt to emulate `std::mem::needs_drop`.
DropTraitConstraints => [DROP_BOUNDS]
);

impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
use rustc_middle::ty::PredicateAtom::*;

let def_id = cx.tcx.hir().local_def_id(item.hir_id);
let predicates = cx.tcx.explicit_predicates_of(def_id);
for &(predicate, span) in predicates.predicates {
let trait_predicate = match predicate.skip_binders() {
Trait(trait_predicate, _constness) => trait_predicate,
_ => continue,
};
let def_id = trait_predicate.trait_ref.def_id;
if cx.tcx.lang_items().drop_trait() == Some(def_id) {
// Explicitly allow `impl Drop`, a drop-guards-as-Voldemort-type pattern.
if trait_predicate.trait_ref.self_ty().is_impl_trait() {
continue;
}
cx.struct_span_lint(DROP_BOUNDS, span, |lint| {
let needs_drop = match cx.tcx.get_diagnostic_item(sym::needs_drop) {
Some(needs_drop) => needs_drop,
None => return,
};
let msg = format!(
"bounds on `{}` are useless, consider instead \
using `{}` to detect if a type has a destructor",
predicate,
cx.tcx.def_path_str(needs_drop)
);
lint.build(&msg).emit()
});
}
}
}
}
Loading