Skip to content

Commit 8e8231f

Browse files
committed
Auto merge of rust-lang#115137 - GuillaumeGomez:rollup-37jqoyg, r=GuillaumeGomez
Rollup of 6 pull requests Successful merges: - rust-lang#114696 (Fix a pthread_t handle leak rust-lang#114610) - rust-lang#115102 (Improve note for the `invalid_reference_casting` lint) - rust-lang#115103 (Disable bootstrap rustc version check) - rust-lang#115106 (ArchiveWrapper: handle LLVM API update) - rust-lang#115109 (Skip ExpandYamlAnchors when the config is missing) - rust-lang#115135 (Rustdoc: Add unstable --no-html-source flag) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 97fff1f + 5cbc00f commit 8e8231f

File tree

13 files changed

+123
-2
lines changed

13 files changed

+123
-2
lines changed

Diff for: compiler/rustc_lint/messages.ftl

+2
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ lint_invalid_reference_casting_assign_to_ref = assigning to `&T` is undefined be
323323
lint_invalid_reference_casting_borrow_as_mut = casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
324324
.label = casting happend here
325325
326+
lint_invalid_reference_casting_note_book = for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
327+
326328
lint_lintpass_by_hand = implementing `LintPass` by hand
327329
.help = try using `declare_lint_pass!` or `impl_lint_pass!` instead
328330

Diff for: compiler/rustc_lint/src/lints.rs

+2
Original file line numberDiff line numberDiff line change
@@ -764,11 +764,13 @@ pub enum InvalidFromUtf8Diag {
764764
#[derive(LintDiagnostic)]
765765
pub enum InvalidReferenceCastingDiag {
766766
#[diag(lint_invalid_reference_casting_borrow_as_mut)]
767+
#[note(lint_invalid_reference_casting_note_book)]
767768
BorrowAsMut {
768769
#[label]
769770
orig_cast: Option<Span>,
770771
},
771772
#[diag(lint_invalid_reference_casting_assign_to_ref)]
773+
#[note(lint_invalid_reference_casting_note_book)]
772774
AssignToRef {
773775
#[label]
774776
orig_cast: Option<Span>,

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

+5
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,12 @@ LLVMRustWriteArchive(char *Dst, size_t NumMembers,
203203
}
204204
}
205205

206+
#if LLVM_VERSION_LT(18, 0)
206207
auto Result = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false);
208+
#else
209+
auto SymtabMode = WriteSymbtab ? SymtabWritingMode::NormalSymtab : SymtabWritingMode::NoSymtab;
210+
auto Result = writeArchive(Dst, Members, SymtabMode, Kind, true, false);
211+
#endif
207212
if (!Result)
208213
return LLVMRustResult::Success;
209214
LLVMRustSetLastError(toString(std::move(Result)).c_str());

Diff for: library/std/src/sys/wasi/thread.rs

+8
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,20 @@ cfg_if::cfg_if! {
4747
stack_size: libc::size_t,
4848
) -> ffi::c_int;
4949
pub fn pthread_attr_destroy(attr: *mut pthread_attr_t) -> ffi::c_int;
50+
pub fn pthread_detach(thread: pthread_t) -> ffi::c_int;
5051
}
5152
}
5253

5354
pub struct Thread {
5455
id: libc::pthread_t,
5556
}
57+
58+
impl Drop for Thread {
59+
fn drop(&mut self) {
60+
let ret = unsafe { libc::pthread_detach(self.id) };
61+
debug_assert_eq!(ret, 0);
62+
}
63+
}
5664
} else {
5765
pub struct Thread(!);
5866
}

Diff for: src/bootstrap/config.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,8 @@ impl Config {
12761276
}
12771277

