Skip to content
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

Rollup of 15 pull requests #78870

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
9412a89
Stabilize `Poll::is_ready` and `is_pending` as const
CDirkx Sep 2, 2020
ce1d5ed
Move const tests for `Poll` to `library\core`
CDirkx Sep 3, 2020
c027844
Fill in things needed to stabilize int_error_matching
eopb Oct 6, 2020
83d294f
Bring char along with InvalidDigit
eopb Oct 6, 2020
8eaf0de
Remove incorrect plural
eopb Oct 6, 2020
1e7e2e4
remove OnlySign in favour of InvalidDigit
eopb Oct 6, 2020
f233abb
Add comment to helper function
eopb Oct 7, 2020
91a9f83
Define `fs::hard_link` to not follow symlinks.
sunfishcode Oct 16, 2020
5e80c65
Bump version to 1.49.0
CDirkx Oct 16, 2020
23a5c21
Fix a typo in a comment.
sunfishcode Oct 19, 2020
ce00b3e
Use `link` on platforms which lack `linkat`.
sunfishcode Oct 19, 2020
628fb9f
make concurrency helper more pleasant to read
tshepang Oct 21, 2020
d0178b4
Make it platform-specific whether `hard_link` follows symlinks.
sunfishcode Oct 20, 2020
6249cda
Disable use of `linkat` on Android as well.
sunfishcode Oct 23, 2020
199c361
Fix spelling eror
eopb Oct 26, 2020
69c301f
Small reword
eopb Oct 26, 2020
75e6dee
asci -> ASCII
eopb Oct 26, 2020
ad2d93d
Apply suggested changes
eopb Oct 26, 2020
e750238
Fix typo
eopb Oct 26, 2020
e099138
BTreeMap: stop mistaking node for an orderly place
ssomers Oct 26, 2020
b0df3f7
fix some incorrect aliasing in the BTree
RalfJung Oct 28, 2020
39103ce
Fix run-make tests running when LLVM is disabled
bjorn3 Nov 3, 2020
5fc22f1
Add a tool to run `x.py` from any subdirectory
casey Nov 2, 2020
54a0a98
ci: gate on aarch64-gnu passing tests
pietroalbini Oct 22, 2020
1274fae
doc/rustc: promote aarch64-unknown-linux-gnu to tier 1
pietroalbini Oct 22, 2020
874cbb8
ci: build docs for aarch64-unknown-linux-gnu
pietroalbini Oct 22, 2020
eed0ceb
Recognize `private_intra_doc_links` as a lint
jyn514 Oct 19, 2020
47b21b8
Add PRIVATE_INTRA_DOC_LINKS to rustdoc special-casing
jyn514 Nov 5, 2020
dd68d0b
Vendor libtest's dependencies in the rust-src component
Gankra Nov 5, 2020
e8b5be5
Stabilize hint::spin_loop
pickfire Aug 30, 2020
020ed65
use single char patterns for split() (clippy::single_char_pattern)
matthiaskrgr Nov 7, 2020
5c8d25f
remove FIXME comment of #62277 in print_type_sizez ui tests
sasurau4 Nov 7, 2020
67d0db6
Fix handling of item names for HIR
jyn514 Oct 22, 2020
f60fd49
Remove unused `from_hir` call
jyn514 Nov 7, 2020
548e1b9
Rollup merge of #76097 - pickfire:stabilize-spin-loop, r=KodrAus
Dylan-DPC Nov 8, 2020
e22a27f
Rollup merge of #76227 - CDirkx:const-poll, r=KodrAus
Dylan-DPC Nov 8, 2020
a4d5d39
Rollup merge of #77640 - ethanboxx:int_error_matching_attempt_2, r=Ko…
Dylan-DPC Nov 8, 2020
3187ff7
Rollup merge of #78026 - sunfishcode:symlink-hard-link, r=dtolnay
Dylan-DPC Nov 8, 2020
74ff00d
Rollup merge of #78065 - tshepang:nits, r=dtolnay
Dylan-DPC Nov 8, 2020
e06e5c2
Rollup merge of #78114 - jyn514:private, r=oli-obk
Dylan-DPC Nov 8, 2020
5238cca
Rollup merge of #78228 - pietroalbini:finally, r=Mark-Simulacrum
Dylan-DPC Nov 8, 2020
fabf1d7
Rollup merge of #78345 - jyn514:proper-names, r=varkor
Dylan-DPC Nov 8, 2020
ed10eba
Rollup merge of #78437 - ssomers:btree_no_ord_at_node_level, r=Mark-S…
Dylan-DPC Nov 8, 2020
f53b71c
Rollup merge of #78476 - RalfJung:btree-alias, r=Mark-Simulacrum
Dylan-DPC Nov 8, 2020
e53a521
Rollup merge of #78570 - sasurau4:test/check-pass-print-type-size, r=…
Dylan-DPC Nov 8, 2020
c02d52b
Rollup merge of #78658 - casey:x, r=Mark-Simulacrum
Dylan-DPC Nov 8, 2020
4dbbc3c
Rollup merge of #78706 - bjorn3:fix_run_make_without_llvm, r=Mark-Sim…
Dylan-DPC Nov 8, 2020
c713b73
Rollup merge of #78790 - Gankra:rust-src-vendor, r=Mark-Simulacrum
Dylan-DPC Nov 8, 2020
2959ceb
Rollup merge of #78828 - matthiaskrgr:sing_chr, r=lcnr
Dylan-DPC Nov 8, 2020
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
115 changes: 5 additions & 110 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ jobs:
strategy:
matrix:
include:
- name: aarch64-gnu
os:
- self-hosted
- ARM64
- linux
- name: arm-android
os: ubuntu-latest-xl
env: {}
Expand Down Expand Up @@ -497,116 +502,6 @@ jobs:
AWS_ACCESS_KEY_ID: "${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}"
if: "success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')"
auto-fallible:
name: auto-fallible
env:
CI_JOB_NAME: "${{ matrix.name }}"
SCCACHE_BUCKET: rust-lang-gha-caches
DEPLOY_BUCKET: rust-lang-gha
TOOLSTATE_REPO: "https://github.com/pietroalbini/rust-toolstate"
TOOLSTATE_ISSUES_API_URL: "https://api.github.com/repos/pietroalbini/rust-toolstate/issues"
TOOLSTATE_PUBLISH: 1
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
if: "github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
strategy:
fail-fast: false
matrix:
include:
- name: aarch64-gnu
os:
- self-hosted
- ARM64
- linux
timeout-minutes: 600
runs-on: "${{ matrix.os }}"
steps:
- name: disable git crlf conversion
run: git config --global core.autocrlf false
- name: checkout the source code
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: configure the PR in which the error message will be posted
run: "echo \"[CI_PR_NUMBER=$num]\""
env:
num: "${{ github.event.number }}"
if: "success() && !env.SKIP_JOBS && github.event_name == 'pull_request'"
- name: add extra environment variables
run: src/ci/scripts/setup-environment.sh
env:
EXTRA_VARIABLES: "${{ toJson(matrix.env) }}"
if: success() && !env.SKIP_JOB
- name: decide whether to skip this job
run: src/ci/scripts/should-skip-this.sh
if: success() && !env.SKIP_JOB
- name: configure GitHub Actions to kill the build when outdated
uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.github_token }}"
if: "success() && !env.SKIP_JOB && github.ref != 'refs/heads/try'"
- name: collect CPU statistics
run: src/ci/scripts/collect-cpu-stats.sh
if: success() && !env.SKIP_JOB
- name: show the current environment
run: src/ci/scripts/dump-environment.sh
if: success() && !env.SKIP_JOB
- name: install awscli
run: src/ci/scripts/install-awscli.sh
if: success() && !env.SKIP_JOB
- name: install sccache
run: src/ci/scripts/install-sccache.sh
if: success() && !env.SKIP_JOB
- name: select Xcode
run: src/ci/scripts/select-xcode.sh
if: success() && !env.SKIP_JOB
- name: install clang
run: src/ci/scripts/install-clang.sh
if: success() && !env.SKIP_JOB
- name: install WIX
run: src/ci/scripts/install-wix.sh
if: success() && !env.SKIP_JOB
- name: ensure the build happens on a partition with enough space
run: src/ci/scripts/symlink-build-dir.sh
if: success() && !env.SKIP_JOB
- name: disable git crlf conversion
run: src/ci/scripts/disable-git-crlf-conversion.sh
if: success() && !env.SKIP_JOB
- name: install MSYS2
run: src/ci/scripts/install-msys2.sh
if: success() && !env.SKIP_JOB
- name: install MinGW
run: src/ci/scripts/install-mingw.sh
if: success() && !env.SKIP_JOB
- name: install ninja
run: src/ci/scripts/install-ninja.sh
if: success() && !env.SKIP_JOB
- name: enable ipv6 on Docker
run: src/ci/scripts/enable-docker-ipv6.sh
if: success() && !env.SKIP_JOB
- name: disable git crlf conversion
run: src/ci/scripts/disable-git-crlf-conversion.sh
if: success() && !env.SKIP_JOB
- name: checkout submodules
run: src/ci/scripts/checkout-submodules.sh
if: success() && !env.SKIP_JOB
- name: ensure line endings are correct
run: src/ci/scripts/verify-line-endings.sh
if: success() && !env.SKIP_JOB
- name: run the build
run: src/ci/scripts/run-build-from-ci.sh
env:
AWS_ACCESS_KEY_ID: "${{ env.CACHES_AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}"
TOOLSTATE_REPO_ACCESS_TOKEN: "${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}"
if: success() && !env.SKIP_JOB
- name: upload artifacts to S3
run: src/ci/scripts/upload-artifacts.sh
env:
AWS_ACCESS_KEY_ID: "${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}"
if: "success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')"
try:
name: try
env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ __pycache__/
/inst/
/llvm/
/mingw-build/
/src/tools/x/target
# Created by default with `src/ci/docker/run.sh`:
/obj/
/unicode-downloads
Expand Down
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ members = [
"src/tools/unicode-table-generator",
"src/tools/expand-yaml-anchors",
]

