Skip to content

Commit e612ce9

Browse files
committed
Auto merge of #96824 - matthiaskrgr:rollup-silw3ki, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #96336 (Link to correct `as_mut` in docs for `pointer::as_ref`) - #96586 (Add aliases for std::fs::canonicalize) - #96667 (Add regression test) - #96671 (Remove hard links from `env::current_exe` security example) - #96726 (Add regression and bug tests) - #96756 (Enable compiler-docs by default for `compiler`, `codegen`, and `tools` profiles) - #96757 (Don't constantly rebuild clippy on `x test src/tools/clippy`.) - #96769 (Remove `adx_target_feature` feature from active features list) - #96777 (Make the test `check-pass` not to produce a JSON file) - #96822 (Enforce quote rule for JS source code) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents ea92b08 + 20ade86 commit e612ce9

24 files changed

+237
-87
lines changed

compiler/rustc_feature/src/active.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ declare_features! (
244244

245245
// Unstable `#[target_feature]` directives.
246246
(active, aarch64_ver_target_feature, "1.27.0", Some(44839), None),
247-
(active, adx_target_feature, "1.32.0", Some(44839), None),
248247
(active, arm_target_feature, "1.27.0", Some(44839), None),
249248
(active, avx512_target_feature, "1.27.0", Some(44839), None),
250249
(active, bpf_target_feature, "1.54.0", Some(44839), None),

library/core/src/ptr/mut_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ impl<T: ?Sized> *mut T {
287287
/// For the mutable counterpart see [`as_mut`].
288288
///
289289
/// [`as_uninit_ref`]: #method.as_uninit_ref-1
290-
/// [`as_mut`]: #method.as_mut
290+
/// [`as_mut`]: #method.as_mut-1
291291
///
292292
/// # Safety
293293
///

library/std/src/env.rs

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -644,36 +644,23 @@ pub fn temp_dir() -> PathBuf {
644644
///
645645
/// # Security
646646
///
647-
/// The output of this function should not be used in anything that might have
648-
/// security implications. For example:
649-
///
650-
/// ```
651-
/// fn main() {
652-
/// println!("{:?}", std::env::current_exe());
653-
/// }
654-
/// ```
655-
///
656-
/// On Linux systems, if this is compiled as `foo`:
657-
///
658-
/// ```bash
659-
/// $ rustc foo.rs
660-
/// $ ./foo
661-
/// Ok("/home/alex/foo")
662-
/// ```
663-
///
664-
/// And you make a hard link of the program:
665-
///
666-
/// ```bash
667-
/// $ ln foo bar
668-
/// ```
669-
///
670-
/// When you run it, you won’t get the path of the original executable, you’ll
671-
/// get the path of the hard link:
672-
///
673-
/// ```bash
674-
/// $ ./bar
675-
/// Ok("/home/alex/bar")
676-
/// ```
647+
/// The output of this function should not be trusted for anything
648+
/// that might have security implications. Basically, if users can run
649+
/// the executable, they can change the output arbitrarily.
650+
///
651+
/// As an example, you can easily introduce a race condition. It goes
652+
/// like this:
653+
///
654+
/// 1. You get the path to the current executable using `current_exe()`, and
655+
/// store it in a variable.
656+
/// 2. Time passes. A malicious actor removes the current executable, and
657+
/// replaces it with a malicious one.
658+
/// 3. You then use the stored path to re-execute the current
659+
/// executable.
660+
///
661+
/// You expected to safely execute the current executable, but you're
662+
/// instead executing something completely different. The code you
663+
/// just executed run with your privileges.
677664
///
678665
/// This sort of behavior has been known to [lead to privilege escalation] when
679666
/// used incorrectly.

library/std/src/fs.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,6 +1930,8 @@ pub fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
19301930
/// Ok(())
19311931
/// }
19321932
/// ```
1933+
#[doc(alias = "realpath")]
1934+
#[doc(alias = "GetFinalPathNameByHandle")]
19331935
#[stable(feature = "fs_canonicalize", since = "1.5.0")]
19341936
pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
19351937
fs_imp::canonicalize(path.as_ref())

src/bootstrap/defaults/config.codegen.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# These defaults are meant for contributors to the compiler who modify codegen or LLVM
2+
[build]
3+
# Contributors working on the compiler will probably expect compiler docs to be generated.
4+
compiler-docs = true
5+
26
[llvm]
37
# This enables debug-assertions in LLVM,
48
# catching logic errors in codegen much earlier in the process.

src/bootstrap/defaults/config.compiler.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# These defaults are meant for contributors to the compiler who do not modify codegen or LLVM
2+
[build]
3+
# Contributors working on the compiler will probably expect compiler docs to be generated.
4+
compiler-docs = true
5+
26
[rust]
37
# This enables `RUSTC_LOG=debug`, avoiding confusing situations
48
# where adding `debug!()` appears to do nothing.

src/bootstrap/defaults/config.tools.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ download-rustc = "if-unchanged"
1414
[build]
1515
# Document with the in-tree rustdoc by default, since `download-rustc` makes it quick to compile.
1616
doc-stage = 2
17+
# Contributors working on tools will probably expect compiler docs to be generated, so they can figure out how to use the API.
18+
compiler-docs = true
1719

1820
[llvm]
1921
# Will download LLVM from CI if available on your platform.

src/bootstrap/test.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,8 +664,6 @@ impl Step for Clippy {
664664
&[],
665665
);
666666

667-
// clippy tests need to know about the stage sysroot
668-
cargo.env("SYSROOT", builder.sysroot(compiler));
669667
cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
670668
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
671669
let host_libs = builder.stage_out(compiler, Mode::ToolRustc).join(builder.cargo_dir());

src/bootstrap/tool.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@ pub fn prepare_tool_cargo(
250250
}
251251
}
252252

253+
// clippy tests need to know about the stage sysroot. Set them consistently while building to
254+
// avoid rebuilding when running tests.
255+
cargo.env("SYSROOT", builder.sysroot(compiler));
256+
253257
// if tools are using lzma we want to force the build script to build its
254258
// own copy
255259
cargo.env("LZMA_API_STATIC", "1");

src/librustdoc/html/static/.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ module.exports = {
1717
"error",
1818
"always"
1919
],
20+
"quotes": [
21+
"error",
22+
"double"
23+
],
2024
"no-var": ["error"],
2125
"prefer-const": ["error"],
2226
"prefer-arrow-callback": ["error"],

0 commit comments

Comments
 (0)