Skip to content

Commit 09c817e

Browse files
committed
Auto merge of rust-lang#72120 - Dylan-DPC:rollup-ca0tur2, r=Dylan-DPC
Rollup of 10 pull requests Successful merges: - rust-lang#72014 (Deprecated emoji) - rust-lang#72019 (Fix debug assertion in error code) - rust-lang#72027 (Use CDN for ci-caches on download) - rust-lang#72044 (use min_specialization for some rustc crates where it requires no changes) - rust-lang#72052 (display `ConstKind::Param`) - rust-lang#72067 (Emit a warning when optimization fuel runs out) - rust-lang#72072 (doc: minus (U+2212) instead of dash (U+002D) for negative infinity) - rust-lang#72077 (Improve E0571 wording) - rust-lang#72107 (Clean up E0579 explanation) - rust-lang#72109 (Fix clippy warnings) Failed merges: r? @ghost
2 parents 99cb9cc + dfa3677 commit 09c817e

File tree

55 files changed

+178
-125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+178
-125
lines changed

.github/workflows/ci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
CI_JOB_NAME: "${{ matrix.name }}"
3535
SCCACHE_BUCKET: rust-lang-gha-caches
3636
TOOLSTATE_REPO: "https://github.com/pietroalbini/rust-toolstate"
37+
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
3738
if: "github.event_name == 'pull_request'"
3839
strategy:
3940
matrix:
@@ -146,6 +147,7 @@ jobs:
146147
TOOLSTATE_PUBLISH: 1
147148
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
148149
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
150+
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
149151
if: "github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
150152
strategy:
151153
matrix:
@@ -255,6 +257,7 @@ jobs:
255257
TOOLSTATE_PUBLISH: 1
256258
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
257259
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
260+
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
258261
if: "github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
259262
strategy:
260263
matrix:
@@ -606,6 +609,7 @@ jobs:
606609
TOOLSTATE_PUBLISH: 1
607610
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
608611
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
612+
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
609613
if: "github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'"
610614
steps:
611615
- name: checkout the source code

src/ci/docker/run.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ dist=$objdir/build/dist
1717

1818
source "$ci_dir/shared.sh"
1919

20+
CACHE_DOMAIN="${CACHE_DOMAIN:-ci-caches.rust-lang.org}"
21+
2022
if [ -f "$docker_dir/$image/Dockerfile" ]; then
2123
if [ "$CI" != "" ]; then
2224
hash_key=/tmp/.docker-hash-key.txt
@@ -38,9 +40,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
3840
cksum=$(sha512sum $hash_key | \
3941
awk '{print $1}')
4042

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

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

68-
if [ "$upload" != "" ]; then
68+
if [ "$CI" != "" ]; then
69+
s3url="s3://$SCCACHE_BUCKET/docker/$cksum"
70+
upload="aws s3 cp - $s3url"
6971
digest=$(docker inspect rust-ci --format '{{.Id}}')
7072
echo "Built container $digest"
7173
if ! grep -q "$digest" <(echo "$loaded_images"); then

src/ci/github-actions/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ x--expand-yaml-anchors--remove:
3737
- &public-variables
3838
SCCACHE_BUCKET: rust-lang-gha-caches
3939
TOOLSTATE_REPO: https://github.com/pietroalbini/rust-toolstate
40+
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
4041

4142
- &prod-variables
4243
SCCACHE_BUCKET: rust-lang-gha-caches
@@ -51,6 +52,7 @@ x--expand-yaml-anchors--remove:
5152
# (caches, artifacts...).
5253
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
5354
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
55+
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
5456

5557
- &base-job
5658
env: {}

