Skip to content

Rollup of 7 pull requests #107963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/session.rs
Original file line number Diff line number Diff line change
@@ -156,7 +156,7 @@ pub struct Session {
/// `-C metadata` arguments passed to the compiler. Its value forms a unique
/// global identifier for the crate. It is used to allow multiple crates
/// with the same name to coexist. See the
/// `rustc_codegen_llvm::back::symbol_names` module for more information.
/// `rustc_symbol_mangling` crate for more information.
pub stable_crate_id: OnceCell<StableCrateId>,

features: OnceCell<rustc_feature::Features>,
3 changes: 0 additions & 3 deletions config.toml.example
Original file line number Diff line number Diff line change
@@ -798,9 +798,6 @@ changelog-seen = 2
# on linux
#src-tarball = true

# Whether to allow failures when building tools
#missing-tools = false

# List of compression formats to use when generating dist tarballs. The list of
# formats is provided to rust-installer, which must support all of them.
#
5 changes: 4 additions & 1 deletion library/core/src/marker.rs
Original file line number Diff line number Diff line change
@@ -871,7 +871,10 @@ pub trait Destruct {}
#[rustc_deny_explicit_impl]
pub trait Tuple {}

/// A marker for things
/// A marker for pointer-like types.
///
/// All types that have the same size and alignment as a `usize` or
/// `*const ()` automatically implement this trait.
#[unstable(feature = "pointer_like_trait", issue = "none")]
#[cfg_attr(bootstrap, lang = "pointer_sized")]
#[cfg_attr(not(bootstrap), lang = "pointer_like")]
6 changes: 3 additions & 3 deletions library/core/tests/ptr.rs
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ fn test() {
snd: isize,
}
let mut p = Pair { fst: 10, snd: 20 };
let pptr: *mut Pair = &mut p;
let pptr: *mut Pair = addr_of_mut!(p);
let iptr: *mut isize = pptr as *mut isize;
assert_eq!(*iptr, 10);
*iptr = 30;
@@ -1070,8 +1070,8 @@ fn swap_copy_untyped() {
let mut x = 5u8;
let mut y = 6u8;

let ptr1 = &mut x as *mut u8 as *mut bool;
let ptr2 = &mut y as *mut u8 as *mut bool;
let ptr1 = addr_of_mut!(x).cast::<bool>();
let ptr2 = addr_of_mut!(y).cast::<bool>();

unsafe {
ptr::swap(ptr1, ptr2);
3 changes: 0 additions & 3 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
@@ -198,7 +198,6 @@ pub struct Config {
pub save_toolstates: Option<PathBuf>,
pub print_step_timings: bool,
pub print_step_rusage: bool,
pub missing_tools: bool,

// Fallback musl-root for all targets
pub musl_root: Option<PathBuf>,
@@ -696,7 +695,6 @@ define_config! {
gpg_password_file: Option<String> = "gpg-password-file",
upload_addr: Option<String> = "upload-addr",
src_tarball: Option<bool> = "src-tarball",
missing_tools: Option<bool> = "missing-tools",
compression_formats: Option<Vec<String>> = "compression-formats",
}
}
@@ -1301,7 +1299,6 @@ impl Config {
config.dist_upload_addr = t.upload_addr;
config.dist_compression_formats = t.compression_formats;
set(&mut config.rust_dist_src, t.src_tarball);
set(&mut config.missing_tools, t.missing_tools);
}

if let Some(r) = build.rustfmt {
1 change: 0 additions & 1 deletion src/bootstrap/configure.py
Original file line number Diff line number Diff line change
@@ -57,7 +57,6 @@ def v(*args):
o("full-tools", None, "enable all tools")
o("lld", "rust.lld", "build lld")
o("clang", "llvm.clang", "build clang")
o("missing-tools", "dist.missing-tools", "allow failures when building tools")
o("use-libcxx", "llvm.use-libcxx", "build LLVM with libc++")
o("control-flow-guard", "rust.control-flow-guard", "Enable Control Flow Guard")

37 changes: 13 additions & 24 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
@@ -1096,9 +1096,7 @@ impl Step for Rls {
let compiler = self.compiler;
let target = self.target;

let rls = builder
.ensure(tool::Rls { compiler, target, extra_features: Vec::new() })
.expect("rls expected to build");
let rls = builder.ensure(tool::Rls { compiler, target, extra_features: Vec::new() });

let mut tarball = Tarball::new(builder, "rls", &target.triple);
tarball.set_overlay(OverlayKind::RLS);
@@ -1140,10 +1138,7 @@ impl Step for RustAnalyzer {
let compiler = self.compiler;
let target = self.target;

let rust_analyzer = builder
.ensure(tool::RustAnalyzer { compiler, target })
.expect("rust-analyzer always builds");

let rust_analyzer = builder.ensure(tool::RustAnalyzer { compiler, target });
let mut tarball = Tarball::new(builder, "rust-analyzer", &target.triple);
tarball.set_overlay(OverlayKind::RustAnalyzer);
tarball.is_preview(true);
@@ -1187,12 +1182,9 @@ impl Step for Clippy {
// Prepare the image directory
// We expect clippy to build, because we've exited this step above if tool
// state for clippy isn't testing.
let clippy = builder
.ensure(tool::Clippy { compiler, target, extra_features: Vec::new() })
.expect("clippy expected to build - essential tool");
let cargoclippy = builder
.ensure(tool::CargoClippy { compiler, target, extra_features: Vec::new() })
.expect("clippy expected to build - essential tool");
let clippy = builder.ensure(tool::Clippy { compiler, target, extra_features: Vec::new() });
let cargoclippy =
builder.ensure(tool::CargoClippy { compiler, target, extra_features: Vec::new() });

let mut tarball = Tarball::new(builder, "clippy", &target.triple);
tarball.set_overlay(OverlayKind::Clippy);
@@ -1241,9 +1233,9 @@ impl Step for Miri {
let compiler = self.compiler;
let target = self.target;

let miri = builder.ensure(tool::Miri { compiler, target, extra_features: Vec::new() })?;
let miri = builder.ensure(tool::Miri { compiler, target, extra_features: Vec::new() });
let cargomiri =
builder.ensure(tool::CargoMiri { compiler, target, extra_features: Vec::new() })?;
builder.ensure(tool::CargoMiri { compiler, target, extra_features: Vec::new() });

let mut tarball = Tarball::new(builder, "miri", &target.triple);
tarball.set_overlay(OverlayKind::Miri);
@@ -1286,12 +1278,10 @@ impl Step for Rustfmt {
let compiler = self.compiler;
let target = self.target;

let rustfmt = builder
.ensure(tool::Rustfmt { compiler, target, extra_features: Vec::new() })
.expect("rustfmt expected to build - essential tool");
let cargofmt = builder
.ensure(tool::Cargofmt { compiler, target, extra_features: Vec::new() })
.expect("cargo fmt expected to build - essential tool");
let rustfmt =
builder.ensure(tool::Rustfmt { compiler, target, extra_features: Vec::new() });
let cargofmt =
builder.ensure(tool::Cargofmt { compiler, target, extra_features: Vec::new() });
let mut tarball = Tarball::new(builder, "rustfmt", &target.triple);
tarball.set_overlay(OverlayKind::Rustfmt);
tarball.is_preview(true);
@@ -1345,9 +1335,8 @@ impl Step for RustDemangler {
return None;
}

let rust_demangler = builder
.ensure(tool::RustDemangler { compiler, target, extra_features: Vec::new() })
.expect("rust-demangler expected to build - in-tree tool");
let rust_demangler =
builder.ensure(tool::RustDemangler { compiler, target, extra_features: Vec::new() });

// Prepare the image directory
let mut tarball = Tarball::new(builder, "rust-demangler", &target.triple);
3 changes: 0 additions & 3 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
@@ -227,8 +227,6 @@ pub struct Build {
ci_env: CiEnv,
delayed_failures: RefCell<Vec<String>>,
prerelease_version: Cell<Option<u32>>,
tool_artifacts:
RefCell<HashMap<TargetSelection, HashMap<String, (&'static str, PathBuf, Vec<String>)>>>,

#[cfg(feature = "build-metrics")]
metrics: metrics::BuildMetrics,
@@ -447,7 +445,6 @@ impl Build {
ci_env: CiEnv::current(),
delayed_failures: RefCell::new(Vec::new()),
prerelease_version: Cell::new(None),
tool_artifacts: Default::default(),

#[cfg(feature = "build-metrics")]
metrics: metrics::BuildMetrics::init(),
5 changes: 2 additions & 3 deletions src/bootstrap/run.rs
Original file line number Diff line number Diff line change
@@ -161,9 +161,8 @@ impl Step for Miri {
let target = self.target;
let compiler = builder.compiler(stage, host);

let miri = builder
.ensure(tool::Miri { compiler, target: self.host, extra_features: Vec::new() })
.expect("in-tree tool");
let miri =
builder.ensure(tool::Miri { compiler, target: self.host, extra_features: Vec::new() });
let miri_sysroot = test::Miri::build_miri_sysroot(builder, compiler, &miri, target);

// # Run miri.
43 changes: 20 additions & 23 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
@@ -362,7 +362,7 @@ impl Step for RustAnalyzer {
let host = self.host;
let compiler = builder.compiler(stage, host);

builder.ensure(tool::RustAnalyzer { compiler, target: self.host }).expect("in-tree tool");
builder.ensure(tool::RustAnalyzer { compiler, target: self.host });

let workspace_path = "src/tools/rust-analyzer";
// until the whole RA test suite runs on `i686`, we only run
@@ -420,9 +420,7 @@ impl Step for Rustfmt {
let host = self.host;
let compiler = builder.compiler(stage, host);

builder
.ensure(tool::Rustfmt { compiler, target: self.host, extra_features: Vec::new() })
.expect("in-tree tool");
builder.ensure(tool::Rustfmt { compiler, target: self.host, extra_features: Vec::new() });

let mut cargo = tool::prepare_tool_cargo(
builder,
@@ -469,9 +467,11 @@ impl Step for RustDemangler {
let host = self.host;
let compiler = builder.compiler(stage, host);

let rust_demangler = builder
.ensure(tool::RustDemangler { compiler, target: self.host, extra_features: Vec::new() })
.expect("in-tree tool");
let rust_demangler = builder.ensure(tool::RustDemangler {
compiler,
target: self.host,
extra_features: Vec::new(),
});
let mut cargo = tool::prepare_tool_cargo(
builder,
compiler,
@@ -589,12 +589,13 @@ impl Step for Miri {
// Except if we are at stage 2, the bootstrap loop is complete and we can stick with our current stage.
let compiler_std = builder.compiler(if stage < 2 { stage + 1 } else { stage }, host);

let miri = builder
.ensure(tool::Miri { compiler, target: self.host, extra_features: Vec::new() })
.expect("in-tree tool");
let _cargo_miri = builder
.ensure(tool::CargoMiri { compiler, target: self.host, extra_features: Vec::new() })
.expect("in-tree tool");
let miri =
builder.ensure(tool::Miri { compiler, target: self.host, extra_features: Vec::new() });
let _cargo_miri = builder.ensure(tool::CargoMiri {
compiler,
target: self.host,
extra_features: Vec::new(),
});
// The stdlib we need might be at a different stage. And just asking for the
// sysroot does not seem to populate it, so we do that first.
builder.ensure(compile::Std::new(compiler_std, host));
@@ -732,9 +733,7 @@ impl Step for Clippy {
let host = self.host;
let compiler = builder.compiler(stage, host);

builder
.ensure(tool::Clippy { compiler, target: self.host, extra_features: Vec::new() })
.expect("in-tree tool");
builder.ensure(tool::Clippy { compiler, target: self.host, extra_features: Vec::new() });
let mut cargo = tool::prepare_tool_cargo(
builder,
compiler,
@@ -1458,13 +1457,11 @@ note: if you're sure you want to do this, please open an issue as to why. In the
}

if mode == "run-make" {
let rust_demangler = builder
.ensure(tool::RustDemangler {
compiler,
target: compiler.host,
extra_features: Vec::new(),
})
.expect("in-tree tool");
let rust_demangler = builder.ensure(tool::RustDemangler {
compiler,
target: compiler.host,
extra_features: Vec::new(),
});
cmd.arg("--rust-demangler-path").arg(rust_demangler);
}

279 changes: 62 additions & 217 deletions src/bootstrap/tool.rs

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions src/ci/run.sh
Original file line number Diff line number Diff line change
@@ -125,10 +125,6 @@ else
fi
fi

if [ "$RUST_RELEASE_CHANNEL" = "nightly" ] || [ "$DIST_REQUIRE_ALL_TOOLS" = "" ]; then
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-missing-tools"
fi

export COMPILETEST_NEEDS_ALL_LLVM_COMPONENTS=1

# Print the date from the local machine and the date from an external source to
13 changes: 11 additions & 2 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
@@ -1176,14 +1176,23 @@ pub(crate) fn short_markdown_summary(markdown: &str, link_names: &[RenderedLink]
/// - Headings, links, and formatting are stripped.
/// - Inline code is rendered as-is, surrounded by backticks.
/// - HTML and code blocks are ignored.
pub(crate) fn plain_text_summary(md: &str) -> String {
pub(crate) fn plain_text_summary(md: &str, link_names: &[RenderedLink]) -> String {
if md.is_empty() {
return String::new();
}

let mut s = String::with_capacity(md.len() * 3 / 2);

for event in Parser::new_ext(md, summary_opts()) {
let mut replacer = |broken_link: BrokenLink<'_>| {
link_names
.iter()
.find(|link| link.original_text.as_str() == &*broken_link.reference)
.map(|link| (link.href.as_str().into(), link.new_text.as_str().into()))
};

let p = Parser::new_with_broken_link_callback(md, summary_opts(), Some(&mut replacer));

for event in p {
match &event {
Event::Text(text) => s.push_str(text),
Event::Code(code) => {
2 changes: 1 addition & 1 deletion src/librustdoc/html/markdown/tests.rs
Original file line number Diff line number Diff line change
@@ -249,7 +249,7 @@ fn test_short_markdown_summary() {
#[test]
fn test_plain_text_summary() {
fn t(input: &str, expect: &str) {
let output = plain_text_summary(input);
let output = plain_text_summary(input, &[]);
assert_eq!(output, expect, "original: {}", input);
}

5 changes: 4 additions & 1 deletion src/librustdoc/html/render/context.rs
Original file line number Diff line number Diff line change
@@ -182,7 +182,10 @@ impl<'tcx> Context<'tcx> {
};
title.push_str(" - Rust");
let tyname = it.type_();
let desc = it.doc_value().as_ref().map(|doc| plain_text_summary(doc));
let desc = it
.doc_value()
.as_ref()
.map(|doc| plain_text_summary(doc, &it.link_names(&self.cache())));
let desc = if let Some(desc) = desc {
desc
} else if it.is_crate() {
10 changes: 4 additions & 6 deletions src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
@@ -142,13 +142,11 @@ function initSearch(rawSearchIndex) {
}

function itemTypeFromName(typename) {
for (let i = 0, len = itemTypes.length; i < len; ++i) {
if (itemTypes[i] === typename) {
return i;
}
const index = itemTypes.findIndex(i => i === typename);
if (index < 0) {
throw new Error("Unknown type filter `" + typename + "`");
}

throw new Error("Unknown type filter `" + typename + "`");
return index;
}

/**
6 changes: 6 additions & 0 deletions tests/rustdoc/description.rs
Original file line number Diff line number Diff line change
@@ -22,3 +22,9 @@ pub mod foo_mod {
// 'Only paragraph.'
/// Only paragraph.
pub fn foo_fn() {}

// @has 'foo/fn.bar_fn.html' '//meta[@name="description"]/@content' \
// 'Description with intra-doc link to foo_fn and [nonexistent_item] and foo_fn.'
#[allow(rustdoc::broken_intra_doc_links)]
/// Description with intra-doc link to [foo_fn] and [nonexistent_item] and [foo_fn](self::foo_fn).
pub fn bar_fn() {}
8 changes: 4 additions & 4 deletions tests/ui/regions/regions-mock-codegen.rs
Original file line number Diff line number Diff line change
@@ -22,23 +22,23 @@ struct Ccx {
x: isize,
}

fn allocate(_bcx: &arena) -> &Bcx<'_> {
fn allocate(_bcx: &arena) -> &mut Bcx<'_> {
unsafe {
let layout = Layout::new::<Bcx>();
let ptr = Global.allocate(layout).unwrap_or_else(|_| handle_alloc_error(layout));
&*(ptr.as_ptr() as *const _)
&mut *ptr.as_ptr().cast()
}
}

fn h<'a>(bcx: &'a Bcx<'a>) -> &'a Bcx<'a> {
fn h<'a>(bcx: &'a Bcx<'a>) -> &'a mut Bcx<'a> {
return allocate(bcx.fcx.arena);
}

fn g(fcx: &Fcx) {
let bcx = Bcx { fcx };
let bcx2 = h(&bcx);
unsafe {
Global.deallocate(NonNull::new_unchecked(bcx2 as *const _ as *mut _), Layout::new::<Bcx>());
Global.deallocate(NonNull::new_unchecked(bcx2 as *mut _ as *mut _), Layout::new::<Bcx>());
}
}