Skip to content

Commit

Permalink
Auto merge of rust-lang#123171 - matthiaskrgr:rollup-7id2r8o, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#123063 (Function ABI is irrelevant for reachability)
 - rust-lang#123096 (Don't check match scrutinee of postfix match for unused parens)
 - rust-lang#123146 (Use compiletest directives instead of manually checking TARGET / tools)
 - rust-lang#123160 (remove `def_id_to_node_id` in ast lowering)
 - rust-lang#123162 (Correctly get complete intra-doc link data)
 - rust-lang#123164 (Bump Unicode printables to version 15.1, align to unicode_data)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Mar 28, 2024
2 parents 929bcee + 83b4d3d commit ba52720
Show file tree
Hide file tree
Showing 22 changed files with 76 additions and 88 deletions.
4 changes: 3 additions & 1 deletion compiler/rustc_lint/src/unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,9 @@ trait UnusedDelimLint {
(iter, UnusedDelimsCtx::ForIterExpr, true, None, Some(body.span.lo()), true)
}

Match(ref head, ..) if Self::LINT_EXPR_IN_PATTERN_MATCHING_CTX => {
Match(ref head, _, ast::MatchKind::Prefix)
if Self::LINT_EXPR_IN_PATTERN_MATCHING_CTX =>
{
let left = e.span.lo() + rustc_span::BytePos(5);
(head, UnusedDelimsCtx::MatchScrutineeExpr, true, Some(left), None, true)
}
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ pub struct ResolverAstLowering {
pub next_node_id: ast::NodeId,

pub node_id_to_def_id: NodeMap<LocalDefId>,
pub def_id_to_node_id: IndexVec<LocalDefId, ast::NodeId>,

pub trait_map: NodeMap<Vec<hir::TraitCandidate>>,
/// List functions and methods for which lifetime elision was successful.
Expand Down
13 changes: 1 addition & 12 deletions compiler/rustc_passes/src/reachable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ use rustc_middle::query::Providers;
use rustc_middle::ty::{self, ExistentialTraitRef, TyCtxt};
use rustc_privacy::DefIdVisitor;
use rustc_session::config::CrateType;
use rustc_target::spec::abi::Abi;

/// Determines whether this item is recursive for reachability. See `is_recursively_reachable_local`
/// below for details.
Expand Down Expand Up @@ -164,16 +163,6 @@ impl<'tcx> ReachableContext<'tcx> {
if !self.any_library {
// If we are building an executable, only explicitly extern
// types need to be exported.
let reachable =
if let Node::Item(hir::Item { kind: hir::ItemKind::Fn(sig, ..), .. })
| Node::ImplItem(hir::ImplItem {
kind: hir::ImplItemKind::Fn(sig, ..), ..
}) = *node
{
sig.header.abi != Abi::Rust
} else {
false
};
let codegen_attrs = if self.tcx.def_kind(search_item).has_codegen_attrs() {
self.tcx.codegen_fn_attrs(search_item)
} else {
Expand All @@ -182,7 +171,7 @@ impl<'tcx> ReachableContext<'tcx> {
let is_extern = codegen_attrs.contains_extern_indicator();
let std_internal =
codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL);
if reachable || is_extern || std_internal {
if is_extern || std_internal {
self.reachable_symbols.insert(search_item);
}
} else {
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1618,7 +1618,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
.into_items()
.map(|(k, f)| (k, f.key()))
.collect(),
def_id_to_node_id: self.def_id_to_node_id,
trait_map: self.trait_map,
lifetime_elision_allowed: self.lifetime_elision_allowed,
lint_buffer: Steal::new(self.lint_buffer),
Expand Down
26 changes: 14 additions & 12 deletions library/core/src/unicode/printable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ pub(crate) fn is_printable(x: char) -> bool {
if 0x2cea2 <= x && x < 0x2ceb0 {
return false;
}
if 0x2ebe1 <= x && x < 0x2f800 {
if 0x2ebe1 <= x && x < 0x2ebf0 {
return false;
}
if 0x2ee5e <= x && x < 0x2f800 {
return false;
}
if 0x2fa1e <= x && x < 0x30000 {
Expand Down Expand Up @@ -112,7 +115,7 @@ const SINGLETONS0U: &[(u8, u8)] = &[
(0x2b, 3),
(0x2d, 11),
(0x2e, 1),
(0x30, 3),
(0x30, 4),
(0x31, 2),
(0x32, 1),
(0xa7, 2),
Expand Down Expand Up @@ -157,12 +160,12 @@ const SINGLETONS0L: &[u8] = &[
0x7e, 0x7f, 0xb5, 0xc5, 0xd4, 0xd5, 0xdc, 0xf0,
0xf1, 0xf5, 0x72, 0x73, 0x8f, 0x74, 0x75, 0x96,
0x26, 0x2e, 0x2f, 0xa7, 0xaf, 0xb7, 0xbf, 0xc7,
0xcf, 0xd7, 0xdf, 0x9a, 0x40, 0x97, 0x98, 0x30,
0x8f, 0x1f, 0xd2, 0xd4, 0xce, 0xff, 0x4e, 0x4f,
0x5a, 0x5b, 0x07, 0x08, 0x0f, 0x10, 0x27, 0x2f,
0xee, 0xef, 0x6e, 0x6f, 0x37, 0x3d, 0x3f, 0x42,
0x45, 0x90, 0x91, 0x53, 0x67, 0x75, 0xc8, 0xc9,
0xd0, 0xd1, 0xd8, 0xd9, 0xe7, 0xfe, 0xff,
0xcf, 0xd7, 0xdf, 0x9a, 0x00, 0x40, 0x97, 0x98,
0x30, 0x8f, 0x1f, 0xd2, 0xd4, 0xce, 0xff, 0x4e,
0x4f, 0x5a, 0x5b, 0x07, 0x08, 0x0f, 0x10, 0x27,
0x2f, 0xee, 0xef, 0x6e, 0x6f, 0x37, 0x3d, 0x3f,
0x42, 0x45, 0x90, 0x91, 0x53, 0x67, 0x75, 0xc8,
0xc9, 0xd0, 0xd1, 0xd8, 0xd9, 0xe7, 0xfe, 0xff,
];
#[rustfmt::skip]
const SINGLETONS1U: &[(u8, u8)] = &[
Expand Down Expand Up @@ -339,10 +342,9 @@ const NORMAL0: &[u8] = &[
0x80, 0xbe, 0x22,
0x74, 0x0c,
0x80, 0xd6, 0x1a,
0x0c, 0x05,
0x80, 0xff, 0x05,
0x80, 0xdf, 0x0c,
0xf2, 0x9d, 0x03,
0x81, 0x10, 0x05,
0x80, 0xdf, 0x0b,
0xf2, 0x9e, 0x03,
0x37, 0x09,
0x81, 0x5c, 0x14,
0x80, 0xb8, 0x08,
Expand Down
13 changes: 12 additions & 1 deletion src/librustdoc/passes/lint/redundant_explicit_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn check_redundant_explicit_link<'md>(
) -> Option<()> {
let mut broken_line_callback = |link: BrokenLink<'md>| Some((link.reference, "".into()));
let mut offset_iter = Parser::new_with_broken_link_callback(
&doc,
doc,
main_body_opts(),
Some(&mut broken_line_callback),
)
Expand Down Expand Up @@ -264,6 +264,7 @@ fn collect_link_data(offset_iter: &mut OffsetIter<'_, '_>) -> LinkData {
let mut resolvable_link = None;
let mut resolvable_link_range = None;
let mut display_link = String::new();
let mut is_resolvable = true;

while let Some((event, range)) = offset_iter.next() {
match event {
Expand All @@ -281,13 +282,23 @@ fn collect_link_data(offset_iter: &mut OffsetIter<'_, '_>) -> LinkData {
resolvable_link = Some(code);
resolvable_link_range = Some(range);
}
Event::Start(_) => {
// If there is anything besides backticks, it's not considered as an intra-doc link
// so we ignore it.
is_resolvable = false;
}
Event::End(_) => {
break;
}
_ => {}
}
}

if !is_resolvable {
resolvable_link_range = None;
resolvable_link = None;
}

LinkData { resolvable_link, resolvable_link_range, display_link }
}

Expand Down
8 changes: 5 additions & 3 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,9 +691,9 @@ pub fn line_directive<'line>(
}
}

/// This is generated by collecting directives from ui tests and then extracting their directive
/// names. This is **not** an exhaustive list of all possible directives. Instead, this is a
/// best-effort approximation for diagnostics.
/// This was originally generated by collecting directives from ui tests and then extracting their
/// directive names. This is **not** an exhaustive list of all possible directives. Instead, this is
/// a best-effort approximation for diagnostics. Add new headers to this list when needed.
const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
// tidy-alphabetical-start
"assembly-output",
Expand Down Expand Up @@ -837,6 +837,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"needs-sanitizer-thread",
"needs-threads",
"needs-unwind",
"needs-wasmtime",
"needs-xray",
"no-prefer-dynamic",
"normalize-stderr-32bit",
Expand Down Expand Up @@ -872,6 +873,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"only-unix",
"only-wasm32",
"only-wasm32-bare",
"only-wasm32-wasip1",
"only-windows",
"only-x86",
"only-x86_64",
Expand Down
5 changes: 5 additions & 0 deletions src/tools/compiletest/src/header/needs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ pub(super) fn handle_needs(
condition: config.target_cfg().relocation_model == "pic",
ignore_reason: "ignored on targets without PIC relocation model",
},
Need {
name: "needs-wasmtime",
condition: config.runner.as_ref().is_some_and(|r| r.contains("wasmtime")),
ignore_reason: "ignored when wasmtime runner is not available",
},
];

let (name, comment) = match ln.split_once([':', ' ']) {
Expand Down
8 changes: 4 additions & 4 deletions tests/run-make/compiler-builtins/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
//! settings. Turning off optimizations and enabling debug assertions tends to produce the most
//! dependence on core that is possible, so that is the configuration we test here.

// wasm and nvptx targets don't produce rlib files that object can parse.
//@ ignore-wasm
//@ ignore-nvptx64

#![deny(warnings)]

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

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

Expand Down
16 changes: 3 additions & 13 deletions tests/run-make/wasm-abi/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
//@ only-wasm32-wasip1
//@ needs-wasmtime

extern crate run_make_support;

use run_make_support::{rustc, tmp_dir};
use std::path::Path;
use std::process::Command;

fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}

rustc().input("foo.rs").target("wasm32-wasip1").run();

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

let has_wasmtime = match Command::new("wasmtime").arg("--version").output() {
Ok(s) => s.status.success(),
_ => false,
};
if !has_wasmtime {
println!("skipping test, wasmtime isn't available");
return;
}

run(&file, "return_two_i32", "1\n2\n");
run(&file, "return_two_i64", "3\n4\n");
run(&file, "return_two_f32", "5\n6\n");
Expand Down
5 changes: 1 addition & 4 deletions tests/run-make/wasm-custom-section/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
//@ only-wasm32-wasip1
extern crate run_make_support;

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

fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}

rustc().input("foo.rs").target("wasm32-wasip1").run();
rustc().input("bar.rs").target("wasm32-wasip1").arg("-Clto").opt().run();

Expand Down
5 changes: 1 addition & 4 deletions tests/run-make/wasm-custom-sections-opt/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
//@ only-wasm32-wasip1
extern crate run_make_support;

use run_make_support::{tmp_dir, wasmparser, rustc};
use std::collections::HashMap;
use std::path::Path;

fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}

rustc().input("foo.rs").target("wasm32-wasip1").opt().run();

verify(&tmp_dir().join("foo.wasm"));
Expand Down
6 changes: 2 additions & 4 deletions tests/run-make/wasm-export-all-symbols/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ only-wasm32-wasip1

extern crate run_make_support;

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

fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}

test(&[]);
test(&["-O"]);
test(&["-Clto"]);
Expand Down
6 changes: 2 additions & 4 deletions tests/run-make/wasm-import-module/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
//@ only-wasm32-wasip1

extern crate run_make_support;

use run_make_support::{tmp_dir, wasmparser, rustc};
use std::collections::HashMap;
use wasmparser::TypeRef::Func;

fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}

rustc().input("foo.rs").target("wasm32-wasip1").run();
rustc()
.input("bar.rs")
Expand Down
5 changes: 1 addition & 4 deletions tests/run-make/wasm-panic-small/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
//@ only-wasm32-wasip1
#![deny(warnings)]

extern crate run_make_support;

use run_make_support::{rustc, tmp_dir};

fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}

test("a");
test("b");
test("c");
Expand Down
6 changes: 2 additions & 4 deletions tests/run-make/wasm-spurious-import/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
//@ only-wasm32-wasip1

extern crate run_make_support;

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

fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}

rustc()
.input("main.rs")
.target("wasm32-wasip1")
Expand Down
5 changes: 1 addition & 4 deletions tests/run-make/wasm-stringify-ints-small/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
//@ only-wasm32-wasip1
#![deny(warnings)]

extern crate run_make_support;

use run_make_support::{rustc, tmp_dir};

fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}

rustc().input("foo.rs").target("wasm32-wasip1").arg("-Clto").opt().run();

let bytes = std::fs::read(&tmp_dir().join("foo.wasm")).unwrap();
Expand Down
5 changes: 1 addition & 4 deletions tests/run-make/wasm-symbols-different-module/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
//@ only-wasm32-wasip1
extern crate run_make_support;

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

fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}

test_file("foo.rs", &[("a", &["foo"]), ("b", &["foo"])]);
test_file("bar.rs", &[("m1", &["f", "g"]), ("m2", &["f"])]);
test_file("baz.rs", &[("sqlite", &["allocate", "deallocate"])]);
Expand Down
5 changes: 1 addition & 4 deletions tests/run-make/wasm-symbols-not-exported/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
//@ only-wasm32-wasip1
extern crate run_make_support;

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

fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}

rustc().input("foo.rs").target("wasm32-wasip1").run();
verify_symbols(&tmp_dir().join("foo.wasm"));
rustc().input("foo.rs").target("wasm32-wasip1").opt().run();
Expand Down
Loading

0 comments on commit ba52720

Please sign in to comment.