Skip to content

Rollup of 7 pull requests #137163

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

Merged
merged 29 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e1c6ead
move pattern migration setup/emitting to a separate module
dianne Feb 9, 2025
f1c287f
move pattern migration internals to the `migration` module
dianne Feb 9, 2025
7edd034
Use io::const_error! when possible over io::Error::new
thaliaarchi Feb 11, 2025
9e390b2
Fix &&str and trailing commas in io::const_error!
thaliaarchi Feb 11, 2025
b621a48
bootstrap: add more tracing to compiler/std/llvm flows
jieyouxu Feb 15, 2025
7b11816
bootstrap: take `target` by value in `is_builder_target`
jieyouxu Feb 15, 2025
05ba1a4
rustc-dev-guide: document `COMPILER` and `COMPILER_FOR` tracing targets
jieyouxu Feb 15, 2025
f53d0f5
invalid_from_utf8[_unchecked]: also lint inherent methods
GrigorenkoPV Feb 15, 2025
77571a5
clippy: string_from_utf8_as_bytes: also detect inherent `from_utf8`
GrigorenkoPV Feb 15, 2025
8a02724
Fix const items not being allowed to be called `r#move` or `r#static`
Noratrieb Feb 16, 2025
b023671
Add `pattern_complexity_limit` to `Limits`.
nnethercote Feb 6, 2025
30b8c84
Merge `get_limit` and `get_limit_size`.
nnethercote Feb 7, 2025
13280ee
Improve comments about limits.
nnethercote Feb 7, 2025
223c95f
Move `rustc_middle::limits` to `rustc_interface`.
nnethercote Feb 7, 2025
7a8c0fc
Rename `pattern_complexity` attr as `pattern_complexity_limit`.
nnethercote Feb 7, 2025
7ff6790
Avoid unnecessary use of the `Map` trait.
nnethercote Feb 3, 2025
b51ab7d
Clarify `impl Map for !`.
nnethercote Feb 3, 2025
6021ba0
Rename `rustc_middle/src/hir/map/mod.rs` as `map.rs`.
nnethercote Feb 2, 2025
cd1d84c
Remove unused `Map::hir_node_by_def_id` method.
nnethercote Feb 2, 2025
f86f7ad
Move some `Map` methods onto `TyCtxt`.
nnethercote Feb 2, 2025
661f99b
Overhaul the `intravisit::Map` trait.
nnethercote Feb 3, 2025
f666361
Remove `TyCtxt::hir_krate`.
nnethercote Feb 17, 2025
f3a4f1a
Rollup merge of #136466 - nnethercote:start-removing-Map, r=cjgillot
matthiaskrgr Feb 17, 2025
0c051c8
Rollup merge of #136671 - nnethercote:middle-limits, r=Nadrieril
matthiaskrgr Feb 17, 2025
767ec0a
Rollup merge of #136817 - dianne:clean-and-comment-pat-migration, r=N…
matthiaskrgr Feb 17, 2025
c04801d
Rollup merge of #136844 - thaliaarchi:const-io-error, r=ChrisDenton
matthiaskrgr Feb 17, 2025
5dd48bc
Rollup merge of #137080 - jieyouxu:more-tracing, r=onur-ozkan
matthiaskrgr Feb 17, 2025
86f3d52
Rollup merge of #137101 - GrigorenkoPV:str-inherent-lint, r=Urgau
matthiaskrgr Feb 17, 2025
f071099
Rollup merge of #137140 - Noratrieb:const-move, r=jieyouxu,compiler-e…
matthiaskrgr Feb 17, 2025
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 library/std/src/io/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl Error {

pub(crate) const UNKNOWN_THREAD_COUNT: Self = const_error!(
ErrorKind::NotFound,
"The number of hardware threads is not known for the target platform"
"The number of hardware threads is not known for the target platform",
);

pub(crate) const UNSUPPORTED_PLATFORM: Self =
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3575,7 +3575,7 @@ impl Error for StripPrefixError {
pub fn absolute<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
let path = path.as_ref();
if path.as_os_str().is_empty() {
Err(io::const_error!(io::ErrorKind::InvalidInput, "cannot make an empty path absolute",))
Err(io::const_error!(io::ErrorKind::InvalidInput, "cannot make an empty path absolute"))
} else {
sys::path::absolute(path)
}
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/net/connection/xous/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ impl TryFrom<(&str, u16)> for LookupHost {
type Error = io::Error;

fn try_from(v: (&str, u16)) -> io::Result<LookupHost> {
lookup(v.0, v.1).map_err(|_e| io::const_error!(io::ErrorKind::InvalidInput, &"DNS failure"))
lookup(v.0, v.1).map_err(|_e| io::const_error!(io::ErrorKind::InvalidInput, "DNS failure"))
}
}
32 changes: 15 additions & 17 deletions library/std/src/sys/net/connection/xous/tcplistener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ macro_rules! unimpl {
() => {
return Err(io::const_error!(
io::ErrorKind::Unsupported,
&"This function is not yet implemented",
"This function is not yet implemented",
));
};
}
Expand Down Expand Up @@ -71,7 +71,7 @@ impl TcpListener {
0,
4096,
) else {
return Err(io::const_error!(io::ErrorKind::InvalidInput, &"Invalid response"));
return Err(io::const_error!(io::ErrorKind::InvalidInput, "Invalid response"));
};

// The first four bytes should be zero upon success, and will be nonzero
Expand All @@ -80,15 +80,15 @@ impl TcpListener {
if response[0] != 0 || valid == 0 {
let errcode = response[1];
if errcode == NetError::SocketInUse as u8 {
return Err(io::const_error!(io::ErrorKind::ResourceBusy, &"Socket in use"));
return Err(io::const_error!(io::ErrorKind::ResourceBusy, "Socket in use"));
} else if errcode == NetError::Invalid as u8 {
return Err(io::const_error!(io::ErrorKind::AddrNotAvailable, &"Invalid address"));
return Err(io::const_error!(io::ErrorKind::AddrNotAvailable, "Invalid address"));
} else if errcode == NetError::LibraryError as u8 {
return Err(io::const_error!(io::ErrorKind::Other, &"Library error"));
return Err(io::const_error!(io::ErrorKind::Other, "Library error"));
} else {
return Err(io::const_error!(
io::ErrorKind::Other,
&"Unable to connect or internal error"
"Unable to connect or internal error",
));
}
}
Expand Down Expand Up @@ -127,15 +127,13 @@ impl TcpListener {
if receive_request.raw[0] != 0 {
// error case
if receive_request.raw[1] == NetError::TimedOut as u8 {
return Err(io::const_error!(io::ErrorKind::TimedOut, &"accept timed out",));
return Err(io::const_error!(io::ErrorKind::TimedOut, "accept timed out"));
} else if receive_request.raw[1] == NetError::WouldBlock as u8 {
return Err(
io::const_error!(io::ErrorKind::WouldBlock, &"accept would block",),
);
return Err(io::const_error!(io::ErrorKind::WouldBlock, "accept would block"));
} else if receive_request.raw[1] == NetError::LibraryError as u8 {
return Err(io::const_error!(io::ErrorKind::Other, &"Library error"));
return Err(io::const_error!(io::ErrorKind::Other, "Library error"));
} else {
return Err(io::const_error!(io::ErrorKind::Other, &"library error",));
return Err(io::const_error!(io::ErrorKind::Other, "library error"));
}
} else {
// accept successful
Expand All @@ -159,7 +157,7 @@ impl TcpListener {
port,
)
} else {
return Err(io::const_error!(io::ErrorKind::Other, &"library error",));
return Err(io::const_error!(io::ErrorKind::Other, "library error"));
};

// replenish the listener
Expand All @@ -171,7 +169,7 @@ impl TcpListener {
Ok((TcpStream::from_listener(stream_fd, self.local.port(), port, addr), addr))
}
} else {
Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unable to accept"))
Err(io::const_error!(io::ErrorKind::InvalidInput, "Unable to accept"))
}
}

Expand All @@ -182,13 +180,13 @@ impl TcpListener {

pub fn set_ttl(&self, ttl: u32) -> io::Result<()> {
if ttl > 255 {
return Err(io::Error::new(io::ErrorKind::InvalidInput, "TTL must be less than 256"));
return Err(io::const_error!(io::ErrorKind::InvalidInput, "TTL must be less than 256"));
}
crate::os::xous::ffi::blocking_scalar(
services::net_server(),
services::NetBlockingScalar::StdSetTtlTcp(self.fd.load(Ordering::Relaxed), ttl).into(),
)
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value")))
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value")))
.map(|_| ())
}

Expand All @@ -197,7 +195,7 @@ impl TcpListener {
services::net_server(),
services::NetBlockingScalar::StdGetTtlTcp(self.fd.load(Ordering::Relaxed)).into(),
)
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value")))
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value")))
.map(|res| res[0] as _)?)
}

Expand Down
42 changes: 21 additions & 21 deletions library/std/src/sys/net/connection/xous/tcpstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ macro_rules! unimpl {
() => {
return Err(io::const_error!(
io::ErrorKind::Unsupported,
&"This function is not yet implemented",
"This function is not yet implemented",
));
};
}
Expand Down Expand Up @@ -96,7 +96,7 @@ impl TcpStream {
0,
4096,
) else {
return Err(io::const_error!(io::ErrorKind::InvalidInput, &"Invalid response"));
return Err(io::const_error!(io::ErrorKind::InvalidInput, "Invalid response"));
};

// The first four bytes should be zero upon success, and will be nonzero
Expand All @@ -106,13 +106,13 @@ impl TcpStream {
// errcode is a u8 but stuck in a u16 where the upper byte is invalid. Mask & decode accordingly.
let errcode = response[0];
if errcode == NetError::SocketInUse as u8 {
return Err(io::const_error!(io::ErrorKind::ResourceBusy, &"Socket in use",));
return Err(io::const_error!(io::ErrorKind::ResourceBusy, "Socket in use"));
} else if errcode == NetError::Unaddressable as u8 {
return Err(io::const_error!(io::ErrorKind::AddrNotAvailable, &"Invalid address",));
return Err(io::const_error!(io::ErrorKind::AddrNotAvailable, "Invalid address"));
} else {
return Err(io::const_error!(
io::ErrorKind::InvalidInput,
&"Unable to connect or internal error",
"Unable to connect or internal error",
));
}
}
Expand Down Expand Up @@ -198,7 +198,7 @@ impl TcpStream {
) else {
return Err(io::const_error!(
io::ErrorKind::InvalidInput,
&"Library failure: wrong message type or messaging error"
"Library failure: wrong message type or messaging error",
));
};

Expand All @@ -212,14 +212,14 @@ impl TcpStream {
if result[0] != 0 {
if result[1] == 8 {
// timed out
return Err(io::const_error!(io::ErrorKind::TimedOut, &"Timeout",));
return Err(io::const_error!(io::ErrorKind::TimedOut, "Timeout"));
}
if result[1] == 9 {
// would block
return Err(io::const_error!(io::ErrorKind::WouldBlock, &"Would block",));
return Err(io::const_error!(io::ErrorKind::WouldBlock, "Would block"));
}
}
Err(io::const_error!(io::ErrorKind::Other, &"recv_slice failure"))
Err(io::const_error!(io::ErrorKind::Other, "recv_slice failure"))
}
}

