Skip to content

Commit e7815e5

Browse files
committed
Auto merge of rust-lang#157448 - JonathanBrouwer:rollup-yMu450t, r=JonathanBrouwer
Rollup of 3 pull requests Successful merges: - rust-lang#156414 (std/sys/net/xous: read NetError code from byte 4 in recv/accept paths) - rust-lang#157429 (Add regression test for unreachable_code with try operator) - rust-lang#157435 (Introduce -Zdisable-incr-comp-backend-caching)
2 parents 688ab44 + f37676f commit e7815e5

7 files changed

Lines changed: 40 additions & 12 deletions

File tree

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,8 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
463463
) -> FxIndexMap<WorkProductId, WorkProduct> {
464464
let mut work_products = FxIndexMap::default();
465465

466-
if sess.opts.incremental.is_none() {
466+
if sess.opts.incremental.is_none() || sess.opts.unstable_opts.disable_incr_comp_backend_caching
467+
{
467468
return work_products;
468469
}
469470

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,9 @@ pub(crate) fn provide(providers: &mut Providers) {
11321132
}
11331133

11341134
pub fn determine_cgu_reuse<'tcx>(tcx: TyCtxt<'tcx>, cgu: &CodegenUnit<'tcx>) -> CguReuse {
1135-
if !tcx.dep_graph.is_fully_enabled() {
1135+
if !tcx.dep_graph.is_fully_enabled()
1136+
|| tcx.sess.opts.unstable_opts.disable_incr_comp_backend_caching
1137+
{
11361138
return CguReuse::No;
11371139
}
11381140

compiler/rustc_session/src/options.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2298,6 +2298,8 @@ options! {
22982298
"Direct or use GOT indirect to reference external data symbols"),
22992299
disable_fast_paths: bool = (false, parse_bool, [TRACKED],
23002300
"disable various performance optimizations in trait solving"),
2301+
disable_incr_comp_backend_caching: bool = (false, parse_bool, [TRACKED],
2302+
"disable caching of compiled objects by the codegen backend during incremental compilation"),
23012303
dual_proc_macros: bool = (false, parse_bool, [TRACKED],
23022304
"load proc macros for both target and host, but only link to the target (default: no)"),
23032305
dump_dep_graph: bool = (false, parse_bool, [UNTRACKED],

library/std/src/sys/net/connection/xous/tcplistener.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,13 @@ impl TcpListener {
129129
0,
130130
) {
131131
if receive_request.raw[0] != 0 {
132-
// error case
133-
if receive_request.raw[1] == NetError::TimedOut as u8 {
132+
// Error case — code lives at byte 4 (where the send path
133+
// also reads it). Byte 1 is part of the marker header.
134+
if receive_request.raw[4] == NetError::TimedOut as u8 {
134135
return Err(io::const_error!(io::ErrorKind::TimedOut, "accept timed out"));
135-
} else if receive_request.raw[1] == NetError::WouldBlock as u8 {
136+
} else if receive_request.raw[4] == NetError::WouldBlock as u8 {
136137
return Err(io::const_error!(io::ErrorKind::WouldBlock, "accept would block"));
137-
} else if receive_request.raw[1] == NetError::LibraryError as u8 {
138+
} else if receive_request.raw[4] == NetError::LibraryError as u8 {
138139
return Err(io::const_error!(io::ErrorKind::Other, "library error"));
139140
} else {
140141
return Err(io::const_error!(io::ErrorKind::Other, "library error"));

library/std/src/sys/net/connection/xous/tcpstream.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,14 @@ impl TcpStream {
213213
} else {
214214
let result = receive_request.raw;
215215
if result[0] != 0 {
216-
if result[1] == 8 {
216+
// The error code lives at byte 4 of the kernel's response buffer
217+
// (matches the byte the send path reads in `write` below). Byte 1
218+
// is part of the marker header, not the code.
219+
if result[4] == 8 {
217220
// timed out
218221
return Err(io::const_error!(io::ErrorKind::TimedOut, "timeout"));
219222
}
220-
if result[1] == 9 {
223+
if result[4] == 9 {
221224
// would block
222225
return Err(io::const_error!(io::ErrorKind::WouldBlock, "would block"));
223226
}

library/std/src/sys/net/connection/xous/udp.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,13 @@ impl UdpSocket {
145145
0,
146146
) {
147147
if receive_request.raw[0] != 0 {
148-
// error case
149-
if receive_request.raw[1] == NetError::TimedOut as u8 {
148+
// Error case — code lives at byte 4 (where `send_message`
149+
// also reads it). Byte 1 is part of the marker header.
150+
if receive_request.raw[4] == NetError::TimedOut as u8 {
150151
return Err(io::const_error!(io::ErrorKind::TimedOut, "recv timed out"));
151-
} else if receive_request.raw[1] == NetError::WouldBlock as u8 {
152+
} else if receive_request.raw[4] == NetError::WouldBlock as u8 {
152153
return Err(io::const_error!(io::ErrorKind::WouldBlock, "recv would block"));
153-
} else if receive_request.raw[1] == NetError::LibraryError as u8 {
154+
} else if receive_request.raw[4] == NetError::LibraryError as u8 {
154155
return Err(io::const_error!(io::ErrorKind::Other, "library error"));
155156
} else {
156157
return Err(io::const_error!(io::ErrorKind::Other, "library error"));
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ check-pass
2+
3+
#![forbid(unreachable_code)]
4+
5+
fn result() -> Result<(), ()> {
6+
Ok(())?;
7+
Err(())
8+
}
9+
10+
fn option() -> Option<()> {
11+
Some(())?;
12+
None
13+
}
14+
15+
fn main() {
16+
let _ = result();
17+
let _ = option();
18+
}

0 commit comments

Comments
 (0)