Skip to content

Commit 04e9575

Browse files
committed
Auto merge of rust-lang#108771 - matthiaskrgr:rollup-whlvo2g, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#106440 (Ignore files in .gitignore in tidy) - rust-lang#108613 (Remove `llvm.skip-rebuild` option) - rust-lang#108616 (Sync codegen defaults with compiler defaults and add a ping message so they stay in sync) - rust-lang#108618 (Rename `src/etc/vscode_settings.json` to `rust_analyzer_settings.json`) - rust-lang#108626 (rustdoc-json: switch from HashMap to FxHashMap to fix non-determinism) - rust-lang#108744 (Don't ICE when encountering bound var in builtin copy/clone bounds) - rust-lang#108749 (Clean up rustdoc-js tester.js file) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 0d439f8 + 5219616 commit 04e9575

File tree

36 files changed

+231
-250
lines changed

36 files changed

+231
-250
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ no_llvm_build
4141
/inst/
4242
/llvm/
4343
/mingw-build/
44-
/build/
44+
build/
4545
/build-rust-analyzer/
4646
/dist/
4747
/unicode-downloads

Cargo.lock

+2
Original file line numberDiff line numberDiff line change
@@ -2287,6 +2287,7 @@ dependencies = [
22872287
"anyhow",
22882288
"clap 4.1.4",
22892289
"fs-err",
2290+
"rustc-hash",
22902291
"rustdoc-json-types",
22912292
"serde",
22922293
"serde_json",
@@ -4850,6 +4851,7 @@ dependencies = [
48504851
name = "rustdoc-json-types"
48514852
version = "0.1.0"
48524853
dependencies = [
4854+
"rustc-hash",
48534855
"serde",
48544856
"serde_json",
48554857
]

compiler/rustc_trait_selection/src/traits/select/mod.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -2149,7 +2149,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
21492149
ty::Alias(..) | ty::Param(_) | ty::Placeholder(..) => None,
21502150
ty::Infer(ty::TyVar(_)) => Ambiguous,
21512151

2152-
// We can make this an ICE if/once we actually instantiate the trait obligation.
2152+
// We can make this an ICE if/once we actually instantiate the trait obligation eagerly.
21532153
ty::Bound(..) => None,
21542154

21552155
ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
@@ -2257,7 +2257,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
22572257
}
22582258
}
22592259

2260-
ty::Adt(..) | ty::Alias(..) | ty::Param(..) => {
2260+
ty::Adt(..) | ty::Alias(..) | ty::Param(..) | ty::Placeholder(..) => {
22612261
// Fallback to whatever user-defined impls exist in this case.
22622262
None
22632263
}
@@ -2269,9 +2269,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
22692269
Ambiguous
22702270
}
22712271

2272-
ty::Placeholder(..)
2273-
| ty::Bound(..)
2274-
| ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
2272+
// We can make this an ICE if/once we actually instantiate the trait obligation eagerly.
2273+
ty::Bound(..) => None,
2274+
2275+
ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
22752276
bug!("asked to assemble builtin bounds of unexpected type: {:?}", self_ty);
22762277
}
22772278
}

config.toml.example

-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ changelog-seen = 2
4646
# Defaults to "if-available" when `channel = "dev"` and "false" otherwise.
4747
#download-ci-llvm = "if-available"
4848

49-
# Indicates whether LLVM rebuild should be skipped when running bootstrap. If
50-
# this is `false` then the compiler's LLVM will be rebuilt whenever the built
51-
# version doesn't have the correct hash. If it is `true` then LLVM will never
52-
# be rebuilt. The default value is `false`.
53-
#skip-rebuild = false
54-
5549
# Indicates whether the LLVM build is a Release or Debug build
5650
#optimize = true
5751

src/bootstrap/config.rs