Expand Down Expand Up @@ -258,20 +258,20 @@ impl TcpStream {
self.write_timeout.load(Ordering::Relaxed) as usize,
buf_len,
)
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Internal error")))?;
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Internal error")))?;

if send_request.raw[0] != 0 {
if send_request.raw[4] == 8 {
// timed out
return Err(io::const_error!(
io::ErrorKind::BrokenPipe,
&"Timeout or connection closed",
"Timeout or connection closed",
));
} else if send_request.raw[4] == 9 {
// would block
return Err(io::const_error!(io::ErrorKind::WouldBlock, &"Would block",));
return Err(io::const_error!(io::ErrorKind::WouldBlock, "Would block"));
} else {
return Err(io::const_error!(io::ErrorKind::InvalidInput, &"Error when sending",));
return Err(io::const_error!(io::ErrorKind::InvalidInput, "Error when sending"));
}
}
Ok(u32::from_le_bytes([
Expand Down Expand Up @@ -304,7 +304,7 @@ impl TcpStream {
0,
0,
) else {
return Err(io::const_error!(io::ErrorKind::InvalidInput, &"Internal error"));
return Err(io::const_error!(io::ErrorKind::InvalidInput, "Internal error"));
};
let mut i = get_addr.raw.iter();
match *i.next().unwrap() {
Expand All @@ -324,7 +324,7 @@ impl TcpStream {
}
Ok(SocketAddr::V6(SocketAddrV6::new(new_addr.into(), self.local_port, 0, 0)))
}
_ => Err(io::const_error!(io::ErrorKind::InvalidInput, &"Internal error")),
_ => Err(io::const_error!(io::ErrorKind::InvalidInput, "Internal error")),
}
}

Expand All @@ -333,7 +333,7 @@ impl TcpStream {
services::net_server(),
services::NetBlockingScalar::StdTcpStreamShutdown(self.fd, how).into(),
)
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value")))
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value")))
.map(|_| ())
}

