Skip to content

Commit

Permalink
Auto merge of rust-lang#108771 - matthiaskrgr:rollup-whlvo2g, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

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
  • Loading branch information
bors committed Mar 5, 2023
2 parents 0d439f8 + 5219616 commit 04e9575
Show file tree
Hide file tree
Showing 36 changed files with 231 additions and 250 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ no_llvm_build
/inst/
/llvm/
/mingw-build/
/build/
build/
/build-rust-analyzer/
/dist/
/unicode-downloads
Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2287,6 +2287,7 @@ dependencies = [
"anyhow",
"clap 4.1.4",
"fs-err",
"rustc-hash",
"rustdoc-json-types",
"serde",
"serde_json",
Expand Down Expand Up @@ -4850,6 +4851,7 @@ dependencies = [
name = "rustdoc-json-types"
version = "0.1.0"
dependencies = [
"rustc-hash",
"serde",
"serde_json",
]
Expand Down
11 changes: 6 additions & 5 deletions compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2149,7 +2149,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
ty::Alias(..) | ty::Param(_) | ty::Placeholder(..) => None,
ty::Infer(ty::TyVar(_)) => Ambiguous,

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

ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
Expand Down Expand Up @@ -2257,7 +2257,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
}

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

ty::Placeholder(..)
| ty::Bound(..)
| ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
// We can make this an ICE if/once we actually instantiate the trait obligation eagerly.
ty::Bound(..) => None,

ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
bug!("asked to assemble builtin bounds of unexpected type: {:?}", self_ty);
}
}
Expand Down
6 changes: 0 additions & 6 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ changelog-seen = 2
# Defaults to "if-available" when `channel = "dev"` and "false" otherwise.
#download-ci-llvm = "if-available"

# Indicates whether LLVM rebuild should be skipped when running bootstrap. If
# this is `false` then the compiler's LLVM will be rebuilt whenever the built
# version doesn't have the correct hash. If it is `true` then LLVM will never
# be rebuilt. The default value is `false`.
#skip-rebuild = false

# Indicates whether the LLVM build is a Release or Debug build
#optimize = true

