Skip to content

Commit a569a88

Browse files
committedNov 30, 2022
Auto merge of rust-lang#105080 - matthiaskrgr:rollup-7ffj4oe, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - rust-lang#104697 (Restore control flow on error in EUV) - rust-lang#104811 (feat: implement TcpStream shutdown for wasm32-wasi) - rust-lang#105039 (Fix an ICE parsing a malformed literal in `concat_bytes!`.) - rust-lang#105071 (Add Nicholas Nethercote to `.mailmap`.) - rust-lang#105079 (Add bots to `.mailmap`) Failed merges: - rust-lang#105074 (Add Nicholas Bishop to `.mailmap`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8de4b13 + 815b6e5 commit a569a88

File tree

9 files changed

+103
-10
lines changed

9 files changed

+103
-10
lines changed
 

‎.mailmap

+8
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Björn Steinbrink <bsteinbr@gmail.com> <B.Steinbrink@gmx.de>
7373
blake2-ppc <ulrik.sverdrup@gmail.com> <blake2-ppc>
7474
boolean_coercion <booleancoercion@gmail.com>
7575
Boris Egorov <jightuse@gmail.com> <egorov@linux.com>
76+
bors <bors@rust-lang.org> bors[bot] <26634292+bors[bot]@users.noreply.github.com>
77+
bors <bors@rust-lang.org> bors[bot] <bors[bot]@users.noreply.github.com>
7678
Braden Nelson <moonheart08@users.noreply.github.com>
7779
Brandon Sanderson <singingboyo@gmail.com> Brandon Sanderson <singingboyo@hotmail.com>
7880
Brett Cannon <brett@python.org> Brett Cannon <brettcannon@users.noreply.github.com>
@@ -139,6 +141,10 @@ David Ross <daboross@daboross.net>
139141
David Wood <david@davidtw.co> <david.wood@huawei.com>
140142
Deadbeef <ent3rm4n@gmail.com>
141143
Deadbeef <ent3rm4n@gmail.com> <fee1-dead-beef@protonmail.com>
144+
dependabot[bot] <dependabot[bot]@users.noreply.github.com> <27856297+dependabot-preview[bot]@users.noreply.github.com>
145+
dependabot[bot] <dependabot[bot]@users.noreply.github.com> <49699333+dependabot[bot]@users.noreply.github.com>
146+
dependabot[bot] <dependabot[bot]@users.noreply.github.com> <dependabot-preview[bot]@users.noreply.github.com>
147+
dependabot[bot] <dependabot[bot]@users.noreply.github.com> <support@dependabot.com>
142148
Derek Chiang <derekchiang93@gmail.com> Derek Chiang (Enchi Jiang) <derekchiang93@gmail.com>
143149
DeveloperC <DeveloperC@protonmail.com>
144150
Devin Ragotzy <devin.ragotzy@gmail.com>
@@ -396,6 +402,8 @@ Nathaniel Herman <nherman@post.harvard.edu> Nathaniel Herman <nherman@college.ha
396402
Neil Pankey <npankey@gmail.com> <neil@wire.im>
397403
Ngo Iok Ui (Wu Yu Wei) <wusyong9104@gmail.com>
398404
Nicholas Baron <nicholas.baron.ten@gmail.com>
405+
Nicholas Nethercote <n.nethercote@gmail.com> <nnethercote@apple.com>
406+
Nicholas Nethercote <n.nethercote@gmail.com> <nnethercote@mozilla.com>
399407
Nick Platt <platt.nicholas@gmail.com>
400408
Niclas Schwarzlose <15schnic@gmail.com>
401409
Nicolas Abram <abramlujan@gmail.com>

‎compiler/rustc_builtin_macros/src/concat_bytes.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use rustc_ast as ast;
22
use rustc_ast::{ptr::P, tokenstream::TokenStream};
33
use rustc_errors::Applicability;
44
use rustc_expand::base::{self, DummyResult};
5+
use rustc_session::errors::report_lit_error;
56
use rustc_span::Span;
67

78
/// Emits errors for literal expressions that are invalid inside and outside of an array.
@@ -68,7 +69,10 @@ fn invalid_type_err(
6869
Ok(ast::LitKind::Int(_, _)) => {
6970
cx.span_err(span, "numeric literal is not a `u8`");
7071
}
71-
_ => unreachable!(),
72+
Ok(ast::LitKind::ByteStr(_) | ast::LitKind::Byte(_)) => unreachable!(),
73+
Err(err) => {
74+
report_lit_error(&cx.sess.parse_sess, err, token_lit, span);
75+
}
7276
}
7377
}
7478

‎compiler/rustc_hir_typeck/src/expr_use_visitor.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,11 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
252252