exclude = [
"build",
"compiler/rustc_codegen_cranelift",
# HACK(eddyb) This hardcodes the fact that our CI uses `/checkout/obj`.
"obj",
# The `x` binary is a thin wrapper that calls `x.py`, which initializes
# submodules, before which workspace members cannot be invoked because
# not all `Cargo.toml` files are available, so we exclude the `x` binary,
# so it can be invoked before the current checkout is set up.
"src/tools/x",
]

[profile.release.package.compiler_builtins]
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2677,6 +2677,9 @@ impl<'hir> Node<'hir> {
Node::TraitItem(TraitItem { ident, .. })
| Node::ImplItem(ImplItem { ident, .. })
| Node::ForeignItem(ForeignItem { ident, .. })
| Node::Field(StructField { ident, .. })
| Node::Variant(Variant { ident, .. })
| Node::MacroDef(MacroDef { ident, .. })
| Node::Item(Item { ident, .. }) => Some(*ident),
_ => None,
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2801,6 +2801,7 @@ declare_lint_pass! {
UNSTABLE_NAME_COLLISIONS,
IRREFUTABLE_LET_PATTERNS,
BROKEN_INTRA_DOC_LINKS,
PRIVATE_INTRA_DOC_LINKS,
INVALID_CODEBLOCK_ATTRIBUTES,
MISSING_CRATE_LEVEL_DOCS,
MISSING_DOC_CODE_EXAMPLES,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ impl<'hir> Map<'hir> {
}

pub fn get_if_local(&self, id: DefId) -> Option<Node<'hir>> {
id.as_local().map(|id| self.get(self.local_def_id_to_hir_id(id)))
id.as_local().and_then(|id| self.find(self.local_def_id_to_hir_id(id)))
}

pub fn get_generics(&self, id: DefId) -> Option<&'hir Generics<'hir>> {
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_middle/src/middle/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ fn update_limit(
.unwrap_or(attr.span);

let error_str = match e.kind() {
IntErrorKind::Overflow => "`limit` is too large",
IntErrorKind::PosOverflow => "`limit` is too large",
IntErrorKind::Empty => "`limit` must be a non-negative integer",
IntErrorKind::InvalidDigit => "not a valid integer",
IntErrorKind::Underflow => bug!("`limit` should never underflow"),
IntErrorKind::NegOverflow => {
bug!("`limit` should never negatively overflow")
}
IntErrorKind::Zero => bug!("zero is a valid `limit`"),
kind => bug!("unimplemented IntErrorKind variant: {:?}", kind),
};
Expand Down
63 changes: 43 additions & 20 deletions compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2795,10 +2795,50 @@ impl<'tcx> TyCtxt<'tcx> {
.filter(|item| item.kind == AssocKind::Fn && item.defaultness.has_value())
}

fn item_name_from_hir(self, def_id: DefId) -> Option<Ident> {
self.hir().get_if_local(def_id).and_then(|node| node.ident())
}

fn item_name_from_def_id(self, def_id: DefId) -> Option<Symbol> {
if def_id.index == CRATE_DEF_INDEX {
Some(self.original_crate_name(def_id.krate))
} else {
let def_key = self.def_key(def_id);
match def_key.disambiguated_data.data {
// The name of a constructor is that of its parent.
rustc_hir::definitions::DefPathData::Ctor => self.item_name_from_def_id(DefId {
krate: def_id.krate,
index: def_key.parent.unwrap(),
}),
_ => def_key.disambiguated_data.data.get_opt_name(),
}
}
}

/// Look up the name of an item across crates. This does not look at HIR.
///
/// When possible, this function should be used for cross-crate lookups over
/// [`opt_item_name`] to avoid invalidating the incremental cache. If you
/// need to handle items without a name, or HIR items that will not be
/// serialized cross-crate, or if you need the span of the item, use
/// [`opt_item_name`] instead.
///
/// [`opt_item_name`]: Self::opt_item_name
pub fn item_name(self, id: DefId) -> Symbol {
// Look at cross-crate items first to avoid invalidating the incremental cache
// unless we have to.
self.item_name_from_def_id(id).unwrap_or_else(|| {
bug!("item_name: no name for {:?}", self.def_path(id));
})
}

/// Look up the name and span of an item or [`Node`].
///
/// See [`item_name`][Self::item_name] for more information.
pub fn opt_item_name(self, def_id: DefId) -> Option<Ident> {
def_id
.as_local()
.and_then(|def_id| self.hir().get(self.hir().local_def_id_to_hir_id(def_id)).ident())
// Look at the HIR first so the span will be correct if this is a local item.
self.item_name_from_hir(def_id)
.or_else(|| self.item_name_from_def_id(def_id).map(Ident::with_dummy_span))
}

pub fn opt_associated_item(self, def_id: DefId) -> Option<&'tcx AssocItem> {
Expand Down Expand Up @@ -2921,23 +2961,6 @@ impl<'tcx> TyCtxt<'tcx> {
}
}

pub fn item_name(self, id: DefId) -> Symbol {
if id.index == CRATE_DEF_INDEX {
self.original_crate_name(id.krate)
} else {
let def_key = self.def_key(id);
match def_key.disambiguated_data.data {
// The name of a constructor is that of its parent.
rustc_hir::definitions::DefPathData::Ctor => {
self.item_name(DefId { krate: id.krate, index: def_key.parent.unwrap() })
}
_ => def_key.disambiguated_data.data.get_opt_name().unwrap_or_else(|| {
bug!("item_name: no name for {:?}", self.def_path(id));
}),
}
}
}

/// Returns the possibly-auto-generated MIR of a `(DefId, Subst)` pair.
pub fn instance_mir(self, instance: ty::InstanceDef<'tcx>) -> &'tcx Body<'tcx> {
match instance {
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_mir/src/transform/coverage/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ impl DebugOptions {
let mut counter_format = ExpressionFormat::default();

if let Ok(env_debug_options) = std::env::var(RUSTC_COVERAGE_DEBUG_OPTIONS) {
for setting_str in env_debug_options.replace(" ", "").replace("-", "_").split(",") {
let mut setting = setting_str.splitn(2, "=");
for setting_str in env_debug_options.replace(" ", "").replace("-", "_").split(',') {
let mut setting = setting_str.splitn(2, '=');
match setting.next() {
Some(option) if option == "allow_unused_expressions" => {
allow_unused_expressions = bool_option_val(option, setting.next());
Expand Down Expand Up @@ -210,7 +210,7 @@ fn bool_option_val(option: &str, some_strval: Option<&str>) -> bool {

fn counter_format_option_val(strval: &str) -> ExpressionFormat {
let mut counter_format = ExpressionFormat { id: false, block: false, operation: false };
let components = strval.splitn(3, "+");
let components = strval.splitn(3, '+');
for component in components {
match component {
"id" => counter_format.id = true,
Expand Down Expand Up @@ -695,7 +695,7 @@ pub(crate) fn dump_coverage_graphviz(
let from_bcb_data = &basic_coverage_blocks[from_bcb];
let from_terminator = from_bcb_data.terminator(mir_body);
let mut edge_labels = from_terminator.kind.fmt_successor_labels();
edge_labels.retain(|label| label.to_string() != "unreachable");
edge_labels.retain(|label| label != "unreachable");
let edge_counters = from_terminator
.successors()
.map(|&successor_bb| graphviz_data.get_edge_counter(from_bcb, successor_bb));
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/util/generic_graphviz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl<
where
W: Write,
{
let lines = label.split("\n").map(|s| dot::escape_html(s)).collect::<Vec<_>>();
let lines = label.split('\n').map(|s| dot::escape_html(s)).collect::<Vec<_>>();
let escaped_label = lines.join(r#"<br align="left"/>"#);
writeln!(w, r#" label=<<br/><br/>{}<br align="left"/><br/><br/><br/>>;"#, escaped_label)
}
Expand Down
26 changes: 22 additions & 4 deletions library/alloc/src/collections/btree/map/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn test_all_refs<'a, T: 'a>(dummy: &mut T, iter: impl Iterator<Item = &'a mut T>
}
}

impl<'a, K: 'a, V: 'a> BTreeMap<K, V> {
impl<K, V> BTreeMap<K, V> {
/// Panics if the map (or the code navigating it) is corrupted.
fn check(&self)
where
Expand All @@ -54,14 +54,14 @@ impl<'a, K: 'a, V: 'a> BTreeMap<K, V> {
assert!(root_node.ascend().is_err());
root_node.assert_back_pointers();

let counted = root_node.assert_ascending();
assert_eq!(self.length, counted);
assert_eq!(self.length, root_node.calc_length());

root_node.assert_min_len(if root_node.height() > 0 { 1 } else { 0 });
} else {
assert_eq!(self.length, 0);
}

self.assert_ascending();
}

/// Returns the height of the root, if any.
Expand All @@ -79,10 +79,28 @@ impl<'a, K: 'a, V: 'a> BTreeMap<K, V> {
String::from("not yet allocated")
}
}

/// Asserts that the keys are in strictly ascending order.
fn assert_ascending(&self)
where
K: Copy + Debug + Ord,
{
let mut num_seen = 0;
let mut keys = self.keys();
if let Some(mut previous) = keys.next() {
num_seen = 1;
for next in keys {
assert!(previous < next, "{:?} >= {:?}", previous, next);
previous = next;
num_seen += 1;
}
}
assert_eq!(num_seen, self.len());
}
}

impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal> {
pub fn assert_min_len(self, min_len: usize) {
fn assert_min_len(self, min_len: usize) {
assert!(self.len() >= min_len, "{} < {}", self.len(), min_len);
if let node::ForceResult::Internal(node) = self.force() {
for idx in 0..=node.len() {
Expand Down
12 changes: 8 additions & 4 deletions library/alloc/src/collections/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1608,15 +1608,19 @@ pub mod marker {

unsafe fn slice_insert<T>(slice: &mut [T], idx: usize, val: T) {
unsafe {
ptr::copy(slice.as_ptr().add(idx), slice.as_mut_ptr().add(idx + 1), slice.len() - idx);
ptr::write(slice.get_unchecked_mut(idx), val);
let len = slice.len();
let slice_ptr = slice.as_mut_ptr();
ptr::copy(slice_ptr.add(idx), slice_ptr.add(idx + 1), len - idx);
ptr::write(slice_ptr.add(idx), val);
}
}

unsafe fn slice_remove<T>(slice: &mut [T], idx: usize) -> T {
unsafe {
let ret = ptr::read(slice.get_unchecked(idx));
ptr::copy(slice.as_ptr().add(idx + 1), slice.as_mut_ptr().add(idx), slice.len() - idx - 1);
let len = slice.len();
let slice_ptr = slice.as_mut_ptr();
let ret = ptr::read(slice_ptr.add(idx));
ptr::copy(slice_ptr.add(idx + 1), slice_ptr.add(idx), len - idx - 1);
ret
}
}
Expand Down
Loading