Expand Down
9 changes: 0 additions & 9 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ pub struct Config {
pub backtrace_on_ice: bool,

// llvm codegen options
pub llvm_skip_rebuild: bool,
pub llvm_assertions: bool,
pub llvm_tests: bool,
pub llvm_plugins: bool,
Expand Down Expand Up @@ -666,7 +665,6 @@ define_config! {
define_config! {
/// TOML representation of how the LLVM build is configured.
struct Llvm {
skip_rebuild: Option<bool> = "skip-rebuild",
optimize: Option<bool> = "optimize",
thin_lto: Option<bool> = "thin-lto",
release_debuginfo: Option<bool> = "release-debuginfo",
Expand Down Expand Up @@ -1060,11 +1058,6 @@ impl Config {
config.mandir = install.mandir.map(PathBuf::from);
}

// We want the llvm-skip-rebuild flag to take precedence over the
// skip-rebuild config.toml option so we store it separately
// so that we can infer the right value
let mut llvm_skip_rebuild = flags.llvm_skip_rebuild;

// Store off these values as options because if they're not provided
// we'll infer default values for them later
let mut llvm_assertions = None;
Expand Down Expand Up @@ -1170,7 +1163,6 @@ impl Config {
llvm_assertions = llvm.assertions;
llvm_tests = llvm.tests;
llvm_plugins = llvm.plugins;
llvm_skip_rebuild = llvm_skip_rebuild.or(llvm.skip_rebuild);
set(&mut config.llvm_optimize, llvm.optimize);
set(&mut config.llvm_thin_lto, llvm.thin_lto);
set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
Expand Down Expand Up @@ -1324,7 +1316,6 @@ impl Config {
// Now that we've reached the end of our configuration, infer the
// default values for all options that we haven't otherwise stored yet.

config.llvm_skip_rebuild = llvm_skip_rebuild.unwrap_or(false);
config.llvm_assertions = llvm_assertions.unwrap_or(false);
config.llvm_tests = llvm_tests.unwrap_or(false);
config.llvm_plugins = llvm_plugins.unwrap_or(false);
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/defaults/config.codegen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ debug-logging = true
incremental = true
# Print backtrace on internal compiler errors during bootstrap
backtrace-on-ice = true
# Make the compiler and standard library faster to build, at the expense of a ~20% runtime slowdown.
lto = "off"
13 changes: 0 additions & 13 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ pub struct Flags {
// true => deny, false => warn
pub deny_warnings: Option<bool>,

pub llvm_skip_rebuild: Option<bool>,

pub rust_profile_use: Option<String>,
pub rust_profile_generate: Option<String>,

Expand Down Expand Up @@ -249,14 +247,6 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
opts.optopt("", "error-format", "rustc error format", "FORMAT");
opts.optflag("", "json-output", "use message-format=json");
opts.optopt("", "color", "whether to use color in cargo and rustc output", "STYLE");
opts.optopt(
"",
"llvm-skip-rebuild",
"whether rebuilding llvm should be skipped \
a VALUE of TRUE indicates that llvm will not be rebuilt \
VALUE overrides the skip-rebuild option in config.toml.",
"VALUE",
);
opts.optopt(
"",
"rust-profile-generate",
Expand Down Expand Up @@ -714,9 +704,6 @@ Arguments:
.collect::<Vec<_>>(),
include_default_paths: matches.opt_present("include-default-paths"),
deny_warnings: parse_deny_warnings(&matches),
llvm_skip_rebuild: matches.opt_str("llvm-skip-rebuild").map(|s| s.to_lowercase()).map(
|s| s.parse::<bool>().expect("`llvm-skip-rebuild` should be either true or false"),
),
color: matches
.opt_get_default("color", Color::Auto)
.expect("`color` should be `always`, `never`, or `auto`"),
Expand Down
9 changes: 0 additions & 9 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,6 @@ pub fn prebuilt_llvm_config(
let stamp = out_dir.join("llvm-finished-building");
let stamp = HashStamp::new(stamp, builder.in_tree_llvm_info.sha());

if builder.config.llvm_skip_rebuild && stamp.path.exists() {
builder.info(
"Warning: \
Using a potentially stale build of LLVM; \
This may not behave well.",
);
return Ok(res);
}

if stamp.is_done() {
if stamp.hash.is_none() {
builder.info(
Expand Down
10 changes: 5 additions & 5 deletions src/bootstrap/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ pub enum Profile {
None,
}

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

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

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

Expand Down Expand Up @@ -580,10 +580,10 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
}
_ => "Created",
};
fs::write(&vscode_settings, &VSCODE_SETTINGS)?;
fs::write(&vscode_settings, &RUST_ANALYZER_SETTINGS)?;
println!("{verb} `.vscode/settings.json`");
} else {
println!("\n{VSCODE_SETTINGS}");
println!("\n{RUST_ANALYZER_SETTINGS}");
}
Ok(())
}
6 changes: 3 additions & 3 deletions src/bootstrap/setup/tests.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use super::{SETTINGS_HASHES, VSCODE_SETTINGS};
use super::{RUST_ANALYZER_SETTINGS, SETTINGS_HASHES};
use sha2::Digest;

#[test]
fn check_matching_settings_hash() {
let mut hasher = sha2::Sha256::new();
hasher.update(&VSCODE_SETTINGS);
hasher.update(&RUST_ANALYZER_SETTINGS);
let hash = hex::encode(hasher.finalize().as_slice());
assert_eq!(
&hash,
SETTINGS_HASHES.last().unwrap(),
"Update `SETTINGS_HASHES` with the new hash of `src/etc/vscode_settings.json`"
"Update `SETTINGS_HASHES` with the new hash of `src/etc/rust_analyzer_settings.json`"
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Therefore, you can build Rust with support for the target by adding it to the ta
```toml
[llvm]
download-ci-llvm = false
skip-rebuild = true
optimize = true
ninja = true
targets = "ARM;X86"
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/rustdoc-json-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ path = "lib.rs"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
rustc-hash = "1.1.0"

[dev-dependencies]
serde_json = "1.0"
17 changes: 8 additions & 9 deletions src/rustdoc-json-types/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
//! These types are the public API exposed through the `--output-format json` flag. The [`Crate`]
//! struct is the root of the JSON blob and all other items are contained within.
use std::collections::HashMap;
use std::path::PathBuf;

use rustc_hash::FxHashMap;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;

/// rustdoc format-version.
pub const FORMAT_VERSION: u32 = 24;
Expand All @@ -24,11 +23,11 @@ pub struct Crate {
pub includes_private: bool,
/// A collection of all items in the local crate as well as some external traits and their
/// items that are referenced locally.
pub index: HashMap<Id, Item>,
pub index: FxHashMap<Id, Item>,
/// Maps IDs to fully qualified paths and other info helpful for generating links.
pub paths: HashMap<Id, ItemSummary>,
pub paths: FxHashMap<Id, ItemSummary>,
/// Maps `crate_id` of items to a crate name and html_root_url if it exists.
pub external_crates: HashMap<u32, ExternalCrate>,
pub external_crates: FxHashMap<u32, ExternalCrate>,
/// A single version number to be used in the future when making backwards incompatible changes
/// to the JSON output.
pub format_version: u32,
Expand All @@ -54,8 +53,8 @@ pub struct ItemSummary {
///
/// Note that items can appear in multiple paths, and the one chosen is implementation
/// defined. Currently, this is the full path to where the item was defined. Eg
/// [`String`] is currently `["alloc", "string", "String"]` and [`HashMap`] is
/// `["std", "collections", "hash", "map", "HashMap"]`, but this is subject to change.
/// [`String`] is currently `["alloc", "string", "String"]` and [`HashMap`][`std::collections::HashMap`]
/// is `["std", "collections", "hash", "map", "HashMap"]`, but this is subject to change.
pub path: Vec<String>,
/// Whether this item is a struct, trait, macro, etc.
pub kind: ItemKind,
Expand All @@ -80,7 +79,7 @@ pub struct Item {
/// Some("") if there is some documentation but it is empty (EG `#[doc = ""]`).
pub docs: Option<String>,
/// 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
pub links: HashMap<String, Id>,
pub links: FxHashMap<String, Id>,
/// Stringified versions of the attributes on this item (e.g. `"#[inline]"`)
pub attrs: Vec<String>,
pub deprecation: Option<Deprecation>,
Expand Down
1 change: 1 addition & 0 deletions src/tools/jsondoclint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ edition = "2021"
anyhow = "1.0.62"
clap = { version = "4.0.15", features = ["derive"] }
fs-err = "2.8.1"
rustc-hash = "1.1.0"
rustdoc-json-types = { version = "0.1.0", path = "../../rustdoc-json-types" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.85"
Loading

0 comments on commit 04e9575

Please sign in to comment.