-9
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ pub struct Config {
112112
pub backtrace_on_ice: bool,
113113

114114
// llvm codegen options
115-
pub llvm_skip_rebuild: bool,
116115
pub llvm_assertions: bool,
117116
pub llvm_tests: bool,
118117
pub llvm_plugins: bool,
@@ -666,7 +665,6 @@ define_config! {
666665
define_config! {
667666
/// TOML representation of how the LLVM build is configured.
668667
struct Llvm {
669-
skip_rebuild: Option<bool> = "skip-rebuild",
670668
optimize: Option<bool> = "optimize",
671669
thin_lto: Option<bool> = "thin-lto",
672670
release_debuginfo: Option<bool> = "release-debuginfo",
@@ -1060,11 +1058,6 @@ impl Config {
10601058
config.mandir = install.mandir.map(PathBuf::from);
10611059
}
10621060

1063-
// We want the llvm-skip-rebuild flag to take precedence over the
1064-
// skip-rebuild config.toml option so we store it separately
1065-
// so that we can infer the right value
1066-
let mut llvm_skip_rebuild = flags.llvm_skip_rebuild;
1067-
10681061
// Store off these values as options because if they're not provided
10691062
// we'll infer default values for them later
10701063
let mut llvm_assertions = None;
@@ -1170,7 +1163,6 @@ impl Config {
11701163
llvm_assertions = llvm.assertions;
11711164
llvm_tests = llvm.tests;
11721165
llvm_plugins = llvm.plugins;
1173-
llvm_skip_rebuild = llvm_skip_rebuild.or(llvm.skip_rebuild);
11741166
set(&mut config.llvm_optimize, llvm.optimize);
11751167
set(&mut config.llvm_thin_lto, llvm.thin_lto);
11761168
set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
@@ -1324,7 +1316,6 @@ impl Config {
13241316
// Now that we've reached the end of our configuration, infer the
13251317
// default values for all options that we haven't otherwise stored yet.
13261318

1327-
config.llvm_skip_rebuild = llvm_skip_rebuild.unwrap_or(false);
13281319
config.llvm_assertions = llvm_assertions.unwrap_or(false);
13291320
config.llvm_tests = llvm_tests.unwrap_or(false);
13301321
config.llvm_plugins = llvm_plugins.unwrap_or(false);

src/bootstrap/defaults/config.codegen.toml

+2
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ debug-logging = true
1717
incremental = true
1818
# Print backtrace on internal compiler errors during bootstrap
1919
backtrace-on-ice = true
20+
# Make the compiler and standard library faster to build, at the expense of a ~20% runtime slowdown.
21+
lto = "off"

src/bootstrap/flags.rs

-13
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ pub struct Flags {
6767
// true => deny, false => warn
6868
pub deny_warnings: Option<bool>,
6969

70-
pub llvm_skip_rebuild: Option<bool>,
71-
7270
pub rust_profile_use: Option<String>,
7371
pub rust_profile_generate: Option<String>,
7472

@@ -249,14 +247,6 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
249247
opts.optopt("", "error-format", "rustc error format", "FORMAT");
250248
opts.optflag("", "json-output", "use message-format=json");
251249
opts.optopt("", "color", "whether to use color in cargo and rustc output", "STYLE");
252-
opts.optopt(
253-
"",
254-
"llvm-skip-rebuild",
255-
"whether rebuilding llvm should be skipped \
256-
a VALUE of TRUE indicates that llvm will not be rebuilt \
257-
VALUE overrides the skip-rebuild option in config.toml.",
258-
"VALUE",
259-
);
260250
opts.optopt(
261251
"",
262252
"rust-profile-generate",
@@ -714,9 +704,6 @@ Arguments:
714704
.collect::<Vec<_>>(),
715705
include_default_paths: matches.opt_present("include-default-paths"),
716706
deny_warnings: parse_deny_warnings(&matches),
717-
llvm_skip_rebuild: matches.opt_str("llvm-skip-rebuild").map(|s| s.to_lowercase()).map(
718-
|s| s.parse::<bool>().expect("`llvm-skip-rebuild` should be either true or false"),
719-
),
720707
color: matches
721708
.opt_get_default("color", Color::Auto)
722709
.expect("`color` should be `always`, `never`, or `auto`"),

src/bootstrap/native.rs

-9
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,6 @@ pub fn prebuilt_llvm_config(
108108
let stamp = out_dir.join("llvm-finished-building");
109109
let stamp = HashStamp::new(stamp, builder.in_tree_llvm_info.sha());
110110

111-
if builder.config.llvm_skip_rebuild && stamp.path.exists() {
112-
builder.info(
113-
"Warning: \
114-
Using a potentially stale build of LLVM; \
115-
This may not behave well.",
116-
);
117-
return Ok(res);
118-
}
119-
120111
if stamp.is_done() {
121112
if stamp.hash.is_none() {
122113
builder.info(

src/bootstrap/setup.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ pub enum Profile {
2424
None,
2525
}
2626

27-
/// A list of historical hashes of `src/etc/vscode_settings.json`.
27+
/// A list of historical hashes of `src/etc/rust_analyzer_settings.json`.
2828
/// New entries should be appended whenever this is updated so we can detect
2929
/// outdated vs. user-modified settings files.
3030
static SETTINGS_HASHES: &[&str] = &[
3131
"ea67e259dedf60d4429b6c349a564ffcd1563cf41c920a856d1f5b16b4701ac8",
3232
"56e7bf011c71c5d81e0bf42e84938111847a810eee69d906bba494ea90b51922",
3333
"af1b5efe196aed007577899db9dae15d6dbc923d6fa42fa0934e68617ba9bbe0",
3434
];
35-
static VSCODE_SETTINGS: &str = include_str!("../etc/vscode_settings.json");
35+
static RUST_ANALYZER_SETTINGS: &str = include_str!("../etc/rust_analyzer_settings.json");
3636

3737
impl Profile {
3838
fn include_path(&self, src_path: &Path) -> PathBuf {
@@ -489,7 +489,7 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
489489
Ok(())
490490
}
491491

492-
/// Sets up or displays `src/etc/vscode_settings.json`
492+
/// Sets up or displays `src/etc/rust_analyzer_settings.json`
493493
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
494494
pub struct Vscode;
495495

@@ -580,10 +580,10 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
580580
}
581581
_ => "Created",
582582
};
583-
fs::write(&vscode_settings, &VSCODE_SETTINGS)?;
583+
fs::write(&vscode_settings, &RUST_ANALYZER_SETTINGS)?;
584584
println!("{verb} `.vscode/settings.json`");
585585
} else {
586-
println!("\n{VSCODE_SETTINGS}");
586+
println!("\n{RUST_ANALYZER_SETTINGS}");
587587
}
588588
Ok(())
589589
}

src/bootstrap/setup/tests.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
use super::{SETTINGS_HASHES, VSCODE_SETTINGS};
1+
use super::{RUST_ANALYZER_SETTINGS, SETTINGS_HASHES};
22
use sha2::Digest;
33

44
#[test]
55
fn check_matching_settings_hash() {
66
let mut hasher = sha2::Sha256::new();
7-
hasher.update(&VSCODE_SETTINGS);
7+
hasher.update(&RUST_ANALYZER_SETTINGS);
88
let hash = hex::encode(hasher.finalize().as_slice());
99
assert_eq!(
1010
&hash,
1111
SETTINGS_HASHES.last().unwrap(),
12-
"Update `SETTINGS_HASHES` with the new hash of `src/etc/vscode_settings.json`"
12+
"Update `SETTINGS_HASHES` with the new hash of `src/etc/rust_analyzer_settings.json`"
1313
);
1414
}

src/doc/rustc/src/platform-support/armeb-unknown-linux-gnueabi.md

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ Therefore, you can build Rust with support for the target by adding it to the ta
2626
```toml
2727
[llvm]
2828
download-ci-llvm = false
29-
skip-rebuild = true
3029
optimize = true
3130
ninja = true
3231
targets = "ARM;X86"
File renamed without changes.

src/rustdoc-json-types/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ path = "lib.rs"
88

99
[dependencies]
1010
serde = { version = "1.0", features = ["derive"] }
11+
rustc-hash = "1.1.0"
1112

1213
[dev-dependencies]
1314
serde_json = "1.0"

src/rustdoc-json-types/lib.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
//! These types are the public API exposed through the `--output-format json` flag. The [`Crate`]
44
//! struct is the root of the JSON blob and all other items are contained within.
55
6-
use std::collections::HashMap;
7-
use std::path::PathBuf;
8-
6+
use rustc_hash::FxHashMap;
97
use serde::{Deserialize, Serialize};
8+
use std::path::PathBuf;
109

1110
/// rustdoc format-version.
1211
pub const FORMAT_VERSION: u32 = 24;
@@ -24,11 +23,11 @@ pub struct Crate {
2423
pub includes_private: bool,
2524
/// A collection of all items in the local crate as well as some external traits and their
2625
/// items that are referenced locally.
27-
pub index: HashMap<Id, Item>,
26+
pub index: FxHashMap<Id, Item>,
2827
/// Maps IDs to fully qualified paths and other info helpful for generating links.
29-
pub paths: HashMap<Id, ItemSummary>,
28+
pub paths: FxHashMap<Id, ItemSummary>,
3029
/// Maps `crate_id` of items to a crate name and html_root_url if it exists.
31-
pub external_crates: HashMap<u32, ExternalCrate>,
30+
pub external_crates: FxHashMap<u32, ExternalCrate>,
3231
/// A single version number to be used in the future when making backwards incompatible changes
3332
/// to the JSON output.
3433
pub format_version: u32,
@@ -54,8 +53,8 @@ pub struct ItemSummary {
5453
///
5554
/// Note that items can appear in multiple paths, and the one chosen is implementation
5655
/// defined. Currently, this is the full path to where the item was defined. Eg
57-
/// [`String`] is currently `["alloc", "string", "String"]` and [`HashMap`] is
58-
/// `["std", "collections", "hash", "map", "HashMap"]`, but this is subject to change.
56+
/// [`String`] is currently `["alloc", "string", "String"]` and [`HashMap`][`std::collections::HashMap`]
57+
/// is `["std", "collections", "hash", "map", "HashMap"]`, but this is subject to change.
5958
pub path: Vec<String>,
6059
/// Whether this item is a struct, trait, macro, etc.
6160
pub kind: ItemKind,
@@ -80,7 +79,7 @@ pub struct Item {
8079
/// Some("") if there is some documentation but it is empty (EG `#[doc = ""]`).
8180
pub docs: Option<String>,
8281
/// This mapping resolves [intra-doc links](https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md) from the docstring to their IDs
83-
pub links: HashMap<String, Id>,
82+
pub links: FxHashMap<String, Id>,
8483
/// Stringified versions of the attributes on this item (e.g. `"#[inline]"`)
8584
pub attrs: Vec<String>,
8685
pub deprecation: Option<Deprecation>,

src/tools/jsondoclint/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ edition = "2021"
99
anyhow = "1.0.62"
1010
clap = { version = "4.0.15", features = ["derive"] }
1111
fs-err = "2.8.1"
12+
rustc-hash = "1.1.0"
1213
rustdoc-json-types = { version = "0.1.0", path = "../../rustdoc-json-types" }
1314
serde = { version = "1.0", features = ["derive"] }
1415
serde_json = "1.0.85"

0 commit comments

Comments
 (0)