Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 17527ef

Browse files
committed
Auto merge of rust-lang#130230 - workingjubilee:rollup-0e4ulat, r=workingjubilee
Rollup of 14 pull requests Successful merges: - rust-lang#129260 (Don't suggest adding return type for closures with default return type) - rust-lang#129520 (Suggest the correct pattern syntax on usage of unit variant pattern for a struct variant) - rust-lang#129696 (update stdarch) - rust-lang#129759 (Stabilize `const_refs_to_static`) - rust-lang#129835 (enable const-float-classify test, and test_next_up/down on 32bit x86) - rust-lang#129866 (Clarify documentation labelling and definitions for std::collections) - rust-lang#130052 (Don't leave debug locations for constants sitting on the builder indefinitely) - rust-lang#130077 (Fix linking error when compiling for 32-bit watchOS) - rust-lang#130123 (Report the `note` when specified in `diagnostic::on_unimplemented`) - rust-lang#130156 (Add test for S_OBJNAME & update test for LF_BUILDINFO cl and cmd) - rust-lang#130206 (Map `WSAEDQUOT` to `ErrorKind::FilesystemQuotaExceeded`) - rust-lang#130207 (Map `ERROR_CANT_RESOLVE_FILENAME` to `ErrorKind::FilesystemLoop`) - rust-lang#130219 (Fix false positive with `missing_docs` and `#[test]`) - rust-lang#130221 (Make SearchPath::new public) r? `@ghost` `@rustbot` modify labels: rollup
2 parents f7f8bdf + 2f4edab commit 17527ef

File tree

97 files changed

+770
-826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+770
-826
lines changed

