Commit 5dbf406

Browse files
committed
Auto merge of #148885 - Zalathar:rollup-wrvewer, r=Zalathar
Rollup of 7 pull requests Successful merges: - #147701 (rustdoc: don't ignore path distance for doc aliases) - #148735 (Fix ICE caused by invalid spans for shrink_file) - #148839 (fix rtsan_nonblocking_async lint closure ICE) - #148846 (add a test for combining RPIT with explicit tail calls) - #148872 (fix: Do not ICE when missing match arm with ill-formed subty is met) - #148880 (Remove explicit install of `eslint` inside of `tidy`'s Dockerfile) - #148883 (bootstrap: dont require cmake if local-rebuild is enabled) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 503dce3 + 314a6cd commit 5dbf406

20 files changed

Lines changed: 280 additions & 29 deletions

‎compiler/rustc_codegen_ssa/src/codegen_attrs.rs‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,16 +469,18 @@ fn check_result(
469469
})
470470
}
471471

472-
// warn for nonblocking async fn.
472+
// warn for nonblocking async functions, blocks and closures.
473473
// This doesn't behave as expected, because the executor can run blocking code without the sanitizer noticing.
474474
if codegen_fn_attrs.sanitizers.rtsan_setting == RtsanSetting::Nonblocking
475475
&& letSome(sanitize_span) = interesting_spans.sanitize
476-
// async function
477-
&& (tcx.asyncness(did).is_async() || (tcx.is_closure_like(did.into())
476+
// async fn
477+
&& (tcx.asyncness(did).is_async()
478478
// async block
479-
&& (tcx.coroutine_is_async(did.into())
480-
// async closure
481-
|| tcx.coroutine_is_async(tcx.coroutine_for_closure(did)))))
479+
|| tcx.is_coroutine(did.into())
480+
// async closure
481+
|| (tcx.is_closure_like(did.into())
482+
&& tcx.hir_node_by_def_id(did).expect_closure().kind
483+
!= rustc_hir::ClosureKind::Closure))
482484
{
483485
let hir_id = tcx.local_def_id_to_hir_id(did);
484486
tcx.node_span_lint(

‎compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs‎

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,22 +350,27 @@ impl AnnotateSnippetEmitter {
350350
"all spans must be disjoint",
351351
);
352352

353+
let lo = subst.parts.iter().map(|part| part.span.lo()).min()?;
354+
let lo_file = sm.lookup_source_file(lo);
355+
let hi = subst.parts.iter().map(|part| part.span.hi()).max()?;
356+
let hi_file = sm.lookup_source_file(hi);
357+
358+
// The different spans might belong to different contexts, if so ignore suggestion.
359+
if lo_file.stable_id != hi_file.stable_id{
360+
returnNone;
361+
}
362+
363+
// We can't splice anything if the source is unavailable.
364+
if !sm.ensure_source_file_source_present(&lo_file){
365+
returnNone;
366+
}
367+
353368
// Account for cases where we are suggesting the same code that's already
354369
// there. This shouldn't happen often, but in some cases for multipart
355370
// suggestions it's much easier to handle it here than in the origin.
356371
subst.parts.retain(|p| is_different(sm,&p.snippet, p.span));
357372

358-
let item_span = subst.parts.first()?;
359-
let file = sm.lookup_source_file(item_span.span.lo());
360-
ifshould_show_source_code(
361-
&self.ignored_directories_in_source_blocks,
362-
sm,
363-
&file,
364-
){
365-
Some(subst)
366-
}else{
367-
None
368-
}
373+
if subst.parts.is_empty(){None}else{Some(subst)}
369374
})
370375
.collect::<Vec<_>>();
371376

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

750754
let hi_byte = spans.iter().map(|s| s.hi()).max()?;
751755
let hi_loc = sm.lookup_char_pos(hi_byte);
752-
let hi = lo_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
756+
757+
if lo_loc.file.stable_id != hi_loc.file.stable_id{
758+
// this may happen when spans cross file boundaries due to macro expansion.
759+
returnNone;
760+
}
761+
762+
let lo = lo_loc.file.line_bounds(lo_loc.line.saturating_sub(1)).start;
763+
let hi = hi_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
753764

754765
let bounding_span = Span::with_root_ctxt(lo, hi);
755-
let source = sm.span_to_snippet(bounding_span).unwrap_or_default();
766+
let source = sm.span_to_snippet(bounding_span).ok()?;
756767
let offset_line = sm.doctest_offset_line(file_name, lo_loc.line);
757768

758769
Some((bounding_span, source, offset_line))

‎compiler/rustc_pattern_analysis/src/rustc.rs‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,18 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
191191
variant.fields.iter().map(move |field| {
192192
let ty = field.ty(self.tcx, args);
193193
// `field.ty()` doesn't normalize after instantiating.
194-
let ty = self.tcx.normalize_erasing_regions(self.typing_env, ty);
194+
let ty =
195+
self.tcx.try_normalize_erasing_regions(self.typing_env, ty).unwrap_or_else(|e| {
196+
self.tcx.dcx().span_delayed_bug(
197+
self.scrut_span,
198+
format!(
199+
"Failed to normalize {:?} in typing_env={:?} while getting variant sub tys for {ty:?}",
200+
e.get_type_for_failure(),
201+
self.typing_env,
202+
),
203+
);
204+
ty
205+
});
195206
let ty = self.reveal_opaque_ty(ty);
196207
(field, ty)
197208
})

