Skip to content

Commit

Permalink
Auto merge of #72120 - Dylan-DPC:rollup-ca0tur2, r=Dylan-DPC
Browse files Browse the repository at this point in the history
Rollup of 10 pull requests

Successful merges:

 - #72014 (Deprecated emoji)
 - #72019 (Fix debug assertion in error code)
 - #72027 (Use CDN for ci-caches on download)
 - #72044 (use min_specialization for some rustc crates where it requires no changes)
 - #72052 (display `ConstKind::Param`)
 - #72067 (Emit a warning when optimization fuel runs out)
 - #72072 (doc: minus (U+2212) instead of dash (U+002D) for negative infinity)
 - #72077 (Improve E0571 wording)
 - #72107 (Clean up E0579 explanation)
 - #72109 (Fix clippy warnings)

Failed merges:

r? @ghost
  • Loading branch information
bors committed May 11, 2020
2 parents 99cb9cc + dfa3677 commit 09c817e
Show file tree
Hide file tree
Showing 55 changed files with 178 additions and 125 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
CI_JOB_NAME: "${{ matrix.name }}"
SCCACHE_BUCKET: rust-lang-gha-caches
TOOLSTATE_REPO: "https://github.com/pietroalbini/rust-toolstate"
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
if: "github.event_name == 'pull_request'"
strategy:
matrix:
Expand Down Expand Up @@ -146,6 +147,7 @@ jobs:
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/try' && github.repository == 'rust-lang-ci/rust'"
strategy:
matrix:
Expand Down Expand Up @@ -255,6 +257,7 @@ jobs:
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:
matrix:
Expand Down Expand Up @@ -606,6 +609,7 @@ jobs:
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/master' && github.repository == 'rust-lang-ci/rust'"
steps:
- name: checkout the source code
Expand Down
10 changes: 6 additions & 4 deletions src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ dist=$objdir/build/dist

source "$ci_dir/shared.sh"

CACHE_DOMAIN="${CACHE_DOMAIN:-ci-caches.rust-lang.org}"

if [ -f "$docker_dir/$image/Dockerfile" ]; then
if [ "$CI" != "" ]; then
hash_key=/tmp/.docker-hash-key.txt
Expand All @@ -38,9 +40,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
cksum=$(sha512sum $hash_key | \
awk '{print $1}')

s3url="s3://$SCCACHE_BUCKET/docker/$cksum"
url="https://$SCCACHE_BUCKET.s3.amazonaws.com/docker/$cksum"
upload="aws s3 cp - $s3url"
url="https://$CACHE_DOMAIN/docker/$cksum"

echo "Attempting to download $url"
rm -f /tmp/rustci_docker_cache
Expand All @@ -65,7 +65,9 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
-f "$dockerfile" \
"$context"

if [ "$upload" != "" ]; then
if [ "$CI" != "" ]; then
s3url="s3://$SCCACHE_BUCKET/docker/$cksum"
upload="aws s3 cp - $s3url"
digest=$(docker inspect rust-ci --format '{{.Id}}')
echo "Built container $digest"
if ! grep -q "$digest" <(echo "$loaded_images"); then
Expand Down
2 changes: 2 additions & 0 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ x--expand-yaml-anchors--remove:
- &public-variables
SCCACHE_BUCKET: rust-lang-gha-caches
TOOLSTATE_REPO: https://github.com/pietroalbini/rust-toolstate
CACHE_DOMAIN: ci-caches-gha.rust-lang.org

- &prod-variables
SCCACHE_BUCKET: rust-lang-gha-caches
Expand All @@ -51,6 +52,7 @@ x--expand-yaml-anchors--remove:
# (caches, artifacts...).
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
CACHE_DOMAIN: ci-caches-gha.rust-lang.org

