Skip to content

Commit ba52720

Browse files
committed
Auto merge of #123171 - matthiaskrgr:rollup-7id2r8o, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #123063 (Function ABI is irrelevant for reachability) - #123096 (Don't check match scrutinee of postfix match for unused parens) - #123146 (Use compiletest directives instead of manually checking TARGET / tools) - #123160 (remove `def_id_to_node_id` in ast lowering) - #123162 (Correctly get complete intra-doc link data) - #123164 (Bump Unicode printables to version 15.1, align to unicode_data) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 929bcee + 83b4d3d commit ba52720

File tree

22 files changed

+76
-88
lines changed

22 files changed

+76
-88
lines changed

compiler/rustc_lint/src/unused.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,9 @@ trait UnusedDelimLint {
865865
(iter, UnusedDelimsCtx::ForIterExpr, true, None, Some(body.span.lo()), true)
866866
}
867867

868-
Match(ref head, ..) if Self::LINT_EXPR_IN_PATTERN_MATCHING_CTX => {
868+
Match(ref head, _, ast::MatchKind::Prefix)
869+
if Self::LINT_EXPR_IN_PATTERN_MATCHING_CTX =>
870+
{
869871
let left = e.span.lo() + rustc_span::BytePos(5);
870872
(head, UnusedDelimsCtx::MatchScrutineeExpr, true, Some(left), None, true)
871873
}

compiler/rustc_middle/src/ty/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ pub struct ResolverAstLowering {
215215
pub next_node_id: ast::NodeId,
216216

217217
pub node_id_to_def_id: NodeMap<LocalDefId>,
218-
pub def_id_to_node_id: IndexVec<LocalDefId, ast::NodeId>,
219218

220219
pub trait_map: NodeMap<Vec<hir::TraitCandidate>>,
221220
/// List functions and methods for which lifetime elision was successful.

compiler/rustc_passes/src/reachable.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use rustc_middle::query::Providers;
2424
use rustc_middle::ty::{self, ExistentialTraitRef, TyCtxt};
2525
use rustc_privacy::DefIdVisitor;
2626
use rustc_session::config::CrateType;
27-
use rustc_target::spec::abi::Abi;
2827

2928
/// Determines whether this item is recursive for reachability. See `is_recursively_reachable_local`
3029
/// below for details.
@@ -164,16 +163,6 @@ impl<'tcx> ReachableContext<'tcx> {
164163
if !self.any_library {
165164
// If we are building an executable, only explicitly extern
166165
// types need to be exported.
167-
let reachable =
168-
if let Node::Item(hir::Item { kind: hir::ItemKind::Fn(sig, ..), .. })
169-
| Node::ImplItem(hir::ImplItem {
170-
kind: hir::ImplItemKind::Fn(sig, ..), ..
171-
}) = *node
172-
{
173-
sig.header.abi != Abi::Rust
174-
} else {
175-
false
176-
};
177166
let codegen_attrs = if self.tcx.def_kind(search_item).has_codegen_attrs() {
178167
self.tcx.codegen_fn_attrs(search_item)
179168
} else {
@@ -182,7 +171,7 @@ impl<'tcx> ReachableContext<'tcx> {
182171
let is_extern = codegen_attrs.contains_extern_indicator();
183172
let std_internal =
184173
codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL);
185-
if reachable || is_extern || std_internal {
174+
if is_extern || std_internal {
186175
self.reachable_symbols.insert(search_item);
187176
}
188177
} else {

compiler/rustc_resolve/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
16181618
.into_items()
16191619
.map(|(k, f)| (k, f.key()))
16201620
.collect(),
1621-
def_id_to_node_id: self.def_id_to_node_id,
16221621
trait_map: self.trait_map,
16231622
lifetime_elision_allowed: self.lifetime_elision_allowed,
16241623
lint_buffer: Steal::new(self.lint_buffer),

library/core/src/unicode/printable.rs

+14-12
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ pub(crate) fn is_printable(x: char) -> bool {
6363
if 0x2cea2 <= x && x < 0x2ceb0 {
6464
return false;
6565
}
66-
if 0x2ebe1 <= x && x < 0x2f800 {
66+
if 0x2ebe1 <= x && x < 0x2ebf0 {
67+
return false;
68+
}
69+
if 0x2ee5e <= x && x < 0x2f800 {
6770
return false;
6871
}
6972
if 0x2fa1e <= x && x < 0x30000 {
@@ -112,7 +115,7 @@ const SINGLETONS0U: &[(u8, u8)] = &[
112115
(0x2b, 3),
113116
(0x2d, 11),
114117
(0x2e, 1),
115-
(0x30, 3),
118+
(0x30, 4),
116119
(0x31, 2),
117120
(0x32, 1),
118121
(0xa7, 2),
@@ -157,12 +160,12 @@ const SINGLETONS0L: &[u8] = &[
157160
0x7e, 0x7f, 0xb5, 0xc5, 0xd4, 0xd5, 0xdc, 0xf0,
158161
0xf1, 0xf5, 0x72, 0x73, 0x8f, 0x74, 0x75, 0x96,
159162
0x26, 0x2e, 0x2f, 0xa7, 0xaf, 0xb7, 0xbf, 0xc7,
160-
0xcf, 0xd7, 0xdf, 0x9a, 0x40, 0x97, 0x98, 0x30,
161-
0x8f, 0x1f, 0xd2, 0xd4, 0xce, 0xff, 0x4e, 0x4f,
162-
0x5a, 0x5b, 0x07, 0x08, 0x0f, 0x10, 0x27, 0x2f,
163-
0xee, 0xef, 0x6e, 0x6f, 0x37, 0x3d, 0x3f, 0x42,
164-
0x45, 0x90, 0x91, 0x53, 0x67, 0x75, 0xc8, 0xc9,
165-
0xd0, 0xd1, 0xd8, 0xd9, 0xe7, 0xfe, 0xff,
163+
0xcf, 0xd7, 0xdf, 0x9a, 0x00, 0x40, 0x97, 0x98,
164+
0x30, 0x8f, 0x1f, 0xd2, 0xd4, 0xce, 0xff, 0x4e,
165+
0x4f, 0x5a, 0x5b, 0x07, 0x08, 0x0f, 0x10, 0x27,
166+
0x2f, 0xee, 0xef, 0x6e, 0x6f, 0x37, 0x3d, 0x3f,
167+
0x42, 0x45, 0x90, 0x91, 0x53, 0x67, 0x75, 0xc8,
168+
0xc9, 0xd0, 0xd1, 0xd8, 0xd9, 0xe7, 0xfe, 0xff,
166169
];
167170
#[rustfmt::skip]
168171
const SINGLETONS1U: &[(u8, u8)] = &[
@@ -339,10 +342,9 @@ const NORMAL0: &[u8] = &[
339342
0x80, 0xbe, 0x22,
340343
0x74, 0x0c,
341344
0x80, 0xd6, 0x1a,
342-
0x0c, 0x05,
343-
0x80, 0xff, 0x05,
344-
0x80, 0xdf, 0x0c,
345-
0xf2, 0x9d, 0x03,
345+
0x81, 0x10, 0x05,
346+
0x80, 0xdf, 0x0b,
347+
0xf2, 0x9e, 0x03,
346348
0x37, 0x09,
347349
0x81, 0x5c, 0x14,
348350
0x80, 0xb8, 0x08,

src/librustdoc/passes/lint/redundant_explicit_links.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn check_redundant_explicit_link<'md>(
9090
) -> Option<()> {
9191
let mut broken_line_callback = |link: BrokenLink<'md>| Some((link.reference, "".into()));
9292
let mut offset_iter = Parser::new_with_broken_link_callback(
93-
&doc,
93+
doc,
9494
main_body_opts(),
9595
Some(&mut broken_line_callback),
9696
)
@@ -264,6 +264,7 @@ fn collect_link_data(offset_iter: &mut OffsetIter<'_, '_>) -> LinkData {
264264
let mut resolvable_link = None;
265265
let mut resolvable_link_range = None;
266266
let mut display_link = String::new();
267+
let mut is_resolvable = true;
267268

268269
while let Some((event, range)) = offset_iter.next() {
269270
match event {
@@ -281,13 +282,23 @@ fn collect_link_data(offset_iter: &mut OffsetIter<'_, '_>) -> LinkData {
281282
resolvable_link = Some(code);
282283
resolvable_link_range = Some(range);
283284
}
285+
Event::Start(_) => {
286+
// If there is anything besides backticks, it's not considered as an intra-doc link
287+
// so we ignore it.
288+
is_resolvable = false;
289+
}
284290
Event::End(_) => {
285291
break;
286292
}
287293
_ => {}
288294
}
289295
}
290296

297+
if !is_resolvable {
298+
resolvable_link_range = None;
299+
resolvable_link = None;
300+
}
301+
291302
LinkData { resolvable_link, resolvable_link_range, display_link }
292303
}
293304

src/tools/compiletest/src/header.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -691,9 +691,9 @@ pub fn line_directive<'line>(
691691
}
692692
}
693693

694-
/// This is generated by collecting directives from ui tests and then extracting their directive
695-
/// names. This is **not** an exhaustive list of all possible directives. Instead, this is a
696-
/// best-effort approximation for diagnostics.
694+
/// This was originally generated by collecting directives from ui tests and then extracting their
695+
/// directive names. This is **not** an exhaustive list of all possible directives. Instead, this is
696+
/// a best-effort approximation for diagnostics. Add new headers to this list when needed.
697697
const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
698698
// tidy-alphabetical-start
699699
"assembly-output",
@@ -837,6 +837,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
837837
"needs-sanitizer-thread",
838838
"needs-threads",
839839
"needs-unwind",
840+
"needs-wasmtime",
840841
"needs-xray",
841842
"no-prefer-dynamic",
842843
"normalize-stderr-32bit",
@@ -872,6 +873,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
872873
"only-unix",
873874
"only-wasm32",
874875
"only-wasm32-bare",
876+
"only-wasm32-wasip1",
875877
"only-windows",
876878
"only-x86",
877879
"only-x86_64",

src/tools/compiletest/src/header/needs.rs

+5
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ pub(super) fn handle_needs(
149149
condition: config.target_cfg().relocation_model == "pic",
150150
ignore_reason: "ignored on targets without PIC relocation model",
151151
},
152+
Need {
153+
name: "needs-wasmtime",
154+
condition: config.runner.as_ref().is_some_and(|r| r.contains("wasmtime")),
155+
ignore_reason: "ignored when wasmtime runner is not available",
156+
},
152157
];
153158

154159
let (name, comment) = match ln.split_once([':', ' ']) {

tests/run-make/compiler-builtins/rmake.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
//! settings. Turning off optimizations and enabling debug assertions tends to produce the most
99
//! dependence on core that is possible, so that is the configuration we test here.
1010
11+
// wasm and nvptx targets don't produce rlib files that object can parse.
12+
//@ ignore-wasm
13+
//@ ignore-nvptx64
14+
1115
#![deny(warnings)]
1216

1317
extern crate run_make_support;
@@ -33,10 +37,6 @@ path = "lib.rs""#;
3337
fn main() {
3438
let target_dir = tmp_dir().join("target");
3539
let target = std::env::var("TARGET").unwrap();
36-
if target.starts_with("wasm") || target.starts_with("nvptx") {
37-
// wasm and nvptx targets don't produce rlib files that object can parse.
38-
return;
39-
}
4040

4141
println!("Testing compiler_builtins for {}", target);
4242

tests/run-make/wasm-abi/rmake.rs

+3-13
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
1+
//@ only-wasm32-wasip1
2+
//@ needs-wasmtime
3+
14
extern crate run_make_support;
25

36
use run_make_support::{rustc, tmp_dir};
47
use std::path::Path;
58
use std::process::Command;
69

710
fn main() {
8-
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
9-
return;
10-
}
11-
1211
rustc().input("foo.rs").target("wasm32-wasip1").run();
1312

1413
let file = tmp_dir().join("foo.wasm");
1514

16-
let has_wasmtime = match Command::new("wasmtime").arg("--version").output() {
17-
Ok(s) => s.status.success(),
18-
_ => false,
19-
};
20-
if !has_wasmtime {
21-
println!("skipping test, wasmtime isn't available");
22-
return;
23-
}
24-
2515
run(&file, "return_two_i32", "1\n2\n");
2616
run(&file, "return_two_i64", "3\n4\n");
2717
run(&file, "return_two_f32", "5\n6\n");

tests/run-make/wasm-custom-section/rmake.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1+
//@ only-wasm32-wasip1
12
extern crate run_make_support;
23

34
use run_make_support::{rustc, tmp_dir, wasmparser};
45
use std::collections::HashMap;
56

67
fn main() {
7-
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
8-
return;
9-
}
10-
118
rustc().input("foo.rs").target("wasm32-wasip1").run();
129
rustc().input("bar.rs").target("wasm32-wasip1").arg("-Clto").opt().run();
1310

tests/run-make/wasm-custom-sections-opt/rmake.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1+
//@ only-wasm32-wasip1
12
extern crate run_make_support;
23

34
use run_make_support::{tmp_dir, wasmparser, rustc};
45
use std::collections::HashMap;
56
use std::path::Path;
67

78
fn main() {
8-
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
9-
return;
10-
}
11-
129
rustc().input("foo.rs").target("wasm32-wasip1").opt().run();
1310

1411
verify(&tmp_dir().join("foo.wasm"));

tests/run-make/wasm-export-all-symbols/rmake.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ only-wasm32-wasip1
2+
13
extern crate run_make_support;
24

35
use run_make_support::{tmp_dir, wasmparser, rustc};
@@ -6,10 +8,6 @@ use std::path::Path;
68
use wasmparser::ExternalKind::*;
79

810
fn main() {
9-
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
10-
return;
11-
}
12-
1311
test(&[]);
1412
test(&["-O"]);
1513
test(&["-Clto"]);

tests/run-make/wasm-import-module/rmake.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1+
//@ only-wasm32-wasip1
2+
13
extern crate run_make_support;
24

35
use run_make_support::{tmp_dir, wasmparser, rustc};
46
use std::collections::HashMap;
57
use wasmparser::TypeRef::Func;
68

79
fn main() {
8-
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
9-
return;
10-
}
11-
1210
rustc().input("foo.rs").target("wasm32-wasip1").run();
1311
rustc()
1412
.input("bar.rs")

tests/run-make/wasm-panic-small/rmake.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1+
//@ only-wasm32-wasip1
12
#![deny(warnings)]
23

34
extern crate run_make_support;
45

56
use run_make_support::{rustc, tmp_dir};
67

78
fn main() {
8-
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
9-
return;
10-
}
11-
129
test("a");
1310
test("b");
1411
test("c");

tests/run-make/wasm-spurious-import/rmake.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1+
//@ only-wasm32-wasip1
2+
13
extern crate run_make_support;
24

35
use run_make_support::{rustc, tmp_dir, wasmparser};
46
use std::collections::HashMap;
57

68
fn main() {
7-
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
8-
return;
9-
}
10-
119
rustc()
1210
.input("main.rs")
1311
.target("wasm32-wasip1")

tests/run-make/wasm-stringify-ints-small/rmake.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1+
//@ only-wasm32-wasip1
12
#![deny(warnings)]
23

34
extern crate run_make_support;
45

56
use run_make_support::{rustc, tmp_dir};
67

78
fn main() {
8-
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
9-
return;
10-
}
11-
129
rustc().input("foo.rs").target("wasm32-wasip1").arg("-Clto").opt().run();
1310

1411
let bytes = std::fs::read(&tmp_dir().join("foo.wasm")).unwrap();

tests/run-make/wasm-symbols-different-module/rmake.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1+
//@ only-wasm32-wasip1
12
extern crate run_make_support;
23

34
use run_make_support::{rustc, tmp_dir, wasmparser};
45
use std::collections::{HashMap, HashSet};
56

67
fn main() {
7-
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
8-
return;
9-
}
10-
118
test_file("foo.rs", &[("a", &["foo"]), ("b", &["foo"])]);
129
test_file("bar.rs", &[("m1", &["f", "g"]), ("m2", &["f"])]);
1310
test_file("baz.rs", &[("sqlite", &["allocate", "deallocate"])]);

tests/run-make/wasm-symbols-not-exported/rmake.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1+
//@ only-wasm32-wasip1
12
extern crate run_make_support;
23

34
use run_make_support::{rustc, tmp_dir, wasmparser};
45
use std::path::Path;
56

67
fn main() {
7-
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
8-
return;
9-
}
10-
118
rustc().input("foo.rs").target("wasm32-wasip1").run();
129
verify_symbols(&tmp_dir().join("foo.wasm"));
1310
rustc().input("foo.rs").target("wasm32-wasip1").opt().run();

0 commit comments

Comments
 (0)