compiler/rustc_builtin_macros/src/test.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ pub(crate) fn expand_test_or_bench(
277277
cx.attr_nested_word(sym::cfg, sym::test, attr_sp),
278278
// #[rustc_test_marker = "test_case_sort_key"]
279279
cx.attr_name_value_str(sym::rustc_test_marker, test_path_symbol, attr_sp),
280+
// #[doc(hidden)]
281+
cx.attr_nested_word(sym::doc, sym::hidden, attr_sp),
280282
],
281283
// const $ident: test::TestDescAndFn =
282284
ast::ItemKind::Const(

compiler/rustc_builtin_macros/src/test_harness.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> {
326326
let main_attr = ecx.attr_word(sym::rustc_main, sp);
327327
// #[coverage(off)]
328328
let coverage_attr = ecx.attr_nested_word(sym::coverage, sym::off, sp);
329-
// #[allow(missing_docs)]
330-
let missing_docs_attr = ecx.attr_nested_word(sym::allow, sym::missing_docs, sp);
329+
// #[doc(hidden)]
330+
let doc_hidden_attr = ecx.attr_nested_word(sym::doc, sym::hidden, sp);
331331

332332
// pub fn main() { ... }
333333
let main_ret_ty = ecx.ty(sp, ast::TyKind::Tup(ThinVec::new()));
@@ -357,7 +357,7 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> {
357357

358358
let main = P(ast::Item {
359359
ident: main_id,
360-
attrs: thin_vec![main_attr, coverage_attr, missing_docs_attr],
360+
attrs: thin_vec![main_attr, coverage_attr, doc_hidden_attr],
361361
id: ast::DUMMY_NODE_ID,
362362
kind: main,
363363
vis: ast::Visibility { span: sp, kind: ast::VisibilityKind::Public, tokens: None },

compiler/rustc_codegen_gcc/src/debuginfo.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ impl<'a, 'gcc, 'tcx> DebugInfoBuilderMethods for Builder<'a, 'gcc, 'tcx> {
4848
fn set_dbg_loc(&mut self, dbg_loc: Self::DILocation) {
4949
self.location = Some(dbg_loc);
5050
}
51+
52+
fn clear_dbg_loc(&mut self) {
53+
self.location = None;
54+
}
5155
}
5256

5357
/// Generate the `debug_context` in an MIR Body.

compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#![doc = include_str!("doc.md")]
22

33
use std::cell::{OnceCell, RefCell};
4-
use std::iter;
54
use std::ops::Range;
5+
use std::{iter, ptr};
66

77
use libc::c_uint;
88
use rustc_codegen_ssa::debuginfo::type_names;
@@ -209,6 +209,12 @@ impl<'ll> DebugInfoBuilderMethods for Builder<'_, 'll, '_> {
209209
}
210210
}
211211

212+
fn clear_dbg_loc(&mut self) {
213+
unsafe {
214+
llvm::LLVMSetCurrentDebugLocation2(self.llbuilder, ptr::null());
215+
}
216+
}
217+
212218
fn insert_reference_to_gdb_debug_scripts_section_global(&mut self) {
213219
gdb::insert_reference_to_gdb_debug_scripts_section_global(self)
214220
}

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ unsafe extern "C" {
10411041
pub fn LLVMDisposeBuilder<'a>(Builder: &'a mut Builder<'a>);
10421042

10431043
// Metadata
1044-
pub fn LLVMSetCurrentDebugLocation2<'a>(Builder: &Builder<'a>, Loc: &'a Metadata);
1044+
pub fn LLVMSetCurrentDebugLocation2<'a>(Builder: &Builder<'a>, Loc: *const Metadata);
10451045

10461046
// Terminators
10471047
pub fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value;

compiler/rustc_codegen_ssa/src/mir/debuginfo.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
547547
self.set_debug_loc(bx, var.source_info);
548548
let base =
549549
Self::spill_operand_to_stack(operand, Some(var.name.to_string()), bx);
550+
bx.clear_dbg_loc();
550551

551552
bx.dbg_var_addr(
552553
dbg_var,

compiler/rustc_codegen_ssa/src/traits/debuginfo.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ pub trait DebugInfoBuilderMethods: BackendTypes {
8080
fragment: Option<Range<Size>>,
8181
);
8282
fn set_dbg_loc(&mut self, dbg_loc: Self::DILocation);
83+
fn clear_dbg_loc(&mut self);
8384
fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
8485
fn set_var_name(&mut self, value: Self::Value, name: &str);
8586
}

compiler/rustc_const_eval/src/check_consts/check.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,6 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
355355
{
356356
self.error_emitted = Some(guar);
357357
}
358-
self.check_op_spanned(ops::StaticAccess, span)
359358
}
360359

361360
fn check_local_or_return_ty(&mut self, ty: Ty<'tcx>, local: Local) {

compiler/rustc_const_eval/src/check_consts/ops.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -553,33 +553,6 @@ impl<'tcx> NonConstOp<'tcx> for RawPtrToIntCast {
553553
}
554554
}
555555

556-
/// An access to a (non-thread-local) `static`.
557-
#[derive(Debug)]
558-
pub(crate) struct StaticAccess;
559-
impl<'tcx> NonConstOp<'tcx> for StaticAccess {
560-
fn status_in_item(&self, ccx: &ConstCx<'_, 'tcx>) -> Status {
561-
if let hir::ConstContext::Static(_) = ccx.const_kind() {
562-
Status::Allowed
563-
} else {
564-
Status::Unstable(sym::const_refs_to_static)
565-
}
566-
}
567-
568-
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
569-
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
570-
let mut err = feature_err(
571-
&ccx.tcx.sess,
572-
sym::const_refs_to_static,
573-
span,
574-
format!("referencing statics in {}s is unstable", ccx.const_kind(),),
575-
);
576-
err
577-
.note("`static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.")
578-
.help("to fix this, the value can be extracted to a `const` and then used.");
579-
err
580-
}
581-
}
582-
583556
/// An access to a thread-local `static`.
584557
#[derive(Debug)]
585558
pub(crate) struct ThreadLocalAccess;

compiler/rustc_error_codes/src/error_codes/E0013.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ variable cannot refer to a static variable.
55

66
Erroneous code example:
77

8-
```compile_fail,E0658
8+
```
99
static X: i32 = 42;
1010
const Y: i32 = X;
1111
```

0 commit comments

Comments
 (0)