12781278
config.initial_rustc = if let Some(rustc) = build.rustc {
1279-
config.check_build_rustc_version(&rustc);
1279+
// FIXME(#115065): re-enable this check
1280+
// config.check_build_rustc_version(&rustc);
12801281
PathBuf::from(rustc)
12811282
} else {
12821283
config.download_beta_toolchain();

Diff for: src/bootstrap/test.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,11 @@ impl Step for ExpandYamlAnchors {
11741174
/// appropriate configuration for all our CI providers. This step ensures the tool was called
11751175
/// by the user before committing CI changes.
11761176
fn run(self, builder: &Builder<'_>) {
1177+
// Note: `.github/` is not included in dist-src tarballs
1178+
if !builder.src.join(".github/workflows/ci.yml").exists() {
1179+
builder.info("Skipping YAML anchors check: GitHub Actions config not found");
1180+
return;
1181+
}
11771182
builder.info("Ensuring the YAML anchors in the GitHub Actions config were expanded");
11781183
builder.run_delaying_failure(
11791184
&mut builder.tool_cmd(Tool::ExpandYamlAnchors).arg("check").arg(&builder.src),

Diff for: src/librustdoc/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ pub(crate) struct RenderOptions {
273273
pub(crate) call_locations: AllCallLocations,
274274
/// If `true`, Context::init will not emit shared files.
275275
pub(crate) no_emit_shared: bool,
276+
/// If `true`, HTML source code pages won't be generated.
277+
pub(crate) html_no_source: bool,
276278
}
277279

278280
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
@@ -686,6 +688,7 @@ impl Options {
686688
let generate_link_to_definition = matches.opt_present("generate-link-to-definition");
687689
let extern_html_root_takes_precedence =
688690
matches.opt_present("extern-html-root-takes-precedence");
691+
let html_no_source = matches.opt_present("html-no-source");
689692

690693
if generate_link_to_definition && (show_coverage || output_format != OutputFormat::Html) {
691694
diag.struct_err(
@@ -769,6 +772,7 @@ impl Options {
769772
generate_link_to_definition,
770773
call_locations,
771774
no_emit_shared: false,
775+
html_no_source,
772776
};
773777
Ok((options, render_options))
774778
}

Diff for: src/librustdoc/html/render/context.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
463463
generate_link_to_definition,
464464
call_locations,
465465
no_emit_shared,
466+
html_no_source,
466467
..
467468
} = options;
468469

@@ -488,7 +489,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
488489
scrape_examples_extension: !call_locations.is_empty(),
489490
};
490491
let mut issue_tracker_base_url = None;
491-
let mut include_sources = true;
492+
let mut include_sources = !html_no_source;
492493

493494
// Crawl the crate attributes looking for attributes which control how we're
494495
// going to emit HTML

Diff for: src/librustdoc/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,9 @@ fn opts() -> Vec<RustcOptGroup> {
656656
"[rust]",
657657
)
658658
}),
659+
unstable("html-no-source", |o| {
660+
o.optflag("", "html-no-source", "Disable HTML source code pages generation")
661+
}),
659662
]
660663
}
661664

Diff for: tests/run-make/issue-88756-default-output/output-default.stdout

+2
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ Options:
191191
removed, see issue #44136
192192
<https://github.com/rust-lang/rust/issues/44136> for
193193
more information
194+
--html-no-source
195+
Disable HTML source code pages generation
194196

195197
@path Read newline separated options from `path`
196198

Diff for: tests/rustdoc/html-no-source.rs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// compile-flags: -Zunstable-options --html-no-source
2+
3+
// This test ensures that the `--html-no-source` flag disables
4+
// the creation of the `src` folder.
5+
6+
#![feature(staged_api)]
7+
#![stable(feature = "bar", since = "1.0")]
8+
#![crate_name = "foo"]
9+
10+
// Ensures that there is no items in the corresponding "src" folder.
11+
// @files 'src/foo' '[]'
12+
13+
// @has foo/fn.foo.html
14+
// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · '
15+
// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · '
16+
#[stable(feature = "bar", since = "1.0")]
17+
pub fn foo() {}
18+
19+
// @has foo/struct.Bar.html
20+
// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · '
21+
// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · '
22+
#[stable(feature = "bar", since = "1.0")]
23+
pub struct Bar;
24+
25+
impl Bar {
26+
// @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0'
27+
// @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0 ·'
28+
#[stable(feature = "foobar", since = "2.0")]
29+
pub fn bar() {}
30+
}

Diff for: tests/ui/const-generics/issues/issue-100313.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
44
LL | *(B as *const bool as *mut bool) = false;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7+
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
78
= note: `#[deny(invalid_reference_casting)]` on by default
89

910
error[E0080]: evaluation of constant value failed

0 commit comments

Comments
 (0)