Auto merge of #148885 - Zalathar:rollup-wrvewer, r=Zalathar
Rollup of 7 pull requests Successful merges: - rust-lang/rust#147701 (rustdoc: don't ignore path distance for doc aliases) - rust-lang/rust#148735 (Fix ICE caused by invalid spans for shrink_file) - rust-lang/rust#148839 (fix rtsan_nonblocking_async lint closure ICE) - rust-lang/rust#148846 (add a test for combining RPIT with explicit tail calls) - rust-lang/rust#148872 (fix: Do not ICE when missing match arm with ill-formed subty is met) - rust-lang/rust#148880 (Remove explicit install of `eslint` inside of `tidy`'s Dockerfile) - rust-lang/rust#148883 (bootstrap: dont require cmake if local-rebuild is enabled) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
5dbf4069dc
20 changed files with 280 additions and 29 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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<_>>();
|
||||
|
||||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
8.57.1
|
||||
|
|
@ -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,
|
||||
};
|
||||
};
|
||||
/**
|
||||
|
|
|
|||
32
tests/rustdoc-js/alias-path-distance-146214.js
Normal file
32
tests/rustdoc-js/alias-path-distance-146214.js
Normal file
|
|
@ -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
tests/rustdoc-js/alias-path-distance-146214.rs
Normal file
14
tests/rustdoc-js/alias-path-distance-146214.rs
Normal file
|
|
@ -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
tests/rustdoc-js/alias-rank-lower-140968.js
Normal file
10
tests/rustdoc-js/alias-rank-lower-140968.js
Normal file
|
|
@ -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
tests/rustdoc-js/alias-rank-lower-140968.rs
Normal file
6
tests/rustdoc-js/alias-rank-lower-140968.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#![crate_name = "alias_rank_lower"]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
#[doc(alias = "Foo")]
|
||||
pub struct Bar;
|
||||
8
tests/ui/delegation/ice-line-bounds-issue-148732.rs
Normal file
8
tests/ui/delegation/ice-line-bounds-issue-148732.rs
Normal file
|
|
@ -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
tests/ui/delegation/ice-line-bounds-issue-148732.stderr
Normal file
34
tests/ui/delegation/ice-line-bounds-issue-148732.stderr
Normal file
|
|
@ -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
tests/ui/explicit-tail-calls/rpit.rs
Normal file
20
tests/ui/explicit-tail-calls/rpit.rs
Normal file
|
|
@ -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
tests/ui/explicit-tail-calls/rpit.stderr
Normal file
12
tests/ui/explicit-tail-calls/rpit.stderr
Normal file
|
|
@ -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
|
||||
|
||||
|
|
@ -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() {}
|
||||
|
|
@ -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`.
|
||||
|
|
@ -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
tests/ui/structs/ice-line-bounds-issue-148684.rs
Normal file
9
tests/ui/structs/ice-line-bounds-issue-148684.rs
Normal file
|
|
@ -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`
|
||||
}
|
||||
16
tests/ui/structs/ice-line-bounds-issue-148684.stderr
Normal file
16
tests/ui/structs/ice-line-bounds-issue-148684.stderr
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
error[E0423]: expected function, tuple struct or tuple variant, found struct `A`
|
||||
--> $DIR/ice-line-bounds-issue-148684.rs:7:5
|
||||
|
|
||||
LL | / struct A {
|
||||
LL | | b: Vec<u8>,
|
||||
LL | | c: usize,
|
||||
LL | | }
|
||||
| |_- `A` defined here
|
||||
...
|
||||
LL | A(2, vec![])
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0423`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue