Skip to content

Rollup of 7 pull requests #117030

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

Merged
merged 15 commits into from
Oct 21, 2023
Merged
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: 0 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
@@ -3697,7 +3697,6 @@ version = "0.0.0"
dependencies = [
"arrayvec",
"bitflags 1.3.2",
"cfg-if",
"elsa",
"ena",
"indexmap 2.0.0",
@@ -4529,7 +4528,6 @@ dependencies = [
name = "rustc_span"
version = "0.0.0"
dependencies = [
"cfg-if",
"indexmap 2.0.0",
"md-5",
"rustc_arena",
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -11,6 +11,20 @@ standard library, and documentation.
If you wish to _contribute_ to the compiler, you should read
[CONTRIBUTING.md](CONTRIBUTING.md) instead.

<details>
<summary>Table of content</summary>

- [Quick Start](#quick-start)
- [Installing from Source](#installing-from-source)
- [Building Documentation](#building-documentation)
- [Notes](#notes)
- [Getting Help](#getting-help)
- [Contributing](#contributing)
- [License](#license)
- [Trademark](#trademark)

</details>

## Quick Start

Read ["Installation"] from [The Book].
1 change: 0 additions & 1 deletion compiler/rustc_data_structures/Cargo.toml
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@ edition = "2021"
[dependencies]
arrayvec = { version = "0.7", default-features = false }
bitflags = "1.2.1"
cfg-if = "1.0"
ena = "0.14.2"
indexmap = { version = "2.0.0" }
jobserver_crate = { version = "0.1.13", package = "jobserver" }
13 changes: 8 additions & 5 deletions compiler/rustc_data_structures/src/flock.rs
Original file line number Diff line number Diff line change
@@ -4,17 +4,20 @@
//! green/native threading. This is just a bare-bones enough solution for
//! librustdoc, it is not production quality at all.

cfg_if! {
if #[cfg(target_os = "linux")] {
cfg_match! {
cfg(target_os = "linux") => {
mod linux;
use linux as imp;
} else if #[cfg(unix)] {
}
cfg(unix) => {
mod unix;
use unix as imp;
} else if #[cfg(windows)] {
}
cfg(windows) => {
mod windows;
use self::windows as imp;
} else {
}
_ => {
mod unsupported;
use unsupported as imp;
}
33 changes: 17 additions & 16 deletions compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
@@ -6,43 +6,44 @@
//!
//! This API is completely unstable and subject to change.

// tidy-alphabetical-start
#![allow(internal_features)]
#![allow(rustc::default_hash_types)]
#![allow(rustc::potential_query_instability)]
#![cfg_attr(not(bootstrap), doc(rust_logo))]
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
#![deny(rustc::diagnostic_outside_of_impl)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(unsafe_op_in_unsafe_fn)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(allocator_api)]
#![feature(array_windows)]
#![feature(auto_traits)]
#![feature(cell_leak)]
#![feature(cfg_match)]
#![feature(core_intrinsics)]
#![feature(extend_one)]
#![feature(hash_raw_entry)]
#![feature(hasher_prefixfree_extras)]
#![feature(lazy_cell)]
#![feature(lint_reasons)]
#![feature(macro_metavar_expr)]
#![feature(maybe_uninit_uninit_array)]
#![feature(min_specialization)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(type_alias_impl_trait)]
#![feature(lazy_cell)]
#![feature(ptr_alignment_type)]
#![feature(rustc_attrs)]
#![feature(negative_impls)]
#![feature(strict_provenance)]
#![feature(test)]
#![feature(thread_id_value)]
#![feature(allocator_api)]
#![feature(lint_reasons)]
#![feature(type_alias_impl_trait)]
#![feature(unwrap_infallible)]
#![feature(strict_provenance)]
#![feature(ptr_alignment_type)]
#![feature(macro_metavar_expr)]
#![allow(rustc::default_hash_types)]
#![allow(rustc::potential_query_instability)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![allow(internal_features)]
#![deny(unsafe_op_in_unsafe_fn)]
// tidy-alphabetical-end

#[macro_use]
extern crate tracing;
#[macro_use]
extern crate cfg_if;
#[macro_use]
extern crate rustc_macros;

use std::fmt;
31 changes: 13 additions & 18 deletions compiler/rustc_data_structures/src/marker.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
cfg_if!(
if #[cfg(not(parallel_compiler))] {
cfg_match! {
cfg(not(parallel_compiler)) => {
pub auto trait DynSend {}
pub auto trait DynSync {}

impl<T> DynSend for T {}
impl<T> DynSync for T {}
} else {
}
_ => {
#[rustc_on_unimplemented(
message = "`{Self}` doesn't implement `DynSend`. \
Add it to `rustc_data_structures::marker` or use `IntoDynSyncSend` if it's already `Send`"
@@ -48,13 +49,10 @@ cfg_if!(
[std::io::StdoutLock<'_>]
[std::io::StderrLock<'_>]
);
cfg_if!(
// Consistent with `std`
// `os_imp::Env` is `!Send` in these platforms
if #[cfg(any(unix, target_os = "hermit", target_os = "wasi", target_os = "solid_asp3"))] {
impl !DynSend for std::env::VarsOs {}
}
);

#[cfg(any(unix, target_os = "hermit", target_os = "wasi", target_os = "solid_asp3"))]
// Consistent with `std`, `os_imp::Env` is `!Sync` in these platforms
impl !DynSend for std::env::VarsOs {}

macro_rules! already_send {
($([$ty: ty])*) => {
@@ -123,13 +121,10 @@ cfg_if!(
[std::sync::mpsc::Receiver<T> where T]
[std::sync::mpsc::Sender<T> where T]
);
cfg_if!(
// Consistent with `std`
// `os_imp::Env` is `!Sync` in these platforms
if #[cfg(any(unix, target_os = "hermit", target_os = "wasi", target_os = "solid_asp3"))] {
impl !DynSync for std::env::VarsOs {}
}
);

#[cfg(any(unix, target_os = "hermit", target_os = "wasi", target_os = "solid_asp3"))]
// Consistent with `std`, `os_imp::Env` is `!Sync` in these platforms
impl !DynSync for std::env::VarsOs {}

macro_rules! already_sync {
($([$ty: ty])*) => {
@@ -183,7 +178,7 @@ cfg_if!(
[thin_vec::ThinVec<T> where T: DynSync]
);
}
);
}

pub fn assert_dyn_sync<T: ?Sized + DynSync>() {}
pub fn assert_dyn_send<T: ?Sized + DynSend>() {}
13 changes: 8 additions & 5 deletions compiler/rustc_data_structures/src/profiling.rs
Original file line number Diff line number Diff line change
@@ -859,8 +859,8 @@ fn get_thread_id() -> u32 {
}

// Memory reporting
cfg_if! {
if #[cfg(windows)] {
cfg_match! {
cfg(windows) => {
pub fn get_resident_set_size() -> Option<usize> {
use std::mem;

@@ -885,7 +885,8 @@ cfg_if! {

Some(pmc.WorkingSetSize)
}
} else if #[cfg(target_os = "macos")] {
}
cfg(target_os = "macos") => {
pub fn get_resident_set_size() -> Option<usize> {
use libc::{c_int, c_void, getpid, proc_pidinfo, proc_taskinfo, PROC_PIDTASKINFO};
use std::mem;
@@ -903,7 +904,8 @@ cfg_if! {
}
}
}
} else if #[cfg(unix)] {
}
cfg(unix) => {
pub fn get_resident_set_size() -> Option<usize> {
let field = 1;
let contents = fs::read("/proc/self/statm").ok()?;
@@ -912,7 +914,8 @@ cfg_if! {
let npages = s.parse::<usize>().ok()?;
Some(npages * 4096)
}
} else {
}
_ => {
pub fn get_resident_set_size() -> Option<usize> {
None
}
7 changes: 4 additions & 3 deletions compiler/rustc_data_structures/src/sync.rs
Original file line number Diff line number Diff line change
@@ -109,8 +109,8 @@ mod mode {

pub use mode::{is_dyn_thread_safe, set_dyn_thread_safe_mode};

cfg_if! {
if #[cfg(not(parallel_compiler))] {
cfg_match! {
cfg(not(parallel_compiler)) => {
use std::ops::Add;
use std::cell::Cell;

@@ -251,7 +251,8 @@ cfg_if! {
MTLock(self.0.clone())
}
}
} else {
}
_ => {
pub use std::marker::Send as Send;
pub use std::marker::Sync as Sync;

1 change: 1 addition & 0 deletions compiler/rustc_expand/messages.ftl
Original file line number Diff line number Diff line change
@@ -86,6 +86,7 @@ expand_module_circular =
expand_module_file_not_found =
file not found for module `{$name}`
.help = to create the module `{$name}`, create file "{$default_path}" or "{$secondary_path}"
.note = if there is a `mod {$name}` elsewhere in the crate already, import it with `use crate::...` instead

expand_module_in_block =
cannot declare a non-inline module inside a block unless it has a path attribute
1 change: 1 addition & 0 deletions compiler/rustc_expand/src/errors.rs
Original file line number Diff line number Diff line change
@@ -350,6 +350,7 @@ pub(crate) struct ModuleInBlockName {
#[derive(Diagnostic)]
#[diag(expand_module_file_not_found, code = "E0583")]
#[help]
#[note]
pub(crate) struct ModuleFileNotFound {
#[primary_span]
pub span: Span,
1 change: 0 additions & 1 deletion compiler/rustc_span/Cargo.toml
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@ rustc_index = { path = "../rustc_index" }
rustc_arena = { path = "../rustc_arena" }
scoped-tls = "1.0"
unicode-width = "0.1.4"
cfg-if = "1.0"
tracing = "0.1"
sha1 = "0.10.0"
sha2 = "0.10.1"
8 changes: 4 additions & 4 deletions compiler/rustc_span/src/analyze_source_file.rs
Original file line number Diff line number Diff line change
@@ -33,8 +33,8 @@ pub fn analyze_source_file(
(lines, multi_byte_chars, non_narrow_chars)
}

cfg_if::cfg_if! {
if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
cfg_match! {
cfg(any(target_arch = "x86", target_arch = "x86_64")) => {
fn analyze_source_file_dispatch(src: &str,
lines: &mut Vec<RelativeBytePos>,
multi_byte_chars: &mut Vec<MultiByteChar>,
@@ -172,8 +172,8 @@ cfg_if::cfg_if! {
non_narrow_chars);
}
}
} else {

}
_ => {
// The target (or compiler version) does not support SSE2 ...
fn analyze_source_file_dispatch(src: &str,
lines: &mut Vec<RelativeBytePos>,
21 changes: 12 additions & 9 deletions compiler/rustc_span/src/lib.rs
Original file line number Diff line number Diff line change
@@ -13,21 +13,24 @@
//!
//! This API is completely unstable and subject to change.

#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(not(bootstrap), doc(rust_logo))]
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
#![deny(rustc::diagnostic_outside_of_impl)]
#![deny(rustc::untranslatable_diagnostic)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(array_windows)]
#![feature(cfg_match)]
#![feature(if_let_guard)]
#![feature(negative_impls)]
#![feature(min_specialization)]
#![feature(rustc_attrs)]
#![feature(let_chains)]
#![feature(round_char_boundary)]
#![feature(read_buf)]
#![feature(min_specialization)]
#![feature(negative_impls)]
#![feature(new_uninit)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![allow(internal_features)]
#![feature(read_buf)]
#![feature(round_char_boundary)]
#![feature(rustc_attrs)]
// tidy-alphabetical-end

#[macro_use]
extern crate rustc_macros;
6 changes: 3 additions & 3 deletions compiler/rustc_target/src/asm/csky.rs
Original file line number Diff line number Diff line change
@@ -64,9 +64,9 @@ def_regs! {
r20: reg = ["r20","t4"],// feature high-register
r21: reg = ["r21","t5"],// feature high-register
r22: reg = ["r22","t6"],// feature high-register
r23: reg = ["r23","t7", "fp"],// feature high-register
r24: reg = ["r24","t8", "sop"],// feature high-register
r25: reg = ["r25","t9","tp", "bsp"],// feature high-register
r23: reg = ["r23","t7"],// feature high-register
r24: reg = ["r24","t8"],// feature high-register
r25: reg = ["r25","t9"],// feature high-register
f0: freg = ["fr0","vr0"],
f1: freg = ["fr1","vr1"],
f2: freg = ["fr2","vr2"],
2 changes: 1 addition & 1 deletion library/alloc/src/boxed.rs
Original file line number Diff line number Diff line change
@@ -207,7 +207,7 @@ impl<T> Box<T> {
/// ```
/// let five = Box::new(5);
/// ```
#[cfg(all(not(no_global_oom_handling)))]
#[cfg(not(no_global_oom_handling))]
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[must_use]
2 changes: 1 addition & 1 deletion src/doc/rustdoc/src/write-documentation/what-to-include.md
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ rustdoc --theme awesome.css src/lib.rs

Here is an example of a new theme, [Ayu].

[Ayu]: https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/static/css/themes/ayu.css
[Ayu]: https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/static/css/rustdoc.css#L2384-L2574
[API Guidelines]: https://rust-lang.github.io/api-guidelines/documentation.html#rustdoc-does-not-show-unhelpful-implementation-details-c-hidden
[Documentation tests]: documentation-tests.md
[on this blog]: https://blog.guillaume-gomez.fr/articles/2016-09-16+Generating+doc+with+rustdoc+and+a+custom+theme
1 change: 1 addition & 0 deletions tests/run-make/unknown-mod-stdin/unknown-mod.stderr
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ error[E0583]: file not found for module `unknown`
| ^^^^^^^^^^^^
|
= help: to create the module `unknown`, create file "unknown.rs" or "unknown/mod.rs"
= note: if there is a `mod unknown` elsewhere in the crate already, import it with `use crate::...` instead

error: aborting due to previous error

1 change: 1 addition & 0 deletions tests/ui/error-codes/E0583.stderr
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ LL | mod module_that_doesnt_exist;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: to create the module `module_that_doesnt_exist`, create file "$DIR/module_that_doesnt_exist.rs" or "$DIR/module_that_doesnt_exist/mod.rs"
= note: if there is a `mod module_that_doesnt_exist` elsewhere in the crate already, import it with `use crate::...` instead

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ LL | pub mod baz;
| ^^^^^^^^^^^^
|
= help: to create the module `baz`, create file "$DIR/auxiliary/foo/bar/baz.rs" or "$DIR/auxiliary/foo/bar/baz/mod.rs"
= note: if there is a `mod baz` elsewhere in the crate already, import it with `use crate::...` instead

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ LL | mod missing;
| ^^^^^^^^^^^^
|
= help: to create the module `missing`, create file "$DIR/foo/missing.rs" or "$DIR/foo/missing/mod.rs"
= note: if there is a `mod missing` elsewhere in the crate already, import it with `use crate::...` instead

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ LL | mod missing;
| ^^^^^^^^^^^^
|
= help: to create the module `missing`, create file "$DIR/foo_inline/inline/missing.rs" or "$DIR/foo_inline/inline/missing/mod.rs"
= note: if there is a `mod missing` elsewhere in the crate already, import it with `use crate::...` instead

error: aborting due to previous error

2 changes: 2 additions & 0 deletions tests/ui/modules/special_module_name.stderr
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ LL | mod lib;
| ^^^^^^^^
|
= help: to create the module `lib`, create file "$DIR/lib.rs" or "$DIR/lib/mod.rs"
= note: if there is a `mod lib` elsewhere in the crate already, import it with `use crate::...` instead

error[E0583]: file not found for module `main`
--> $DIR/special_module_name.rs:4:1
@@ -13,6 +14,7 @@ LL | mod main;
| ^^^^^^^^^
|
= help: to create the module `main`, create file "$DIR/main.rs" or "$DIR/main/mod.rs"
= note: if there is a `mod main` elsewhere in the crate already, import it with `use crate::...` instead

warning: found module declaration for lib.rs
--> $DIR/special_module_name.rs:1:1
1 change: 1 addition & 0 deletions tests/ui/parser/mod_file_not_exist.stderr
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ LL | mod not_a_real_file;
| ^^^^^^^^^^^^^^^^^^^^
|
= help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs" or "$DIR/not_a_real_file/mod.rs"
= note: if there is a `mod not_a_real_file` elsewhere in the crate already, import it with `use crate::...` instead

error[E0433]: failed to resolve: use of undeclared crate or module `mod_file_aux`
--> $DIR/mod_file_not_exist.rs:7:16
1 change: 1 addition & 0 deletions tests/ui/parser/mod_file_not_exist_windows.stderr
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ LL | mod not_a_real_file;
| ^^^^^^^^^^^^^^^^^^^^
|
= help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs" or "$DIR/not_a_real_file/mod.rs"
= note: if there is a `mod not_a_real_file` elsewhere in the crate already, import it with `use crate::...` instead

error[E0433]: failed to resolve: use of undeclared crate or module `mod_file_aux`
--> $DIR/mod_file_not_exist_windows.rs:7:16
1 change: 1 addition & 0 deletions tests/ui/parser/unsafe-mod.stderr
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ LL | unsafe mod n;
| ^^^^^^^^^^^^^
|
= help: to create the module `n`, create file "$DIR/n.rs" or "$DIR/n/mod.rs"
= note: if there is a `mod n` elsewhere in the crate already, import it with `use crate::...` instead

error: module cannot be declared unsafe
--> $DIR/unsafe-mod.rs:1:1
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ LL | mod řųśť;
| ^^^^^^^^^
|
= help: to create the module `řųśť`, create file "$DIR/řųśť.rs" or "$DIR/řųśť/mod.rs"
= note: if there is a `mod řųśť` elsewhere in the crate already, import it with `use crate::...` instead

error[E0754]: trying to load file for module `řųśť` with non-ascii identifier name
--> $DIR/mod_file_nonascii_forbidden.rs:1:5
18 changes: 10 additions & 8 deletions triagebot.toml
Original file line number Diff line number Diff line change
@@ -23,10 +23,10 @@ allow-unauthenticated = [
"needs-triage",
]

[review-submitted]
# This label is added when a "request changes" review is submitted.
reviewed_label = "S-waiting-on-author"
# These labels are removed when a "request changes" review is submitted.
[review-submitted]
# This label is added when a "request changes" review is submitted.
reviewed_label = "S-waiting-on-author"
# These labels are removed when a "request changes" review is submitted.
review_labels = ["S-waiting-on-review"]

[review-requested]
@@ -586,17 +586,19 @@ message = "`src/tools/x` was changed. Bump version of Cargo.toml in `src/tools/x
message = "Third-party dependency whitelist may have been modified! You must ensure that any new dependencies have compatible licenses before merging."
cc = ["@davidtwco", "@wesleywiser"]

[mentions."src/bootstrap/config.rs"]
message = "This PR changes `src/bootstrap/config.rs`. If appropriate, please also update `CONFIG_CHANGE_HISTORY` in `src/bootstrap/lib.rs` and `change-id` in `config.example.toml`."
[mentions."src/bootstrap/src/core/config"]
message = "This PR modifies `src/bootstrap/src/core/config`. If appropriate, please also update `CONFIG_CHANGE_HISTORY` in `src/bootstrap/src/lib.rs` and `change-id` in `config.example.toml`."
[mentions."src/bootstrap/defaults"]
message = "This PR modifies `src/bootstrap/defaults`. If appropriate, please also update `CONFIG_CHANGE_HISTORY` in `src/bootstrap/src/lib.rs` and `change-id` in `config.example.toml`."
[mentions."config.example.toml"]
message = "This PR changes `config.example.toml`. If appropriate, please also update `CONFIG_CHANGE_HISTORY` in `src/bootstrap/lib.rs` and `change-id` in `config.example.toml`."
message = "This PR changes `config.example.toml`. If appropriate, please also update `CONFIG_CHANGE_HISTORY` in `src/bootstrap/src/lib.rs` and `change-id` in `config.example.toml`."

[mentions."src/bootstrap/defaults/config.compiler.toml"]
message = "This PR changes src/bootstrap/defaults/config.compiler.toml. If appropriate, please also update `config.codegen.toml` so the defaults are in sync."
[mentions."src/bootstrap/defaults/config.codegen.toml"]
message = "This PR changes src/bootstrap/defaults/config.codegen.toml. If appropriate, please also update `config.compiler.toml` so the defaults are in sync."

[mentions."src/bootstrap/llvm.rs"]
[mentions."src/bootstrap/src/core/build_steps/llvm.rs"]
message = "This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp."

[mentions."tests/ui/deriving/deriving-all-codegen.stdout"]