Skip to content

Commit 40fdb1d

Browse files
committed
Auto merge of rust-lang#131380 - GuillaumeGomez:rollup-l2a7x0w, r=GuillaumeGomez
Rollup of 4 pull requests Successful merges: - rust-lang#130824 (Add missing module flags for `-Zfunction-return=thunk-extern`) - rust-lang#131170 (Fix `target_vendor` in non-IDF Xtensa ESP32 targets) - rust-lang#131369 (Update books) - rust-lang#131370 (rustdoc: improve `<wbr>`-insertion for SCREAMING_CAMEL_CASE) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3ae715c + 26691c0 commit 40fdb1d

File tree

13 files changed

+43
-8
lines changed

13 files changed

+43
-8
lines changed

compiler/rustc_codegen_llvm/src/context.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
1919
use rustc_middle::{bug, span_bug};
2020
use rustc_session::Session;
2121
use rustc_session::config::{
22-
BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, PAuthKey, PacRet,
22+
BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, FunctionReturn, PAuthKey, PacRet,
2323
};
2424
use rustc_span::source_map::Spanned;
2525
use rustc_span::{DUMMY_SP, Span};
@@ -378,6 +378,18 @@ pub(crate) unsafe fn create_module<'ll>(
378378
}
379379
}
380380

381+
match sess.opts.unstable_opts.function_return {
382+
FunctionReturn::Keep => {}
383+
FunctionReturn::ThunkExtern => unsafe {
384+
llvm::LLVMRustAddModuleFlagU32(
385+
llmod,
386+
llvm::LLVMModFlagBehavior::Override,
387+
c"function_return_thunk_extern".as_ptr(),
388+
1,
389+
)
390+
},
391+
}
392+
381393
match (sess.opts.unstable_opts.small_data_threshold, sess.target.small_data_threshold_support())
382394
{
383395
// Set up the small-data optimization limit for architectures that use

compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub(crate) fn target() -> Target {
1515
},
1616

1717
options: TargetOptions {
18+
vendor: "espressif".into(),
1819
cpu: "esp32".into(),
1920
linker: Some("xtensa-esp32-elf-gcc".into()),
2021
max_atomic_width: Some(32),

compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub(crate) fn target() -> Target {
1515
},
1616

1717
options: TargetOptions {
18+
vendor: "espressif".into(),
1819
cpu: "esp32-s2".into(),
1920
linker: Some("xtensa-esp32s2-elf-gcc".into()),
2021
max_atomic_width: Some(32),

compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub(crate) fn target() -> Target {
1515
},
1616

1717
options: TargetOptions {
18+
vendor: "espressif".into(),
1819
cpu: "esp32-s3".into(),
1920
linker: Some("xtensa-esp32s3-elf-gcc".into()),
2021
max_atomic_width: Some(32),

src/doc/nomicon

src/doc/rust-by-example

Submodule rust-by-example updated 97 files

src/librustdoc/html/escape.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,17 @@ impl<'a> fmt::Display for EscapeBodyTextWithWbr<'a> {
108108
|| pk.map_or(true, |(_, t)| t.chars().any(|c| c.is_uppercase()));
109109
let next_is_underscore = || pk.map_or(true, |(_, t)| t.contains('_'));
110110
let next_is_colon = || pk.map_or(true, |(_, t)| t.contains(':'));
111-
if i - last > 3 && is_uppercase() && !next_is_uppercase() {
111+
// Check for CamelCase.
112+
//
113+
// `i - last > 3` avoids turning FmRadio into Fm<wbr>Radio, which is technically
114+
// correct, but needlessly bloated.
115+
//
116+
// is_uppercase && !next_is_uppercase checks for camelCase. HTTPSProxy,
117+
// for example, should become HTTPS<wbr>Proxy.
118+
//
119+
// !next_is_underscore avoids turning TEST_RUN into TEST<wbr>_<wbr>RUN, which is also
120+
// needlessly bloated.
121+
if i - last > 3 && is_uppercase() && !next_is_uppercase() && !next_is_underscore() {
112122
EscapeBodyText(&text[last..i]).fmt(fmt)?;
113123
fmt.write_str("<wbr>")?;
114124
last = i;

src/librustdoc/html/escape/tests.rs

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ fn escape_body_text_with_wbr() {
2424
assert_eq!(&E("first:second").to_string(), "first:<wbr>second");
2525
assert_eq!(&E("first::second").to_string(), "first::<wbr>second");
2626
assert_eq!(&E("MY_CONSTANT").to_string(), "MY_<wbr>CONSTANT");
27+
assert_eq!(
28+
&E("_SIDD_MASKED_NEGATIVE_POLARITY").to_string(),
29+
"_SIDD_<wbr>MASKED_<wbr>NEGATIVE_<wbr>POLARITY"
30+
);
2731
// a string won't get wrapped if it's less than 8 bytes
2832
assert_eq!(&E("HashSet").to_string(), "HashSet");
2933
// an individual word won't get wrapped if it's less than 4 bytes

tests/codegen/function-return.rs

+6
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ pub fn foo() {
2626
// keep-thunk-extern: attributes #0 = { {{.*}}fn_ret_thunk_extern{{.*}} }
2727
// thunk-extern-keep-NOT: fn_ret_thunk_extern
2828
}
29+
30+
// unset-NOT: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}
31+
// keep-NOT: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}
32+
// thunk-extern: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}
33+
// keep-thunk-extern: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}
34+
// thunk-extern-keep-NOT: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}

0 commit comments

Comments
 (0)