- &base-job
env: {}
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ impl f32 {
/// Infinity (∞).
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
pub const INFINITY: f32 = 1.0_f32 / 0.0_f32;
/// Negative infinity (-∞).
/// Negative infinity (∞).
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
pub const NEG_INFINITY: f32 = -1.0_f32 / 0.0_f32;

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ impl f64 {
/// Infinity (∞).
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
pub const INFINITY: f64 = 1.0_f64 / 0.0_f64;
/// Negative infinity (-∞).
/// Negative infinity (∞).
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
pub const NEG_INFINITY: f64 = -1.0_f64 / 0.0_f64;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_ast_lowering/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#![feature(array_value_iter)]
#![feature(crate_visibility_modifier)]
#![feature(marker_trait_attr)]
#![feature(specialization)]
#![feature(specialization)] // FIXME: min_specialization does not work
#![feature(or_patterns)]
#![recursion_limit = "256"]

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_attr/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ pub fn eval_condition(
[NestedMetaItem::Literal(Lit { span, .. })
| NestedMetaItem::MetaItem(MetaItem { span, .. })] => {
sess.span_diagnostic
.struct_span_err(*span, &*format!("expected a version literal"))
.struct_span_err(*span, "expected a version literal")
.emit();
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_data_structures/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#![feature(generators)]
#![feature(generator_trait)]
#![feature(fn_traits)]
#![feature(specialization)]
#![feature(min_specialization)]
#![feature(optin_builtin_traits)]
#![feature(nll)]
#![feature(allow_internal_unstable)]
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_data_structures/tiny_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl<T: PartialEq> TinyList<T> {
if &e.data == data {
return true;
}
elem = e.next.as_ref().map(|e| &**e);
elem = e.next.as_deref();
}
false
}
Expand All @@ -62,7 +62,7 @@ impl<T: PartialEq> TinyList<T> {
let (mut elem, mut count) = (self.head.as_ref(), 0);
while let Some(ref e) = elem {
count += 1;
elem = e.next.as_ref().map(|e| &**e);
elem = e.next.as_deref();
}
count
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_error_codes/error_codes/E0571.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Example of erroneous code:
# fn satisfied(n: usize) -> bool { n % 23 == 0 }
let result = while true {
if satisfied(i) {
break 2*i; // error: `break` with value from a `while` loop
break 2 * i; // error: `break` with value from a `while` loop
}
i += 1;
};
Expand All @@ -22,9 +22,9 @@ Make sure `break value;` statements only occur in `loop` loops:
```
# let mut i = 1;
# fn satisfied(n: usize) -> bool { n % 23 == 0 }
let result = loop { // ok!
let result = loop { // This is now a "loop" loop.
if satisfied(i) {
break 2*i;
break 2 * i; // ok!
}
i += 1;
};
Expand Down
10 changes: 6 additions & 4 deletions src/librustc_error_codes/error_codes/E0579.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
When matching against an exclusive range, the compiler verifies that the range
is non-empty. Exclusive range patterns include the start point but not the end
point, so this is equivalent to requiring the start of the range to be less
than the end of the range.
A lower range wasn't less than the upper range.

Erroneous code example:

Expand All @@ -17,3 +14,8 @@ fn main() {
}
}
```

When matching against an exclusive range, the compiler verifies that the range
is non-empty. Exclusive range patterns include the start point but not the end
point, so this is equivalent to requiring the start of the range to be less
than the end of the range.
2 changes: 1 addition & 1 deletion src/librustc_hir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#![feature(const_panic)]
#![feature(in_band_lifetimes)]
#![feature(or_patterns)]
#![feature(specialization)]
#![feature(min_specialization)]
#![recursion_limit = "256"]

#[macro_use]
Expand Down
5 changes: 2 additions & 3 deletions src/librustc_infer/traits/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ pub fn elaborate_predicates<'tcx>(
tcx: TyCtxt<'tcx>,
predicates: impl Iterator<Item = ty::Predicate<'tcx>>,
) -> Elaborator<'tcx> {
let obligations =
predicates.into_iter().map(|predicate| predicate_obligation(predicate, None)).collect();
let obligations = predicates.map(|predicate| predicate_obligation(predicate, None)).collect();
elaborate_obligations(tcx, obligations)
}

Expand Down Expand Up @@ -149,7 +148,7 @@ impl Elaborator<'tcx> {
// Get predicates declared on the trait.
let predicates = tcx.super_predicates_of(data.def_id());

let obligations = predicates.predicates.into_iter().map(|(pred, span)| {
let obligations = predicates.predicates.iter().map(|(pred, span)| {
predicate_obligation(
pred.subst_supertrait(tcx, &data.to_poly_trait_ref()),
Some(*span),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_interface/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl<'tcx> Queries<'tcx> {
let result = passes::register_plugins(
self.session(),
&*self.codegen_backend().metadata_loader(),
self.compiler.register_lints.as_ref().map(|p| &**p).unwrap_or_else(|| empty),
self.compiler.register_lints.as_deref().unwrap_or_else(|| empty),
krate,
&crate_name,
);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#![feature(nll)]
#![feature(or_patterns)]
#![feature(proc_macro_internals)]
#![feature(specialization)]
#![feature(specialization)] // FIXME: min_specialization ICEs
#![feature(stmt_expr_attributes)]
#![recursion_limit = "256"]

Expand Down
4 changes: 2 additions & 2 deletions src/librustc_middle/dep_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ impl rustc_query_system::dep_graph::DepKind for DepKind {
})
}

fn read_deps<OP>(op: OP) -> ()
fn read_deps<OP>(op: OP)
where
OP: for<'a> FnOnce(Option<&'a Lock<TaskDeps>>) -> (),
OP: for<'a> FnOnce(Option<&'a Lock<TaskDeps>>),
{
ty::tls::with_context_opt(|icx| {
let icx = if let Some(icx) = icx { icx } else { return };
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_middle/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ pub fn provide(providers: &mut Providers<'_>) {
&tcx.untracked_crate.modules[&module]
};
providers.hir_owner = |tcx, id| tcx.index_hir(LOCAL_CRATE).map[id].signature;
providers.hir_owner_nodes =
|tcx, id| tcx.index_hir(LOCAL_CRATE).map[id].with_bodies.as_ref().map(|nodes| &**nodes);
providers.hir_owner_nodes = |tcx, id| tcx.index_hir(LOCAL_CRATE).map[id].with_bodies.as_deref();
map::provide(providers);
}
2 changes: 1 addition & 1 deletion src/librustc_middle/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#![feature(option_expect_none)]
#![feature(or_patterns)]
#![feature(range_is_empty)]
#![feature(specialization)]
#![feature(specialization)] // FIXME: min_specialization does not work
#![feature(track_caller)]
#![feature(trusted_len)]
#![feature(vec_remove_item)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_middle/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ impl<'tcx> AssociatedItems<'tcx> {
&self,
name: Symbol,
) -> impl '_ + Iterator<Item = &ty::AssocItem> {
self.items.get_by_key(&name).map(|v| *v)
self.items.get_by_key(&name).copied()
}

/// Returns an iterator over all associated items with the given name.
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_middle/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,12 +701,14 @@ pub trait PrettyPrinter<'tcx>:
if self.tcx().sess.verbose() {
p!(write("{:?}", sz));
} else if let ty::ConstKind::Unevaluated(..) = sz.val {
// do not try to evaluate unevaluated constants. If we are const evaluating an
// Do not try to evaluate unevaluated constants. If we are const evaluating an
// array length anon const, rustc will (with debug assertions) print the
// constant's path. Which will end up here again.
p!(write("_"));
} else if let Some(n) = sz.val.try_to_bits(self.tcx().data_layout.pointer_size) {
p!(write("{}", n));
} else if let ty::ConstKind::Param(param) = sz.val {
p!(write("{}", param));
} else {
p!(write("_"));
}
Expand Down
5 changes: 1 addition & 4 deletions src/librustc_middle/ty/trait_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,7 @@ impl<'tcx> TyCtxt<'tcx> {
pub fn all_impls(self, def_id: DefId) -> impl Iterator<Item = DefId> + 'tcx {
let TraitImpls { blanket_impls, non_blanket_impls } = self.trait_impls_of(def_id);

blanket_impls
.into_iter()
.chain(non_blanket_impls.into_iter().map(|(_, v)| v).flatten())
.cloned()
blanket_impls.iter().chain(non_blanket_impls.iter().map(|(_, v)| v).flatten()).cloned()
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Rust MIR: a lowered representation of Rust.
#![feature(exhaustive_patterns)]
#![feature(iter_order_by)]
#![feature(never_type)]
#![feature(specialization)]
#![feature(min_specialization)]
#![feature(trusted_len)]
#![feature(try_blocks)]
#![feature(associated_type_bounds)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir_build/hair/pattern/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {
);
}

adt_defined_here(&mut cx, &mut err, pattern_ty, &witnesses);
adt_defined_here(&cx, &mut err, pattern_ty, &witnesses);
err.note(&format!("the matched value is of type `{}`", pattern_ty));
err.emit();
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir_build/hair/pattern/const_to_pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl<'a, 'tcx> ConstToPat<'a, 'tcx> {
)
}
traits::NonStructuralMatchTy::Dynamic => {
format!("trait objects cannot be used in patterns")
"trait objects cannot be used in patterns".to_string()
}
traits::NonStructuralMatchTy::Param => {
bug!("use of constant whose type is a parameter inside a pattern")
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_passes/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
if blk.targeted_by_break {
self.break_ln.insert(blk.hir_id, succ);
}
let succ = self.propagate_through_opt_expr(blk.expr.as_ref().map(|e| &**e), succ);
let succ = self.propagate_through_opt_expr(blk.expr.as_deref(), succ);
blk.stmts.iter().rev().fold(succ, |succ, stmt| self.propagate_through_stmt(stmt, succ))
}

Expand All @@ -952,7 +952,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
// initialization, which is mildly more complex than checking
// once at the func header but otherwise equivalent.

let succ = self.propagate_through_opt_expr(local.init.as_ref().map(|e| &**e), succ);
let succ = self.propagate_through_opt_expr(local.init.as_deref(), succ);
self.define_bindings_in_pat(&local.pat, succ)
}
hir::StmtKind::Item(..) => succ,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_passes/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
resolve_expr(self, ex);
}
fn visit_local(&mut self, l: &'tcx Local<'tcx>) {
resolve_local(self, Some(&l.pat), l.init.as_ref().map(|e| &**e));
resolve_local(self, Some(&l.pat), l.init.as_deref());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_query_system/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl<K: DepKind> DepNode<K> {
}
}

return dep_node;
dep_node
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc_query_system/dep_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ pub trait DepKind: Copy + fmt::Debug + Eq + Ord + Hash {
OP: FnOnce() -> R;

/// Access dependencies from current implicit context.
fn read_deps<OP>(op: OP) -> ()
fn read_deps<OP>(op: OP)
where
OP: for<'a> FnOnce(Option<&'a Lock<TaskDeps<Self>>>) -> ();
OP: for<'a> FnOnce(Option<&'a Lock<TaskDeps<Self>>>);

fn can_reconstruct_query_key(&self) -> bool;
}
2 changes: 1 addition & 1 deletion src/librustc_query_system/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![feature(const_panic)]
#![feature(core_intrinsics)]
#![feature(hash_raw_entry)]
#![feature(specialization)]
#![feature(specialization)] // FIXME: min_specialization rejects `default const`
#![feature(stmt_expr_attributes)]
#![feature(vec_remove_item)]

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_session/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ impl Session {
let mut fuel = self.optimization_fuel.lock();
ret = fuel.remaining != 0;
if fuel.remaining == 0 && !fuel.out_of_fuel {
eprintln!("optimization-fuel-exhausted: {}", msg());
self.warn(&format!("optimization-fuel-exhausted: {}", msg()));
fuel.out_of_fuel = true;
} else if fuel.remaining > 0 {
fuel.remaining -= 1;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_span/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#![feature(negative_impls)]
#![feature(nll)]
#![feature(optin_builtin_traits)]
#![feature(specialization)]
#![feature(min_specialization)]

// FIXME(#56935): Work around ICEs during cross-compilation.
#[allow(unused)]
Expand Down
Loading

0 comments on commit 09c817e

Please sign in to comment.