src/libcore/num/f32.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ impl f32 {
367367
/// Infinity (∞).
368368
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
369369
pub const INFINITY: f32 = 1.0_f32 / 0.0_f32;
370-
/// Negative infinity (-∞).
370+
/// Negative infinity (∞).
371371
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
372372
pub const NEG_INFINITY: f32 = -1.0_f32 / 0.0_f32;
373373

src/libcore/num/f64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ impl f64 {
366366
/// Infinity (∞).
367367
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
368368
pub const INFINITY: f64 = 1.0_f64 / 0.0_f64;
369-
/// Negative infinity (-∞).
369+
/// Negative infinity (∞).
370370
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
371371
pub const NEG_INFINITY: f64 = -1.0_f64 / 0.0_f64;
372372

src/librustc_ast_lowering/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#![feature(array_value_iter)]
3434
#![feature(crate_visibility_modifier)]
3535
#![feature(marker_trait_attr)]
36-
#![feature(specialization)]
36+
#![feature(specialization)] // FIXME: min_specialization does not work
3737
#![feature(or_patterns)]
3838
#![recursion_limit = "256"]
3939

src/librustc_attr/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ pub fn eval_condition(
634634
[NestedMetaItem::Literal(Lit { span, .. })
635635
| NestedMetaItem::MetaItem(MetaItem { span, .. })] => {
636636
sess.span_diagnostic
637-
.struct_span_err(*span, &*format!("expected a version literal"))
637+
.struct_span_err(*span, "expected a version literal")
638638
.emit();
639639
return false;
640640
}

src/librustc_data_structures/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#![feature(generators)]
1313
#![feature(generator_trait)]
1414
#![feature(fn_traits)]
15-
#![feature(specialization)]
15+
#![feature(min_specialization)]
1616
#![feature(optin_builtin_traits)]
1717
#![feature(nll)]
1818
#![feature(allow_internal_unstable)]

src/librustc_data_structures/tiny_list.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl<T: PartialEq> TinyList<T> {
5252
if &e.data == data {
5353
return true;
5454
}
55-
elem = e.next.as_ref().map(|e| &**e);
55+
elem = e.next.as_deref();
5656
}
5757
false
5858
}
@@ -62,7 +62,7 @@ impl<T: PartialEq> TinyList<T> {
6262
let (mut elem, mut count) = (self.head.as_ref(), 0);
6363
while let Some(ref e) = elem {
6464
count += 1;
65-
elem = e.next.as_ref().map(|e| &**e);
65+
elem = e.next.as_deref();
6666
}
6767
count
6868
}

src/librustc_error_codes/error_codes/E0571.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Example of erroneous code:
77
# fn satisfied(n: usize) -> bool { n % 23 == 0 }
88
let result = while true {
99
if satisfied(i) {
10-
break 2*i; // error: `break` with value from a `while` loop
10+
break 2 * i; // error: `break` with value from a `while` loop
1111
}
1212
i += 1;
1313
};
@@ -22,9 +22,9 @@ Make sure `break value;` statements only occur in `loop` loops:
2222
```
2323
# let mut i = 1;
2424
# fn satisfied(n: usize) -> bool { n % 23 == 0 }
25-
let result = loop { // ok!
25+
let result = loop { // This is now a "loop" loop.
2626
if satisfied(i) {
27-
break 2*i;
27+
break 2 * i; // ok!
2828
}
2929
i += 1;
3030
};

src/librustc_error_codes/error_codes/E0579.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
When matching against an exclusive range, the compiler verifies that the range
2-
is non-empty. Exclusive range patterns include the start point but not the end
3-
point, so this is equivalent to requiring the start of the range to be less
4-
than the end of the range.
1+
A lower range wasn't less than the upper range.
52

63
Erroneous code example:
74

@@ -17,3 +14,8 @@ fn main() {
1714
}
1815
}
1916
```
17+
18+
When matching against an exclusive range, the compiler verifies that the range
19+
is non-empty. Exclusive range patterns include the start point but not the end
20+
point, so this is equivalent to requiring the start of the range to be less
21+
than the end of the range.

src/librustc_hir/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#![feature(const_panic)]
99
#![feature(in_band_lifetimes)]
1010
#![feature(or_patterns)]
11-
#![feature(specialization)]
11+
#![feature(min_specialization)]
1212
#![recursion_limit = "256"]
1313

1414
#[macro_use]

src/librustc_infer/traits/util.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ pub fn elaborate_predicates<'tcx>(
112112
tcx: TyCtxt<'tcx>,
113113
predicates: impl Iterator<Item = ty::Predicate<'tcx>>,
114114
) -> Elaborator<'tcx> {
115-
let obligations =
116-
predicates.into_iter().map(|predicate| predicate_obligation(predicate, None)).collect();
115+
let obligations = predicates.map(|predicate| predicate_obligation(predicate, None)).collect();
117116
elaborate_obligations(tcx, obligations)
118117
}
119118

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

