mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Auto merge of #92465 - matthiaskrgr:rollup-yuary84, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #90383 (Extend check for UnsafeCell in consts to cover unions) - #91375 (config.rs: Add support for a per-target default_linker option.) - #91480 (rustdoc: use smaller number of colors to distinguish items) - #92338 (Add try_reserve and try_reserve_exact for OsString) - #92405 (Add a couple needs-asm-support headers to tests) - #92435 (Sync rustc_codegen_cranelift) - #92440 (Fix mobile toggles position) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
4d2e0fd96c
@ -5,6 +5,21 @@ on:
|
||||
- pull_request
|
||||
|
||||
jobs:
|
||||
rustfmt:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install rustfmt
|
||||
run: |
|
||||
rustup component add rustfmt
|
||||
|
||||
- name: Rustfmt
|
||||
run: |
|
||||
cargo fmt --check
|
||||
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 60
|
||||
|
@ -3,7 +3,7 @@ name: Test nightly Cranelift
|
||||
on:
|
||||
push:
|
||||
schedule:
|
||||
- cron: '1 17 * * *' # At 01:17 UTC every day.
|
||||
- cron: '17 1 * * *' # At 01:17 UTC every day.
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
1
compiler/rustc_codegen_cranelift/.gitignore
vendored
1
compiler/rustc_codegen_cranelift/.gitignore
vendored
@ -7,6 +7,7 @@ perf.data.old
|
||||
*.events
|
||||
*.string*
|
||||
/y.bin
|
||||
/y.bin.dSYM
|
||||
/build
|
||||
/build_sysroot/sysroot_src
|
||||
/build_sysroot/compiler-builtins
|
||||
|
@ -40,31 +40,12 @@ unstable-features = ["jit", "inline_asm"]
|
||||
jit = ["cranelift-jit", "libloading"]
|
||||
inline_asm = []
|
||||
|
||||
[profile.dev]
|
||||
# By compiling dependencies with optimizations, performing tests gets much faster.
|
||||
opt-level = 3
|
||||
|
||||
[profile.dev.package.rustc_codegen_cranelift]
|
||||
# Disabling optimizations for cg_clif itself makes compilation after a change faster.
|
||||
opt-level = 0
|
||||
|
||||
[profile.release.package.rustc_codegen_cranelift]
|
||||
incremental = true
|
||||
|
||||
# Disable optimizations and debuginfo of build scripts and some of the heavy build deps, as the
|
||||
# execution time of build scripts is so fast that optimizing them slows down the total build time.
|
||||
[profile.dev.build-override]
|
||||
opt-level = 0
|
||||
debug = false
|
||||
|
||||
[profile.release.build-override]
|
||||
opt-level = 0
|
||||
debug = false
|
||||
|
||||
[profile.dev.package.cranelift-codegen-meta]
|
||||
opt-level = 0
|
||||
debug = false
|
||||
|
||||
[profile.release.package.cranelift-codegen-meta]
|
||||
opt-level = 0
|
||||
debug = false
|
||||
|
@ -37,7 +37,7 @@ Assuming `$cg_clif_dir` is the directory you cloned this repo into and you follo
|
||||
In the directory with your project (where you can do the usual `cargo build`), run:
|
||||
|
||||
```bash
|
||||
$ $cg_clif_dir/build/cargo build
|
||||
$ $cg_clif_dir/build/cargo-clif build
|
||||
```
|
||||
|
||||
This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend.
|
||||
|
@ -10,6 +10,18 @@ pub(crate) fn build_backend(
|
||||
let mut cmd = Command::new("cargo");
|
||||
cmd.arg("build").arg("--target").arg(host_triple);
|
||||
|
||||
cmd.env("CARGO_BUILD_INCREMENTAL", "true"); // Force incr comp even in release mode
|
||||
|
||||
let mut rustflags = env::var("RUSTFLAGS").unwrap_or_default();
|
||||
|
||||
if env::var("CI").as_ref().map(|val| &**val) == Ok("true") {
|
||||
// Deny warnings on CI
|
||||
rustflags += " -Dwarnings";
|
||||
|
||||
// Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
|
||||
cmd.env("CARGO_BUILD_INCREMENTAL", "false");
|
||||
}
|
||||
|
||||
if use_unstable_features {
|
||||
cmd.arg("--features").arg("unstable-features");
|
||||
}
|
||||
@ -22,25 +34,20 @@ pub(crate) fn build_backend(
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
// Set the rpath to make the cg_clif executable find librustc_codegen_cranelift without changing
|
||||
// LD_LIBRARY_PATH
|
||||
if cfg!(unix) {
|
||||
if cfg!(target_os = "macos") {
|
||||
cmd.env(
|
||||
"RUSTFLAGS",
|
||||
"-Csplit-debuginfo=unpacked \
|
||||
rustflags += " -Csplit-debuginfo=unpacked \
|
||||
-Clink-arg=-Wl,-rpath,@loader_path/../lib \
|
||||
-Zosx-rpath-install-name"
|
||||
.to_string()
|
||||
+ env::var("RUSTFLAGS").as_deref().unwrap_or(""),
|
||||
);
|
||||
-Zosx-rpath-install-name";
|
||||
} else {
|
||||
cmd.env(
|
||||
"RUSTFLAGS",
|
||||
"-Clink-arg=-Wl,-rpath=$ORIGIN/../lib ".to_string()
|
||||
+ env::var("RUSTFLAGS").as_deref().unwrap_or(""),
|
||||
);
|
||||
rustflags += " -Clink-arg=-Wl,-rpath=$ORIGIN/../lib ";
|
||||
}
|
||||
}
|
||||
|
||||
cmd.env("RUSTFLAGS", rustflags);
|
||||
|
||||
eprintln!("[BUILD] rustc_codegen_cranelift");
|
||||
crate::utils::spawn_and_wait(cmd);
|
||||
|
||||
|
@ -46,9 +46,9 @@ pub(crate) fn build_sysroot(
|
||||
// Build and copy cargo wrapper
|
||||
let mut build_cargo_wrapper_cmd = Command::new("rustc");
|
||||
build_cargo_wrapper_cmd
|
||||
.arg("scripts/cargo.rs")
|
||||
.arg("scripts/cargo-clif.rs")
|
||||
.arg("-o")
|
||||
.arg(target_dir.join("cargo"))
|
||||
.arg(target_dir.join("cargo-clif"))
|
||||
.arg("-g");
|
||||
spawn_and_wait(build_cargo_wrapper_cmd);
|
||||
|
||||
|
@ -9,7 +9,7 @@ Assuming `$cg_clif_dir` is the directory you cloned this repo into and you follo
|
||||
In the directory with your project (where you can do the usual `cargo build`), run:
|
||||
|
||||
```bash
|
||||
$ $cg_clif_dir/build/cargo build
|
||||
$ $cg_clif_dir/build/cargo-clif build
|
||||
```
|
||||
|
||||
This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend.
|
||||
@ -32,7 +32,7 @@ In jit mode cg_clif will immediately execute your code without creating an execu
|
||||
> The jit mode will probably need cargo integration to make this possible.
|
||||
|
||||
```bash
|
||||
$ $cg_clif_dir/build/cargo jit
|
||||
$ $cg_clif_dir/build/cargo-clif jit
|
||||
```
|
||||
|
||||
or
|
||||
@ -45,7 +45,7 @@ There is also an experimental lazy jit mode. In this mode functions are only com
|
||||
first called.
|
||||
|
||||
```bash
|
||||
$ $cg_clif_dir/build/cargo lazy-jit
|
||||
$ $cg_clif_dir/build/cargo-clif lazy-jit
|
||||
```
|
||||
|
||||
## Shell
|
||||
|
@ -129,6 +129,7 @@ fn call_return_u128_pair() {
|
||||
return_u128_pair();
|
||||
}
|
||||
|
||||
#[allow(unreachable_code)] // FIXME false positive
|
||||
fn main() {
|
||||
take_unique(Unique {
|
||||
pointer: 0 as *const (),
|
||||
|
@ -1,3 +1,3 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2021-12-20"
|
||||
channel = "nightly-2021-12-30"
|
||||
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
./y.rs build
|
||||
./y.rs build --no-unstable-features
|
||||
source scripts/config.sh
|
||||
|
||||
echo "[SETUP] Rust fork"
|
||||
|
@ -47,6 +47,8 @@ rm src/test/ui/codegen/init-large-type.rs # same
|
||||
rm src/test/ui/sse2.rs # cpuid not supported, so sse2 not detected
|
||||
rm src/test/ui/issues/issue-33992.rs # unsupported linkages
|
||||
rm src/test/ui/issues/issue-51947.rs # same
|
||||
rm src/test/incremental/hashes/function_interfaces.rs # same
|
||||
rm src/test/incremental/hashes/statics.rs # same
|
||||
rm src/test/ui/numbers-arithmetic/saturating-float-casts.rs # intrinsic gives different but valid result
|
||||
rm src/test/ui/mir/mir_misc_casts.rs # depends on deduplication of constants
|
||||
rm src/test/ui/mir/mir_raw_fat_ptr.rs # same
|
||||
@ -60,18 +62,14 @@ rm src/test/ui/intrinsics/intrinsic-nearby.rs # unimplemented nearbyintf32 and n
|
||||
|
||||
rm src/test/incremental/hashes/inline_asm.rs # inline asm
|
||||
rm src/test/incremental/issue-72386.rs # same
|
||||
rm src/test/incremental/issue-49482.rs # same
|
||||
rm src/test/incremental/issue-54059.rs # same
|
||||
rm src/test/incremental/lto.rs # requires lto
|
||||
rm src/test/incremental/dirty_clean.rs # TODO
|
||||
|
||||
rm -r src/test/run-make/emit-shared-files # requires the rustdoc executable in build/bin/
|
||||
rm -r src/test/run-make/unstable-flag-required # same
|
||||
rm -r src/test/run-make/rustdoc-* # same
|
||||
rm -r src/test/run-make/emit-named-files # requires full --emit support
|
||||
|
||||
rm src/test/pretty/asm.rs # inline asm
|
||||
rm src/test/pretty/raw-str-nonexpr.rs # same
|
||||
|
||||
rm -r src/test/run-pass-valgrind/unsized-locals
|
||||
|
||||
rm src/test/ui/json-bom-plus-crlf-multifile.rs # differing warning
|
||||
@ -97,6 +95,12 @@ rm src/test/ui/command/command-current-dir.rs # can't find libstd.so
|
||||
|
||||
rm src/test/ui/abi/stack-protector.rs # requires stack protector support
|
||||
|
||||
rm src/test/incremental/issue-80691-bad-eval-cache.rs # wrong exit code
|
||||
rm src/test/incremental/spike-neg1.rs # errors out for some reason
|
||||
rm src/test/incremental/spike-neg2.rs # same
|
||||
|
||||
rm src/test/incremental/thinlto/cgu_invalidated_when_import_{added,removed}.rs # requires LLVM
|
||||
|
||||
echo "[TEST] rustc test suite"
|
||||
RUST_TEST_NOCAPTURE=1 COMPILETEST_FORCE_STAGE0=1 ./x.py test --stage 0 src/test/{codegen-units,run-make,run-pass-valgrind,ui}
|
||||
RUST_TEST_NOCAPTURE=1 COMPILETEST_FORCE_STAGE0=1 ./x.py test --stage 0 src/test/{codegen-units,run-make,run-pass-valgrind,ui,incremental}
|
||||
popd
|
||||
|
@ -80,73 +80,73 @@ function base_sysroot_tests() {
|
||||
|
||||
function extended_sysroot_tests() {
|
||||
pushd rand
|
||||
../build/cargo clean
|
||||
../build/cargo-clif clean
|
||||
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
|
||||
echo "[TEST] rust-random/rand"
|
||||
../build/cargo test --workspace
|
||||
../build/cargo-clif test --workspace
|
||||
else
|
||||
echo "[AOT] rust-random/rand"
|
||||
../build/cargo build --workspace --target $TARGET_TRIPLE --tests
|
||||
../build/cargo-clif build --workspace --target $TARGET_TRIPLE --tests
|
||||
fi
|
||||
popd
|
||||
|
||||
pushd simple-raytracer
|
||||
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
|
||||
echo "[BENCH COMPILE] ebobby/simple-raytracer"
|
||||
hyperfine --runs "${RUN_RUNS:-10}" --warmup 1 --prepare "../build/cargo clean" \
|
||||
hyperfine --runs "${RUN_RUNS:-10}" --warmup 1 --prepare "../build/cargo-clif clean" \
|
||||
"RUSTC=rustc RUSTFLAGS='' cargo build" \
|
||||
"../build/cargo build"
|
||||
"../build/cargo-clif build"
|
||||
|
||||
echo "[BENCH RUN] ebobby/simple-raytracer"
|
||||
cp ./target/debug/main ./raytracer_cg_clif
|
||||
hyperfine --runs "${RUN_RUNS:-10}" ./raytracer_cg_llvm ./raytracer_cg_clif
|
||||
else
|
||||
../build/cargo clean
|
||||
../build/cargo-clif clean
|
||||
echo "[BENCH COMPILE] ebobby/simple-raytracer (skipped)"
|
||||
echo "[COMPILE] ebobby/simple-raytracer"
|
||||
../build/cargo build --target $TARGET_TRIPLE
|
||||
../build/cargo-clif build --target $TARGET_TRIPLE
|
||||
echo "[BENCH RUN] ebobby/simple-raytracer (skipped)"
|
||||
fi
|
||||
popd
|
||||
|
||||
pushd build_sysroot/sysroot_src/library/core/tests
|
||||
echo "[TEST] libcore"
|
||||
../../../../../build/cargo clean
|
||||
../../../../../build/cargo-clif clean
|
||||
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
|
||||
../../../../../build/cargo test
|
||||
../../../../../build/cargo-clif test
|
||||
else
|
||||
../../../../../build/cargo build --target $TARGET_TRIPLE --tests
|
||||
../../../../../build/cargo-clif build --target $TARGET_TRIPLE --tests
|
||||
fi
|
||||
popd
|
||||
|
||||
pushd regex
|
||||
echo "[TEST] rust-lang/regex example shootout-regex-dna"
|
||||
../build/cargo clean
|
||||
../build/cargo-clif clean
|
||||
export RUSTFLAGS="$RUSTFLAGS --cap-lints warn" # newer aho_corasick versions throw a deprecation warning
|
||||
# Make sure `[codegen mono items] start` doesn't poison the diff
|
||||
../build/cargo build --example shootout-regex-dna --target $TARGET_TRIPLE
|
||||
../build/cargo-clif build --example shootout-regex-dna --target $TARGET_TRIPLE
|
||||
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
|
||||
cat examples/regexdna-input.txt \
|
||||
| ../build/cargo run --example shootout-regex-dna --target $TARGET_TRIPLE \
|
||||
| ../build/cargo-clif run --example shootout-regex-dna --target $TARGET_TRIPLE \
|
||||
| grep -v "Spawned thread" > res.txt
|
||||
diff -u res.txt examples/regexdna-output.txt
|
||||
fi
|
||||
|
||||
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
|
||||
echo "[TEST] rust-lang/regex tests"
|
||||
../build/cargo test --tests -- --exclude-should-panic --test-threads 1 -Zunstable-options -q
|
||||
../build/cargo-clif test --tests -- --exclude-should-panic --test-threads 1 -Zunstable-options -q
|
||||
else
|
||||
echo "[AOT] rust-lang/regex tests"
|
||||
../build/cargo build --tests --target $TARGET_TRIPLE
|
||||
../build/cargo-clif build --tests --target $TARGET_TRIPLE
|
||||
fi
|
||||
popd
|
||||
|
||||
pushd portable-simd
|
||||
echo "[TEST] rust-lang/portable-simd"
|
||||
../build/cargo clean
|
||||
../build/cargo build --all-targets --target $TARGET_TRIPLE
|
||||
../build/cargo-clif clean
|
||||
../build/cargo-clif build --all-targets --target $TARGET_TRIPLE
|
||||
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
|
||||
../build/cargo test -q
|
||||
../build/cargo-clif test -q
|
||||
fi
|
||||
popd
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ pub(crate) struct FunctionCx<'m, 'clif, 'tcx: 'm> {
|
||||
pub(crate) module: &'m mut dyn Module,
|
||||
pub(crate) tcx: TyCtxt<'tcx>,
|
||||
pub(crate) target_config: TargetFrontendConfig, // Cached from module
|
||||
pub(crate) pointer_type: Type, // Cached from module
|
||||
pub(crate) pointer_type: Type, // Cached from module
|
||||
pub(crate) constants_cx: ConstantCx,
|
||||
|
||||
pub(crate) instance: Instance<'tcx>,
|
||||
|
@ -67,7 +67,7 @@ impl WriterRelocate {
|
||||
}
|
||||
|
||||
/// Perform the collected relocations to be usable for JIT usage.
|
||||
#[cfg(feature = "jit")]
|
||||
#[cfg(all(feature = "jit", not(windows)))]
|
||||
pub(super) fn relocate_for_jit(mut self, jit_module: &cranelift_jit::JITModule) -> Vec<u8> {
|
||||
for reloc in self.relocs.drain(..) {
|
||||
match reloc.name {
|
||||
|
@ -10,7 +10,7 @@ use crate::prelude::*;
|
||||
use rustc_index::vec::IndexVec;
|
||||
|
||||
use cranelift_codegen::entity::EntityRef;
|
||||
use cranelift_codegen::ir::{LabelValueLoc, ValueLabel};
|
||||
use cranelift_codegen::ir::{Endianness, LabelValueLoc, ValueLabel};
|
||||
use cranelift_codegen::isa::TargetIsa;
|
||||
use cranelift_codegen::ValueLocRange;
|
||||
|
||||
@ -23,15 +23,6 @@ use gimli::{Encoding, Format, LineEncoding, RunTimeEndian, X86_64};
|
||||
pub(crate) use emit::{DebugReloc, DebugRelocName};
|
||||
pub(crate) use unwind::UnwindContext;
|
||||
|
||||
fn target_endian(tcx: TyCtxt<'_>) -> RunTimeEndian {
|
||||
use rustc_target::abi::Endian;
|
||||
|
||||
match tcx.data_layout.endian {
|
||||
Endian::Big => RunTimeEndian::Big,
|
||||
Endian::Little => RunTimeEndian::Little,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct DebugContext<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
|
||||
@ -60,6 +51,11 @@ impl<'tcx> DebugContext<'tcx> {
|
||||
address_size: isa.frontend_config().pointer_bytes(),
|
||||
};
|
||||
|
||||
let endian = match isa.endianness() {
|
||||
Endianness::Little => RunTimeEndian::Little,
|
||||
Endianness::Big => RunTimeEndian::Big,
|
||||
};
|
||||
|
||||
let mut dwarf = DwarfUnit::new(encoding);
|
||||
|
||||
let producer = format!(
|
||||
@ -108,7 +104,7 @@ impl<'tcx> DebugContext<'tcx> {
|
||||
DebugContext {
|
||||
tcx,
|
||||
|
||||
endian: target_endian(tcx),
|
||||
endian,
|
||||
|
||||
dwarf,
|
||||
unit_range_list: RangeList(Vec::new()),
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
use cranelift_codegen::ir::Endianness;
|
||||
use cranelift_codegen::isa::{unwind::UnwindInfo, TargetIsa};
|
||||
|
||||
use cranelift_object::ObjectProduct;
|
||||
@ -17,8 +18,11 @@ pub(crate) struct UnwindContext {
|
||||
}
|
||||
|
||||
impl UnwindContext {
|
||||
pub(crate) fn new(tcx: TyCtxt<'_>, isa: &dyn TargetIsa, pic_eh_frame: bool) -> Self {
|
||||
let endian = super::target_endian(tcx);
|
||||
pub(crate) fn new(isa: &dyn TargetIsa, pic_eh_frame: bool) -> Self {
|
||||
let endian = match isa.endianness() {
|
||||
Endianness::Little => RunTimeEndian::Little,
|
||||
Endianness::Big => RunTimeEndian::Big,
|
||||
};
|
||||
let mut frame_table = FrameTable::default();
|
||||
|
||||
let cie_id = if let Some(mut cie) = isa.create_systemv_cie() {
|
||||
|
@ -243,7 +243,7 @@ pub(crate) fn run_aot(
|
||||
let isa = crate::build_isa(tcx.sess, &backend_config);
|
||||
let mut allocator_module = make_module(tcx.sess, isa, "allocator_shim".to_string());
|
||||
assert_eq!(pointer_ty(tcx), allocator_module.target_config().pointer_type());
|
||||
let mut allocator_unwind_context = UnwindContext::new(tcx, allocator_module.isa(), true);
|
||||
let mut allocator_unwind_context = UnwindContext::new(allocator_module.isa(), true);
|
||||
let created_alloc_shim =
|
||||
crate::allocator::codegen(tcx, &mut allocator_module, &mut allocator_unwind_context);
|
||||
|
||||
|
@ -141,7 +141,7 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
assert_eq!(pointer_ty(tcx), isa.pointer_type());
|
||||
|
||||
let unwind_context =
|
||||
UnwindContext::new(tcx, isa, matches!(backend_config.codegen_mode, CodegenMode::Aot));
|
||||
UnwindContext::new(isa, matches!(backend_config.codegen_mode, CodegenMode::Aot));
|
||||
let debug_context = if debug_info { Some(DebugContext::new(tcx, isa)) } else { None };
|
||||
CodegenCx {
|
||||
tcx,
|
||||
|
@ -14,6 +14,7 @@ use rustc_middle::mir::interpret::InterpError;
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::DUMMY_SP;
|
||||
use rustc_target::abi::{Abi, Scalar as ScalarAbi, Size, VariantIdx, Variants, WrappingRange};
|
||||
|
||||
use std::hash::Hash;
|
||||
@ -736,9 +737,15 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
|
||||
#[inline(always)]
|
||||
fn visit_union(
|
||||
&mut self,
|
||||
_op: &OpTy<'tcx, M::PointerTag>,
|
||||
op: &OpTy<'tcx, M::PointerTag>,
|
||||
_fields: NonZeroUsize,
|
||||
) -> InterpResult<'tcx> {
|
||||
// Special check preventing `UnsafeCell` inside unions in the inner part of constants.
|
||||
if matches!(self.ctfe_mode, Some(CtfeValidationMode::Const { inner: true, .. })) {
|
||||
if !op.layout.ty.is_freeze(self.ecx.tcx.at(DUMMY_SP), self.ecx.param_env) {
|
||||
throw_validation_failure!(self.path, { "`UnsafeCell` in a `const`" });
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -488,9 +488,12 @@ changelog-seen = 2
|
||||
# FIXME(#75760): Some UI tests fail when this option is enabled.
|
||||
#parallel-compiler = false
|
||||
|
||||
# The default linker that will be hard-coded into the generated compiler for
|
||||
# targets that don't specify linker explicitly in their target specifications.
|
||||
# Note that this is not the linker used to link said compiler.
|
||||
# The default linker that will be hard-coded into the generated
|
||||
# compiler for targets that don't specify a default linker explicitly
|
||||
# in their target specifications. Note that this is not the linker
|
||||
# used to link said compiler. It can also be set per-target (via the
|
||||
# `[target.<triple>]` block), which may be useful in a cross-compilation
|
||||
# setting.
|
||||
#
|
||||
# See https://doc.rust-lang.org/rustc/codegen-options/index.html#linker for more information.
|
||||
#default-linker = <none> (path)
|
||||
|
@ -3,6 +3,7 @@ mod tests;
|
||||
|
||||
use crate::borrow::{Borrow, Cow};
|
||||
use crate::cmp;
|
||||
use crate::collections::TryReserveError;
|
||||
use crate::fmt;
|
||||
use crate::hash::{Hash, Hasher};
|
||||
use crate::iter::{Extend, FromIterator};
|
||||
@ -265,6 +266,43 @@ impl OsString {
|
||||
self.inner.reserve(additional)
|
||||
}
|
||||
|
||||
/// Tries to reserve capacity for at least `additional` more length units
|
||||
/// in the given `OsString`. The string may reserve more space to avoid
|
||||
/// frequent reallocations. After calling `try_reserve`, capacity will be
|
||||
/// greater than or equal to `self.len() + additional`. Does nothing if
|
||||
/// capacity is already sufficient.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// If the capacity overflows, or the allocator reports a failure, then an error
|
||||
/// is returned.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(try_reserve_2)]
|
||||
/// use std::ffi::{OsStr, OsString};
|
||||
/// use std::collections::TryReserveError;
|
||||
///
|
||||
/// fn process_data(data: &str) -> Result<OsString, TryReserveError> {
|
||||
/// let mut s = OsString::new();
|
||||
///
|
||||
/// // Pre-reserve the memory, exiting if we can't
|
||||
/// s.try_reserve(OsStr::new(data).len())?;
|
||||
///
|
||||
/// // Now we know this can't OOM in the middle of our complex work
|
||||
/// s.push(data);
|
||||
///
|
||||
/// Ok(s)
|
||||
/// }
|
||||
/// # process_data("123").expect("why is the test harness OOMing on 3 bytes?");
|
||||
/// ```
|
||||
#[unstable(feature = "try_reserve_2", issue = "91789")]
|
||||
#[inline]
|
||||
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
|
||||
self.inner.try_reserve(additional)
|
||||
}
|
||||
|
||||
/// Reserves the minimum capacity for exactly `additional` more capacity to
|
||||
/// be inserted in the given `OsString`. Does nothing if the capacity is
|
||||
/// already sufficient.
|
||||
@ -290,6 +328,49 @@ impl OsString {
|
||||
self.inner.reserve_exact(additional)
|
||||
}
|
||||
|
||||
/// Tries to reserve the minimum capacity for exactly `additional`
|
||||
/// more length units in the given `OsString`. After calling
|
||||
/// `try_reserve_exact`, capacity will be greater than or equal to
|
||||
/// `self.len() + additional` if it returns `Ok(())`.
|
||||
/// Does nothing if the capacity is already sufficient.
|
||||
///
|
||||
/// Note that the allocator may give the `OsString` more space than it
|
||||
/// requests. Therefore, capacity can not be relied upon to be precisely
|
||||
/// minimal. Prefer [`try_reserve`] if future insertions are expected.
|
||||
///
|
||||
/// [`try_reserve`]: OsString::try_reserve
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// If the capacity overflows, or the allocator reports a failure, then an error
|
||||
/// is returned.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(try_reserve_2)]
|
||||
/// use std::ffi::{OsStr, OsString};
|
||||
/// use std::collections::TryReserveError;
|
||||
///
|
||||
/// fn process_data(data: &str) -> Result<OsString, TryReserveError> {
|
||||
/// let mut s = OsString::new();
|
||||
///
|
||||
/// // Pre-reserve the memory, exiting if we can't
|
||||
/// s.try_reserve_exact(OsStr::new(data).len())?;
|
||||
///
|
||||
/// // Now we know this can't OOM in the middle of our complex work
|
||||
/// s.push(data);
|
||||
///
|
||||
/// Ok(s)
|
||||
/// }
|
||||
/// # process_data("123").expect("why is the test harness OOMing on 3 bytes?");
|
||||
/// ```
|
||||
#[unstable(feature = "try_reserve_2", issue = "91789")]
|
||||
#[inline]
|
||||
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> {
|
||||
self.inner.try_reserve_exact(additional)
|
||||
}
|
||||
|
||||
/// Shrinks the capacity of the `OsString` to match its length.
|
||||
///
|
||||
/// # Examples
|
||||
|
@ -2,6 +2,7 @@
|
||||
//! systems: just a `Vec<u8>`/`[u8]`.
|
||||
|
||||
use crate::borrow::Cow;
|
||||
use crate::collections::TryReserveError;
|
||||
use crate::fmt;
|
||||
use crate::fmt::Write;
|
||||
use crate::mem;
|
||||
@ -112,11 +113,21 @@ impl Buf {
|
||||
self.inner.reserve(additional)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
|
||||
self.inner.try_reserve(additional)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn reserve_exact(&mut self, additional: usize) {
|
||||
self.inner.reserve_exact(additional)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> {
|
||||
self.inner.try_reserve_exact(additional)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn shrink_to_fit(&mut self) {
|
||||
self.inner.shrink_to_fit()
|
||||
|
@ -1,6 +1,7 @@
|
||||
/// The underlying OsString/OsStr implementation on Windows is a
|
||||
/// wrapper around the "WTF-8" encoding; see the `wtf8` module for more.
|
||||
use crate::borrow::Cow;
|
||||
use crate::collections::TryReserveError;
|
||||
use crate::fmt;
|
||||
use crate::mem;
|
||||
use crate::rc::Rc;
|
||||
@ -104,10 +105,18 @@ impl Buf {
|
||||
self.inner.reserve(additional)
|
||||
}
|
||||
|
||||
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
|
||||
self.inner.try_reserve(additional)
|
||||
}
|
||||
|
||||
pub fn reserve_exact(&mut self, additional: usize) {
|
||||
self.inner.reserve_exact(additional)
|
||||
}
|
||||
|
||||
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> {
|
||||
self.inner.try_reserve_exact(additional)
|
||||
}
|
||||
|
||||
pub fn shrink_to_fit(&mut self) {
|
||||
self.inner.shrink_to_fit()
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ use core::str::next_code_point;
|
||||
|
||||
use crate::borrow::Cow;
|
||||
use crate::char;
|
||||
use crate::collections::TryReserveError;
|
||||
use crate::fmt;
|
||||
use crate::hash::{Hash, Hasher};
|
||||
use crate::iter::FromIterator;
|
||||
@ -231,11 +232,47 @@ impl Wtf8Buf {
|
||||
self.bytes.reserve(additional)
|
||||
}
|
||||
|
||||
/// Tries to reserve capacity for at least `additional` more length units
|
||||
/// in the given `Wtf8Buf`. The `Wtf8Buf` may reserve more space to avoid
|
||||
/// frequent reallocations. After calling `try_reserve`, capacity will be
|
||||
/// greater than or equal to `self.len() + additional`. Does nothing if
|
||||
/// capacity is already sufficient.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// If the capacity overflows, or the allocator reports a failure, then an error
|
||||
/// is returned.
|
||||
#[inline]
|
||||
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
|
||||
self.bytes.try_reserve(additional)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn reserve_exact(&mut self, additional: usize) {
|
||||
self.bytes.reserve_exact(additional)
|
||||
}
|
||||
|
||||
/// Tries to reserve the minimum capacity for exactly `additional`
|
||||
/// length units in the given `Wtf8Buf`. After calling
|
||||
/// `try_reserve_exact`, capacity will be greater than or equal to
|
||||
/// `self.len() + additional` if it returns `Ok(())`.
|
||||
/// Does nothing if the capacity is already sufficient.
|
||||
///
|
||||
/// Note that the allocator may give the `Wtf8Buf` more space than it
|
||||
/// requests. Therefore, capacity can not be relied upon to be precisely
|
||||
/// minimal. Prefer [`try_reserve`] if future insertions are expected.
|
||||
///
|
||||
/// [`try_reserve`]: Wtf8Buf::try_reserve
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// If the capacity overflows, or the allocator reports a failure, then an error
|
||||
/// is returned.
|
||||
#[inline]
|
||||
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> {
|
||||
self.bytes.try_reserve_exact(additional)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn shrink_to_fit(&mut self) {
|
||||
self.bytes.shrink_to_fit()
|
||||
|
@ -662,6 +662,8 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS
|
||||
.env("CFG_VERSION", builder.rust_version());
|
||||
|
||||
let libdir_relative = builder.config.libdir_relative().unwrap_or_else(|| Path::new("lib"));
|
||||
let target_config = builder.config.target_config.get(&target);
|
||||
|
||||
cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);
|
||||
|
||||
if let Some(ref ver_date) = builder.rust_info.commit_date() {
|
||||
@ -673,9 +675,15 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS
|
||||
if !builder.unstable_features() {
|
||||
cargo.env("CFG_DISABLE_UNSTABLE_FEATURES", "1");
|
||||
}
|
||||
if let Some(ref s) = builder.config.rustc_default_linker {
|
||||
|
||||
// Prefer the current target's own default_linker, else a globally
|
||||
// specified one.
|
||||
if let Some(s) = target_config.and_then(|c| c.default_linker.as_ref()) {
|
||||
cargo.env("CFG_DEFAULT_LINKER", s);
|
||||
} else if let Some(ref s) = builder.config.rustc_default_linker {
|
||||
cargo.env("CFG_DEFAULT_LINKER", s);
|
||||
}
|
||||
|
||||
if builder.config.rustc_parallel {
|
||||
cargo.rustflag("--cfg=parallel_compiler");
|
||||
cargo.rustdocflag("--cfg=parallel_compiler");
|
||||
@ -700,7 +708,6 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS
|
||||
}
|
||||
let llvm_config = builder.ensure(native::Llvm { target });
|
||||
cargo.env("LLVM_CONFIG", &llvm_config);
|
||||
let target_config = builder.config.target_config.get(&target);
|
||||
if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
|
||||
cargo.env("CFG_LLVM_ROOT", s);
|
||||
}
|
||||
|
@ -294,6 +294,7 @@ pub struct Target {
|
||||
pub cxx: Option<PathBuf>,
|
||||
pub ar: Option<PathBuf>,
|
||||
pub ranlib: Option<PathBuf>,
|
||||
pub default_linker: Option<PathBuf>,
|
||||
pub linker: Option<PathBuf>,
|
||||
pub ndk: Option<PathBuf>,
|
||||
pub sanitizers: Option<bool>,
|
||||
@ -531,6 +532,7 @@ struct TomlTarget {
|
||||
cxx: Option<String>,
|
||||
ar: Option<String>,
|
||||
ranlib: Option<String>,
|
||||
default_linker: Option<PathBuf>,
|
||||
linker: Option<String>,
|
||||
llvm_config: Option<String>,
|
||||
llvm_filecheck: Option<String>,
|
||||
|
@ -72,7 +72,7 @@ ENV PATH="/node-v14.4.0-linux-x64/bin:${PATH}"
|
||||
# https://github.com/puppeteer/puppeteer/issues/375
|
||||
#
|
||||
# We also specify the version in case we need to update it to go around cache limitations.
|
||||
RUN npm install -g browser-ui-test@0.5.1 --unsafe-perm=true
|
||||
RUN npm install -g browser-ui-test@0.5.3 --unsafe-perm=true
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--build=x86_64-unknown-linux-gnu \
|
||||
|
@ -955,7 +955,7 @@ fn fmt_type<'cx>(
|
||||
Ok((ref url, _, ref path)) if !f.alternate() => {
|
||||
write!(
|
||||
f,
|
||||
"<a class=\"type\" href=\"{url}#{shortty}.{name}\" \
|
||||
"<a class=\"associatedtype\" href=\"{url}#{shortty}.{name}\" \
|
||||
title=\"type {path}::{name}\">{name}</a>",
|
||||
url = url,
|
||||
shortty = ItemType::AssocType,
|
||||
|
@ -788,7 +788,7 @@ fn assoc_type(
|
||||
) {
|
||||
write!(
|
||||
w,
|
||||
"{}type <a href=\"{}\" class=\"type\">{}</a>",
|
||||
"{}type <a href=\"{}\" class=\"associatedtype\">{}</a>",
|
||||
extra,
|
||||
naive_assoc_href(it, link, cx),
|
||||
it.name.as_ref().unwrap()
|
||||
|
@ -2007,6 +2007,16 @@ details.rustdoc-toggle[open] > summary.hideme::after {
|
||||
max-width: 100vw;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
/* Position of the "[-]" element. */
|
||||
details.rustdoc-toggle:not(.top-doc) > summary {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.impl-items > details.rustdoc-toggle > summary:not(.hideme)::before,
|
||||
#main-content > details.rustdoc-toggle:not(.top-doc) > summary::before,
|
||||
#main-content > div > details.rustdoc-toggle > summary::before {
|
||||
left: -11px;
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
|
@ -167,29 +167,35 @@ pre, .rustdoc.source .example-wrap {
|
||||
|
||||
.content .item-info::before { color: #ccc; }
|
||||
|
||||
.content span.foreigntype, .content a.foreigntype { color: #ef57ff; }
|
||||
.content span.union, .content a.union { color: #98a01c; }
|
||||
.content span.foreigntype, .content a.foreigntype { color: #ffa0a5; }
|
||||
.content span.union, .content a.union { color: #ffa0a5; }
|
||||
.content span.constant, .content a.constant,
|
||||
.content span.static, .content a.static { color: #6380a0; }
|
||||
.content span.primitive, .content a.primitive { color: #32889b; }
|
||||
.content span.traitalias, .content a.traitalias { color: #57d399; }
|
||||
.content span.keyword, .content a.keyword { color: #de5249; }
|
||||
.content span.static, .content a.static { color: #39AFD7; }
|
||||
.content span.primitive, .content a.primitive { color: #ffa0a5; }
|
||||
.content span.traitalias, .content a.traitalias { color: #39AFD7; }
|
||||
.content span.keyword, .content a.keyword { color: #39AFD7; }
|
||||
|
||||
.content span.externcrate, .content span.mod, .content a.mod {
|
||||
color: #acccf9;
|
||||
color: #39AFD7;
|
||||
}
|
||||
.content span.struct, .content a.struct {
|
||||
color: #ffa0a5;
|
||||
}
|
||||
.content span.enum, .content a.enum {
|
||||
color: #99e0c9;
|
||||
color: #ffa0a5;
|
||||
}
|
||||
.content span.trait, .content a.trait {
|
||||
color: #39AFD7;
|
||||
}
|
||||
.content span.type, .content a.type {
|
||||
color: #cfbcf5;
|
||||
color: #39AFD7;
|
||||
}
|
||||
.content span.type,
|
||||
.content a.type,
|
||||
.block a.current.type { color: #39AFD7; }
|
||||
.content span.associatedtype,
|
||||
.content a.associatedtype,
|
||||
.block a.current.associatedtype { color: #39AFD7; }
|
||||
.content span.fn, .content a.fn, .content span.method,
|
||||
.content a.method, .content span.tymethod,
|
||||
.content a.tymethod, .content .fnname {
|
||||
@ -454,11 +460,12 @@ above the `@media (max-width: 700px)` rules due to a bug in the css checker */
|
||||
.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro {}
|
||||
.content span.struct,.content a.struct,.block a.current.struct {}
|
||||
#titles>button:hover,#titles>button.selected {}
|
||||
.content span.type,.content a.type,.block a.current.type {}
|
||||
.content span.typedef,.content a.typedef,.block a.current.typedef {}
|
||||
.content span.union,.content a.union,.block a.current.union {}
|
||||
pre.rust .lifetime {}
|
||||
.stab.unstable {}
|
||||
h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod) {}
|
||||
h2,
|
||||
h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) {}
|
||||
.content span.enum,.content a.enum,.block a.current.enum {}
|
||||
.content span.constant,.content a.constant,.block a.current.constant,.content span.static,
|
||||
.content a.static, .block a.current.static {}
|
||||
@ -495,6 +502,7 @@ a.result-fn:focus,
|
||||
a.result-method:focus,
|
||||
a.result-tymethod:focus {}
|
||||
a.result-type:focus {}
|
||||
a.result-associatedtype:focus {}
|
||||
a.result-foreigntype:focus {}
|
||||
a.result-attr:focus,
|
||||
a.result-derive:focus,
|
||||
|
@ -119,47 +119,49 @@ pre, .rustdoc.source .example-wrap {
|
||||
a.result-trait:focus { background-color: #013191; }
|
||||
a.result-traitalias:focus { background-color: #013191; }
|
||||
a.result-mod:focus,
|
||||
a.result-externcrate:focus { background-color: #afc6e4; }
|
||||
a.result-mod:focus { background-color: #803a1b; }
|
||||
a.result-externcrate:focus { background-color: #396bac; }
|
||||
a.result-enum:focus { background-color: #5b4e68; }
|
||||
a.result-externcrate:focus { background-color: #884719; }
|
||||
a.result-enum:focus { background-color: #194e9f; }
|
||||
a.result-struct:focus { background-color: #194e9f; }
|
||||
a.result-union:focus { background-color: #b7bd49; }
|
||||
a.result-union:focus { background-color: #194e9f; }
|
||||
a.result-fn:focus,
|
||||
a.result-method:focus,
|
||||
a.result-tymethod:focus { background-color: #4950ed; }
|
||||
a.result-type:focus { background-color: #38902c; }
|
||||
a.result-foreigntype:focus { background-color: #b200d6; }
|
||||
a.result-type:focus { background-color: #194e9f; }
|
||||
a.result-associatedtype:focus { background-color: #884719; }
|
||||
a.result-foreigntype:focus { background-color: #194e9f; }
|
||||
a.result-attr:focus,
|
||||
a.result-derive:focus,
|
||||
a.result-macro:focus { background-color: #217d1c; }
|
||||
a.result-constant:focus,
|
||||
a.result-static:focus { background-color: #0063cc; }
|
||||
a.result-primitive:focus { background-color: #00708a; }
|
||||
a.result-static:focus { background-color: #884719; }
|
||||
a.result-primitive:focus { background-color: #194e9f; }
|
||||
a.result-keyword:focus { background-color: #884719; }
|
||||
|
||||
.content .item-info::before { color: #ccc; }
|
||||
|
||||
.content span.enum, .content a.enum, .block a.current.enum { color: #82b089; }
|
||||
.content span.enum, .content a.enum, .block a.current.enum { color: #2dbfb8; }
|
||||
.content span.struct, .content a.struct, .block a.current.struct { color: #2dbfb8; }
|
||||
.content span.type, .content a.type, .block a.current.type { color: #ff7f00; }
|
||||
.content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #dd7de8; }
|
||||
.content span.type, .content a.type, .block a.current.type { color: #2dbfb8; }
|
||||
.content span.associatedtype,
|
||||
.content a.associatedtype,
|
||||
.block a.current.associatedtype { color: #D2991D; }
|
||||
.content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #2dbfb8; }
|
||||
.content span.attr, .content a.attr, .block a.current.attr,
|
||||
.content span.derive, .content a.derive, .block a.current.derive,
|
||||
.content span.macro, .content a.macro, .block a.current.macro { color: #09bd00; }
|
||||
.content span.union, .content a.union, .block a.current.union { color: #a6ae37; }
|
||||
.content span.union, .content a.union, .block a.current.union { color: #2dbfb8; }
|
||||
.content span.constant, .content a.constant, .block a.current.constant,
|
||||
.content span.static, .content a.static, .block a.current.static { color: #82a5c9; }
|
||||
.content span.primitive, .content a.primitive, .block a.current.primitive { color: #43aec7; }
|
||||
.content span.static, .content a.static, .block a.current.static { color: #D2991D; }
|
||||
.content span.primitive, .content a.primitive, .block a.current.primitive { color: #2dbfb8; }
|
||||
.content span.externcrate,
|
||||
.content span.mod, .content a.mod, .block a.current.mod { color: #bda000; }
|
||||
.content span.mod, .content a.mod, .block a.current.mod { color: #D2991D; }
|
||||
.content span.trait, .content a.trait, .block a.current.trait { color: #b78cf2; }
|
||||
.content span.traitalias, .content a.traitalias, .block a.current.traitalias { color: #b397da; }
|
||||
.content span.traitalias, .content a.traitalias, .block a.current.traitalias { color: #b78cf2; }
|
||||
.content span.fn, .content a.fn, .block a.current.fn,
|
||||
.content span.method, .content a.method, .block a.current.method,
|
||||
.content span.tymethod, .content a.tymethod, .block a.current.tymethod,
|
||||
.content .fnname{ color: #2BAB63; }
|
||||
.content span.keyword, .content a.keyword, .block a.current.keyword { color: #de5249; }
|
||||
.content span.keyword, .content a.keyword, .block a.current.keyword { color: #D2991D; }
|
||||
|
||||
pre.rust .comment { color: #8d8d8b; }
|
||||
pre.rust .doccomment { color: #8ca375; }
|
||||
|
@ -9,7 +9,7 @@ h1, h2, h3, h4 {
|
||||
color: black;
|
||||
}
|
||||
h1.fqn {
|
||||
border-bottom-color: #D5D5D5;
|
||||
border-bottom-color: #DDDDDD;
|
||||
}
|
||||
h2, h3, h4 {
|
||||
border-bottom-color: #DDDDDD;
|
||||
@ -31,7 +31,7 @@ pre, .rustdoc.source .example-wrap {
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
background-color: #F1F1F1;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
/* Improve the scrollbar display on firefox */
|
||||
@ -90,7 +90,7 @@ pre, .rustdoc.source .example-wrap {
|
||||
|
||||
.line-numbers span { color: #c67e2d; }
|
||||
.line-numbers .line-highlighted {
|
||||
background-color: #f6fdb0 !important;
|
||||
background-color: #FDFFD3 !important;
|
||||
}
|
||||
|
||||
.docblock h1, .docblock h2, .docblock h3, .docblock h4, .docblock h5, .docblock h6 {
|
||||
@ -120,44 +120,48 @@ a.result-trait:focus { background-color: #c7b6ff; }
|
||||
a.result-traitalias:focus { background-color: #c7b6ff; }
|
||||
a.result-mod:focus,
|
||||
a.result-externcrate:focus { background-color: #afc6e4; }
|
||||
a.result-enum:focus { background-color: #b4d1b9; }
|
||||
a.result-enum:focus { background-color: #e7b1a0; }
|
||||
a.result-struct:focus { background-color: #e7b1a0; }
|
||||
a.result-union:focus { background-color: #b7bd49; }
|
||||
a.result-union:focus { background-color: #e7b1a0; }
|
||||
a.result-fn:focus,
|
||||
a.result-method:focus,
|
||||
a.result-tymethod:focus { background-color: #c6afb3; }
|
||||
a.result-type:focus { background-color: #ffc891; }
|
||||
a.result-foreigntype:focus { background-color: #f5c4ff; }
|
||||
a.result-type:focus { background-color: #e7b1a0; }
|
||||
a.result-associatedtype:focus { background-color: #afc6e4; }
|
||||
a.result-foreigntype:focus { background-color: #e7b1a0; }
|
||||
a.result-attr:focus,
|
||||
a.result-derive:focus,
|
||||
a.result-macro:focus { background-color: #8ce488; }
|
||||
a.result-constant:focus,
|
||||
a.result-static:focus { background-color: #c3e0ff; }
|
||||
a.result-primitive:focus { background-color: #9aecff; }
|
||||
a.result-keyword:focus { background-color: #f99650; }
|
||||
a.result-static:focus { background-color: #afc6e4; }
|
||||
a.result-primitive:focus { background-color: #e7b1a0; }
|
||||
a.result-keyword:focus { background-color: #afc6e4; }
|
||||
|
||||
.content .item-info::before { color: #ccc; }
|
||||
|
||||
.content span.enum, .content a.enum, .block a.current.enum { color: #508157; }
|
||||
.content span.struct, .content a.struct, .block a.current.struct { color: #ad448e; }
|
||||
.content span.type, .content a.type, .block a.current.type { color: #ba5d00; }
|
||||
.content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #cd00e2; }
|
||||
.content span.enum, .content a.enum, .block a.current.enum { color: #AD378A; }
|
||||
.content span.struct, .content a.struct, .block a.current.struct { color: #AD378A; }
|
||||
.content span.type, .content a.type, .block a.current.type { color: #AD378A; }
|
||||
.content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #3873AD; }
|
||||
.content span.associatedtype,
|
||||
.content a.associatedtype,
|
||||
.block a.current.associatedtype { color: #3873AD; }
|
||||
.content span.attr, .content a.attr, .block a.current.attr,
|
||||
.content span.derive, .content a.derive, .block a.current.derive,
|
||||
.content span.macro, .content a.macro, .block a.current.macro { color: #068000; }
|
||||
.content span.union, .content a.union, .block a.current.union { color: #767b27; }
|
||||
.content span.union, .content a.union, .block a.current.union { color: #AD378A; }
|
||||
.content span.constant, .content a.constant, .block a.current.constant,
|
||||
.content span.static, .content a.static, .block a.current.static { color: #546e8a; }
|
||||
.content span.primitive, .content a.primitive, .block a.current.primitive { color: #2c8093; }
|
||||
.content span.static, .content a.static, .block a.current.static { color: #3873AD; }
|
||||
.content span.primitive, .content a.primitive, .block a.current.primitive { color: #AD378A; }
|
||||
.content span.externcrate,
|
||||
.content span.mod, .content a.mod, .block a.current.mod { color: #4d76ae; }
|
||||
.content span.trait, .content a.trait, .block a.current.trait { color: #7c5af3; }
|
||||
.content span.traitalias, .content a.traitalias, .block a.current.traitalias { color: #6841f1; }
|
||||
.content span.mod, .content a.mod, .block a.current.mod { color: #3873AD; }
|
||||
.content span.trait, .content a.trait, .block a.current.trait { color: #6E4FC9; }
|
||||
.content span.traitalias, .content a.traitalias, .block a.current.traitalias { color: #5137AD; }
|
||||
.content span.fn, .content a.fn, .block a.current.fn,
|
||||
.content span.method, .content a.method, .block a.current.method,
|
||||
.content span.tymethod, .content a.tymethod, .block a.current.tymethod,
|
||||
.content .fnname { color: #9a6e31; }
|
||||
.content span.keyword, .content a.keyword, .block a.current.keyword { color: #de5249; }
|
||||
.content .fnname { color: #AD7C37; }
|
||||
.content span.keyword, .content a.keyword, .block a.current.keyword { color: #3873AD; }
|
||||
|
||||
nav:not(.sidebar) {
|
||||
border-bottom-color: #e0e0e0;
|
||||
@ -268,7 +272,7 @@ pre.rust .question-mark {
|
||||
}
|
||||
|
||||
a.test-arrow {
|
||||
background-color: rgba(78, 139, 202, 0.2);
|
||||
background-color: rgb(78, 139, 202, 0.2);
|
||||
}
|
||||
|
||||
a.test-arrow:hover{
|
||||
@ -285,7 +289,7 @@ a.test-arrow:hover{
|
||||
}
|
||||
|
||||
:target {
|
||||
border-right: 3px solid #ffb44c;
|
||||
border-right: 3px solid #AD7C37;
|
||||
}
|
||||
|
||||
pre.compile_fail {
|
||||
@ -337,7 +341,7 @@ pre.ignore:hover, .information:hover + pre.ignore {
|
||||
}
|
||||
|
||||
.search-failed a {
|
||||
color: #0089ff;
|
||||
color: #3873AD;
|
||||
}
|
||||
|
||||
.tooltip::after {
|
||||
@ -374,18 +378,18 @@ pre.ignore:hover, .information:hover + pre.ignore {
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.sidebar-menu {
|
||||
background-color: #F1F1F1;
|
||||
background-color: #F5F5F5;
|
||||
border-bottom-color: #e0e0e0;
|
||||
border-right-color: #e0e0e0;
|
||||
}
|
||||
|
||||
.sidebar-elems {
|
||||
background-color: #F1F1F1;
|
||||
background-color: #F5F5F5;
|
||||
border-right-color: #000;
|
||||
}
|
||||
|
||||
#sidebar-filler {
|
||||
background-color: #F1F1F1;
|
||||
background-color: #F5F5F5;
|
||||
border-bottom-color: #e0e0e0;
|
||||
}
|
||||
}
|
||||
@ -453,13 +457,13 @@ kbd {
|
||||
}
|
||||
|
||||
#sidebar-toggle {
|
||||
background-color: #F1F1F1;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
#sidebar-toggle:hover {
|
||||
background-color: #E0E0E0;
|
||||
}
|
||||
#source-sidebar {
|
||||
background-color: #F1F1F1;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
#source-sidebar > .title {
|
||||
border-bottom-color: #ccc;
|
||||
|
@ -8,6 +8,7 @@
|
||||
// build-pass (FIXME(62277): could be check-pass?)
|
||||
// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
|
||||
// compile-flags: -Z query-dep-graph
|
||||
// needs-asm-support
|
||||
// [cfail1]compile-flags: -Zincremental-ignore-spans
|
||||
// [cfail2]compile-flags: -Zincremental-ignore-spans
|
||||
// [cfail3]compile-flags: -Zincremental-ignore-spans
|
||||
|
@ -1,4 +1,5 @@
|
||||
// revisions: rpass1 cfail1 rpass3
|
||||
// needs-asm-support
|
||||
// only-x86_64
|
||||
// Regression test for issue #72386
|
||||
// Checks that we don't ICE when switching to an invalid register
|
||||
|
@ -12,7 +12,7 @@ reload:
|
||||
|
||||
assert-css: ("#toggle-all-docs", {"color": "rgb(0, 0, 0)"})
|
||||
assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(0, 0, 0)"})
|
||||
assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(173, 68, 142)"})
|
||||
assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(173, 55, 138)"})
|
||||
assert-css: (".srclink", {"color": "rgb(0, 0, 0)"})
|
||||
assert-css: (".srclink", {"color": "rgb(0, 0, 0)"})
|
||||
|
||||
|
@ -37,8 +37,8 @@ assert-css: (
|
||||
{"font-weight": "400"},
|
||||
)
|
||||
|
||||
assert-count: (".methods .type", 1)
|
||||
assert-css: (".methods .type", {"font-weight": "600"})
|
||||
assert-count: (".methods .associatedtype", 1)
|
||||
assert-css: (".methods .associatedtype", {"font-weight": "600"})
|
||||
assert-count: (".methods .constant", 1)
|
||||
assert-css: (".methods .constant", {"font-weight": "600"})
|
||||
assert-css: (".methods .method", {"font-weight": "600"})
|
||||
|
@ -9,6 +9,16 @@ assert-attribute: (".top-doc", {"open": ""})
|
||||
click: (3, 280)
|
||||
assert-attribute: (".top-doc", {"open": ""})
|
||||
|
||||
// Assert the position of the toggle on the top doc block.
|
||||
assert-position: (".top-doc summary::before", {"x": 4})
|
||||
// Assert the position of the toggle on the impl block.
|
||||
assert-position: ("#implementations + details > summary::before", {"x": 4})
|
||||
// Assert the position of the toggle on a method.
|
||||
assert-position: (
|
||||
"#trait-implementations-list .impl-items .method-toggle > summary::before",
|
||||
{"x": 4},
|
||||
)
|
||||
|
||||
// Now we do the same but with a little bigger width
|
||||
size: (600, 600)
|
||||
assert-attribute: (".top-doc", {"open": ""})
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![crate_name = "foo"]
|
||||
|
||||
|
||||
pub trait Expression {
|
||||
type SqlType;
|
||||
}
|
||||
@ -11,5 +10,5 @@ pub trait AsExpression<T> {
|
||||
}
|
||||
|
||||
// @has foo/type.AsExprOf.html
|
||||
// @has - '//*[@class="rust typedef"]' 'type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;'
|
||||
// @has - '//pre[@class="rust typedef"]' 'type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;'
|
||||
pub type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;
|
||||
|
@ -6,9 +6,8 @@ pub trait MyTrait {
|
||||
fn defaulted_override(&self) {}
|
||||
}
|
||||
|
||||
|
||||
impl MyTrait for String {
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-1"]//a[@class="type"]/@href' #associatedtype.Assoc
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-1"]//a[@class="associatedtype"]/@href' #associatedtype.Assoc
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-1"]//a[@class="anchor"]/@href' #associatedtype.Assoc-1
|
||||
type Assoc = ();
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-1"]//a[@class="constant"]/@href' #associatedconstant.VALUE
|
||||
@ -23,7 +22,7 @@ impl MyTrait for String {
|
||||
}
|
||||
|
||||
impl MyTrait for Vec<u8> {
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-2"]//a[@class="type"]/@href' #associatedtype.Assoc
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-2"]//a[@class="associatedtype"]/@href' #associatedtype.Assoc
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-2"]//a[@class="anchor"]/@href' #associatedtype.Assoc-2
|
||||
type Assoc = ();
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-2"]//a[@class="constant"]/@href' #associatedconstant.VALUE
|
||||
@ -39,7 +38,7 @@ impl MyTrait for Vec<u8> {
|
||||
|
||||
impl MyTrait for MyStruct {
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="anchor"]/@href' #associatedtype.Assoc-3
|
||||
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="type"]/@href' trait.MyTrait.html#associatedtype.Assoc
|
||||
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="associatedtype"]/@href' trait.MyTrait.html#associatedtype.Assoc
|
||||
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="anchor"]/@href' #associatedtype.Assoc
|
||||
type Assoc = bool;
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-3
|
||||
|
24
src/test/ui/consts/invalid-union.32bit.stderr
Normal file
24
src/test/ui/consts/invalid-union.32bit.stderr
Normal file
@ -0,0 +1,24 @@
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/invalid-union.rs:41:1
|
||||
|
|
||||
LL | fn main() {
|
||||
| ^^^^^^^^^ type validation failed at .<deref>.y.<enum-variant(B)>.0: encountered `UnsafeCell` in a `const`
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 4, align: 4) {
|
||||
╾─alloc7──╼ │ ╾──╼
|
||||
}
|
||||
|
||||
error: erroneous constant used
|
||||
--> $DIR/invalid-union.rs:42:25
|
||||
|
|
||||
LL | let _: &'static _ = &C;
|
||||
| ^^ referenced constant has errors
|
||||
|
|
||||
= note: `#[deny(const_err)]` on by default
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
24
src/test/ui/consts/invalid-union.64bit.stderr
Normal file
24
src/test/ui/consts/invalid-union.64bit.stderr
Normal file
@ -0,0 +1,24 @@
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/invalid-union.rs:41:1
|
||||
|
|
||||
LL | fn main() {
|
||||
| ^^^^^^^^^ type validation failed at .<deref>.y.<enum-variant(B)>.0: encountered `UnsafeCell` in a `const`
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 8, align: 8) {
|
||||
╾───────alloc7────────╼ │ ╾──────╼
|
||||
}
|
||||
|
||||
error: erroneous constant used
|
||||
--> $DIR/invalid-union.rs:42:25
|
||||
|
|
||||
LL | let _: &'static _ = &C;
|
||||
| ^^ referenced constant has errors
|
||||
|
|
||||
= note: `#[deny(const_err)]` on by default
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
44
src/test/ui/consts/invalid-union.rs
Normal file
44
src/test/ui/consts/invalid-union.rs
Normal file
@ -0,0 +1,44 @@
|
||||
// Check that constants with interior mutability inside unions are rejected
|
||||
// during validation.
|
||||
//
|
||||
// Note that this test case relies on undefined behaviour to construct a
|
||||
// constant with interior mutability that is "invisible" to the static checks.
|
||||
// If for some reason this approach no longer works, it is should be fine to
|
||||
// remove the test case.
|
||||
//
|
||||
// build-fail
|
||||
// stderr-per-bitwidth
|
||||
#![feature(const_mut_refs)]
|
||||
#![feature(const_ptr_offset)]
|
||||
#![feature(untagged_unions)]
|
||||
use std::cell::Cell;
|
||||
|
||||
#[repr(C)]
|
||||
struct S {
|
||||
x: u32,
|
||||
y: E,
|
||||
}
|
||||
|
||||
#[repr(u32)]
|
||||
enum E {
|
||||
A,
|
||||
B(U)
|
||||
}
|
||||
|
||||
union U {
|
||||
cell: Cell<u32>,
|
||||
}
|
||||
|
||||
const C: S = {
|
||||
let s = S { x: 0, y: E::A };
|
||||
// Go through an &u32 reference which is definitely not allowed to mutate anything.
|
||||
let p = &s.x as *const u32 as *mut u32;
|
||||
// Change enum tag to E::B.
|
||||
unsafe { *p.add(1) = 1 };
|
||||
s
|
||||
};
|
||||
|
||||
fn main() { //~ ERROR it is undefined behavior to use this value
|
||||
let _: &'static _ = &C; //~ ERROR erroneous constant used
|
||||
//~^ WARN this was previously accepted
|
||||
}
|
Loading…
Reference in New Issue
Block a user