253253
hir::ExprKind::Match(ref discr, arms, _) => {
254254
let discr_place = return_if_err!(self.mc.cat_expr(discr));
255-
self.maybe_read_scrutinee(
255+
return_if_err!(self.maybe_read_scrutinee(
256256
discr,
257257
discr_place.clone(),
258258
arms.iter().map(|arm| arm.pat),
259-
);
259+
));
260260

261261
// treatment of the discriminant is handled while walking the arms.
262262
for arm in arms {
@@ -390,15 +390,15 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
390390
discr: &Expr<'_>,
391391
discr_place: PlaceWithHirId<'tcx>,
392392
pats: impl Iterator<Item = &'t hir::Pat<'t>>,
393-
) {
393+
) -> Result<(), ()> {
394394
// Matching should not always be considered a use of the place, hence
395395
// discr does not necessarily need to be borrowed.
396396
// We only want to borrow discr if the pattern contain something other
397397
// than wildcards.
398398
let ExprUseVisitor { ref mc, body_owner: _, delegate: _ } = *self;
399399
let mut needs_to_be_read = false;
400400
for pat in pats {
401-
return_if_err!(mc.cat_pattern(discr_place.clone(), pat, |place, pat| {
401+
mc.cat_pattern(discr_place.clone(), pat, |place, pat| {
402402
match &pat.kind {
403403
PatKind::Binding(.., opt_sub_pat) => {
404404
// If the opt_sub_pat is None, than the binding does not count as
@@ -453,7 +453,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
453453
// examined
454454
}
455455
}
456-
}));
456+
})?
457457
}
458458

459459
if needs_to_be_read {
@@ -474,6 +474,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
474474
// that the discriminant has been initialized.
475475
self.walk_expr(discr);
476476
}
477+
Ok(())
477478
}
478479

479480
fn walk_local<F>(
@@ -490,7 +491,11 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
490491
f(self);
491492
if let Some(els) = els {
492493
// borrowing because we need to test the discriminant
493-
self.maybe_read_scrutinee(expr, expr_place.clone(), from_ref(pat).iter());
494+
return_if_err!(self.maybe_read_scrutinee(
495+
expr,
496+
expr_place.clone(),
497+
from_ref(pat).iter()
498+
));
494499
self.walk_block(els)
495500
}
496501
self.walk_irrefutable_pat(&expr_place, &pat);

‎compiler/rustc_hir_typeck/src/upvar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2168,7 +2168,7 @@ fn determine_place_ancestry_relation<'tcx>(
21682168
place_a: &Place<'tcx>,
21692169
place_b: &Place<'tcx>,
21702170
) -> PlaceAncestryRelation {
2171-
// If Place A and Place B, don't start off from the same root variable, they are divergent.
2171+
// If Place A and Place B don't start off from the same root variable, they are divergent.
21722172
if place_a.base != place_b.base {
21732173
return PlaceAncestryRelation::Divergent;
21742174
}

‎library/std/src/sys/wasi/net.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,14 @@ impl TcpStream {
119119
unsupported()
120120
}
121121

122-
pub fn shutdown(&self, _: Shutdown) -> io::Result<()> {
123-
unsupported()
122+
pub fn shutdown(&self, how: Shutdown) -> io::Result<()> {
123+
let wasi_how = match how {
124+
Shutdown::Read => wasi::SDFLAGS_RD,
125+
Shutdown::Write => wasi::SDFLAGS_WR,
126+
Shutdown::Both => wasi::SDFLAGS_RD | wasi::SDFLAGS_WR,
127+
};
128+
129+
unsafe { wasi::sock_shutdown(self.socket().as_raw_fd() as _, wasi_how).map_err(err2io) }
124130
}
125131

126132
pub fn duplicate(&self) -> io::Result<TcpStream> {

‎src/test/ui/inference/issue-104649.rs

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
type Result<T, E = Error> = ::std::result::Result<T, E>;
2+
struct Error;
3+
4+
trait ForEach {
5+
type Input;
6+
fn for_each<F, U>(self, f: F)
7+
where
8+
F: FnOnce(Self::Input) -> U;
9+
}
10+
11+
impl<T> ForEach for A<T> {
12+
type Input = T;
13+
fn for_each<F, U>(self, f: F)
14+
where
15+
F: FnOnce(Self::Input) -> U,
16+
{
17+
todo!()
18+
}
19+
}
20+
21+
struct A<T>(T);
22+
23+
fn main() {
24+
let a = A(Result::Ok(Result::Ok(()))); //~ ERROR type annotations needed
25+
a.for_each(|a: Result<_>| {
26+
let f = || match a {
27+
Ok(Ok(a)) => {}
28+
Ok(Err(a)) => {}
29+
Err(a) => {}
30+
};
31+
});
32+
}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0282]: type annotations needed for `A<std::result::Result<std::result::Result<(), E>, Error>>`
2+
--> $DIR/issue-104649.rs:24:9
3+
|
4+
LL | let a = A(Result::Ok(Result::Ok(())));
5+
| ^
6+
|
7+
help: consider giving `a` an explicit type, where the type for type parameter `E` is specified
8+
|
9+
LL | let a: A<std::result::Result<std::result::Result<(), E>, Error>> = A(Result::Ok(Result::Ok(())));
10+
| +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0282`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![feature(concat_bytes)]
2+
3+
fn main() {
4+
concat_bytes!(7Y);
5+
//~^ ERROR invalid suffix `Y` for number literal
6+
concat_bytes!(888888888888888888888888888888888888888);
7+
//~^ ERROR integer literal is too large
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: invalid suffix `Y` for number literal
2+
--> $DIR/issue-104769-concat_bytes-invalid-literal.rs:4:19
3+
|
4+
LL | concat_bytes!(7Y);
5+
| ^^ invalid suffix `Y`
6+
|
7+
= help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
8+
9+
error: integer literal is too large
10+
--> $DIR/issue-104769-concat_bytes-invalid-literal.rs:6:19
11+
|
12+
LL | concat_bytes!(888888888888888888888888888888888888888);
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
15+
error: aborting due to 2 previous errors
16+

0 commit comments

Comments
 (0)
Please sign in to comment.