152-
let obligations = predicates.predicates.into_iter().map(|(pred, span)| {
151+
let obligations = predicates.predicates.iter().map(|(pred, span)| {
153152
predicate_obligation(
154153
pred.subst_supertrait(tcx, &data.to_poly_trait_ref()),
155154
Some(*span),

src/librustc_interface/queries.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl<'tcx> Queries<'tcx> {
137137
let result = passes::register_plugins(
138138
self.session(),
139139
&*self.codegen_backend().metadata_loader(),
140-
self.compiler.register_lints.as_ref().map(|p| &**p).unwrap_or_else(|| empty),
140+
self.compiler.register_lints.as_deref().unwrap_or_else(|| empty),
141141
krate,
142142
&crate_name,
143143
);

src/librustc_metadata/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#![feature(nll)]
88
#![feature(or_patterns)]
99
#![feature(proc_macro_internals)]
10-
#![feature(specialization)]
10+
#![feature(specialization)] // FIXME: min_specialization ICEs
1111
#![feature(stmt_expr_attributes)]
1212
#![recursion_limit = "256"]
1313

src/librustc_middle/dep_graph/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ impl rustc_query_system::dep_graph::DepKind for DepKind {
7272
})
7373
}
7474

75-
fn read_deps<OP>(op: OP) -> ()
75+
fn read_deps<OP>(op: OP)
7676
where
77-
OP: for<'a> FnOnce(Option<&'a Lock<TaskDeps>>) -> (),
77+
OP: for<'a> FnOnce(Option<&'a Lock<TaskDeps>>),
7878
{
7979
ty::tls::with_context_opt(|icx| {
8080
let icx = if let Some(icx) = icx { icx } else { return };

src/librustc_middle/hir/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ pub fn provide(providers: &mut Providers<'_>) {
7878
&tcx.untracked_crate.modules[&module]
7979
};
8080
providers.hir_owner = |tcx, id| tcx.index_hir(LOCAL_CRATE).map[id].signature;
81-
providers.hir_owner_nodes =
82-
|tcx, id| tcx.index_hir(LOCAL_CRATE).map[id].with_bodies.as_ref().map(|nodes| &**nodes);
81+
providers.hir_owner_nodes = |tcx, id| tcx.index_hir(LOCAL_CRATE).map[id].with_bodies.as_deref();
8382
map::provide(providers);
8483
}

src/librustc_middle/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#![feature(option_expect_none)]
4242
#![feature(or_patterns)]
4343
#![feature(range_is_empty)]
44-
#![feature(specialization)]
44+
#![feature(specialization)] // FIXME: min_specialization does not work
4545
#![feature(track_caller)]
4646
#![feature(trusted_len)]
4747
#![feature(vec_remove_item)]

src/librustc_middle/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl<'tcx> AssociatedItems<'tcx> {
280280
&self,
281281
name: Symbol,
282282
) -> impl '_ + Iterator<Item = &ty::AssocItem> {
283-
self.items.get_by_key(&name).map(|v| *v)
283+
self.items.get_by_key(&name).copied()
284284
}
285285

286286
/// Returns an iterator over all associated items with the given name.

src/librustc_middle/ty/print/pretty.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -701,12 +701,14 @@ pub trait PrettyPrinter<'tcx>:
701701
if self.tcx().sess.verbose() {
702702
p!(write("{:?}", sz));
703703
} else if let ty::ConstKind::Unevaluated(..) = sz.val {
704-
// do not try to evaluate unevaluated constants. If we are const evaluating an
704+
// Do not try to evaluate unevaluated constants. If we are const evaluating an
705705
// array length anon const, rustc will (with debug assertions) print the
706706
// constant's path. Which will end up here again.
707707
p!(write("_"));
708708
} else if let Some(n) = sz.val.try_to_bits(self.tcx().data_layout.pointer_size) {
709709
p!(write("{}", n));
710+
} else if let ty::ConstKind::Param(param) = sz.val {
711+
p!(write("{}", param));
710712
} else {
711713
p!(write("_"));
712714
}

src/librustc_middle/ty/trait_def.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,7 @@ impl<'tcx> TyCtxt<'tcx> {
171171
pub fn all_impls(self, def_id: DefId) -> impl Iterator<Item = DefId> + 'tcx {
172172
let TraitImpls { blanket_impls, non_blanket_impls } = self.trait_impls_of(def_id);
173173

174-
blanket_impls
175-
.into_iter()
176-
.chain(non_blanket_impls.into_iter().map(|(_, v)| v).flatten())
177-
.cloned()
174+
blanket_impls.iter().chain(non_blanket_impls.iter().map(|(_, v)| v).flatten()).cloned()
178175
}
179176
}
180177

src/librustc_mir/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Rust MIR: a lowered representation of Rust.
1919
#![feature(exhaustive_patterns)]
2020
#![feature(iter_order_by)]
2121
#![feature(never_type)]
22-
#![feature(specialization)]
22+
#![feature(min_specialization)]
2323
#![feature(trusted_len)]
2424
#![feature(try_blocks)]
2525
#![feature(associated_type_bounds)]

src/librustc_mir_build/hair/pattern/check_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ impl<'tcx> MatchVisitor<'_, 'tcx> {
246246
);
247247
}
248248

