Skip to content

Commit

Permalink
Auto merge of rust-lang#131380 - GuillaumeGomez:rollup-l2a7x0w, r=Gui…
Browse files Browse the repository at this point in the history
…llaumeGomez

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
  • Loading branch information
bors committed Oct 7, 2024
2 parents 3ae715c + 26691c0 commit 40fdb1d
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 8 deletions.
14 changes: 13 additions & 1 deletion compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
use rustc_middle::{bug, span_bug};
use rustc_session::Session;
use rustc_session::config::{
BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, PAuthKey, PacRet,
BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, FunctionReturn, PAuthKey, PacRet,
};
use rustc_span::source_map::Spanned;
use rustc_span::{DUMMY_SP, Span};
Expand Down Expand Up @@ -378,6 +378,18 @@ pub(crate) unsafe fn create_module<'ll>(
}
}

match sess.opts.unstable_opts.function_return {
FunctionReturn::Keep => {}
FunctionReturn::ThunkExtern => unsafe {
llvm::LLVMRustAddModuleFlagU32(
llmod,
llvm::LLVMModFlagBehavior::Override,
c"function_return_thunk_extern".as_ptr(),
1,
)
},
}

match (sess.opts.unstable_opts.small_data_threshold, sess.target.small_data_threshold_support())
{
// Set up the small-data optimization limit for architectures that use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub(crate) fn target() -> Target {
},

