diff --git a/.github/workflows/rust-warnings.yml b/.github/workflows/rust-warnings.yml index 98ddfead5c8522..3ab095e8999ba3 100644 --- a/.github/workflows/rust-warnings.yml +++ b/.github/workflows/rust-warnings.yml @@ -21,7 +21,7 @@ permissions: contents: read jobs: - make: + rust-warnings: env: GITPULLOPTIONS: --no-tags origin ${{ github.ref }} @@ -46,6 +46,15 @@ jobs: run: | set -eu cargo check --quiet --all-features --message-format=json \ - | jq -r 'select(.message.level == "warning" or .message.level == "error") | .message.rendered' \ + | jq -r 'select(.message.level | IN("warning", "error")) | .message.rendered' \ + | tee messages.txt + (exit "${PIPESTATUS[0]}") && ! grep --quiet '[^[:space:]]' messages.txt + + - name: "📜 `rustdoc` warnings" + shell: bash + run: | + set -eu + cargo doc --document-private-items --all --no-deps --message-format=json \ + | jq -r 'select(.message.level | IN("warning", "error")) | .message.rendered' \ | tee messages.txt (exit "${PIPESTATUS[0]}") && ! grep --quiet '[^[:space:]]' messages.txt diff --git a/ext/erb/escape/escape.c b/ext/erb/escape/escape.c index a46fe236c0f952..9437e9694eda5f 100644 --- a/ext/erb/escape/escape.c +++ b/ext/erb/escape/escape.c @@ -49,7 +49,7 @@ optimized_escape_html(VALUE str) const unsigned char c = *cstr++; uint8_t len = html_escape_table[c].len; if (len) { - uint16_t segment_len = cstr - segment_start - 1; + size_t segment_len = cstr - segment_start - 1; if (!buf) { buf = ALLOCV_N(char, vbuf, escaped_length(str)); dest = buf; @@ -64,7 +64,7 @@ optimized_escape_html(VALUE str) } } if (buf) { - uint16_t segment_len = cstr - segment_start; + size_t segment_len = cstr - segment_start; if (segment_len) { memcpy(dest, segment_start, segment_len); dest += segment_len; diff --git a/test/erb/test_erb.rb b/test/erb/test_erb.rb index 24f6cc5d8944e0..c0df690ccebe97 100644 --- a/test/erb/test_erb.rb +++ b/test/erb/test_erb.rb @@ -77,6 +77,9 @@ def test_html_escape assert_equal("", ERB::Util.html_escape(nil)) assert_equal("123", ERB::Util.html_escape(123)) + + assert_equal(65536+5, ERB::Util.html_escape("x"*65536 + "&").size) + assert_equal(65536+5, ERB::Util.html_escape("&" + "x"*65536).size) end def test_html_escape_to_s diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs index b63e1c3272e356..a53d23435b49a7 100644 --- a/yjit/src/stats.rs +++ b/yjit/src/stats.rs @@ -917,6 +917,7 @@ pub extern "C" fn rb_yjit_record_exit_stack(exit_pc: *const VALUE) // rb_vm_insn_addr2opcode won't work in cargo test --all-features // because it's a C function. Without insn call, this function is useless // so wrap the whole thing in a not test check. + let _ = exit_pc; #[cfg(not(test))] { // Get the opcode from the encoded insn handler at this PC diff --git a/yjit/src/virtualmem.rs b/yjit/src/virtualmem.rs index 58c9d9a7fd380a..9126cf300e307d 100644 --- a/yjit/src/virtualmem.rs +++ b/yjit/src/virtualmem.rs @@ -46,7 +46,7 @@ pub struct VirtualMemory { /// Mutable parts of [`VirtualMemory`]. pub struct VirtualMemoryMut { /// Number of bytes that have we have allocated physical memory for starting at - /// [Self::region_start]. + /// [VirtualMemory::region_start]. mapped_region_bytes: usize, /// Keep track of the address of the last written to page. diff --git a/zjit/src/codegen.rs b/zjit/src/codegen.rs index 08df10c100a3d8..262a0361b4a74e 100644 --- a/zjit/src/codegen.rs +++ b/zjit/src/codegen.rs @@ -1242,7 +1242,7 @@ fn gen_new_array( new_array } -/// Compile array access (array[index]) +/// Compile array access (`array[index]`) fn gen_aref_fixnum( asm: &mut Assembler, array: Opnd, diff --git a/zjit/src/gc.rs b/zjit/src/gc.rs index 934e1e8dcad165..baa0926c515189 100644 --- a/zjit/src/gc.rs +++ b/zjit/src/gc.rs @@ -262,7 +262,7 @@ fn ranges_overlap(left: &Range, right: &Range) -> bool where T: Partial left.start < right.end && right.start < left.end } -/// Callback for marking GC objects inside [Invariants]. +/// Callback for marking GC objects inside [crate::invariants::Invariants]. #[unsafe(no_mangle)] pub extern "C" fn rb_zjit_root_mark() { gc_mark_raw_samples();