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 12 pull requests #78885

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
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
23a5c21
Fix a typo in a comment.
sunfishcode Oct 19, 2020
ce00b3e
Use `link` on platforms which lack `linkat`.
sunfishcode Oct 19, 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
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
8a8ee1a
inliner: Use substs_for_mir_body
tmiasko Nov 6, 2020
67d0db6
Fix handling of item names for HIR
jyn514 Oct 22, 2020
f60fd49
Remove unused `from_hir` call
jyn514 Nov 7, 2020
9dc5dfb
Fix tab focus on restyled switches
notriddle Nov 8, 2020
b13817a
Avoid overlapping cfg attributes when both macOS and aarch64
shepmaster Nov 8, 2020
3904617
Nicer hunk headers for rust files
bjorn3 Nov 8, 2020
a2c2720
Rollup merge of #77640 - ethanboxx:int_error_matching_attempt_2, r=Ko…
Dylan-DPC Nov 8, 2020
5bbefb2
Rollup merge of #78026 - sunfishcode:symlink-hard-link, r=dtolnay
Dylan-DPC Nov 8, 2020
b7b835e
Rollup merge of #78114 - jyn514:private, r=oli-obk
Dylan-DPC Nov 8, 2020
5071801
Rollup merge of #78228 - pietroalbini:finally, r=Mark-Simulacrum
Dylan-DPC Nov 8, 2020
7f28849
Rollup merge of #78345 - jyn514:proper-names, r=varkor
Dylan-DPC Nov 8, 2020
f9c2a5d
Rollup merge of #78437 - ssomers:btree_no_ord_at_node_level, r=Mark-S…
Dylan-DPC Nov 8, 2020
73d8af2
Rollup merge of #78476 - RalfJung:btree-alias, r=Mark-Simulacrum
Dylan-DPC Nov 8, 2020
1a949e7
Rollup merge of #78674 - tmiasko:inline-substs-for-mir-body, r=oli-obk
Dylan-DPC Nov 8, 2020
38bfdae
Rollup merge of #78790 - Gankra:rust-src-vendor, r=Mark-Simulacrum
Dylan-DPC Nov 8, 2020
7cc8ab3
Rollup merge of #78868 - notriddle:master, r=GuillaumeGomez
Dylan-DPC Nov 8, 2020
1385035
Rollup merge of #78878 - shepmaster:intersecting-ignores, r=Mark-Simu…
Dylan-DPC Nov 8, 2020
5cd011d
Rollup merge of #78882 - bjorn3:nicer_hunk_headers, r=Mark-Simulacrum
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
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* text=auto eol=lf
*.cpp rust
*.h rust
*.rs rust
*.rs rust diff=rust
*.fixed linguist-language=Rust
src/etc/installer/gfx/* binary
*.woff binary
Expand Down
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
12 changes: 5 additions & 7 deletions compiler/rustc_codegen_cranelift/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,11 @@ impl<'tcx, M: Module> FunctionCx<'_, 'tcx, M> {
where
T: TypeFoldable<'tcx> + Copy,
{
if let Some(substs) = self.instance.substs_for_mir_body() {
self.tcx
.subst_and_normalize_erasing_regions(substs, ty::ParamEnv::reveal_all(), value)
} else {
self.tcx
.normalize_erasing_regions(ty::ParamEnv::reveal_all(), *value)
}
self.instance.subst_mir_and_normalize_erasing_regions(
self.tcx,
ty::ParamEnv::reveal_all(),
value
)
}

pub(crate) fn clif_type(&self, ty: Ty<'tcx>) -> Option<Type> {
Expand Down
14 changes: 5 additions & 9 deletions compiler/rustc_codegen_ssa/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
T: Copy + TypeFoldable<'tcx>,
{
debug!("monomorphize: self.instance={:?}", self.instance);
if let Some(substs) = self.instance.substs_for_mir_body() {
self.cx.tcx().subst_and_normalize_erasing_regions(
substs,
ty::ParamEnv::reveal_all(),
&value,
)
} else {
self.cx.tcx().normalize_erasing_regions(ty::ParamEnv::reveal_all(), *value)
}
self.instance.subst_mir_and_normalize_erasing_regions(
self.cx.tcx(),
ty::ParamEnv::reveal_all(),
value,
)
}
}

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
27 changes: 25 additions & 2 deletions compiler/rustc_middle/src/ty/instance.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use crate::ty::print::{FmtPrinter, Printer};
use crate::ty::subst::InternalSubsts;
use crate::ty::subst::{InternalSubsts, Subst};
use crate::ty::{self, SubstsRef, Ty, TyCtxt, TypeFoldable};
use rustc_errors::ErrorReported;
use rustc_hir::def::Namespace;
Expand Down Expand Up @@ -470,10 +470,33 @@ impl<'tcx> Instance<'tcx> {
/// This function returns `Some(substs)` in the former case and `None` otherwise -- i.e., if
/// this function returns `None`, then the MIR body does not require substitution during
/// codegen.
pub fn substs_for_mir_body(&self) -> Option<SubstsRef<'tcx>> {
fn substs_for_mir_body(&self) -> Option<SubstsRef<'tcx>> {
if self.def.has_polymorphic_mir_body() { Some(self.substs) } else { None }
}

pub fn subst_mir<T>(&self, tcx: TyCtxt<'tcx>, v: &T) -> T
where
T: TypeFoldable<'tcx> + Copy,
{
if let Some(substs) = self.substs_for_mir_body() { v.subst(tcx, substs) } else { *v }
}

pub fn subst_mir_and_normalize_erasing_regions<T>(
&self,
tcx: TyCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
v: &T,
) -> T
where
T: TypeFoldable<'tcx> + Clone,
{
if let Some(substs) = self.substs_for_mir_body() {
tcx.subst_and_normalize_erasing_regions(substs, param_env, v)
} else {
tcx.normalize_erasing_regions(param_env, v.clone())
}
}

/// Returns a new `Instance` where generic parameters in `instance.substs` are replaced by
/// identify parameters if they are determined to be unused in `instance.def`.
pub fn polymorphize(self, tcx: TyCtxt<'tcx>) -> Self {
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
6 changes: 1 addition & 5 deletions compiler/rustc_mir/src/interpret/eval_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,11 +505,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
frame: &Frame<'mir, 'tcx, M::PointerTag, M::FrameExtra>,
value: T,
) -> T {
if let Some(substs) = frame.instance.substs_for_mir_body() {
self.tcx.subst_and_normalize_erasing_regions(substs, self.param_env, &value)
} else {
self.tcx.normalize_erasing_regions(self.param_env, value)
}
frame.instance.subst_mir_and_normalize_erasing_regions(*self.tcx, self.param_env, &value)
}

/// The `substs` are assumed to already be in our interpreter "universe" (param_env).
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_mir/src/monomorphize/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,11 +543,11 @@ impl<'a, 'tcx> MirNeighborCollector<'a, 'tcx> {
T: TypeFoldable<'tcx>,
{
debug!("monomorphize: self.instance={:?}", self.instance);
if let Some(substs) = self.instance.substs_for_mir_body() {
self.tcx.subst_and_normalize_erasing_regions(substs, ty::ParamEnv::reveal_all(), &value)
} else {
self.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), value)
}
self.instance.subst_mir_and_normalize_erasing_regions(
self.tcx,
ty::ParamEnv::reveal_all(),
&value,
)
}
}

Expand Down
Loading