Expand All @@ -355,7 +355,7 @@ impl TcpStream {
services::net_server(),
services::NetBlockingScalar::StdSetNodelay(self.fd, enabled).into(),
)
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value")))
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value")))
.map(|_| ())
}

Expand All @@ -364,19 +364,19 @@ impl TcpStream {
services::net_server(),
services::NetBlockingScalar::StdGetNodelay(self.fd).into(),
)
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value")))
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value")))
.map(|res| res[0] != 0)?)
}

pub fn set_ttl(&self, ttl: u32) -> io::Result<()> {
if ttl > 255 {
return Err(io::Error::new(io::ErrorKind::InvalidInput, "TTL must be less than 256"));
return Err(io::const_error!(io::ErrorKind::InvalidInput, "TTL must be less than 256"));
}
crate::os::xous::ffi::blocking_scalar(
services::net_server(),
services::NetBlockingScalar::StdSetTtlTcp(self.fd, ttl).into(),
)
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value")))
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value")))
.map(|_| ())
}

Expand All @@ -385,7 +385,7 @@ impl TcpStream {
services::net_server(),
services::NetBlockingScalar::StdGetTtlTcp(self.fd).into(),
)
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, &"Unexpected return value")))
.or(Err(io::const_error!(io::ErrorKind::InvalidInput, "Unexpected return value")))
.map(|res| res[0] as _)?)
}

Expand Down
Loading