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 9 pull requests #77483

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
7289383
Adjust rc::Weak::from_raw to support unsized T
CAD97 Jul 8, 2020
0c61ce2
?Sized bounds for rc::Weak::as_ptr and friends
CAD97 Jul 8, 2020
5e7406c
Adjust sync::Weak::from_raw to support unsized T
CAD97 Jul 14, 2020
9d9903c
Allow Weak::as_ptr and friends for unsized T
CAD97 Jul 14, 2020
3d07108
Add tests for weak into/from raw
CAD97 Jul 14, 2020
43c181b
Use `tracing` spans to trace the entire MIR interp stack
oli-obk Aug 4, 2020
e05e2f9
bootstrap: add ./x.py run src/tools/build-manifest
pietroalbini Sep 30, 2020
d4928ad
build-manifest: keep legacy behavior when invoking through ./x.py dist
pietroalbini Sep 30, 2020
6e15975
build-manifest: split the manifest struct definition in a separate file
pietroalbini Sep 30, 2020
5fdf436
unwind: Move linux-gnu library linking to lib.rs and libc
joshtriplett Sep 21, 2020
99557fc
Support static linking with glibc and target-feature=+crt-static
joshtriplett Sep 21, 2020
50ce45b
Cargo.lock: Update libc
joshtriplett Oct 1, 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
0375ee8
build-manifest: move generating a target to the manifest mod
pietroalbini Oct 1, 2020
acd8e59
build-manifest: calculate checksums lazily and in parallel
pietroalbini Oct 1, 2020
fde1135
build-manifest: avoid collecting SHAs in parallel on legacy mode
pietroalbini Oct 1, 2020
9352062
build-manifest: use BufReader
pietroalbini Oct 1, 2020
2e8f705
Add comment explaining why libunwind doesn't need to link libgcc_eh
joshtriplett Oct 1, 2020
cd159fd
Uplift drop-bounds lint from clippy
notriddle Aug 19, 2020
cadd12b
Implement Make `handle_alloc_error` default to panic (for no_std + li…
haraldh Sep 7, 2020
dceb81a
Deprecate clippy lint
notriddle 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
e27ef13
grammar nit
RalfJung Oct 3, 2020
f762dd8
Rollup merge of #74160 - CAD97:weak-as-unsized-ptr, r=RalfJung
Dylan-DPC Oct 3, 2020
61a30c1
Rollup merge of #75143 - oli-obk:tracing, r=RalfJung
Dylan-DPC Oct 3, 2020
291f520
Rollup merge of #75699 - notriddle:drop-bounds-lint, r=petrochenkov
Dylan-DPC Oct 3, 2020
ac5debc
Rollup merge of #76448 - haraldh:default_alloc_error_handler_reduced,…
Dylan-DPC Oct 3, 2020
eda4050
Rollup merge of #77386 - joshtriplett:static-glibc, r=petrochenkov
Dylan-DPC Oct 3, 2020
a341710
Rollup merge of #77388 - JohnTitor:add-tests, r=Dylan-DPC
Dylan-DPC Oct 3, 2020
3bf2d24
Rollup merge of #77407 - pietroalbini:less-build-manifest, r=Mark-Sim…
Dylan-DPC Oct 3, 2020
4edbfac
Rollup merge of #77468 - camelid:fix-test-name, r=Dylan-DPC
Dylan-DPC Oct 3, 2020
3f2a53f
Rollup merge of #77469 - camelid:rustdoc-better-failed-res-error, r=j…
Dylan-DPC 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
91 changes: 69 additions & 22 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,16 @@ dependencies = [
"block-padding",
"byte-tools",
"byteorder",
"generic-array",
"generic-array 0.12.3",
]

[[package]]
name = "block-buffer"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
dependencies = [
"generic-array 0.14.4",
]

[[package]]
Expand Down Expand Up @@ -233,8 +242,11 @@ version = "0.1.0"
dependencies = [
"anyhow",
"flate2",
"hex 0.4.2",
"rayon",
"serde",
"serde_json",
"sha2",
"tar",
"toml",
]
Expand Down Expand Up @@ -687,6 +699,12 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a21fa21941700a3cd8fcb4091f361a6a712fac632f85d9f487cc892045d55c6"

[[package]]
name = "cpuid-bool"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634"

[[package]]
name = "crates-io"
version = "0.31.1"
Expand Down Expand Up @@ -884,7 +902,16 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
dependencies = [
"generic-array",
"generic-array 0.12.3",
]

[[package]]
name = "digest"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
dependencies = [
"generic-array 0.14.4",
]

[[package]]
Expand Down Expand Up @@ -1166,6 +1193,16 @@ dependencies = [
"typenum",
]

[[package]]
name = "generic-array"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
dependencies = [
"typenum",
"version_check",
]

[[package]]
name = "getopts"
version = "0.2.21"
Expand Down Expand Up @@ -1623,9 +1660,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"

[[package]]
name = "libc"
version = "0.2.77"
version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
checksum = "aa7087f49d294270db4e1928fc110c976cd4b9e5a16348e0a1df09afa99e6c98"
dependencies = [
"rustc-std-workspace-core",
]
Expand Down Expand Up @@ -1726,15 +1763,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 @@ -1844,9 +1872,9 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a18af3dcaf2b0219366cdb4e2af65a6101457b415c3d1a5c71dd9c2b7c77b9c8"
dependencies = [
"block-buffer",
"digest",
"opaque-debug",
"block-buffer 0.7.3",
"digest 0.8.1",
"opaque-debug 0.2.3",
]

[[package]]
Expand Down Expand Up @@ -2106,6 +2134,12 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"

[[package]]
name = "opaque-debug"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"

[[package]]
name = "open"
version = "1.4.0"
Expand Down Expand Up @@ -3523,6 +3557,7 @@ dependencies = [
"rustc_target",
"tracing",
"tracing-subscriber",
"tracing-tree",
"winapi 0.3.9",
]

Expand Down Expand Up @@ -3810,7 +3845,6 @@ version = "0.0.0"
dependencies = [
"either",
"itertools 0.9.0",
"log_settings",
"polonius-engine",
"regex",
"rustc_apfloat",
Expand Down Expand Up @@ -4371,10 +4405,23 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df"
dependencies = [
"block-buffer",
"digest",
"block-buffer 0.7.3",
"digest 0.8.1",
"fake-simd",
"opaque-debug",
"opaque-debug 0.2.3",
]

[[package]]
name = "sha2"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1"
dependencies = [
"block-buffer 0.9.0",
"cfg-if",
"cpuid-bool",
"digest 0.9.0",
"opaque-debug 0.3.0",
]

[[package]]
Expand Down Expand Up @@ -5105,9 +5152,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
45 changes: 44 additions & 1 deletion compiler/rustc_codegen_llvm/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ use libc::c_uint;
use rustc_ast::expand::allocator::{AllocatorKind, AllocatorTy, ALLOCATOR_METHODS};
use rustc_middle::bug;
use rustc_middle::ty::TyCtxt;
use rustc_span::symbol::sym;

use crate::llvm::{self, False, True};
use crate::ModuleLlvm;

pub(crate) unsafe fn codegen(tcx: TyCtxt<'_>, mods: &mut ModuleLlvm, kind: AllocatorKind) {
pub(crate) unsafe fn codegen(
tcx: TyCtxt<'_>,
mods: &mut ModuleLlvm,
kind: AllocatorKind,
has_alloc_error_handler: bool,
) {
let llcx = &*mods.llcx;
let llmod = mods.llmod();
let usize = match &tcx.sess.target.target.target_pointer_width[..] {
Expand Down Expand Up @@ -82,4 +88,41 @@ pub(crate) unsafe fn codegen(tcx: TyCtxt<'_>, mods: &mut ModuleLlvm, kind: Alloc
}
llvm::LLVMDisposeBuilder(llbuilder);
}

// rust alloc error handler
let args = [usize, usize]; // size, align

let ty = llvm::LLVMFunctionType(void, args.as_ptr(), args.len() as c_uint, False);
let name = format!("__rust_alloc_error_handler");
let llfn = llvm::LLVMRustGetOrInsertFunction(llmod, name.as_ptr().cast(), name.len(), ty);
// -> ! DIFlagNoReturn
llvm::Attribute::NoReturn.apply_llfn(llvm::AttributePlace::Function, llfn);

if tcx.sess.target.target.options.default_hidden_visibility {
llvm::LLVMRustSetVisibility(llfn, llvm::Visibility::Hidden);
}
if tcx.sess.must_emit_unwind_tables() {
attributes::emit_uwtable(llfn, true);
}

let kind = if has_alloc_error_handler { AllocatorKind::Global } else { AllocatorKind::Default };
let callee = kind.fn_name(sym::oom);
let callee = llvm::LLVMRustGetOrInsertFunction(llmod, callee.as_ptr().cast(), callee.len(), ty);
// -> ! DIFlagNoReturn
llvm::Attribute::NoReturn.apply_llfn(llvm::AttributePlace::Function, callee);
llvm::LLVMRustSetVisibility(callee, llvm::Visibility::Hidden);

let llbb = llvm::LLVMAppendBasicBlockInContext(llcx, llfn, "entry\0".as_ptr().cast());

let llbuilder = llvm::LLVMCreateBuilderInContext(llcx);
llvm::LLVMPositionBuilderAtEnd(llbuilder, llbb);
let args = args
.iter()
.enumerate()
.map(|(i, _)| llvm::LLVMGetParam(llfn, i as c_uint))
.collect::<Vec<_>>();
let ret = llvm::LLVMRustBuildCall(llbuilder, callee, args.as_ptr(), args.len() as c_uint, None);
llvm::LLVMSetTailCall(ret, True);
llvm::LLVMBuildRetVoid(llbuilder);
llvm::LLVMDisposeBuilder(llbuilder);
}
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ impl ExtraBackendMethods for LlvmCodegenBackend {
tcx: TyCtxt<'tcx>,
mods: &mut ModuleLlvm,
kind: AllocatorKind,
has_alloc_error_handler: bool,
) {
unsafe { allocator::codegen(tcx, mods, kind) }
unsafe { allocator::codegen(tcx, mods, kind, has_alloc_error_handler) }
}
fn compile_codegen_unit(
&self,
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,9 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
let llmod_id =
cgu_name_builder.build_cgu_name(LOCAL_CRATE, &["crate"], Some("allocator")).to_string();
let mut modules = backend.new_metadata(tcx, &llmod_id);
tcx.sess
.time("write_allocator_module", || backend.codegen_allocator(tcx, &mut modules, kind));
tcx.sess.time("write_allocator_module", || {
backend.codegen_allocator(tcx, &mut modules, kind, tcx.lang_items().oom().is_some())
});

Some(ModuleCodegen { name: llmod_id, module_llvm: modules, kind: ModuleKind::Allocator })
} else {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_ssa/src/traits/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Se
tcx: TyCtxt<'tcx>,
mods: &mut Self::Module,
kind: AllocatorKind,
has_alloc_error_handler: bool,
);
/// This generates the codegen unit and returns it along with
/// a `u64` giving an estimate of the unit's processing cost.
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_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,9 @@ declare_features! (
/// Allows to use the `#[cmse_nonsecure_entry]` attribute.
(active, cmse_nonsecure_entry, "1.48.0", Some(75835), None),

/// Allows rustc to inject a default alloc_error_handler
(active, default_alloc_error_handler, "1.48.0", Some(66741), None),

// -------------------------------------------------------------------------
// feature-group-end: actual feature gates
// -------------------------------------------------------------------------
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
Loading