options: TargetOptions {
vendor: "espressif".into(),
cpu: "esp32".into(),
linker: Some("xtensa-esp32-elf-gcc".into()),
max_atomic_width: Some(32),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub(crate) fn target() -> Target {
},

options: TargetOptions {
vendor: "espressif".into(),
cpu: "esp32-s2".into(),
linker: Some("xtensa-esp32s2-elf-gcc".into()),
max_atomic_width: Some(32),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub(crate) fn target() -> Target {
},

options: TargetOptions {
vendor: "espressif".into(),
cpu: "esp32-s3".into(),
linker: Some("xtensa-esp32s3-elf-gcc".into()),
max_atomic_width: Some(32),
Expand Down
2 changes: 1 addition & 1 deletion src/doc/embedded-book
2 changes: 1 addition & 1 deletion src/doc/nomicon
Submodule nomicon updated 1 files
+3 −3 src/destructors.md
2 changes: 1 addition & 1 deletion src/doc/rust-by-example
Submodule rust-by-example updated 97 files
+1 −1 .github/workflows/rbe.yml
+2 −0 .gitignore
+2 −2 CONTRIBUTING.md
+1 −1 README.md
+1 −1 TRANSLATING.md
+32 −0 TRANSLATING_ZH.md
+16,910 −0 po/zh.po
+4 −2 src/attribute.md
+0 −1 src/cargo/deps.md
+8 −6 src/cargo/test.md
+1 −1 src/compatibility.md
+2 −2 src/conversion/from_into.md
+1 −1 src/conversion/string.md
+1 −1 src/crates/lib.md
+1 −1 src/crates/using_lib.md
+1 −1 src/custom_types.md
+1 −1 src/custom_types/enum/enum_use.md
+1 −3 src/error/abort_unwind.md
+4 −4 src/error/multiple_error_types/define_error_type.md
+0 −1 src/error/multiple_error_types/wrap_error.md
+1 −1 src/error/option_unwrap.md
+5 −5 src/error/option_unwrap/and_then.md
+6 −4 src/error/option_unwrap/defaults.md
+5 −5 src/error/option_unwrap/map.md
+2 −2 src/error/option_unwrap/question_mark.md
+0 −1 src/error/result.md
+0 −1 src/error/result/enter_question_mark.md
+1 −4 src/flow_control/let_else.md
+1 −1 src/flow_control/loop.md
+1 −0 src/flow_control/match/binding.md
+0 −1 src/flow_control/match/destructuring.md
+2 −2 src/flow_control/match/destructuring/destructure_pointers.md
+1 −0 src/fn/closures.md
+1 −1 src/fn/closures/closure_examples.md
+2 −2 src/fn/closures/closure_examples/iter_find.md
+2 −2 src/fn/diverging.md
+6 −6 src/generics.md
+2 −2 src/generics/assoc_items.md
+5 −5 src/generics/assoc_items/the_problem.md
+1 −1 src/generics/assoc_items/types.md
+1 −1 src/generics/bounds.md
+3 −3 src/generics/gen_fn.md
+0 −1 src/generics/impl.md
+1 −1 src/generics/new_types.md
+3 −3 src/generics/where.md
+0 −1 src/hello/print/print_debug.md
+2 −3 src/index.md
+1 −1 src/macros.md
+2 −2 src/macros/overload.md
+1 −1 src/meta/playground.md
+1 −1 src/mod.md
+3 −3 src/mod/struct_visibility.md
+2 −2 src/scope.md
+1 −1 src/scope/borrow.md
+3 −2 src/scope/borrow/mut.md
+2 −2 src/scope/borrow/ref.md
+6 −6 src/scope/lifetime/explicit.md
+1 −1 src/scope/lifetime/fn.md
+2 −2 src/scope/lifetime/lifetime_bounds.md
+2 −2 src/scope/lifetime/lifetime_coercion.md
+2 −0 src/scope/lifetime/static_lifetime.md
+0 −1 src/scope/lifetime/struct.md
+0 −1 src/scope/lifetime/trait.md
+4 −4 src/scope/move.md
+1 −1 src/scope/move/mut.md
+13 −11 src/scope/move/partial_move.md
+2 −2 src/std/box.md
+9 −9 src/std/hash.md
+8 −8 src/std/hash/alt_key_types.md
+8 −8 src/std/hash/hashset.md
+9 −3 src/std/rc.md
+1 −1 src/std/result.md
+1 −1 src/std/result/question_mark.md
+5 −4 src/std/vec.md
+1 −1 src/std_misc/file.md
+1 −0 src/std_misc/file/create.md
+1 −1 src/std_misc/file/read_lines.md
+3 −3 src/std_misc/path.md
+5 −3 src/std_misc/threads/testcase_mapreduce.md
+1 −0 src/testing/dev_dependencies.md
+2 −2 src/testing/doc_testing.md
+1 −0 src/testing/unit_testing.md
+2 −2 src/trait.md
+3 −1 src/trait/derive.md
+1 −1 src/trait/disambiguating.md
+2 −2 src/trait/drop.md
+12 −4 src/trait/dyn.md
+0 −1 src/trait/impl_trait.md
+2 −1 src/trait/iter.md
+1 −0 src/types.md
+1 −1 src/types/inference.md
+1 −1 src/types/literals.md
+5 −4 src/unsafe.md
+18 −8 src/unsafe/asm.md
+1 −1 src/variable_bindings/freeze.md
+5 −1 src/variable_bindings/scope.md
+3 −0 theme/index.hbs
2 changes: 1 addition & 1 deletion src/doc/rustc-dev-guide
Submodule rustc-dev-guide updated 45 files
+5 −2 examples/rustc-driver-getting-diagnostics.rs
+8 −6 src/SUMMARY.md
+14 −12 src/building/build-install-distribution-artifacts.md
+24 −4 src/building/how-to-build-and-run.md
+10 −2 src/building/new-target.md
+31 −21 src/building/quickstart.md
+179 −139 src/building/suggested.md
+1 −1 src/compiler-debugging.md
+92 −79 src/compiler-src.md
+1 −1 src/diagnostics/diagnostic-items.md
+13 −0 src/git.md
+206 −194 src/macro-expansion.md
+33 −19 src/memory.md
+7 −7 src/mir/index.md
+44 −32 src/name-resolution.md
+8 −31 src/profiling/with_perf.md
+37 −0 src/profiling/with_rustc_perf.md
+40 −41 src/queries/salsa.md
+0 −45 src/rustc-driver.md
+3 −3 src/rustc-driver/getting-diagnostics.md
+1 −1 src/rustc-driver/interacting-with-the-ast.md
+50 −0 src/rustc-driver/intro.md
+73 −3 src/rustdoc-internals/search.md
+2 −2 src/rustdoc.md
+73 −53 src/serialization.md
+16 −4 src/stability.md
+16 −10 src/syntax-intro.md
+96 −91 src/tests/adding.md
+194 −0 src/tests/best-practices.md
+244 −117 src/tests/ci.md
+342 −278 src/tests/compiletest.md
+15 −15 src/tests/crater.md
+443 −0 src/tests/directives.md
+28 −0 src/tests/ecosystem.md
+10 −9 src/tests/fuchsia.md
+0 −449 src/tests/headers.md
+0 −49 src/tests/integration.md
+54 −47 src/tests/intro.md
+27 −23 src/tests/perf.md
+140 −109 src/tests/running.md
+26 −13 src/tests/rust-for-linux.md
+23 −19 src/tests/suggest-tests.md
+245 −253 src/tests/ui.md
+41 −37 src/the-parser.md
+3 −3 src/traits/unsize.md
12 changes: 11 additions & 1 deletion src/librustdoc/html/escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,17 @@ impl<'a> fmt::Display for EscapeBodyTextWithWbr<'a> {
|| pk.map_or(true, |(_, t)| t.chars().any(|c| c.is_uppercase()));
let next_is_underscore = || pk.map_or(true, |(_, t)| t.contains('_'));
let next_is_colon = || pk.map_or(true, |(_, t)| t.contains(':'));
if i - last > 3 && is_uppercase() && !next_is_uppercase() {
// Check for CamelCase.
//
// `i - last > 3` avoids turning FmRadio into Fm<wbr>Radio, which is technically
// correct, but needlessly bloated.
//
// is_uppercase && !next_is_uppercase checks for camelCase. HTTPSProxy,
// for example, should become HTTPS<wbr>Proxy.
//
// !next_is_underscore avoids turning TEST_RUN into TEST<wbr>_<wbr>RUN, which is also
// needlessly bloated.
if i - last > 3 && is_uppercase() && !next_is_uppercase() && !next_is_underscore() {
EscapeBodyText(&text[last..i]).fmt(fmt)?;
fmt.write_str("<wbr>")?;
last = i;
Expand Down
4 changes: 4 additions & 0 deletions src/librustdoc/html/escape/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ fn escape_body_text_with_wbr() {
assert_eq!(&E("first:second").to_string(), "first:<wbr>second");
assert_eq!(&E("first::second").to_string(), "first::<wbr>second");
assert_eq!(&E("MY_CONSTANT").to_string(), "MY_<wbr>CONSTANT");
assert_eq!(
&E("_SIDD_MASKED_NEGATIVE_POLARITY").to_string(),
"_SIDD_<wbr>MASKED_<wbr>NEGATIVE_<wbr>POLARITY"
);
// a string won't get wrapped if it's less than 8 bytes
assert_eq!(&E("HashSet").to_string(), "HashSet");
// an individual word won't get wrapped if it's less than 4 bytes
Expand Down
6 changes: 6 additions & 0 deletions tests/codegen/function-return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ pub fn foo() {
// keep-thunk-extern: attributes #0 = { {{.*}}fn_ret_thunk_extern{{.*}} }
// thunk-extern-keep-NOT: fn_ret_thunk_extern
}

// unset-NOT: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}
// keep-NOT: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}
// thunk-extern: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}
// keep-thunk-extern: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}
// thunk-extern-keep-NOT: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}

0 comments on commit 40fdb1d

Please sign in to comment.