249-
adt_defined_here(&mut cx, &mut err, pattern_ty, &witnesses);
249+
adt_defined_here(&cx, &mut err, pattern_ty, &witnesses);
250250
err.note(&format!("the matched value is of type `{}`", pattern_ty));
251251
err.emit();
252252
}

src/librustc_mir_build/hair/pattern/const_to_pat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'a, 'tcx> ConstToPat<'a, 'tcx> {
121121
)
122122
}
123123
traits::NonStructuralMatchTy::Dynamic => {
124-
format!("trait objects cannot be used in patterns")
124+
"trait objects cannot be used in patterns".to_string()
125125
}
126126
traits::NonStructuralMatchTy::Param => {
127127
bug!("use of constant whose type is a parameter inside a pattern")

src/librustc_passes/liveness.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
931931
if blk.targeted_by_break {
932932
self.break_ln.insert(blk.hir_id, succ);
933933
}
934-
let succ = self.propagate_through_opt_expr(blk.expr.as_ref().map(|e| &**e), succ);
934+
let succ = self.propagate_through_opt_expr(blk.expr.as_deref(), succ);
935935
blk.stmts.iter().rev().fold(succ, |succ, stmt| self.propagate_through_stmt(stmt, succ))
936936
}
937937

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

955-
let succ = self.propagate_through_opt_expr(local.init.as_ref().map(|e| &**e), succ);
955+
let succ = self.propagate_through_opt_expr(local.init.as_deref(), succ);
956956
self.define_bindings_in_pat(&local.pat, succ)
957957
}
958958
hir::StmtKind::Item(..) => succ,

src/librustc_passes/region.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
797797
resolve_expr(self, ex);
798798
}
799799
fn visit_local(&mut self, l: &'tcx Local<'tcx>) {
800-
resolve_local(self, Some(&l.pat), l.init.as_ref().map(|e| &**e));
800+
resolve_local(self, Some(&l.pat), l.init.as_deref());
801801
}
802802
}
803803

src/librustc_query_system/dep_graph/dep_node.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl<K: DepKind> DepNode<K> {
8080
}
8181
}
8282

83-
return dep_node;
83+
dep_node
8484
}
8585
}
8686

src/librustc_query_system/dep_graph/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ pub trait DepKind: Copy + fmt::Debug + Eq + Ord + Hash {
7777
OP: FnOnce() -> R;
7878

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

8484
fn can_reconstruct_query_key(&self) -> bool;
8585
}

src/librustc_query_system/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![feature(const_panic)]
55
#![feature(core_intrinsics)]
66
#![feature(hash_raw_entry)]
7-
#![feature(specialization)]
7+
#![feature(specialization)] // FIXME: min_specialization rejects `default const`
88
#![feature(stmt_expr_attributes)]
99
#![feature(vec_remove_item)]
1010

src/librustc_session/session.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ impl Session {
808808
let mut fuel = self.optimization_fuel.lock();
809809
ret = fuel.remaining != 0;
810810
if fuel.remaining == 0 && !fuel.out_of_fuel {
811-
eprintln!("optimization-fuel-exhausted: {}", msg());
811+
self.warn(&format!("optimization-fuel-exhausted: {}", msg()));
812812
fuel.out_of_fuel = true;
813813
} else if fuel.remaining > 0 {
814814
fuel.remaining -= 1;

src/librustc_span/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#![feature(negative_impls)]
1313
#![feature(nll)]
1414
#![feature(optin_builtin_traits)]
15-
#![feature(specialization)]
15+
#![feature(min_specialization)]
1616

1717
// FIXME(#56935): Work around ICEs during cross-compilation.
1818
#[allow(unused)]

0 commit comments

Comments
 (0)