Skip to content

Commit e33cc71

Browse files
committed
Auto merge of rust-lang#99792 - JohnTitor:rollup-20i7ewx, r=JohnTitor
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
2 parents b573e10 + 0d5bdca commit e33cc71

File tree

26 files changed

+622
-399
lines changed

26 files changed

+622
-399
lines changed

Diff for: Cargo.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ dependencies = [
202202

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

209209
[[package]]
210210
name = "bitmaps"
@@ -2394,9 +2394,9 @@ dependencies = [
23942394

23952395
[[package]]
23962396
name = "memchr"
2397-
version = "2.4.1"
2397+
version = "2.5.0"
23982398
source = "registry+https://github.com/rust-lang/crates.io-index"
2399-
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
2399+
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
24002400
dependencies = [
24012401
"compiler_builtins",
24022402
"rustc-std-workspace-core",
@@ -3044,9 +3044,9 @@ dependencies = [
30443044

30453045
[[package]]
30463046
name = "pulldown-cmark"
3047-
version = "0.9.1"
3047+
version = "0.9.2"
30483048
source = "registry+https://github.com/rust-lang/crates.io-index"
3049-
checksum = "34f197a544b0c9ab3ae46c359a7ec9cbbb5c7bf97054266fecb7ead794a181d6"
3049+
checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63"
30503050
dependencies = [
30513051
"bitflags",
30523052
"memchr",

Diff for: compiler/rustc_codegen_llvm/src/llvm/diagnostic.rs

-13
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,6 @@ pub enum OptimizationDiagnosticKind {
2020
OptimizationRemarkOther,
2121
}
2222

23-
impl OptimizationDiagnosticKind {
24-
pub fn describe(self) -> &'static str {
25-
match self {
26-
OptimizationRemark | OptimizationRemarkOther => "remark",
27-
OptimizationMissed => "missed",
28-
OptimizationAnalysis => "analysis",
29-
OptimizationAnalysisFPCommute => "floating-point",
30-
OptimizationAnalysisAliasing => "aliasing",
31-
OptimizationFailure => "failure",
32-
}
33-
}
34-
}
35-
3623
pub struct OptimizationDiagnostic<'ll> {
3724
pub kind: OptimizationDiagnosticKind,
3825
pub pass_name: String,

Diff for: compiler/rustc_codegen_llvm/src/llvm/ffi.rs

-27
Original file line numberDiff line numberDiff line change
@@ -572,16 +572,6 @@ pub enum ArchiveKind {
572572
K_COFF,
573573
}
574574

575-
/// LLVMRustPassKind
576-
#[derive(Copy, Clone, PartialEq, Debug)]
577-
#[repr(C)]
578-
#[allow(dead_code)] // Variants constructed by C++.
579-
pub enum PassKind {
580-
Other,
581-
Function,
582-
Module,
583-
}
584-
585575
// LLVMRustThinLTOData
586576
extern "C" {
587577
pub type ThinLTOData;
@@ -592,10 +582,6 @@ extern "C" {
592582
pub type ThinLTOBuffer;
593583
}
594584

595-
// LLVMRustModuleNameCallback
596-
pub type ThinLTOModuleNameCallback =
597-
unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
598-
599585
/// LLVMRustThinLTOModule
600586
#[repr(C)]
601587
pub struct ThinLTOModule {
@@ -661,9 +647,6 @@ extern "C" {
661647
}
662648
#[repr(C)]
663649
pub struct Builder<'a>(InvariantOpaque<'a>);
664-
extern "C" {
665-
pub type MemoryBuffer;
666-
}
667650
#[repr(C)]
668651
pub struct PassManager<'a>(InvariantOpaque<'a>);
669652
extern "C" {
@@ -1032,7 +1015,6 @@ extern "C" {
10321015
pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
10331016

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

10381020
/// See llvm::LLVMTypeKind::getTypeID.
@@ -1186,7 +1168,6 @@ extern "C" {
11861168
pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
11871169
pub fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value);
11881170
pub fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool;
1189-
pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
11901171
pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
11911172
pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
11921173
pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
@@ -2267,7 +2248,6 @@ extern "C" {
22672248

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

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

24842463
pub fn LLVMRustSetComdat<'a>(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t);
2485-
pub fn LLVMRustUnsetComdat(V: &Value);
24862464
pub fn LLVMRustSetModulePICLevel(M: &Module);
24872465
pub fn LLVMRustSetModulePIELevel(M: &Module);
24882466
pub fn LLVMRustSetModuleCodeModel(M: &Module, Model: CodeModel);
@@ -2514,11 +2492,6 @@ extern "C" {
25142492
Module: &Module,
25152493
Target: &TargetMachine,
25162494
) -> bool;
2517-
pub fn LLVMRustGetThinLTOModuleImports(
2518-
Data: *const ThinLTOData,
2519-
ModuleNameCallback: ThinLTOModuleNameCallback,
2520-
CallbackPayload: *mut c_void,
2521-
);
25222495
pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
25232496
pub fn LLVMRustParseBitcodeForLTO(
25242497
Context: &Context,

Diff for: compiler/rustc_codegen_llvm/src/llvm/mod.rs

-6
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,6 @@ pub fn SetUniqueComdat(llmod: &Module, val: &Value) {
166166
}
167167
}
168168

169-
pub fn UnsetComdat(val: &Value) {
170-
unsafe {
171-
LLVMRustUnsetComdat(val);
172-
}
173-
}
174-
175169
pub fn SetUnnamedAddress(global: &Value, unnamed: UnnamedAddr) {
176170
unsafe {
177171
LLVMSetUnnamedAddress(global, unnamed);

Diff for: compiler/rustc_error_messages/locales/en-US/passes.ftl

+107
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,110 @@ passes-cold = {passes-should-be-applied-to-fn}
149149
passes-link = attribute should be applied to an `extern` block with non-Rust ABI
150150
.warn = {-passes-previously-accepted}
151151
.label = not an `extern` block
152+
153+
passes-link-name = attribute should be applied to a foreign function or static
154+
.warn = {-passes-previously-accepted}
155+
.label = not a foreign function or static
156+
.help = try `#[link(name = "{$value}")]` instead
157+
158+
passes-no-link = attribute should be applied to an `extern crate` item
159+
.label = not an `extern crate` item
160+
161+
passes-export-name = attribute should be applied to a free function, impl method or static
162+
.label = not a free function, impl method or static
163+
164+
passes-rustc-layout-scalar-valid-range-not-struct = attribute should be applied to a struct
165+
.label = not a struct
166+
167+
passes-rustc-layout-scalar-valid-range-arg = expected exactly one integer literal argument
168+
169+
passes-rustc-legacy-const-generics-only = #[rustc_legacy_const_generics] functions must only have const generics
170+
.label = non-const generic parameter
171+
172+
passes-rustc-legacy-const-generics-index = #[rustc_legacy_const_generics] must have one index for each generic parameter
173+
.label = generic parameters
174+
175+
passes-rustc-legacy-const-generics-index-exceed = index exceeds number of arguments
176+
.label = there {$arg_count ->
177+
[one] is
178+
*[other] are
179+
} only {$arg_count} {$arg_count ->
180+
[one] argument
181+
*[other] arguments
182+
}
183+
184+
passes-rustc-legacy-const-generics-index-negative = arguments should be non-negative integers
185+
186+
passes-rustc-dirty-clean = attribute requires -Z query-dep-graph to be enabled
187+
188+
passes-link-section = attribute should be applied to a function or static
189+
.warn = {-passes-previously-accepted}
190+
.label = not a function or static
191+
192+
passes-no-mangle-foreign = `#[no_mangle]` has no effect on a foreign {$foreign_item_kind}
193+
.warn = {-passes-previously-accepted}
194+
.label = foreign {$foreign_item_kind}
195+
.note = symbol names in extern blocks are not mangled
196+
.suggestion = remove this attribute
197+
198+
passes-no-mangle = attribute should be applied to a free function, impl method or static
199+
.warn = {-passes-previously-accepted}
200+
.label = not a free function, impl method or static
201+
202+
passes-repr-ident = meta item in `repr` must be an identifier
203+
204+
passes-repr-conflicting = conflicting representation hints
205+
206+
passes-used-static = attribute must be applied to a `static` variable
207+
208+
passes-used-compiler-linker = `used(compiler)` and `used(linker)` can't be used together
209+
210+
passes-allow-internal-unstable = attribute should be applied to a macro
211+
.label = not a macro
212+
213+
passes-debug-visualizer-placement = attribute should be applied to a module
214+
215+
passes-debug-visualizer-invalid = invalid argument
216+
.note-1 = expected: `natvis_file = "..."`
217+
.note-2 = OR
218+
.note-3 = expected: `gdb_script_file = "..."`
219+
220+
passes-rustc-allow-const-fn-unstable = attribute should be applied to `const fn`
221+
.label = not a `const fn`
222+
223+
passes-rustc-std-internal-symbol = attribute should be applied to functions or statics
224+
.label = not a function or static
225+
226+
passes-const-trait = attribute should be applied to a trait
227+
228+
passes-stability-promotable = attribute cannot be applied to an expression
229+
230+
passes-deprecated = attribute is ignored here
231+
232+
passes-macro-use = `#[{$name}]` only has an effect on `extern crate` and modules
233+
234+
passes-macro-export = `#[macro_export]` only has an effect on macro definitions
235+
236+
passes-plugin-registrar = `#[plugin_registrar]` only has an effect on functions
237+
238+
passes-unused-empty-lints-note = attribute `{$name}` with an empty list has no effect
239+
240+
passes-unused-no-lints-note = attribute `{$name}` without any lints has no effect
241+
242+
passes-unused-default-method-body-const-note =
243+
`default_method_body_is_const` has been replaced with `#[const_trait]` on traits
244+
245+
passes-unused = unused attribute
246+
.suggestion = remove this attribute
247+
248+
passes-non-exported-macro-invalid-attrs = attribute should be applied to function or closure
249+
.label = not a function or closure
250+
251+
passes-unused-duplicate = unused attribute
252+
.suggestion = remove this attribute
253+
.note = attribute also specified here
254+
.warn = {-passes-previously-accepted}
255+
256+
passes-unused-multiple = multiple `{$name}` attributes
257+
.suggestion = remove this attribute
258+
.note = attribute also specified here

Diff for: compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

-45
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,6 @@ extern "C" void LLVMTimeTraceProfilerFinish(const char* FileName) {
9090
timeTraceProfilerCleanup();
9191
}
9292

93-
enum class LLVMRustPassKind {
94-
Other,
95-
Function,
96-
Module,
97-
};
98-
99-
static LLVMRustPassKind toRust(PassKind Kind) {
100-
switch (Kind) {
101-
case PT_Function:
102-
return LLVMRustPassKind::Function;
103-
case PT_Module:
104-
return LLVMRustPassKind::Module;
105-
default:
106-
return LLVMRustPassKind::Other;
107-
}
108-
}
109-
11093
extern "C" LLVMPassRef LLVMRustFindAndCreatePass(const char *PassName) {
11194
#if LLVM_VERSION_LT(15, 0)
11295
StringRef SR(PassName);
@@ -172,12 +155,6 @@ extern "C" LLVMPassRef LLVMRustCreateHWAddressSanitizerPass(bool Recover) {
172155
#endif
173156
}
174157

175-
extern "C" LLVMRustPassKind LLVMRustPassKind(LLVMPassRef RustPass) {
176-
assert(RustPass);
177-
Pass *Pass = unwrap(RustPass);
178-
return toRust(Pass->getPassKind());
179-
}
180-
181158
extern "C" void LLVMRustAddPass(LLVMPassManagerRef PMR, LLVMPassRef RustPass) {
182159
#if LLVM_VERSION_LT(15, 0)
183160
assert(RustPass);
@@ -1604,28 +1581,6 @@ LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data, LLVMModuleRef M,
16041581
return true;
16051582
}
16061583

1607-
extern "C" typedef void (*LLVMRustModuleNameCallback)(void*, // payload
1608-
const char*, // importing module name
1609-
const char*); // imported module name
1610-
1611-
// Calls `module_name_callback` for each module import done by ThinLTO.
1612-
// The callback is provided with regular null-terminated C strings.
1613-
extern "C" void
1614-
LLVMRustGetThinLTOModules(const LLVMRustThinLTOData *data,
1615-
LLVMRustModuleNameCallback module_name_callback,
1616-
void* callback_payload) {
1617-
for (const auto& importing_module : data->ImportLists) {
1618-
const std::string importing_module_id = importing_module.getKey().str();
1619-
const auto& imports = importing_module.getValue();
1620-
for (const auto& imported_module : imports) {
1621-
const std::string imported_module_id = imported_module.getKey().str();
1622-
module_name_callback(callback_payload,
1623-
importing_module_id.c_str(),
1624-
imported_module_id.c_str());
1625-
}
1626-
}
1627-
}
1628-
16291584
// This struct and various functions are sort of a hack right now, but the
16301585
// problem is that we've got in-memory LLVM modules after we generate and
16311586
// optimize all codegen-units for one compilation in rustc. To be compatible

Diff for: compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ extern "C" char *LLVMRustGetLastError(void) {
8888
return Ret;
8989
}
9090

91-
extern "C" unsigned int LLVMRustGetInstructionCount(LLVMModuleRef M) {
92-
return unwrap(M)->getInstructionCount();
93-
}
94-
9591
extern "C" void LLVMRustSetLastError(const char *Err) {
9692
free((void *)LastError);
9793
LastError = strdup(Err);
@@ -1529,11 +1525,6 @@ extern "C" void LLVMRustSetComdat(LLVMModuleRef M, LLVMValueRef V,
15291525
}
15301526
}
15311527

1532-
extern "C" void LLVMRustUnsetComdat(LLVMValueRef V) {
1533-
GlobalObject *GV = unwrap<GlobalObject>(V);
1534-
GV->setComdat(nullptr);
1535-
}
1536-
15371528
enum class LLVMRustLinkage {
15381529
ExternalLinkage = 0,
15391530
AvailableExternallyLinkage = 1,

Diff for: compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

+15-5
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,13 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
375375
use std::collections::vec_deque::VecDeque;
376376

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

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

419+
if ty::util::is_doc_hidden(tcx, parent) {
420+
fallback_map.insert(def_id, parent);
421+
return;
422+
}
423+
415424
match visible_parent_map.entry(def_id) {
416425
Entry::Occupied(mut entry) => {
417426
// If `child` is defined in crate `cnum`, ensure
@@ -439,8 +448,9 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
439448
}
440449
}
441450

442-
// Fill in any missing entries with the (less preferable) path ending in `::_`.
443-
// We still use this path in a diagnostic that suggests importing `::*`.
451+
// Fill in any missing entries with the less preferable path.
452+
// If this path re-exports the child as `_`, we still use this
453+
// path in a diagnostic that suggests importing `::*`.
444454
for (child, parent) in fallback_map {
445455
visible_parent_map.entry(child).or_insert(parent);
446456
}

0 commit comments

Comments
 (0)