Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
28724dc
rustdoc: add regression test for #146216
lolbinarycat Oct 14, 2025
7a62743
rustdoc: add regression test for #140968
lolbinarycat Oct 14, 2025
0707281
rustdoc: account for path distance in doc aliases
lolbinarycat Oct 14, 2025
0006737
Fix the typo error caused span ice
chenyukang Nov 9, 2025
8573ee6
Fix ICE caused by span boundaries due to macro expansion
chenyukang Nov 9, 2025
725b213
add regression test for 148684
chenyukang Nov 9, 2025
3ba87c4
rustdoc: expand regression test for #146214
lolbinarycat Nov 11, 2025
1bfad01
fix rtsan_nonblocking_async lint closure ICE
inkreasing Nov 10, 2025
f5f91cc
add a test for combining RPIT with explicit tail calls
folkertdev Nov 11, 2025
4a2c9a1
skip invalid span in error emitter
chenyukang Nov 12, 2025
dae003b
fix: Do not ICE when missing match arm with ill-formed subty is met
ShoyuVanilla Nov 12, 2025
c09185c
Remove explicit install of `eslint` inside of `tidy`'s Dockerfile
yotamofek Nov 12, 2025
b1e8d56
bootstrap: dont require cmake if local-rebuild is enabled
weihanglo Nov 12, 2025
c3171d1
Rollup merge of #147701 - lolbinarycat:rustdoc-search-alias-fix, r=Gu…
Zalathar Nov 13, 2025
06b18db
Rollup merge of #148735 - chenyukang:yukang-fix-ice-148732, r=nnether…
Zalathar Nov 13, 2025
20f111f
Rollup merge of #148839 - luca3s:rtsan_ice_fix, r=WaffleLapkin
Zalathar Nov 13, 2025
1f2d7db
Rollup merge of #148846 - folkertdev:tail-call-rpit, r=WaffleLapkin
Zalathar Nov 13, 2025
17c25e4
Rollup merge of #148872 - ShoyuVanilla:issue-148192, r=chenyukang
Zalathar Nov 13, 2025
3a4a738
Rollup merge of #148880 - yotamofek:pr/dockerfile-eslint-install, r=K…
Zalathar Nov 13, 2025
314a6cd
Rollup merge of #148883 - weihanglo:sanity, r=Kobzol
Zalathar Nov 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions compiler/rustc_codegen_ssa/src/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,16 +469,18 @@ fn check_result(
})
}

// warn for nonblocking async fn.
// warn for nonblocking async functions, blocks and closures.
// This doesn't behave as expected, because the executor can run blocking code without the sanitizer noticing.
if codegen_fn_attrs.sanitizers.rtsan_setting == RtsanSetting::Nonblocking
&& let Some(sanitize_span) = interesting_spans.sanitize
// async function
&& (tcx.asyncness(did).is_async() || (tcx.is_closure_like(did.into())
// async fn
&& (tcx.asyncness(did).is_async()
// async block
&& (tcx.coroutine_is_async(did.into())
// async closure
|| tcx.coroutine_is_async(tcx.coroutine_for_closure(did)))))
|| tcx.is_coroutine(did.into())
// async closure
|| (tcx.is_closure_like(did.into())
&& tcx.hir_node_by_def_id(did).expect_closure().kind
!= rustc_hir::ClosureKind::Closure))
{
let hir_id = tcx.local_def_id_to_hir_id(did);
tcx.node_span_lint(
Expand Down
39 changes: 25 additions & 14 deletions compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,22 +350,27 @@ impl AnnotateSnippetEmitter {
"all spans must be disjoint",
);

let lo = subst.parts.iter().map(|part| part.span.lo()).min()?;
let lo_file = sm.lookup_source_file(lo);
let hi = subst.parts.iter().map(|part| part.span.hi()).max()?;
let hi_file = sm.lookup_source_file(hi);

// The different spans might belong to different contexts, if so ignore suggestion.
if lo_file.stable_id != hi_file.stable_id {
return None;
}

// We can't splice anything if the source is unavailable.
if !sm.ensure_source_file_source_present(&lo_file) {
return None;
}

// Account for cases where we are suggesting the same code that's already
// there. This shouldn't happen often, but in some cases for multipart
// suggestions it's much easier to handle it here than in the origin.
subst.parts.retain(|p| is_different(sm, &p.snippet, p.span));

let item_span = subst.parts.first()?;
let file = sm.lookup_source_file(item_span.span.lo());
if should_show_source_code(
&self.ignored_directories_in_source_blocks,
sm,
&file,
) {
Some(subst)
} else {
None
}
if subst.parts.is_empty() { None } else { Some(subst) }
})
.collect::<Vec<_>>();

