Skip to content

Rollup of 8 pull requests #99792

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

Merged
merged 19 commits into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e374c91
Stabilize Windows `FileTypeExt` with `is_symlink_dir` and `is_symlink…
joshtriplett Jun 27, 2022
a4cb0b9
Seal Windows `FileTypeExt` extension trait to allow adding future met…
joshtriplett Jun 27, 2022
6d1100f
Add failing test
In-line Dec 21, 2021
42a4419
Do not prefer module parents which are `doc(hidden)` in visibility map
compiler-errors Jul 24, 2022
76cf6bd
passes: port more of `check_attr` module
davidtwco Jul 19, 2022
5fcd2f7
Add a clickable link to the layout section
est31 Jul 24, 2022
15db418
Simplify test
est31 Jul 26, 2022
017e172
Remove dead code from cg_llvm
bjorn3 Jul 26, 2022
05c1a4a
Don't build std for *-uefi targets
nicholasbishop Jul 26, 2022
7f78a9a
Update pulldown-cmark version
GuillaumeGomez Jul 26, 2022
b8fb6e1
rustdoc: do not allocate String when writing path full name
notriddle Jul 26, 2022
1ff84f0
Rollup merge of #98583 - joshtriplett:stabilize-windows-symlink-types…
JohnTitor Jul 27, 2022
3ca1c31
Rollup merge of #99698 - compiler-errors:no-doc-hidden, r=cjgillot
JohnTitor Jul 27, 2022
181bf05
Rollup merge of #99700 - est31:rustdoc_layout_heading, r=GuillaumeGomez
JohnTitor Jul 27, 2022
fe51d07
Rollup merge of #99712 - davidtwco:translation-migrate-passes-2, r=co…
JohnTitor Jul 27, 2022
7f608e9
Rollup merge of #99759 - bjorn3:remove_llvm_dead_code, r=nikic
JohnTitor Jul 27, 2022
a76f2fe
Rollup merge of #99765 - nicholasbishop:bishop-disable-uefi-std-build…
JohnTitor Jul 27, 2022
f8f07de
Rollup merge of #99771 - GuillaumeGomez:update-pulldown-cmark, r=Urgau
JohnTitor Jul 27, 2022
0d5bdca
Rollup merge of #99775 - notriddle:notriddle/as-str, r=camelid
JohnTitor Jul 27, 2022
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
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