‎src/bootstrap/src/core/sanity.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ pub fn check(build: &mut Build) {
142142

143143
// We need cmake, but only if we're actually building LLVM or sanitizers.
144144
let building_llvm = !build.config.llvm_from_ci
145+
&& !build.config.local_rebuild
145146
&& build.hosts.iter().any(|host| {
146147
build.config.llvm_enabled(*host)
147148
&& build

‎src/ci/docker/host-x86_64/tidy/Dockerfile‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ COPY scripts/nodejs.sh /scripts/
2828
RUN sh /scripts/nodejs.sh /node
2929
ENV PATH="/node/bin:${PATH}"
3030

31-
# Install eslint
32-
COPY host-x86_64/tidy/eslint.version /tmp/
33-
3431
COPY scripts/sccache.sh /scripts/
3532
RUN sh /scripts/sccache.sh
3633

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

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

43-
RUN bash -c 'npm install -g eslint@$(cat /tmp/eslint.version)'
44-
4540
# NOTE: intentionally uses python2 for x.py so we can test it still works.
4641
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
4742
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \

‎src/ci/docker/host-x86_64/tidy/eslint.version‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/librustdoc/html/static/js/search.js‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3926,16 +3926,25 @@ class DocSearch {
39263926
* @returns {Promise<rustdoc.PlainResultObject?>}
39273927
*/
39283928
consthandleAlias=async(name,alias,dist,index)=>{
3929+
constitem=nonnull(awaitthis.getRow(alias,false));
3930+
// space both is an alias for ::,
3931+
// and is also allowed to appear in doc alias names
3932+
constpath_dist=name.includes(" ")||parsedQuery.elems.length===0 ?
3933+
0 : checkRowPath(parsedQuery.elems[0].pathWithoutLast,item);
3934+
// path distance exceeds max, omit alias from results
3935+
if(path_dist===null){
3936+
returnnull;
3937+
}
39293938
return{
39303939
id: alias,
39313940
dist,
3932-
path_dist: 0,
3941+
path_dist,
39333942
index,
39343943
alias: name,
39353944
is_alias: true,
39363945
elems: [],// only used in type-based queries
39373946
returned: [],// only used in type-based queries
3938-
item: nonnull(awaitthis.getRow(alias,false)),
3947+
item,
39393948
};
39403949
};
39413950
/**
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// exact-check
2+
3+
// consider path distance for doc aliases
4+
// regression test for <https://github.com/rust-lang/rust/issues/146214>
5+
6+
constEXPECTED=[
7+
{
8+
'query': 'Foo::zzz',
9+
'others': [
10+
{'path': 'alias_path_distance::Foo','name': 'baz'},
11+
],
12+
},
13+
{
14+
'query': '"Foo::zzz"',
15+
'others': [
16+
{'path': 'alias_path_distance::Foo','name': 'baz'},
17+
],
18+
},
19+
{
20+
'query': 'Foo::zzzz',
21+
'others': [
22+
{'path': 'alias_path_distance::Foo','name': 'baz'},
23+
],
24+
},
25+
{
26+
'query': 'zzzz',
27+
'others': [
28+
{'path': 'alias_path_distance::Foo','name': 'baz'},
29+
{'path': 'alias_path_distance::Bar','name': 'baz'},
30+
],
31+
},
32+
];
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![crate_name = "alias_path_distance"]
2+
3+
pubstructFoo;
4+
pubstructBar;
5+
6+
implFoo{
7+
#[doc(alias = "zzz")]
8+
pubfnbaz(){}
9+
}
10+
11+
implBar{
12+
#[doc(alias = "zzz")]
13+
pubfnbaz(){}
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// rank doc aliases lower than exact matches
2+
// regression test for <https://github.com/rust-lang/rust/issues/140968>
3+
4+
constEXPECTED={
5+
'query': 'Foo',
6+
'others': [
7+
{'path': 'alias_rank_lower','name': 'Foo'},
8+
{'path': 'alias_rank_lower','name': 'Bar'},
9+
],
10+
};

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Commit 5dbf406

Browse files
committed
Auto merge of #148885 - Zalathar:rollup-wrvewer, r=Zalathar
Rollup of 7 pull requests Successful merges: - #147701 (rustdoc: don't ignore path distance for doc aliases) - #148735 (Fix ICE caused by invalid spans for shrink_file) - #148839 (fix rtsan_nonblocking_async lint closure ICE) - #148846 (add a test for combining RPIT with explicit tail calls) - #148872 (fix: Do not ICE when missing match arm with ill-formed subty is met) - #148880 (Remove explicit install of `eslint` inside of `tidy`'s Dockerfile) - #148883 (bootstrap: dont require cmake if local-rebuild is enabled) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 503dce3 + 314a6cd commit 5dbf406

20 files changed

Lines changed: 280 additions & 29 deletions

‎compiler/rustc_codegen_ssa/src/codegen_attrs.rs‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,16 +469,18 @@ fn check_result(
469469
})
470470
}
471471

472-
// warn for nonblocking async fn.
472+
// warn for nonblocking async functions, blocks and closures.
473473
// This doesn't behave as expected, because the executor can run blocking code without the sanitizer noticing.
474474
if codegen_fn_attrs.sanitizers.rtsan_setting == RtsanSetting::Nonblocking
475475
&& letSome(sanitize_span) = interesting_spans.sanitize
476-
// async function
477-
&& (tcx.asyncness(did).is_async() || (tcx.is_closure_like(did.into())
476+
// async fn
477+
&& (tcx.asyncness(did).is_async()
478478
// async block
479-
&& (tcx.coroutine_is_async(did.into())
480-
// async closure
481-
|| tcx.coroutine_is_async(tcx.coroutine_for_closure(did)))))
479+
|| tcx.is_coroutine(did.into())
480+
// async closure
481+
|| (tcx.is_closure_like(did.into())
482+
&& tcx.hir_node_by_def_id(did).expect_closure().kind
483+
!= rustc_hir::ClosureKind::Closure))
482484
{
483485
let hir_id = tcx.local_def_id_to_hir_id(did);
484486
tcx.node_span_lint(

‎compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs‎

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,22 +350,27 @@ impl AnnotateSnippetEmitter {
350350
"all spans must be disjoint",
351351
);
352352

353+
let lo = subst.parts.iter().map(|part| part.span.lo()).min()?;
354+
let lo_file = sm.lookup_source_file(lo);
355+
let hi = subst.parts.iter().map(|part| part.span.hi()).max()?;
356+
let hi_file = sm.lookup_source_file(hi);
357+
358+
// The different spans might belong to different contexts, if so ignore suggestion.
359+
if lo_file.stable_id != hi_file.stable_id{
360+
returnNone;
361+
}
362+
363+
// We can't splice anything if the source is unavailable.
364+
if !sm.ensure_source_file_source_present(&lo_file){
365+
returnNone;
366+
}
367+
353368
// Account for cases where we are suggesting the same code that's already
354369
// there. This shouldn't happen often, but in some cases for multipart
355370
// suggestions it's much easier to handle it here than in the origin.
356371
subst.parts.retain(|p| is_different(sm,&p.snippet, p.span));
357372

358-
let item_span = subst.parts.first()?;
359-
let file = sm.lookup_source_file(item_span.span.lo());
360-
ifshould_show_source_code(
361-
&self.ignored_directories_in_source_blocks,
362-
sm,
363-
&file,
364-
){
365-
Some(subst)
366-
}else{
367-
None
368-
}
373+
if subst.parts.is_empty(){None}else{Some(subst)}
369374
})
370375
.collect::<Vec<_>>();
371376

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

750754
let hi_byte = spans.iter().map(|s| s.hi()).max()?;
751755
let hi_loc = sm.lookup_char_pos(hi_byte);
752-
let hi = lo_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
756+
757+
if lo_loc.file.stable_id != hi_loc.file.stable_id{
758+
// this may happen when spans cross file boundaries due to macro expansion.
759+
returnNone;
760+
}
761+
762+
let lo = lo_loc.file.line_bounds(lo_loc.line.saturating_sub(1)).start;
763+
let hi = hi_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
753764

754765
let bounding_span = Span::with_root_ctxt(lo, hi);
755-
let source = sm.span_to_snippet(bounding_span).unwrap_or_default();
766+
let source = sm.span_to_snippet(bounding_span).ok()?;
756767
let offset_line = sm.doctest_offset_line(file_name, lo_loc.line);
757768

758769
Some((bounding_span, source, offset_line))

‎compiler/rustc_pattern_analysis/src/rustc.rs‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,18 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
191191
variant.fields.iter().map(move |field| {
192192
let ty = field.ty(self.tcx, args);
193193
// `field.ty()` doesn't normalize after instantiating.
194-
let ty = self.tcx.normalize_erasing_regions(self.typing_env, ty);
194+
let ty =
195+
self.tcx.try_normalize_erasing_regions(self.typing_env, ty).unwrap_or_else(|e| {
196+
self.tcx.dcx().span_delayed_bug(
197+
self.scrut_span,
198+
format!(
199+
"Failed to normalize {:?} in typing_env={:?} while getting variant sub tys for {ty:?}",
200+
e.get_type_for_failure(),
201+
self.typing_env,
202+
),
203+
);
204+
ty
205+
});
195206
let ty = self.reveal_opaque_ty(ty);
196207
(field, ty)
197208
})

‎src/bootstrap/src/core/sanity.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ pub fn check(build: &mut Build) {
142142

143143
// We need cmake, but only if we're actually building LLVM or sanitizers.
144144
let building_llvm = !build.config.llvm_from_ci
145+
&& !build.config.local_rebuild
145146
&& build.hosts.iter().any(|host| {
146147
build.config.llvm_enabled(*host)
147148
&& build

‎src/ci/docker/host-x86_64/tidy/Dockerfile‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ COPY scripts/nodejs.sh /scripts/
2828
RUN sh /scripts/nodejs.sh /node
2929
ENV PATH="/node/bin:${PATH}"
3030

31-
# Install eslint
32-
COPY host-x86_64/tidy/eslint.version /tmp/
33-
3431
COPY scripts/sccache.sh /scripts/
3532
RUN sh /scripts/sccache.sh
3633

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

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

43-
RUN bash -c 'npm install -g eslint@$(cat /tmp/eslint.version)'
44-
4540
# NOTE: intentionally uses python2 for x.py so we can test it still works.
4641
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
4742
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \

‎src/ci/docker/host-x86_64/tidy/eslint.version‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/librustdoc/html/static/js/search.js‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3926,16 +3926,25 @@ class DocSearch {
39263926
* @returns {Promise<rustdoc.PlainResultObject?>}
39273927
*/
39283928
consthandleAlias=async(name,alias,dist,index)=>{
3929+
constitem=nonnull(awaitthis.getRow(alias,false));
3930+
// space both is an alias for ::,
3931+
// and is also allowed to appear in doc alias names
3932+
constpath_dist=name.includes(" ")||parsedQuery.elems.length===0 ?
3933+
0 : checkRowPath(parsedQuery.elems[0].pathWithoutLast,item);
3934+
// path distance exceeds max, omit alias from results
3935+
if(path_dist===null){
3936+
returnnull;
3937+
}
39293938
return{
39303939
id: alias,
39313940
dist,
3932-
path_dist: 0,
3941+
path_dist,
39333942
index,
39343943
alias: name,
39353944
is_alias: true,
39363945
elems: [],// only used in type-based queries
39373946
returned: [],// only used in type-based queries
3938-
item: nonnull(awaitthis.getRow(alias,false)),
3947+
item,
39393948
};
39403949
};
39413950
/**
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// exact-check
2+
3+
// consider path distance for doc aliases
4+
// regression test for <https://github.com/rust-lang/rust/issues/146214>
5+
6+
constEXPECTED=[
7+
{
8+
'query': 'Foo::zzz',
9+
'others': [
10+
{'path': 'alias_path_distance::Foo','name': 'baz'},
11+
],
12+
},
13+
{
14+
'query': '"Foo::zzz"',
15+
'others': [
16+
{'path': 'alias_path_distance::Foo','name': 'baz'},
17+
],
18+
},
19+
{
20+
'query': 'Foo::zzzz',
21+
'others': [
22+
{'path': 'alias_path_distance::Foo','name': 'baz'},
23+
],
24+
},
25+
{
26+
'query': 'zzzz',
27+
'others': [
28+
{'path': 'alias_path_distance::Foo','name': 'baz'},
29+
{'path': 'alias_path_distance::Bar','name': 'baz'},
30+
],
31+
},
32+
];
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![crate_name = "alias_path_distance"]
2+
3+
pubstructFoo;
4+
pubstructBar;
5+
6+
implFoo{
7+
#[doc(alias = "zzz")]
8+
pubfnbaz(){}
9+
}
10+
11+
implBar{
12+
#[doc(alias = "zzz")]
13+
pubfnbaz(){}
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// rank doc aliases lower than exact matches
2+
// regression test for <https://github.com/rust-lang/rust/issues/140968>
3+
4+
constEXPECTED={
5+
'query': 'Foo',
6+
'others': [
7+
{'path': 'alias_rank_lower','name': 'Foo'},
8+
{'path': 'alias_rank_lower','name': 'Bar'},
9+
],
10+
};

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 5dbf406

Browse files
committed
Auto merge of #148885 - Zalathar:rollup-wrvewer, r=Zalathar
Rollup of 7 pull requests Successful merges: - #147701 (rustdoc: don't ignore path distance for doc aliases) - #148735 (Fix ICE caused by invalid spans for shrink_file) - #148839 (fix rtsan_nonblocking_async lint closure ICE) - #148846 (add a test for combining RPIT with explicit tail calls) - #148872 (fix: Do not ICE when missing match arm with ill-formed subty is met) - #148880 (Remove explicit install of `eslint` inside of `tidy`'s Dockerfile) - #148883 (bootstrap: dont require cmake if local-rebuild is enabled) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 503dce3 + 314a6cd commit 5dbf406

20 files changed

Lines changed: 280 additions & 29 deletions

‎compiler/rustc_codegen_ssa/src/codegen_attrs.rs‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,16 +469,18 @@ fn check_result(
469469
})
470470
}
471471

472-
// warn for nonblocking async fn.
472+
// warn for nonblocking async functions, blocks and closures.
473473
// This doesn't behave as expected, because the executor can run blocking code without the sanitizer noticing.
474474
if codegen_fn_attrs.sanitizers.rtsan_setting == RtsanSetting::Nonblocking
475475
&& letSome(sanitize_span) = interesting_spans.sanitize
476-
// async function
477-
&& (tcx.asyncness(did).is_async() || (tcx.is_closure_like(did.into())
476+
// async fn
477+
&& (tcx.asyncness(did).is_async()
478478
// async block
479-
&& (tcx.coroutine_is_async(did.into())
480-
// async closure
481-
|| tcx.coroutine_is_async(tcx.coroutine_for_closure(did)))))
479+
|| tcx.is_coroutine(did.into())
480+
// async closure
481+
|| (tcx.is_closure_like(did.into())
482+
&& tcx.hir_node_by_def_id(did).expect_closure().kind
483+
!= rustc_hir::ClosureKind::Closure))
482484
{
483485
let hir_id = tcx.local_def_id_to_hir_id(did);
484486
tcx.node_span_lint(

‎compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs‎

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,22 +350,27 @@ impl AnnotateSnippetEmitter {
350350
"all spans must be disjoint",
351351
);
352352

353+
let lo = subst.parts.iter().map(|part| part.span.lo()).min()?;
354+
let lo_file = sm.lookup_source_file(lo);
355+
let hi = subst.parts.iter().map(|part| part.span.hi()).max()?;
356+
let hi_file = sm.lookup_source_file(hi);
357+
358+
// The different spans might belong to different contexts, if so ignore suggestion.
359+
if lo_file.stable_id != hi_file.stable_id{
360+
returnNone;
361+
}
362+
363+
// We can't splice anything if the source is unavailable.
364+
if !sm.ensure_source_file_source_present(&lo_file){
365+
returnNone;
366+
}
367+
353368
// Account for cases where we are suggesting the same code that's already
354369
// there. This shouldn't happen often, but in some cases for multipart
355370
// suggestions it's much easier to handle it here than in the origin.
356371
subst.parts.retain(|p| is_different(sm,&p.snippet, p.span));
357372

358-
let item_span = subst.parts.first()?;
359-
let file = sm.lookup_source_file(item_span.span.lo());
360-
ifshould_show_source_code(
361-
&self.ignored_directories_in_source_blocks,
362-
sm,
363-
&file,
364-
){
365-
Some(subst)
366-
}else{
367-
None
368-
}
373+
if subst.parts.is_empty(){None}else{Some(subst)}
369374
})
370375
.collect::<Vec<_>>();
371376

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

750754
let hi_byte = spans.iter().map(|s| s.hi()).max()?;
751755
let hi_loc = sm.lookup_char_pos(hi_byte);
752-
let hi = lo_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
756+
757+
if lo_loc.file.stable_id != hi_loc.file.stable_id{
758+
// this may happen when spans cross file boundaries due to macro expansion.
759+
returnNone;
760+
}
761+
762+
let lo = lo_loc.file.line_bounds(lo_loc.line.saturating_sub(1)).start;
763+
let hi = hi_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
753764

754765
let bounding_span = Span::with_root_ctxt(lo, hi);
755-
let source = sm.span_to_snippet(bounding_span).unwrap_or_default();
766+
let source = sm.span_to_snippet(bounding_span).ok()?;
756767
let offset_line = sm.doctest_offset_line(file_name, lo_loc.line);
757768

758769
Some((bounding_span, source, offset_line))

‎compiler/rustc_pattern_analysis/src/rustc.rs‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,18 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
191191
variant.fields.iter().map(move |field| {
192192
let ty = field.ty(self.tcx, args);
193193
// `field.ty()` doesn't normalize after instantiating.
194-
let ty = self.tcx.normalize_erasing_regions(self.typing_env, ty);
194+
let ty =
195+
self.tcx.try_normalize_erasing_regions(self.typing_env, ty).unwrap_or_else(|e| {
196+
self.tcx.dcx().span_delayed_bug(
197+
self.scrut_span,
198+
format!(
199+
"Failed to normalize {:?} in typing_env={:?} while getting variant sub tys for {ty:?}",
200+
e.get_type_for_failure(),
201+
self.typing_env,
202+
),
203+
);
204+
ty
205+
});
195206
let ty = self.reveal_opaque_ty(ty);
196207
(field, ty)
197208
})

‎src/bootstrap/src/core/sanity.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ pub fn check(build: &mut Build) {
142142

143143
// We need cmake, but only if we're actually building LLVM or sanitizers.
144144
let building_llvm = !build.config.llvm_from_ci
145+
&& !build.config.local_rebuild
145146
&& build.hosts.iter().any(|host| {
146147
build.config.llvm_enabled(*host)
147148
&& build

‎src/ci/docker/host-x86_64/tidy/Dockerfile‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ COPY scripts/nodejs.sh /scripts/
2828
RUN sh /scripts/nodejs.sh /node
2929
ENV PATH="/node/bin:${PATH}"
3030

31-
# Install eslint
32-
COPY host-x86_64/tidy/eslint.version /tmp/
33-
3431
COPY scripts/sccache.sh /scripts/
3532
RUN sh /scripts/sccache.sh
3633

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

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

43-
RUN bash -c 'npm install -g eslint@$(cat /tmp/eslint.version)'
44-
4540
# NOTE: intentionally uses python2 for x.py so we can test it still works.
4641
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
4742
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \

‎src/ci/docker/host-x86_64/tidy/eslint.version‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/librustdoc/html/static/js/search.js‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3926,16 +3926,25 @@ class DocSearch {
39263926
* @returns {Promise<rustdoc.PlainResultObject?>}
39273927
*/
39283928
consthandleAlias=async(name,alias,dist,index)=>{
3929+
constitem=nonnull(awaitthis.getRow(alias,false));
3930+
// space both is an alias for ::,
3931+
// and is also allowed to appear in doc alias names
3932+
constpath_dist=name.includes(" ")||parsedQuery.elems.length===0 ?
3933+
0 : checkRowPath(parsedQuery.elems[0].pathWithoutLast,item);
3934+
// path distance exceeds max, omit alias from results
3935+
if(path_dist===null){
3936+
returnnull;
3937+
}
39293938
return{
39303939
id: alias,
39313940
dist,
3932-
path_dist: 0,
3941+
path_dist,
39333942
index,
39343943
alias: name,
39353944
is_alias: true,
39363945
elems: [],// only used in type-based queries
39373946
returned: [],// only used in type-based queries
3938-
item: nonnull(awaitthis.getRow(alias,false)),
3947+
item,
39393948
};
39403949
};
39413950
/**
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// exact-check
2+
3+
// consider path distance for doc aliases
4+
// regression test for <https://github.com/rust-lang/rust/issues/146214>
5+
6+
constEXPECTED=[
7+
{
8+
'query': 'Foo::zzz',
9+
'others': [
10+
{'path': 'alias_path_distance::Foo','name': 'baz'},
11+
],
12+
},
13+
{
14+
'query': '"Foo::zzz"',
15+
'others': [
16+
{'path': 'alias_path_distance::Foo','name': 'baz'},
17+
],
18+
},
19+
{
20+
'query': 'Foo::zzzz',
21+
'others': [
22+
{'path': 'alias_path_distance::Foo','name': 'baz'},
23+
],
24+
},
25+
{
26+
'query': 'zzzz',
27+
'others': [
28+
{'path': 'alias_path_distance::Foo','name': 'baz'},
29+
{'path': 'alias_path_distance::Bar','name': 'baz'},
30+
],
31+
},
32+
];
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![crate_name = "alias_path_distance"]
2+
3+
pubstructFoo;
4+
pubstructBar;
5+
6+
implFoo{
7+
#[doc(alias = "zzz")]
8+
pubfnbaz(){}
9+
}
10+
11+
implBar{
12+
#[doc(alias = "zzz")]
13+
pubfnbaz(){}
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// rank doc aliases lower than exact matches
2+
// regression test for <https://github.com/rust-lang/rust/issues/140968>
3+
4+
constEXPECTED={
5+
'query': 'Foo',
6+
'others': [
7+
{'path': 'alias_rank_lower','name': 'Foo'},
8+
{'path': 'alias_rank_lower','name': 'Bar'},
9+
],
10+
};

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 5dbf406

Browse files
committed
Auto merge of #148885 - Zalathar:rollup-wrvewer, r=Zalathar
Rollup of 7 pull requests Successful merges: - #147701 (rustdoc: don't ignore path distance for doc aliases) - #148735 (Fix ICE caused by invalid spans for shrink_file) - #148839 (fix rtsan_nonblocking_async lint closure ICE) - #148846 (add a test for combining RPIT with explicit tail calls) - #148872 (fix: Do not ICE when missing match arm with ill-formed subty is met) - #148880 (Remove explicit install of `eslint` inside of `tidy`'s Dockerfile) - #148883 (bootstrap: dont require cmake if local-rebuild is enabled) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 503dce3 + 314a6cd commit 5dbf406

20 files changed

Lines changed: 280 additions & 29 deletions

‎compiler/rustc_codegen_ssa/src/codegen_attrs.rs‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,16 +469,18 @@ fn check_result(
469469
})
470470
}
471471

472-
// warn for nonblocking async fn.
472+
// warn for nonblocking async functions, blocks and closures.
473473
// This doesn't behave as expected, because the executor can run blocking code without the sanitizer noticing.
474474
if codegen_fn_attrs.sanitizers.rtsan_setting == RtsanSetting::Nonblocking
475475
&& letSome(sanitize_span) = interesting_spans.sanitize
476-
// async function
477-
&& (tcx.asyncness(did).is_async() || (tcx.is_closure_like(did.into())
476+
// async fn
477+
&& (tcx.asyncness(did).is_async()
478478
// async block
479-
&& (tcx.coroutine_is_async(did.into())
480-
// async closure
481-
|| tcx.coroutine_is_async(tcx.coroutine_for_closure(did)))))
479+
|| tcx.is_coroutine(did.into())
480+
// async closure
481+
|| (tcx.is_closure_like(did.into())
482+
&& tcx.hir_node_by_def_id(did).expect_closure().kind
483+
!= rustc_hir::ClosureKind::Closure))
482484
{
483485
let hir_id = tcx.local_def_id_to_hir_id(did);
484486
tcx.node_span_lint(

‎compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs‎

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,22 +350,27 @@ impl AnnotateSnippetEmitter {
350350
"all spans must be disjoint",
351351
);
352352

353+
let lo = subst.parts.iter().map(|part| part.span.lo()).min()?;
354+
let lo_file = sm.lookup_source_file(lo);
355+
let hi = subst.parts.iter().map(|part| part.span.hi()).max()?;
356+
let hi_file = sm.lookup_source_file(hi);
357+
358+
// The different spans might belong to different contexts, if so ignore suggestion.
359+
if lo_file.stable_id != hi_file.stable_id{
360+
returnNone;
361+
}
362+
363+
// We can't splice anything if the source is unavailable.
364+
if !sm.ensure_source_file_source_present(&lo_file){
365+
returnNone;
366+
}
367+
353368
// Account for cases where we are suggesting the same code that's already
354369
// there. This shouldn't happen often, but in some cases for multipart
355370
// suggestions it's much easier to handle it here than in the origin.
356371
subst.parts.retain(|p| is_different(sm,&p.snippet, p.span));
357372

358-
let item_span = subst.parts.first()?;
359-
let file = sm.lookup_source_file(item_span.span.lo());
360-
ifshould_show_source_code(
361-
&self.ignored_directories_in_source_blocks,
362-
sm,
363-
&file,
364-
){
365-
Some(subst)
366-
}else{
367-
None
368-
}
373+
if subst.parts.is_empty(){None}else{Some(subst)}
369374
})
370375
.collect::<Vec<_>>();
371376

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

750754
let hi_byte = spans.iter().map(|s| s.hi()).max()?;
751755
let hi_loc = sm.lookup_char_pos(hi_byte);
752-
let hi = lo_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
756+
757+
if lo_loc.file.stable_id != hi_loc.file.stable_id{
758+
// this may happen when spans cross file boundaries due to macro expansion.
759+
returnNone;
760+
}
761+
762+
let lo = lo_loc.file.line_bounds(lo_loc.line.saturating_sub(1)).start;
763+
let hi = hi_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
753764

754765
let bounding_span = Span::with_root_ctxt(lo, hi);
755-
let source = sm.span_to_snippet(bounding_span).unwrap_or_default();
766+
let source = sm.span_to_snippet(bounding_span).ok()?;
756767
let offset_line = sm.doctest_offset_line(file_name, lo_loc.line);
757768

758769
Some((bounding_span, source, offset_line))

‎compiler/rustc_pattern_analysis/src/rustc.rs‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,18 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
191191
variant.fields.iter().map(move |field| {
192192
let ty = field.ty(self.tcx, args);
193193
// `field.ty()` doesn't normalize after instantiating.
194-
let ty = self.tcx.normalize_erasing_regions(self.typing_env, ty);
194+
let ty =
195+
self.tcx.try_normalize_erasing_regions(self.typing_env, ty).unwrap_or_else(|e| {
196+
self.tcx.dcx().span_delayed_bug(
197+
self.scrut_span,
198+
format!(
199+
"Failed to normalize {:?} in typing_env={:?} while getting variant sub tys for {ty:?}",
200+
e.get_type_for_failure(),
201+
self.typing_env,
202+
),
203+
);
204+
ty
205+
});
195206
let ty = self.reveal_opaque_ty(ty);
196207
(field, ty)
197208
})

‎src/bootstrap/src/core/sanity.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ pub fn check(build: &mut Build) {
142142

143143
// We need cmake, but only if we're actually building LLVM or sanitizers.
144144
let building_llvm = !build.config.llvm_from_ci
145+
&& !build.config.local_rebuild
145146
&& build.hosts.iter().any(|host| {
146147
build.config.llvm_enabled(*host)
147148
&& build

‎src/ci/docker/host-x86_64/tidy/Dockerfile‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ COPY scripts/nodejs.sh /scripts/
2828
RUN sh /scripts/nodejs.sh /node
2929
ENV PATH="/node/bin:${PATH}"
3030

31-
# Install eslint
32-
COPY host-x86_64/tidy/eslint.version /tmp/
33-
3431
COPY scripts/sccache.sh /scripts/
3532
RUN sh /scripts/sccache.sh
3633

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

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

43-
RUN bash -c 'npm install -g eslint@$(cat /tmp/eslint.version)'
44-
4540
# NOTE: intentionally uses python2 for x.py so we can test it still works.
4641
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
4742
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \

‎src/ci/docker/host-x86_64/tidy/eslint.version‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/librustdoc/html/static/js/search.js‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3926,16 +3926,25 @@ class DocSearch {
39263926
* @returns {Promise<rustdoc.PlainResultObject?>}
39273927
*/
39283928
consthandleAlias=async(name,alias,dist,index)=>{
3929+
constitem=nonnull(awaitthis.getRow(alias,false));
3930+
// space both is an alias for ::,
3931+
// and is also allowed to appear in doc alias names
3932+
constpath_dist=name.includes(" ")||parsedQuery.elems.length===0 ?
3933+
0 : checkRowPath(parsedQuery.elems[0].pathWithoutLast,item);
3934+
// path distance exceeds max, omit alias from results
3935+
if(path_dist===null){
3936+
returnnull;
3937+
}
39293938
return{
39303939
id: alias,
39313940
dist,
3932-
path_dist: 0,
3941+
path_dist,
39333942
index,
39343943
alias: name,
39353944
is_alias: true,
39363945
elems: [],// only used in type-based queries
39373946
returned: [],// only used in type-based queries
3938-
item: nonnull(awaitthis.getRow(alias,false)),
3947+
item,
39393948
};
39403949
};
39413950
/**
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// exact-check
2+
3+
// consider path distance for doc aliases
4+
// regression test for <https://github.com/rust-lang/rust/issues/146214>
5+
6+
constEXPECTED=[
7+
{
8+
'query': 'Foo::zzz',
9+
'others': [
10+
{'path': 'alias_path_distance::Foo','name': 'baz'},
11+
],
12+
},
13+
{
14+
'query': '"Foo::zzz"',
15+
'others': [
16+
{'path': 'alias_path_distance::Foo','name': 'baz'},
17+
],
18+
},
19+
{
20+
'query': 'Foo::zzzz',
21+
'others': [
22+
{'path': 'alias_path_distance::Foo','name': 'baz'},
23+
],
24+
},
25+
{
26+
'query': 'zzzz',
27+
'others': [
28+
{'path': 'alias_path_distance::Foo','name': 'baz'},
29+
{'path': 'alias_path_distance::Bar','name': 'baz'},
30+
],
31+
},
32+
];
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![crate_name = "alias_path_distance"]
2+
3+
pubstructFoo;
4+
pubstructBar;
5+
6+
implFoo{
7+
#[doc(alias = "zzz")]
8+
pubfnbaz(){}
9+
}
10+
11+
implBar{
12+
#[doc(alias = "zzz")]
13+
pubfnbaz(){}
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// rank doc aliases lower than exact matches
2+
// regression test for <https://github.com/rust-lang/rust/issues/140968>
3+
4+
constEXPECTED={
5+
'query': 'Foo',
6+
'others': [
7+
{'path': 'alias_rank_lower','name': 'Foo'},
8+
{'path': 'alias_rank_lower','name': 'Bar'},
9+
],
10+
};

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Commit 5dbf406

Browse files
committed
Auto merge of #148885 - Zalathar:rollup-wrvewer, r=Zalathar
Rollup of 7 pull requests Successful merges: - #147701 (rustdoc: don't ignore path distance for doc aliases) - #148735 (Fix ICE caused by invalid spans for shrink_file) - #148839 (fix rtsan_nonblocking_async lint closure ICE) - #148846 (add a test for combining RPIT with explicit tail calls) - #148872 (fix: Do not ICE when missing match arm with ill-formed subty is met) - #148880 (Remove explicit install of `eslint` inside of `tidy`'s Dockerfile) - #148883 (bootstrap: dont require cmake if local-rebuild is enabled) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 503dce3 + 314a6cd commit 5dbf406

20 files changed

Lines changed: 280 additions & 29 deletions

‎compiler/rustc_codegen_ssa/src/codegen_attrs.rs‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,16 +469,18 @@ fn check_result(
469469
})
470470
}
471471

472-
// warn for nonblocking async fn.
472+
// warn for nonblocking async functions, blocks and closures.
473473
// This doesn't behave as expected, because the executor can run blocking code without the sanitizer noticing.
474474
if codegen_fn_attrs.sanitizers.rtsan_setting == RtsanSetting::Nonblocking
475475
&& letSome(sanitize_span) = interesting_spans.sanitize
476-
// async function
477-
&& (tcx.asyncness(did).is_async() || (tcx.is_closure_like(did.into())
476+
// async fn
477+
&& (tcx.asyncness(did).is_async()
478478
// async block
479-
&& (tcx.coroutine_is_async(did.into())
480-
// async closure
481-
|| tcx.coroutine_is_async(tcx.coroutine_for_closure(did)))))
479+
|| tcx.is_coroutine(did.into())
480+
// async closure
481+
|| (tcx.is_closure_like(did.into())
482+
&& tcx.hir_node_by_def_id(did).expect_closure().kind
483+
!= rustc_hir::ClosureKind::Closure))
482484
{
483485
let hir_id = tcx.local_def_id_to_hir_id(did);
484486
tcx.node_span_lint(

‎compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs‎

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,22 +350,27 @@ impl AnnotateSnippetEmitter {
350350
"all spans must be disjoint",
351351
);
352352

353+
let lo = subst.parts.iter().map(|part| part.span.lo()).min()?;
354+
let lo_file = sm.lookup_source_file(lo);
355+
let hi = subst.parts.iter().map(|part| part.span.hi()).max()?;
356+
let hi_file = sm.lookup_source_file(hi);
357+
358+
// The different spans might belong to different contexts, if so ignore suggestion.
359+
if lo_file.stable_id != hi_file.stable_id{
360+
returnNone;
361+
}
362+
363+
// We can't splice anything if the source is unavailable.
364+
if !sm.ensure_source_file_source_present(&lo_file){
365+
returnNone;
366+
}
367+
353368
// Account for cases where we are suggesting the same code that's already
354369
// there. This shouldn't happen often, but in some cases for multipart
355370
// suggestions it's much easier to handle it here than in the origin.
356371
subst.parts.retain(|p| is_different(sm,&p.snippet, p.span));
357372

358-
let item_span = subst.parts.first()?;
359-
let file = sm.lookup_source_file(item_span.span.lo());
360-
ifshould_show_source_code(
361-
&self.ignored_directories_in_source_blocks,
362-
sm,
363-
&file,
364-
){
365-
Some(subst)
366-
}else{
367-
None
368-
}
373+
if subst.parts.is_empty(){None}else{Some(subst)}
369374
})
370375
.collect::<Vec<_>>();
371376

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

750754
let hi_byte = spans.iter().map(|s| s.hi()).max()?;
751755
let hi_loc = sm.lookup_char_pos(hi_byte);
752-
let hi = lo_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
756+
757+
if lo_loc.file.stable_id != hi_loc.file.stable_id{
758+
// this may happen when spans cross file boundaries due to macro expansion.
759+
returnNone;
760+
}
761+
762+
let lo = lo_loc.file.line_bounds(lo_loc.line.saturating_sub(1)).start;
763+
let hi = hi_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
753764

754765
let bounding_span = Span::with_root_ctxt(lo, hi);
755-
let source = sm.span_to_snippet(bounding_span).unwrap_or_default();
766+
let source = sm.span_to_snippet(bounding_span).ok()?;
756767
let offset_line = sm.doctest_offset_line(file_name, lo_loc.line);
757768

758769
Some((bounding_span, source, offset_line))

‎compiler/rustc_pattern_analysis/src/rustc.rs‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,18 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
191191
variant.fields.iter().map(move |field| {
192192
let ty = field.ty(self.tcx, args);
193193
// `field.ty()` doesn't normalize after instantiating.
194-
let ty = self.tcx.normalize_erasing_regions(self.typing_env, ty);
194+
let ty =
195+
self.tcx.try_normalize_erasing_regions(self.typing_env, ty).unwrap_or_else(|e| {
196+
self.tcx.dcx().span_delayed_bug(
197+
self.scrut_span,
198+
format!(
199+
"Failed to normalize {:?} in typing_env={:?} while getting variant sub tys for {ty:?}",
200+
e.get_type_for_failure(),
201+
self.typing_env,
202+
),
203+
);
204+
ty
205+
});
195206
let ty = self.reveal_opaque_ty(ty);
196207
(field, ty)
197208
})

‎src/bootstrap/src/core/sanity.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ pub fn check(build: &mut Build) {
142142

143143
// We need cmake, but only if we're actually building LLVM or sanitizers.
144144
let building_llvm = !build.config.llvm_from_ci
145+
&& !build.config.local_rebuild
145146
&& build.hosts.iter().any(|host| {
146147
build.config.llvm_enabled(*host)
147148
&& build

‎src/ci/docker/host-x86_64/tidy/Dockerfile‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ COPY scripts/nodejs.sh /scripts/
2828
RUN sh /scripts/nodejs.sh /node
2929
ENV PATH="/node/bin:${PATH}"
3030

31-
# Install eslint
32-
COPY host-x86_64/tidy/eslint.version /tmp/
33-
3431
COPY scripts/sccache.sh /scripts/
3532
RUN sh /scripts/sccache.sh
3633

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

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

43-
RUN bash -c 'npm install -g eslint@$(cat /tmp/eslint.version)'
44-
4540
# NOTE: intentionally uses python2 for x.py so we can test it still works.
4641
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
4742
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \

‎src/ci/docker/host-x86_64/tidy/eslint.version‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/librustdoc/html/static/js/search.js‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3926,16 +3926,25 @@ class DocSearch {
39263926
* @returns {Promise<rustdoc.PlainResultObject?>}
39273927
*/
39283928
consthandleAlias=async(name,alias,dist,index)=>{
3929+
constitem=nonnull(awaitthis.getRow(alias,false));
3930+
// space both is an alias for ::,
3931+
// and is also allowed to appear in doc alias names
3932+
constpath_dist=name.includes(" ")||parsedQuery.elems.length===0 ?
3933+
0 : checkRowPath(parsedQuery.elems[0].pathWithoutLast,item);
3934+
// path distance exceeds max, omit alias from results
3935+
if(path_dist===null){
3936+
returnnull;
3937+
}
39293938
return{
39303939
id: alias,
39313940
dist,
3932-
path_dist: 0,
3941+
path_dist,
39333942
index,
39343943
alias: name,
39353944
is_alias: true,
39363945
elems: [],// only used in type-based queries
39373946
returned: [],// only used in type-based queries
3938-
item: nonnull(awaitthis.getRow(alias,false)),
3947+
item,
39393948
};
39403949
};
39413950
/**
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// exact-check
2+
3+
// consider path distance for doc aliases
4+
// regression test for <https://github.com/rust-lang/rust/issues/146214>
5+
6+
constEXPECTED=[
7+
{
8+
'query': 'Foo::zzz',
9+
'others': [
10+
{'path': 'alias_path_distance::Foo','name': 'baz'},
11+
],
12+
},
13+
{
14+
'query': '"Foo::zzz"',
15+
'others': [
16+
{'path': 'alias_path_distance::Foo','name': 'baz'},
17+
],
18+
},
19+
{
20+
'query': 'Foo::zzzz',
21+
'others': [
22+
{'path': 'alias_path_distance::Foo','name': 'baz'},
23+
],
24+
},
25+
{
26+
'query': 'zzzz',
27+
'others': [
28+
{'path': 'alias_path_distance::Foo','name': 'baz'},
29+
{'path': 'alias_path_distance::Bar','name': 'baz'},
30+
],
31+
},
32+
];
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![crate_name = "alias_path_distance"]
2+
3+
pubstructFoo;
4+
pubstructBar;
5+
6+
implFoo{
7+
#[doc(alias = "zzz")]
8+
pubfnbaz(){}
9+
}
10+
11+
implBar{
12+
#[doc(alias = "zzz")]
13+
pubfnbaz(){}
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// rank doc aliases lower than exact matches
2+
// regression test for <https://github.com/rust-lang/rust/issues/140968>
3+
4+
constEXPECTED={
5+
'query': 'Foo',
6+
'others': [
7+
{'path': 'alias_rank_lower','name': 'Foo'},
8+
{'path': 'alias_rank_lower','name': 'Bar'},
9+
],
10+
};

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 5dbf406

Browse files
committed
Auto merge of #148885 - Zalathar:rollup-wrvewer, r=Zalathar
Rollup of 7 pull requests Successful merges: - #147701 (rustdoc: don't ignore path distance for doc aliases) - #148735 (Fix ICE caused by invalid spans for shrink_file) - #148839 (fix rtsan_nonblocking_async lint closure ICE) - #148846 (add a test for combining RPIT with explicit tail calls) - #148872 (fix: Do not ICE when missing match arm with ill-formed subty is met) - #148880 (Remove explicit install of `eslint` inside of `tidy`'s Dockerfile) - #148883 (bootstrap: dont require cmake if local-rebuild is enabled) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 503dce3 + 314a6cd commit 5dbf406

20 files changed

Lines changed: 280 additions & 29 deletions

‎compiler/rustc_codegen_ssa/src/codegen_attrs.rs‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,16 +469,18 @@ fn check_result(
469469
})
470470
}
471471

472-
// warn for nonblocking async fn.
472+
// warn for nonblocking async functions, blocks and closures.
473473
// This doesn't behave as expected, because the executor can run blocking code without the sanitizer noticing.
474474
if codegen_fn_attrs.sanitizers.rtsan_setting == RtsanSetting::Nonblocking
475475
&& letSome(sanitize_span) = interesting_spans.sanitize
476-
// async function
477-
&& (tcx.asyncness(did).is_async() || (tcx.is_closure_like(did.into())
476+
// async fn
477+
&& (tcx.asyncness(did).is_async()
478478
// async block
479-
&& (tcx.coroutine_is_async(did.into())
480-
// async closure
481-
|| tcx.coroutine_is_async(tcx.coroutine_for_closure(did)))))
479+
|| tcx.is_coroutine(did.into())
480+
// async closure
481+
|| (tcx.is_closure_like(did.into())
482+
&& tcx.hir_node_by_def_id(did).expect_closure().kind
483+
!= rustc_hir::ClosureKind::Closure))
482484
{
483485
let hir_id = tcx.local_def_id_to_hir_id(did);
484486
tcx.node_span_lint(

‎compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs‎

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,22 +350,27 @@ impl AnnotateSnippetEmitter {
350350
"all spans must be disjoint",
351351
);
352352

353+
let lo = subst.parts.iter().map(|part| part.span.lo()).min()?;
354+
let lo_file = sm.lookup_source_file(lo);
355+
let hi = subst.parts.iter().map(|part| part.span.hi()).max()?;
356+
let hi_file = sm.lookup_source_file(hi);
357+
358+
// The different spans might belong to different contexts, if so ignore suggestion.
359+
if lo_file.stable_id != hi_file.stable_id{
360+
returnNone;
361+
}
362+
363+
// We can't splice anything if the source is unavailable.
364+
if !sm.ensure_source_file_source_present(&lo_file){
365+
returnNone;
366+
}
367+
353368
// Account for cases where we are suggesting the same code that's already
354369
// there. This shouldn't happen often, but in some cases for multipart
355370
// suggestions it's much easier to handle it here than in the origin.
356371
subst.parts.retain(|p| is_different(sm,&p.snippet, p.span));
357372

358-
let item_span = subst.parts.first()?;
359-
let file = sm.lookup_source_file(item_span.span.lo());
360-
ifshould_show_source_code(
361-
&self.ignored_directories_in_source_blocks,
362-
sm,
363-
&file,
364-
){
365-
Some(subst)
366-
}else{
367-
None
368-
}
373+
if subst.parts.is_empty(){None}else{Some(subst)}
369374
})
370375
.collect::<Vec<_>>();
371376

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

750754
let hi_byte = spans.iter().map(|s| s.hi()).max()?;
751755
let hi_loc = sm.lookup_char_pos(hi_byte);
752-
let hi = lo_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
756+
757+
if lo_loc.file.stable_id != hi_loc.file.stable_id{
758+
// this may happen when spans cross file boundaries due to macro expansion.
759+
returnNone;
760+
}
761+
762+
let lo = lo_loc.file.line_bounds(lo_loc.line.saturating_sub(1)).start;
763+
let hi = hi_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
753764

754765
let bounding_span = Span::with_root_ctxt(lo, hi);
755-
let source = sm.span_to_snippet(bounding_span).unwrap_or_default();
766+
let source = sm.span_to_snippet(bounding_span).ok()?;
756767
let offset_line = sm.doctest_offset_line(file_name, lo_loc.line);
757768

758769
Some((bounding_span, source, offset_line))

‎compiler/rustc_pattern_analysis/src/rustc.rs‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,18 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
191191
variant.fields.iter().map(move |field| {
192192
let ty = field.ty(self.tcx, args);
193193
// `field.ty()` doesn't normalize after instantiating.
194-
let ty = self.tcx.normalize_erasing_regions(self.typing_env, ty);
194+
let ty =
195+
self.tcx.try_normalize_erasing_regions(self.typing_env, ty).unwrap_or_else(|e| {
196+
self.tcx.dcx().span_delayed_bug(
197+
self.scrut_span,
198+
format!(
199+
"Failed to normalize {:?} in typing_env={:?} while getting variant sub tys for {ty:?}",
200+
e.get_type_for_failure(),
201+
self.typing_env,
202+
),
203+
);
204+
ty
205+
});
195206
let ty = self.reveal_opaque_ty(ty);
196207
(field, ty)
197208
})

‎src/bootstrap/src/core/sanity.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ pub fn check(build: &mut Build) {
142142

143143
// We need cmake, but only if we're actually building LLVM or sanitizers.
144144
let building_llvm = !build.config.llvm_from_ci
145+
&& !build.config.local_rebuild
145146
&& build.hosts.iter().any(|host| {
146147
build.config.llvm_enabled(*host)
147148
&& build

‎src/ci/docker/host-x86_64/tidy/Dockerfile‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ COPY scripts/nodejs.sh /scripts/
2828
RUN sh /scripts/nodejs.sh /node
2929
ENV PATH="/node/bin:${PATH}"
3030

31-
# Install eslint
32-
COPY host-x86_64/tidy/eslint.version /tmp/
33-
3431
COPY scripts/sccache.sh /scripts/
3532
RUN sh /scripts/sccache.sh
3633

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

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

43-
RUN bash -c 'npm install -g eslint@$(cat /tmp/eslint.version)'
44-
4540
# NOTE: intentionally uses python2 for x.py so we can test it still works.
4641
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
4742
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \

‎src/ci/docker/host-x86_64/tidy/eslint.version‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/librustdoc/html/static/js/search.js‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3926,16 +3926,25 @@ class DocSearch {
39263926
* @returns {Promise<rustdoc.PlainResultObject?>}
39273927
*/
39283928
consthandleAlias=async(name,alias,dist,index)=>{
3929+
constitem=nonnull(awaitthis.getRow(alias,false));
3930+
// space both is an alias for ::,
3931+
// and is also allowed to appear in doc alias names
3932+
constpath_dist=name.includes(" ")||parsedQuery.elems.length===0 ?
3933+
0 : checkRowPath(parsedQuery.elems[0].pathWithoutLast,item);
3934+
// path distance exceeds max, omit alias from results
3935+
if(path_dist===null){
3936+
returnnull;
3937+
}
39293938
return{
39303939
id: alias,
39313940
dist,
3932-
path_dist: 0,
3941+
path_dist,
39333942
index,
39343943
alias: name,
39353944
is_alias: true,
39363945
elems: [],// only used in type-based queries
39373946
returned: [],// only used in type-based queries
3938-
item: nonnull(awaitthis.getRow(alias,false)),
3947+
item,
39393948
};
39403949
};
39413950
/**
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// exact-check
2+
3+
// consider path distance for doc aliases
4+
// regression test for <https://github.com/rust-lang/rust/issues/146214>
5+
6+
constEXPECTED=[
7+
{
8+
'query': 'Foo::zzz',
9+
'others': [
10+
{'path': 'alias_path_distance::Foo','name': 'baz'},
11+
],
12+
},
13+
{
14+
'query': '"Foo::zzz"',
15+
'others': [
16+
{'path': 'alias_path_distance::Foo','name': 'baz'},
17+
],
18+
},
19+
{
20+
'query': 'Foo::zzzz',
21+
'others': [
22+
{'path': 'alias_path_distance::Foo','name': 'baz'},
23+
],
24+
},
25+
{
26+
'query': 'zzzz',
27+
'others': [
28+
{'path': 'alias_path_distance::Foo','name': 'baz'},
29+
{'path': 'alias_path_distance::Bar','name': 'baz'},
30+
],
31+
},
32+
];
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![crate_name = "alias_path_distance"]
2+
3+
pubstructFoo;
4+
pubstructBar;
5+
6+
implFoo{
7+
#[doc(alias = "zzz")]
8+
pubfnbaz(){}
9+
}
10+
11+
implBar{
12+
#[doc(alias = "zzz")]
13+
pubfnbaz(){}
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// rank doc aliases lower than exact matches
2+
// regression test for <https://github.com/rust-lang/rust/issues/140968>
3+
4+
constEXPECTED={
5+
'query': 'Foo',
6+
'others': [
7+
{'path': 'alias_rank_lower','name': 'Foo'},
8+
{'path': 'alias_rank_lower','name': 'Bar'},
9+
],
10+
};

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 5dbf406

Browse files
committed
Auto merge of #148885 - Zalathar:rollup-wrvewer, r=Zalathar
Rollup of 7 pull requests Successful merges: - #147701 (rustdoc: don't ignore path distance for doc aliases) - #148735 (Fix ICE caused by invalid spans for shrink_file) - #148839 (fix rtsan_nonblocking_async lint closure ICE) - #148846 (add a test for combining RPIT with explicit tail calls) - #148872 (fix: Do not ICE when missing match arm with ill-formed subty is met) - #148880 (Remove explicit install of `eslint` inside of `tidy`'s Dockerfile) - #148883 (bootstrap: dont require cmake if local-rebuild is enabled) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 503dce3 + 314a6cd commit 5dbf406

20 files changed

Lines changed: 280 additions & 29 deletions

‎compiler/rustc_codegen_ssa/src/codegen_attrs.rs‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,16 +469,18 @@ fn check_result(
469469
})
470470
}
471471

472-
// warn for nonblocking async fn.
472+
// warn for nonblocking async functions, blocks and closures.
473473
// This doesn't behave as expected, because the executor can run blocking code without the sanitizer noticing.
474474
if codegen_fn_attrs.sanitizers.rtsan_setting == RtsanSetting::Nonblocking
475475
&& letSome(sanitize_span) = interesting_spans.sanitize
476-
// async function
477-
&& (tcx.asyncness(did).is_async() || (tcx.is_closure_like(did.into())
476+
// async fn
477+
&& (tcx.asyncness(did).is_async()
478478
// async block
479-
&& (tcx.coroutine_is_async(did.into())
480-
// async closure
481-
|| tcx.coroutine_is_async(tcx.coroutine_for_closure(did)))))
479+
|| tcx.is_coroutine(did.into())
480+
// async closure
481+
|| (tcx.is_closure_like(did.into())
482+
&& tcx.hir_node_by_def_id(did).expect_closure().kind
483+
!= rustc_hir::ClosureKind::Closure))
482484
{
483485
let hir_id = tcx.local_def_id_to_hir_id(did);
484486
tcx.node_span_lint(

‎compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs‎

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,22 +350,27 @@ impl AnnotateSnippetEmitter {
350350
"all spans must be disjoint",
351351
);
352352

353+
let lo = subst.parts.iter().map(|part| part.span.lo()).min()?;
354+
let lo_file = sm.lookup_source_file(lo);
355+
let hi = subst.parts.iter().map(|part| part.span.hi()).max()?;
356+
let hi_file = sm.lookup_source_file(hi);
357+
358+
// The different spans might belong to different contexts, if so ignore suggestion.
359+
if lo_file.stable_id != hi_file.stable_id{
360+
returnNone;
361+
}
362+
363+
// We can't splice anything if the source is unavailable.
364+
if !sm.ensure_source_file_source_present(&lo_file){
365+
returnNone;
366+
}
367+
353368
// Account for cases where we are suggesting the same code that's already
354369
// there. This shouldn't happen often, but in some cases for multipart
355370
// suggestions it's much easier to handle it here than in the origin.
356371
subst.parts.retain(|p| is_different(sm,&p.snippet, p.span));
357372

358-
let item_span = subst.parts.first()?;
359-
let file = sm.lookup_source_file(item_span.span.lo());
360-
ifshould_show_source_code(
361-
&self.ignored_directories_in_source_blocks,
362-
sm,
363-
&file,
364-
){
365-
Some(subst)
366-
}else{
367-
None
368-
}
373+
if subst.parts.is_empty(){None}else{Some(subst)}
369374
})
370375
.collect::<Vec<_>>();
371376

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

750754
let hi_byte = spans.iter().map(|s| s.hi()).max()?;
751755
let hi_loc = sm.lookup_char_pos(hi_byte);
752-
let hi = lo_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
756+
757+
if lo_loc.file.stable_id != hi_loc.file.stable_id{
758+
// this may happen when spans cross file boundaries due to macro expansion.
759+
returnNone;
760+
}
761+
762+
let lo = lo_loc.file.line_bounds(lo_loc.line.saturating_sub(1)).start;
763+
let hi = hi_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
753764

754765
let bounding_span = Span::with_root_ctxt(lo, hi);
755-
let source = sm.span_to_snippet(bounding_span).unwrap_or_default();
766+
let source = sm.span_to_snippet(bounding_span).ok()?;
756767
let offset_line = sm.doctest_offset_line(file_name, lo_loc.line);
757768

758769
Some((bounding_span, source, offset_line))

‎compiler/rustc_pattern_analysis/src/rustc.rs‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,18 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
191191
variant.fields.iter().map(move |field| {
192192
let ty = field.ty(self.tcx, args);
193193
// `field.ty()` doesn't normalize after instantiating.
194-
let ty = self.tcx.normalize_erasing_regions(self.typing_env, ty);
194+
let ty =
195+
self.tcx.try_normalize_erasing_regions(self.typing_env, ty).unwrap_or_else(|e| {
196+
self.tcx.dcx().span_delayed_bug(
197+
self.scrut_span,
198+
format!(
199+
"Failed to normalize {:?} in typing_env={:?} while getting variant sub tys for {ty:?}",
200+
e.get_type_for_failure(),
201+
self.typing_env,
202+
),
203+
);
204+
ty
205+
});
195206
let ty = self.reveal_opaque_ty(ty);
196207
(field, ty)
197208
})

‎src/bootstrap/src/core/sanity.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ pub fn check(build: &mut Build) {
142142

143143
// We need cmake, but only if we're actually building LLVM or sanitizers.
144144
let building_llvm = !build.config.llvm_from_ci
145+
&& !build.config.local_rebuild
145146
&& build.hosts.iter().any(|host| {
146147
build.config.llvm_enabled(*host)
147148
&& build

‎src/ci/docker/host-x86_64/tidy/Dockerfile‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ COPY scripts/nodejs.sh /scripts/
2828
RUN sh /scripts/nodejs.sh /node
2929
ENV PATH="/node/bin:${PATH}"
3030

31-
# Install eslint
32-
COPY host-x86_64/tidy/eslint.version /tmp/
33-
3431
COPY scripts/sccache.sh /scripts/
3532
RUN sh /scripts/sccache.sh
3633

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

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

43-
RUN bash -c 'npm install -g eslint@$(cat /tmp/eslint.version)'
44-
4540
# NOTE: intentionally uses python2 for x.py so we can test it still works.
4641
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
4742
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \

‎src/ci/docker/host-x86_64/tidy/eslint.version‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/librustdoc/html/static/js/search.js‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3926,16 +3926,25 @@ class DocSearch {
39263926
* @returns {Promise<rustdoc.PlainResultObject?>}
39273927
*/
39283928
consthandleAlias=async(name,alias,dist,index)=>{
3929+
constitem=nonnull(awaitthis.getRow(alias,false));
3930+
// space both is an alias for ::,
3931+
// and is also allowed to appear in doc alias names
3932+
constpath_dist=name.includes(" ")||parsedQuery.elems.length===0 ?
3933+
0 : checkRowPath(parsedQuery.elems[0].pathWithoutLast,item);
3934+
// path distance exceeds max, omit alias from results
3935+
if(path_dist===null){
3936+
returnnull;
3937+
}
39293938
return{
39303939
id: alias,
39313940
dist,
3932-
path_dist: 0,
3941+
path_dist,
39333942
index,
39343943
alias: name,
39353944
is_alias: true,
39363945
elems: [],// only used in type-based queries
39373946
returned: [],// only used in type-based queries
3938-
item: nonnull(awaitthis.getRow(alias,false)),
3947+
item,
39393948
};
39403949
};
39413950
/**
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// exact-check
2+
3+
// consider path distance for doc aliases
4+
// regression test for <https://github.com/rust-lang/rust/issues/146214>
5+
6+
constEXPECTED=[
7+
{
8+
'query': 'Foo::zzz',
9+
'others': [
10+
{'path': 'alias_path_distance::Foo','name': 'baz'},
11+
],
12+
},
13+
{
14+
'query': '"Foo::zzz"',
15+
'others': [
16+
{'path': 'alias_path_distance::Foo','name': 'baz'},
17+
],
18+
},
19+
{
20+
'query': 'Foo::zzzz',
21+
'others': [
22+
{'path': 'alias_path_distance::Foo','name': 'baz'},
23+
],
24+
},
25+
{
26+
'query': 'zzzz',
27+
'others': [
28+
{'path': 'alias_path_distance::Foo','name': 'baz'},
29+
{'path': 'alias_path_distance::Bar','name': 'baz'},
30+
],
31+
},
32+
];
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![crate_name = "alias_path_distance"]
2+
3+
pubstructFoo;
4+
pubstructBar;
5+
6+
implFoo{
7+
#[doc(alias = "zzz")]
8+
pubfnbaz(){}
9+
}
10+
11+
implBar{
12+
#[doc(alias = "zzz")]
13+
pubfnbaz(){}
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// rank doc aliases lower than exact matches
2+
// regression test for <https://github.com/rust-lang/rust/issues/140968>
3+
4+
constEXPECTED={
5+
'query': 'Foo',
6+
'others': [
7+
{'path': 'alias_rank_lower','name': 'Foo'},
8+
{'path': 'alias_rank_lower','name': 'Bar'},
9+
],
10+
};

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Commit 5dbf406

Browse files
committed
Auto merge of #148885 - Zalathar:rollup-wrvewer, r=Zalathar
Rollup of 7 pull requests Successful merges: - #147701 (rustdoc: don't ignore path distance for doc aliases) - #148735 (Fix ICE caused by invalid spans for shrink_file) - #148839 (fix rtsan_nonblocking_async lint closure ICE) - #148846 (add a test for combining RPIT with explicit tail calls) - #148872 (fix: Do not ICE when missing match arm with ill-formed subty is met) - #148880 (Remove explicit install of `eslint` inside of `tidy`'s Dockerfile) - #148883 (bootstrap: dont require cmake if local-rebuild is enabled) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 503dce3 + 314a6cd commit 5dbf406

20 files changed

Lines changed: 280 additions & 29 deletions

‎compiler/rustc_codegen_ssa/src/codegen_attrs.rs‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,16 +469,18 @@ fn check_result(
469469
})
470470
}
471471

472-
// warn for nonblocking async fn.
472+
// warn for nonblocking async functions, blocks and closures.
473473
// This doesn't behave as expected, because the executor can run blocking code without the sanitizer noticing.
474474
if codegen_fn_attrs.sanitizers.rtsan_setting == RtsanSetting::Nonblocking
475475
&& letSome(sanitize_span) = interesting_spans.sanitize
476-
// async function
477-
&& (tcx.asyncness(did).is_async() || (tcx.is_closure_like(did.into())
476+
// async fn
477+
&& (tcx.asyncness(did).is_async()
478478
// async block
479-
&& (tcx.coroutine_is_async(did.into())
480-
// async closure
481-
|| tcx.coroutine_is_async(tcx.coroutine_for_closure(did)))))
479+
|| tcx.is_coroutine(did.into())
480+
// async closure
481+
|| (tcx.is_closure_like(did.into())
482+
&& tcx.hir_node_by_def_id(did).expect_closure().kind
483+
!= rustc_hir::ClosureKind::Closure))
482484
{
483485
let hir_id = tcx.local_def_id_to_hir_id(did);
484486
tcx.node_span_lint(

‎compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs‎

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,22 +350,27 @@ impl AnnotateSnippetEmitter {
350350
"all spans must be disjoint",
351351
);
352352

353+
let lo = subst.parts.iter().map(|part| part.span.lo()).min()?;
354+
let lo_file = sm.lookup_source_file(lo);
355+
let hi = subst.parts.iter().map(|part| part.span.hi()).max()?;
356+
let hi_file = sm.lookup_source_file(hi);
357+
358+
// The different spans might belong to different contexts, if so ignore suggestion.
359+
if lo_file.stable_id != hi_file.stable_id{
360+
returnNone;
361+
}
362+
363+
// We can't splice anything if the source is unavailable.
364+
if !sm.ensure_source_file_source_present(&lo_file){
365+
returnNone;
366+
}
367+
353368
// Account for cases where we are suggesting the same code that's already
354369
// there. This shouldn't happen often, but in some cases for multipart
355370
// suggestions it's much easier to handle it here than in the origin.
356371
subst.parts.retain(|p| is_different(sm,&p.snippet, p.span));
357372

358-
let item_span = subst.parts.first()?;
359-
let file = sm.lookup_source_file(item_span.span.lo());
360-
ifshould_show_source_code(
361-
&self.ignored_directories_in_source_blocks,
362-
sm,
363-
&file,
364-
){
365-
Some(subst)
366-
}else{
367-
None
368-
}
373+
if subst.parts.is_empty(){None}else{Some(subst)}
369374
})
370375
.collect::<Vec<_>>();
371376

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

750754
let hi_byte = spans.iter().map(|s| s.hi()).max()?;
751755
let hi_loc = sm.lookup_char_pos(hi_byte);
752-
let hi = lo_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
756+
757+
if lo_loc.file.stable_id != hi_loc.file.stable_id{
758+
// this may happen when spans cross file boundaries due to macro expansion.
759+
returnNone;
760+
}
761+
762+
let lo = lo_loc.file.line_bounds(lo_loc.line.saturating_sub(1)).start;
763+
let hi = hi_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
753764

754765
let bounding_span = Span::with_root_ctxt(lo, hi);
755-
let source = sm.span_to_snippet(bounding_span).unwrap_or_default();
766+
let source = sm.span_to_snippet(bounding_span).ok()?;
756767
let offset_line = sm.doctest_offset_line(file_name, lo_loc.line);
757768

758769
Some((bounding_span, source, offset_line))

‎compiler/rustc_pattern_analysis/src/rustc.rs‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,18 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
191191
variant.fields.iter().map(move |field| {
192192
let ty = field.ty(self.tcx, args);
193193
// `field.ty()` doesn't normalize after instantiating.
194-
let ty = self.tcx.normalize_erasing_regions(self.typing_env, ty);
194+
let ty =
195+
self.tcx.try_normalize_erasing_regions(self.typing_env, ty).unwrap_or_else(|e| {
196+
self.tcx.dcx().span_delayed_bug(
197+
self.scrut_span,
198+
format!(
199+
"Failed to normalize {:?} in typing_env={:?} while getting variant sub tys for {ty:?}",
200+
e.get_type_for_failure(),
201+
self.typing_env,
202+
),
203+
);
204+
ty
205+
});
195206
let ty = self.reveal_opaque_ty(ty);
196207
(field, ty)
197208
})

‎src/bootstrap/src/core/sanity.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ pub fn check(build: &mut Build) {
142142

143143
// We need cmake, but only if we're actually building LLVM or sanitizers.
144144
let building_llvm = !build.config.llvm_from_ci
145+
&& !build.config.local_rebuild
145146
&& build.hosts.iter().any(|host| {
146147
build.config.llvm_enabled(*host)
147148
&& build

‎src/ci/docker/host-x86_64/tidy/Dockerfile‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ COPY scripts/nodejs.sh /scripts/
2828
RUN sh /scripts/nodejs.sh /node
2929
ENV PATH="/node/bin:${PATH}"
3030

31-
# Install eslint
32-
COPY host-x86_64/tidy/eslint.version /tmp/
33-
3431
COPY scripts/sccache.sh /scripts/
3532
RUN sh /scripts/sccache.sh
3633

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

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

43-
RUN bash -c 'npm install -g eslint@$(cat /tmp/eslint.version)'
44-
4540
# NOTE: intentionally uses python2 for x.py so we can test it still works.
4641
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
4742
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \

‎src/ci/docker/host-x86_64/tidy/eslint.version‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/librustdoc/html/static/js/search.js‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3926,16 +3926,25 @@ class DocSearch {
39263926
* @returns {Promise<rustdoc.PlainResultObject?>}
39273927
*/
39283928
consthandleAlias=async(name,alias,dist,index)=>{
3929+
constitem=nonnull(awaitthis.getRow(alias,false));
3930+
// space both is an alias for ::,
3931+
// and is also allowed to appear in doc alias names
3932+
constpath_dist=name.includes(" ")||parsedQuery.elems.length===0 ?
3933+
0 : checkRowPath(parsedQuery.elems[0].pathWithoutLast,item);
3934+
// path distance exceeds max, omit alias from results
3935+
if(path_dist===null){
3936+
returnnull;
3937+
}
39293938
return{
39303939
id: alias,
39313940
dist,
3932-
path_dist: 0,
3941+
path_dist,
39333942
index,
39343943
alias: name,
39353944
is_alias: true,
39363945
elems: [],// only used in type-based queries
39373946
returned: [],// only used in type-based queries
3938-
item: nonnull(awaitthis.getRow(alias,false)),
3947+
item,
39393948
};
39403949
};
39413950
/**
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// exact-check
2+
3+
// consider path distance for doc aliases
4+
// regression test for <https://github.com/rust-lang/rust/issues/146214>
5+
6+
constEXPECTED=[
7+
{
8+
'query': 'Foo::zzz',
9+
'others': [
10+
{'path': 'alias_path_distance::Foo','name': 'baz'},
11+
],
12+
},
13+
{
14+
'query': '"Foo::zzz"',
15+
'others': [
16+
{'path': 'alias_path_distance::Foo','name': 'baz'},
17+
],
18+
},
19+
{
20+
'query': 'Foo::zzzz',
21+
'others': [
22+
{'path': 'alias_path_distance::Foo','name': 'baz'},
23+
],
24+
},
25+
{
26+
'query': 'zzzz',
27+
'others': [
28+
{'path': 'alias_path_distance::Foo','name': 'baz'},
29+
{'path': 'alias_path_distance::Bar','name': 'baz'},
30+
],
31+
},
32+
];
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![crate_name = "alias_path_distance"]
2+
3+
pubstructFoo;
4+
pubstructBar;
5+
6+
implFoo{
7+
#[doc(alias = "zzz")]
8+
pubfnbaz(){}
9+
}
10+
11+
implBar{
12+
#[doc(alias = "zzz")]
13+
pubfnbaz(){}
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// rank doc aliases lower than exact matches
2+
// regression test for <https://github.com/rust-lang/rust/issues/140968>
3+
4+
constEXPECTED={
5+
'query': 'Foo',
6+
'others': [
7+
{'path': 'alias_rank_lower','name': 'Foo'},
8+
{'path': 'alias_rank_lower','name': 'Bar'},
9+
],
10+
};

0 commit comments

Comments
 (0)