Expand Down Expand Up @@ -745,14 +750,20 @@ fn shrink_file(
) -> Option<(Span, String, usize)> {
let lo_byte = spans.iter().map(|s| s.lo()).min()?;
let lo_loc = sm.lookup_char_pos(lo_byte);
let lo = lo_loc.file.line_bounds(lo_loc.line.saturating_sub(1)).start;

let hi_byte = spans.iter().map(|s| s.hi()).max()?;
let hi_loc = sm.lookup_char_pos(hi_byte);
let hi = lo_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;

if lo_loc.file.stable_id != hi_loc.file.stable_id {
// this may happen when spans cross file boundaries due to macro expansion.
return None;
}

let lo = lo_loc.file.line_bounds(lo_loc.line.saturating_sub(1)).start;
let hi = hi_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;

let bounding_span = Span::with_root_ctxt(lo, hi);
let source = sm.span_to_snippet(bounding_span).unwrap_or_default();
let source = sm.span_to_snippet(bounding_span).ok()?;
let offset_line = sm.doctest_offset_line(file_name, lo_loc.line);

Some((bounding_span, source, offset_line))
Expand Down
13 changes: 12 additions & 1 deletion compiler/rustc_pattern_analysis/src/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,18 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
variant.fields.iter().map(move |field| {
let ty = field.ty(self.tcx, args);
// `field.ty()` doesn't normalize after instantiating.
let ty = self.tcx.normalize_erasing_regions(self.typing_env, ty);
let ty =
self.tcx.try_normalize_erasing_regions(self.typing_env, ty).unwrap_or_else(|e| {
self.tcx.dcx().span_delayed_bug(
self.scrut_span,
format!(
"Failed to normalize {:?} in typing_env={:?} while getting variant sub tys for {ty:?}",
e.get_type_for_failure(),
self.typing_env,
),
);
ty
});
let ty = self.reveal_opaque_ty(ty);
(field, ty)
})
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/core/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ pub fn check(build: &mut Build) {

// We need cmake, but only if we're actually building LLVM or sanitizers.
let building_llvm = !build.config.llvm_from_ci
&& !build.config.local_rebuild
&& build.hosts.iter().any(|host| {
build.config.llvm_enabled(*host)
&& build
Expand Down
5 changes: 0 additions & 5 deletions src/ci/docker/host-x86_64/tidy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ COPY scripts/nodejs.sh /scripts/
RUN sh /scripts/nodejs.sh /node
ENV PATH="/node/bin:${PATH}"

# Install eslint
COPY host-x86_64/tidy/eslint.version /tmp/

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

Expand All @@ -40,8 +37,6 @@ RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-require

COPY host-x86_64/pr-check-1/validate-toolstate.sh /scripts/

RUN bash -c 'npm install -g eslint@$(cat /tmp/eslint.version)'

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
Expand Down
1 change: 0 additions & 1 deletion src/ci/docker/host-x86_64/tidy/eslint.version

This file was deleted.

13 changes: 11 additions & 2 deletions src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -3926,16 +3926,25 @@ class DocSearch {
* @returns {Promise<rustdoc.PlainResultObject?>}
*/
const handleAlias = async(name, alias, dist, index) => {
const item = nonnull(await this.getRow(alias, false));
// space both is an alias for ::,
// and is also allowed to appear in doc alias names
const path_dist = name.includes(" ") || parsedQuery.elems.length === 0 ?
0 : checkRowPath(parsedQuery.elems[0].pathWithoutLast, item);
// path distance exceeds max, omit alias from results
if (path_dist === null) {
return null;
}
return {
id: alias,
dist,
path_dist: 0,
path_dist,
index,
alias: name,
is_alias: true,
elems: [], // only used in type-based queries
returned: [], // only used in type-based queries
item: nonnull(await this.getRow(alias, false)),
item,
};
};
/**
Expand Down
32 changes: 32 additions & 0 deletions tests/rustdoc-js/alias-path-distance-146214.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// exact-check

// consider path distance for doc aliases
// regression test for <https://github.com/rust-lang/rust/issues/146214>

const EXPECTED = [
{
'query': 'Foo::zzz',
'others': [
{ 'path': 'alias_path_distance::Foo', 'name': 'baz' },
],
},
{
'query': '"Foo::zzz"',
'others': [
{ 'path': 'alias_path_distance::Foo', 'name': 'baz' },
],
},
{
'query': 'Foo::zzzz',
'others': [
{ 'path': 'alias_path_distance::Foo', 'name': 'baz' },
],
},
{
'query': 'zzzz',
'others': [
{ 'path': 'alias_path_distance::Foo', 'name': 'baz' },
{ 'path': 'alias_path_distance::Bar', 'name': 'baz' },
],
},
];
14 changes: 14 additions & 0 deletions tests/rustdoc-js/alias-path-distance-146214.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#![crate_name = "alias_path_distance"]

pub struct Foo;
pub struct Bar;

impl Foo {
#[doc(alias = "zzz")]
pub fn baz() {}
}

impl Bar {
#[doc(alias = "zzz")]
pub fn baz() {}
}
10 changes: 10 additions & 0 deletions tests/rustdoc-js/alias-rank-lower-140968.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// rank doc aliases lower than exact matches
// regression test for <https://github.com/rust-lang/rust/issues/140968>

const EXPECTED = {
'query': 'Foo',
'others': [
{ 'path': 'alias_rank_lower', 'name': 'Foo' },
{ 'path': 'alias_rank_lower', 'name': 'Bar' },
],
};
6 changes: 6 additions & 0 deletions tests/rustdoc-js/alias-rank-lower-140968.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#![crate_name = "alias_rank_lower"]

pub struct Foo;

#[doc(alias = "Foo")]
pub struct Bar;
8 changes: 8 additions & 0 deletions tests/ui/delegation/ice-line-bounds-issue-148732.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
reuse a as b {
//~^ ERROR cannot find function `a` in this scope
//~| ERROR functions delegation is not yet fully implemented
dbg!(b);
//~^ ERROR missing lifetime specifier
}

fn main() {}
34 changes: 34 additions & 0 deletions tests/ui/delegation/ice-line-bounds-issue-148732.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
error[E0106]: missing lifetime specifier
--> $DIR/ice-line-bounds-issue-148732.rs:4:5
|
LL | dbg!(b);
| ^^^^^^^ expected named lifetime parameter
|
= note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info)
|

error[E0425]: cannot find function `a` in this scope
--> $DIR/ice-line-bounds-issue-148732.rs:1:7
|
LL | reuse a as b {
| ^ not found in this scope

error[E0658]: functions delegation is not yet fully implemented
--> $DIR/ice-line-bounds-issue-148732.rs:1:1
|
LL | / reuse a as b {
LL | |
LL | |
LL | | dbg!(b);
LL | |
LL | | }
| |_^
|
= note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
= help: add `#![feature(fn_delegation)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0106, E0425, E0658.
For more information about an error, try `rustc --explain E0106`.
20 changes: 20 additions & 0 deletions tests/ui/explicit-tail-calls/rpit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#![feature(explicit_tail_calls)]
#![expect(incomplete_features)]

// Regression test for https://github.com/rust-lang/rust/issues/139305.
//
// Combining return position impl trait (RPIT) with guaranteed tail calls does not
// currently work, but at least it does not ICE.

fn foo(x: u32, y: u32) -> u32 {
x + y
}

fn bar(x: u32, y: u32) -> impl ToString {
become foo(x, y);
//~^ ERROR mismatched signatures
}

fn main() {
assert_eq!(bar(1, 2).to_string(), "3");
}
12 changes: 12 additions & 0 deletions tests/ui/explicit-tail-calls/rpit.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error: mismatched signatures
--> $DIR/rpit.rs:14:5
|
LL | become foo(x, y);
| ^^^^^^^^^^^^^^^^
|
= note: `become` requires caller and callee to have matching signatures
= note: caller signature: `fn(u32, u32) -> impl ToString`
= note: callee signature: `fn(u32, u32) -> u32`

error: aborting due to 1 previous error

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
trait WhereTrait {
type Type;
}

fn foo(e: Enum) {
if let Enum::Map(_) = e {}

match e {
//~^ ERROR: non-exhaustive patterns: `Enum::Map2(_)` not covered
Enum::Map(_) => (),
}
}

enum Enum {
Map(()),
Map2(<() as WhereTrait>::Type),
//~^ ERROR: the trait bound `(): WhereTrait` is not satisfied
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
error[E0277]: the trait bound `(): WhereTrait` is not satisfied
--> $DIR/missing-ctor-with-ill-formed-inner-ty-issue-148192.rs:16:10
|
LL | Map2(<() as WhereTrait>::Type),
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `WhereTrait` is not implemented for `()`
|
help: this trait has no implementations, consider adding one
--> $DIR/missing-ctor-with-ill-formed-inner-ty-issue-148192.rs:1:1
|
LL | trait WhereTrait {
| ^^^^^^^^^^^^^^^^

error[E0004]: non-exhaustive patterns: `Enum::Map2(_)` not covered
--> $DIR/missing-ctor-with-ill-formed-inner-ty-issue-148192.rs:8:11
|
LL | match e {
| ^ pattern `Enum::Map2(_)` not covered
|
note: `Enum` defined here
--> $DIR/missing-ctor-with-ill-formed-inner-ty-issue-148192.rs:14:6
|
LL | enum Enum {
| ^^^^
LL | Map(()),
LL | Map2(<() as WhereTrait>::Type),
| ---- not covered
= note: the matched value is of type `Enum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ Enum::Map(_) => (),
LL ~ Enum::Map2(_) => todo!(),
|

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0004, E0277.
For more information about an error, try `rustc --explain E0004`.
5 changes: 5 additions & 0 deletions tests/ui/sanitize-attr/invalid-sanitize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,9 @@ fn test() {
#[sanitize(realtime = "nonblocking")] //~ WARN: the async executor can run blocking code, without realtime sanitizer catching it [rtsan_nonblocking_async]
async || {}
};

let _regular_closure = {
#[sanitize(realtime = "nonblocking")] // no warning on a regular closure
|| 0
};
}
9 changes: 9 additions & 0 deletions tests/ui/structs/ice-line-bounds-issue-148684.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
struct A {
b: Vec<u8>,
c: usize,
}

fn main() {
A(2, vec![])
//~^ ERROR expected function, tuple struct or tuple variant, found struct `A`
}
Loading
Loading