Skip to content

Commit

Permalink
Auto merge of rust-lang#99792 - JohnTitor:rollup-20i7ewx, r=JohnTitor
Browse files Browse the repository at this point in the history
Rollup of 8 pull requests

Successful merges:

 - rust-lang#98583 (Stabilize Windows `FileTypeExt` with `is_symlink_dir` and `is_symlink_file`)
 - rust-lang#99698 (Prefer visibility map parents that are not `doc(hidden)` first)
 - rust-lang#99700 (Add a clickable link to the layout section)
 - rust-lang#99712 (passes: port more of `check_attr` module)
 - rust-lang#99759 (Remove dead code from cg_llvm)
 - rust-lang#99765 (Don't build std for *-uefi targets)
 - rust-lang#99771 (Update pulldown-cmark version to 0.9.2 (fixes url encoding for some chars))
 - rust-lang#99775 (rustdoc: do not allocate String when writing path full name)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Jul 27, 2022
2 parents b573e10 + 0d5bdca commit e33cc71
Show file tree
Hide file tree
Showing 26 changed files with 622 additions and 399 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ dependencies = [

[[package]]
name = "bitflags"
version = "1.2.1"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"

[[package]]
name = "bitmaps"
Expand Down Expand Up @@ -2394,9 +2394,9 @@ dependencies = [

[[package]]
name = "memchr"
version = "2.4.1"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
dependencies = [
"compiler_builtins",
"rustc-std-workspace-core",
Expand Down Expand Up @@ -3044,9 +3044,9 @@ dependencies = [

[[package]]
name = "pulldown-cmark"
version = "0.9.1"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34f197a544b0c9ab3ae46c359a7ec9cbbb5c7bf97054266fecb7ead794a181d6"
checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63"
dependencies = [
"bitflags",
"memchr",
Expand Down
13 changes: 0 additions & 13 deletions compiler/rustc_codegen_llvm/src/llvm/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,6 @@ pub enum OptimizationDiagnosticKind {
OptimizationRemarkOther,
}

impl OptimizationDiagnosticKind {
pub fn describe(self) -> &'static str {
match self {
OptimizationRemark | OptimizationRemarkOther => "remark",
OptimizationMissed => "missed",
OptimizationAnalysis => "analysis",
OptimizationAnalysisFPCommute => "floating-point",
OptimizationAnalysisAliasing => "aliasing",
OptimizationFailure => "failure",
}
}
}

pub struct OptimizationDiagnostic<'ll> {
pub kind: OptimizationDiagnosticKind,
pub pass_name: String,
Expand Down
27 changes: 0 additions & 27 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,16 +572,6 @@ pub enum ArchiveKind {
K_COFF,
}

/// LLVMRustPassKind
#[derive(Copy, Clone, PartialEq, Debug)]
#[repr(C)]
#[allow(dead_code)] // Variants constructed by C++.
pub enum PassKind {
Other,
Function,
Module,
}

// LLVMRustThinLTOData
extern "C" {
pub type ThinLTOData;
Expand All @@ -592,10 +582,6 @@ extern "C" {
pub type ThinLTOBuffer;
}

// LLVMRustModuleNameCallback
pub type ThinLTOModuleNameCallback =
unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);

/// LLVMRustThinLTOModule
#[repr(C)]
pub struct ThinLTOModule {
Expand Down Expand Up @@ -661,9 +647,6 @@ extern "C" {
}
#[repr(C)]
pub struct Builder<'a>(InvariantOpaque<'a>);
extern "C" {
pub type MemoryBuffer;
}
#[repr(C)]
pub struct PassManager<'a>(InvariantOpaque<'a>);
extern "C" {
Expand Down Expand Up @@ -1032,7 +1015,6 @@ extern "C" {
pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);

/// See Module::setModuleInlineAsm.
pub fn LLVMSetModuleInlineAsm2(M: &Module, Asm: *const c_char, AsmLen: size_t);
pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char, AsmLen: size_t);

/// See llvm::LLVMTypeKind::getTypeID.
Expand Down Expand Up @@ -1186,7 +1168,6 @@ extern "C" {
pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
pub fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value);
pub fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool;
pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
Expand Down Expand Up @@ -2267,7 +2248,6 @@ extern "C" {

pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;

pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
pub fn LLVMRustCreateAddressSanitizerFunctionPass(Recover: bool) -> &'static mut Pass;
pub fn LLVMRustCreateModuleAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
Expand Down Expand Up @@ -2384,7 +2364,6 @@ extern "C" {
) -> LLVMRustResult;
pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
pub fn LLVMRustPrintPasses();
pub fn LLVMRustGetInstructionCount(M: &Module) -> u32;
pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
Expand Down Expand Up @@ -2482,7 +2461,6 @@ extern "C" {
pub fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);

pub fn LLVMRustSetComdat<'a>(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t);
pub fn LLVMRustUnsetComdat(V: &Value);
pub fn LLVMRustSetModulePICLevel(M: &Module);
pub fn LLVMRustSetModulePIELevel(M: &Module);
pub fn LLVMRustSetModuleCodeModel(M: &Module, Model: CodeModel);
Expand Down Expand Up @@ -2514,11 +2492,6 @@ extern "C" {
Module: &Module,
Target: &TargetMachine,
) -> bool;
pub fn LLVMRustGetThinLTOModuleImports(
Data: *const ThinLTOData,
ModuleNameCallback: ThinLTOModuleNameCallback,
CallbackPayload: *mut c_void,
);
pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
pub fn LLVMRustParseBitcodeForLTO(
Context: &Context,
Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_codegen_llvm/src/llvm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ pub fn SetUniqueComdat(llmod: &Module, val: &Value) {
}
}

pub fn UnsetComdat(val: &Value) {
unsafe {
LLVMRustUnsetComdat(val);
}
}

pub fn SetUnnamedAddress(global: &Value, unnamed: UnnamedAddr) {
unsafe {
LLVMSetUnnamedAddress(global, unnamed);
Expand Down
107 changes: 107 additions & 0 deletions compiler/rustc_error_messages/locales/en-US/passes.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,110 @@ passes-cold = {passes-should-be-applied-to-fn}
passes-link = attribute should be applied to an `extern` block with non-Rust ABI
.warn = {-passes-previously-accepted}
.label = not an `extern` block
passes-link-name = attribute should be applied to a foreign function or static
.warn = {-passes-previously-accepted}
.label = not a foreign function or static
.help = try `#[link(name = "{$value}")]` instead
passes-no-link = attribute should be applied to an `extern crate` item
.label = not an `extern crate` item
passes-export-name = attribute should be applied to a free function, impl method or static
.label = not a free function, impl method or static
passes-rustc-layout-scalar-valid-range-not-struct = attribute should be applied to a struct
.label = not a struct
passes-rustc-layout-scalar-valid-range-arg = expected exactly one integer literal argument
passes-rustc-legacy-const-generics-only = #[rustc_legacy_const_generics] functions must only have const generics
.label = non-const generic parameter
passes-rustc-legacy-const-generics-index = #[rustc_legacy_const_generics] must have one index for each generic parameter
.label = generic parameters
passes-rustc-legacy-const-generics-index-exceed = index exceeds number of arguments
.label = there {$arg_count ->
[one] is
*[other] are
} only {$arg_count} {$arg_count ->
[one] argument
*[other] arguments
}
passes-rustc-legacy-const-generics-index-negative = arguments should be non-negative integers
passes-rustc-dirty-clean = attribute requires -Z query-dep-graph to be enabled
passes-link-section = attribute should be applied to a function or static
.warn = {-passes-previously-accepted}
.label = not a function or static
passes-no-mangle-foreign = `#[no_mangle]` has no effect on a foreign {$foreign_item_kind}
.warn = {-passes-previously-accepted}
.label = foreign {$foreign_item_kind}
.note = symbol names in extern blocks are not mangled
.suggestion = remove this attribute
passes-no-mangle = attribute should be applied to a free function, impl method or static
.warn = {-passes-previously-accepted}
.label = not a free function, impl method or static
passes-repr-ident = meta item in `repr` must be an identifier
passes-repr-conflicting = conflicting representation hints
passes-used-static = attribute must be applied to a `static` variable
passes-used-compiler-linker = `used(compiler)` and `used(linker)` can't be used together
passes-allow-internal-unstable = attribute should be applied to a macro
.label = not a macro
passes-debug-visualizer-placement = attribute should be applied to a module
passes-debug-visualizer-invalid = invalid argument
.note-1 = expected: `natvis_file = "..."`
.note-2 = OR
.note-3 = expected: `gdb_script_file = "..."`
passes-rustc-allow-const-fn-unstable = attribute should be applied to `const fn`
.label = not a `const fn`
passes-rustc-std-internal-symbol = attribute should be applied to functions or statics
.label = not a function or static
passes-const-trait = attribute should be applied to a trait
passes-stability-promotable = attribute cannot be applied to an expression
passes-deprecated = attribute is ignored here
passes-macro-use = `#[{$name}]` only has an effect on `extern crate` and modules
passes-macro-export = `#[macro_export]` only has an effect on macro definitions
passes-plugin-registrar = `#[plugin_registrar]` only has an effect on functions
passes-unused-empty-lints-note = attribute `{$name}` with an empty list has no effect
passes-unused-no-lints-note = attribute `{$name}` without any lints has no effect
passes-unused-default-method-body-const-note =
`default_method_body_is_const` has been replaced with `#[const_trait]` on traits
passes-unused = unused attribute
.suggestion = remove this attribute
passes-non-exported-macro-invalid-attrs = attribute should be applied to function or closure
.label = not a function or closure
passes-unused-duplicate = unused attribute
.suggestion = remove this attribute
.note = attribute also specified here
.warn = {-passes-previously-accepted}
passes-unused-multiple = multiple `{$name}` attributes
.suggestion = remove this attribute
.note = attribute also specified here
45 changes: 0 additions & 45 deletions compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,6 @@ extern "C" void LLVMTimeTraceProfilerFinish(const char* FileName) {
timeTraceProfilerCleanup();
}

enum class LLVMRustPassKind {
Other,
Function,
Module,
};

static LLVMRustPassKind toRust(PassKind Kind) {
switch (Kind) {
case PT_Function:
return LLVMRustPassKind::Function;
case PT_Module:
return LLVMRustPassKind::Module;
default:
return LLVMRustPassKind::Other;
}
}

extern "C" LLVMPassRef LLVMRustFindAndCreatePass(const char *PassName) {
#if LLVM_VERSION_LT(15, 0)
StringRef SR(PassName);
Expand Down Expand Up @@ -172,12 +155,6 @@ extern "C" LLVMPassRef LLVMRustCreateHWAddressSanitizerPass(bool Recover) {
#endif
}

extern "C" LLVMRustPassKind LLVMRustPassKind(LLVMPassRef RustPass) {
assert(RustPass);
Pass *Pass = unwrap(RustPass);
return toRust(Pass->getPassKind());
}

extern "C" void LLVMRustAddPass(LLVMPassManagerRef PMR, LLVMPassRef RustPass) {
#if LLVM_VERSION_LT(15, 0)
assert(RustPass);
Expand Down Expand Up @@ -1604,28 +1581,6 @@ LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data, LLVMModuleRef M,
return true;
}

extern "C" typedef void (*LLVMRustModuleNameCallback)(void*, // payload
const char*, // importing module name
const char*); // imported module name

// Calls `module_name_callback` for each module import done by ThinLTO.
// The callback is provided with regular null-terminated C strings.
extern "C" void
LLVMRustGetThinLTOModules(const LLVMRustThinLTOData *data,
LLVMRustModuleNameCallback module_name_callback,
void* callback_payload) {
for (const auto& importing_module : data->ImportLists) {
const std::string importing_module_id = importing_module.getKey().str();
const auto& imports = importing_module.getValue();
for (const auto& imported_module : imports) {
const std::string imported_module_id = imported_module.getKey().str();
module_name_callback(callback_payload,
importing_module_id.c_str(),
imported_module_id.c_str());
}
}
}

// This struct and various functions are sort of a hack right now, but the
// problem is that we've got in-memory LLVM modules after we generate and
// optimize all codegen-units for one compilation in rustc. To be compatible
Expand Down
9 changes: 0 additions & 9 deletions compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ extern "C" char *LLVMRustGetLastError(void) {
return Ret;
}

extern "C" unsigned int LLVMRustGetInstructionCount(LLVMModuleRef M) {
return unwrap(M)->getInstructionCount();
}

extern "C" void LLVMRustSetLastError(const char *Err) {
free((void *)LastError);
LastError = strdup(Err);
Expand Down Expand Up @@ -1529,11 +1525,6 @@ extern "C" void LLVMRustSetComdat(LLVMModuleRef M, LLVMValueRef V,
}
}

extern "C" void LLVMRustUnsetComdat(LLVMValueRef V) {
GlobalObject *GV = unwrap<GlobalObject>(V);
GV->setComdat(nullptr);
}

enum class LLVMRustLinkage {
ExternalLinkage = 0,
AvailableExternallyLinkage = 1,
Expand Down
20 changes: 15 additions & 5 deletions compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,13 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
use std::collections::vec_deque::VecDeque;

let mut visible_parent_map: DefIdMap<DefId> = Default::default();
// This is a secondary visible_parent_map, storing the DefId of parents that re-export
// the child as `_`. Since we prefer parents that don't do this, merge this map at the
// end, only if we're missing any keys from the former.
// This is a secondary visible_parent_map, storing the DefId of
// parents that re-export the child as `_` or module parents
// which are `#[doc(hidden)]`. Since we prefer paths that don't
// do this, merge this map at the end, only if we're missing
// keys from the former.
// This is a rudimentary check that does not catch all cases,
// just the easiest.
let mut fallback_map: DefIdMap<DefId> = Default::default();

// Issue 46112: We want the map to prefer the shortest
Expand Down Expand Up @@ -412,6 +416,11 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
return;
}

if ty::util::is_doc_hidden(tcx, parent) {
fallback_map.insert(def_id, parent);
return;
}

match visible_parent_map.entry(def_id) {
Entry::Occupied(mut entry) => {
// If `child` is defined in crate `cnum`, ensure
Expand Down Expand Up @@ -439,8 +448,9 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
}
}

// Fill in any missing entries with the (less preferable) path ending in `::_`.
// We still use this path in a diagnostic that suggests importing `::*`.
// Fill in any missing entries with the less preferable path.
// If this path re-exports the child as `_`, we still use this
// path in a diagnostic that suggests importing `::*`.
for (child, parent) in fallback_map {
visible_parent_map.entry(child).or_insert(parent);
}
Expand Down
Loading

0 comments on commit e33cc71

Please sign in to comment.