mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
Auto merge of #89847 - JohnTitor:rollup-xfymeo4, r=JohnTitor
Rollup of 12 pull requests Successful merges: - #89768 (add some more testcases) - #89777 (Edit explanation of test for nested type ascriptions) - #89781 (Add missing words in `Infallible` docs) - #89782 (Improve CJK font in rustdoc) - #89794 (Add #[must_use] to to_value conversions) - #89814 (Fix uppercase/lowercase error) - #89816 (Fix invalid rules in .gitignore) - #89817 (Add #[inline] to int log10 functions.) - #89818 (Use Option::map_or instead of open coding it) - #89828 (Fix config.toml overflow-checks options) - #89840 (fix the stage0 tools config file path in `config.toml.example`) - #89845 (Add davidtwco to the `.mailmap`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
81117ff930
4
.gitignore
vendored
4
.gitignore
vendored
@ -69,8 +69,8 @@ __pycache__/
|
||||
*$py.class
|
||||
|
||||
## Node
|
||||
**node_modules
|
||||
**package-lock.json
|
||||
node_modules
|
||||
package-lock.json
|
||||
|
||||
## Rustdoc GUI tests
|
||||
src/test/rustdoc-gui/src/**.lock
|
||||
|
1
.mailmap
1
.mailmap
@ -72,6 +72,7 @@ Daniel Ramos <dan@daramos.com>
|
||||
David Klein <david.klein@baesystemsdetica.com>
|
||||
David Manescu <david.manescu@gmail.com> <dman2626@uni.sydney.edu.au>
|
||||
David Ross <daboross@daboross.net>
|
||||
David Wood <david@davidtw.co> <david.wood@huawei.com>
|
||||
Deadbeef <ent3rm4n@gmail.com> <fee1-dead-beef@protonmail.com>
|
||||
Derek Chiang <derekchiang93@gmail.com> Derek Chiang (Enchi Jiang) <derekchiang93@gmail.com>
|
||||
Diggory Hardy <diggory.hardy@gmail.com> Diggory Hardy <github@dhardy.name>
|
||||
|
@ -841,7 +841,7 @@ impl<T: Idx> GrowableBitSet<T> {
|
||||
#[inline]
|
||||
pub fn contains(&self, elem: T) -> bool {
|
||||
let (word_index, mask) = word_index_and_mask(elem);
|
||||
if let Some(word) = self.bit_set.words.get(word_index) { (word & mask) != 0 } else { false }
|
||||
self.bit_set.words.get(word_index).map_or(false, |word| (word & mask) != 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,15 +202,15 @@ changelog-seen = 2
|
||||
# You can use "$ROOT" to indicate the root of the git repository.
|
||||
#build-dir = "build"
|
||||
|
||||
# Instead of downloading the src/stage0.txt version of Cargo specified, use
|
||||
# Instead of downloading the src/stage0.json version of Cargo specified, use
|
||||
# this Cargo binary instead to build all Rust code
|
||||
#cargo = "/path/to/cargo"
|
||||
|
||||
# Instead of downloading the src/stage0.txt version of the compiler
|
||||
# Instead of downloading the src/stage0.json version of the compiler
|
||||
# specified, use this rustc binary instead as the stage0 snapshot compiler.
|
||||
#rustc = "/path/to/rustc"
|
||||
|
||||
# Instead of download the src/stage0.txt version of rustfmt specified,
|
||||
# Instead of download the src/stage0.json version of rustfmt specified,
|
||||
# use this rustfmt binary instead as the stage0 snapshot rustfmt.
|
||||
#rustfmt = "/path/to/rustfmt"
|
||||
|
||||
@ -423,6 +423,18 @@ changelog-seen = 2
|
||||
# set this value to `true`.
|
||||
#debug-logging = rust.debug-assertions (boolean)
|
||||
|
||||
# Whether or not overflow checks are enabled for the compiler and standard
|
||||
# library.
|
||||
#
|
||||
# Defaults to rust.debug value
|
||||
#overflow-checks = rust.debug (boolean)
|
||||
|
||||
# Whether or not overflow checks are enabled for the standard library.
|
||||
# Overrides the `overflow-checks` option, if defined.
|
||||
#
|
||||
# Defaults to rust.overflow-checks value
|
||||
#overflow-checks-std = rust.overflow-checks (boolean)
|
||||
|
||||
# Debuginfo level for most of Rust code, corresponds to the `-C debuginfo=N` option of `rustc`.
|
||||
# `0` - no debug info
|
||||
# `1` - line tables only - sufficient to generate backtraces that include line
|
||||
|
@ -538,7 +538,7 @@ impl str {
|
||||
/// [`make_ascii_uppercase`]: str::make_ascii_uppercase
|
||||
/// [`to_uppercase`]: #method.to_uppercase
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[must_use = "to uppercase the value in-place, use `make_ascii_lowercase()`"]
|
||||
#[must_use = "to uppercase the value in-place, use `make_ascii_uppercase()`"]
|
||||
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
|
||||
#[inline]
|
||||
pub fn to_ascii_uppercase(&self) -> String {
|
||||
|
@ -328,9 +328,11 @@ impl char {
|
||||
///
|
||||
/// ```should_panic
|
||||
/// // this panics
|
||||
/// '1'.to_digit(37);
|
||||
/// let _ = '1'.to_digit(37);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
pub fn to_digit(self, radix: u32) -> Option<u32> {
|
||||
assert!(radix <= 36, "to_digit: radix is too high (maximum 36)");
|
||||
|
@ -664,7 +664,7 @@ impl AsMut<str> for str {
|
||||
///
|
||||
/// However there is one case where `!` syntax can be used
|
||||
/// before `!` is stabilized as a full-fledged type: in the position of a function’s return type.
|
||||
/// Specifically, it is possible implementations for two different function pointer types:
|
||||
/// Specifically, it is possible to have implementations for two different function pointer types:
|
||||
///
|
||||
/// ```
|
||||
/// trait MyTrait {}
|
||||
|
@ -1,5 +1,6 @@
|
||||
mod unchecked {
|
||||
// 0 < val <= u8::MAX
|
||||
#[inline]
|
||||
pub const fn u8(val: u8) -> u32 {
|
||||
let val = val as u32;
|
||||
|
||||
@ -20,6 +21,7 @@ mod unchecked {
|
||||
}
|
||||
|
||||
// 0 < val < 100_000
|
||||
#[inline]
|
||||
const fn less_than_5(val: u32) -> u32 {
|
||||
// Similar to u8, when adding one of these constants to val,
|
||||
// we get two possible bit patterns above the low 17 bits,
|
||||
@ -40,11 +42,13 @@ mod unchecked {
|
||||
}
|
||||
|
||||
// 0 < val <= u16::MAX
|
||||
#[inline]
|
||||
pub const fn u16(val: u16) -> u32 {
|
||||
less_than_5(val as u32)
|
||||
}
|
||||
|
||||
// 0 < val <= u32::MAX
|
||||
#[inline]
|
||||
pub const fn u32(mut val: u32) -> u32 {
|
||||
let mut log = 0;
|
||||
if val >= 100_000 {
|
||||
@ -55,6 +59,7 @@ mod unchecked {
|
||||
}
|
||||
|
||||
// 0 < val <= u64::MAX
|
||||
#[inline]
|
||||
pub const fn u64(mut val: u64) -> u32 {
|
||||
let mut log = 0;
|
||||
if val >= 10_000_000_000 {
|
||||
@ -69,6 +74,7 @@ mod unchecked {
|
||||
}
|
||||
|
||||
// 0 < val <= u128::MAX
|
||||
#[inline]
|
||||
pub const fn u128(mut val: u128) -> u32 {
|
||||
let mut log = 0;
|
||||
if val >= 100_000_000_000_000_000_000_000_000_000_000 {
|
||||
@ -84,26 +90,31 @@ mod unchecked {
|
||||
}
|
||||
|
||||
// 0 < val <= i8::MAX
|
||||
#[inline]
|
||||
pub const fn i8(val: i8) -> u32 {
|
||||
u8(val as u8)
|
||||
}
|
||||
|
||||
// 0 < val <= i16::MAX
|
||||
#[inline]
|
||||
pub const fn i16(val: i16) -> u32 {
|
||||
u16(val as u16)
|
||||
}
|
||||
|
||||
// 0 < val <= i32::MAX
|
||||
#[inline]
|
||||
pub const fn i32(val: i32) -> u32 {
|
||||
u32(val as u32)
|
||||
}
|
||||
|
||||
// 0 < val <= i64::MAX
|
||||
#[inline]
|
||||
pub const fn i64(val: i64) -> u32 {
|
||||
u64(val as u64)
|
||||
}
|
||||
|
||||
// 0 < val <= i128::MAX
|
||||
#[inline]
|
||||
pub const fn i128(val: i128) -> u32 {
|
||||
u128(val as u128)
|
||||
}
|
||||
@ -111,6 +122,7 @@ mod unchecked {
|
||||
|
||||
macro_rules! impl_checked {
|
||||
($T:ident) => {
|
||||
#[inline]
|
||||
pub const fn $T(val: $T) -> Option<u32> {
|
||||
if val > 0 { Some(unchecked::$T(val)) } else { None }
|
||||
}
|
||||
|
@ -242,6 +242,8 @@ impl<T: ?Sized> NonNull<T> {
|
||||
/// The pointer can be later reconstructed with [`NonNull::from_raw_parts`].
|
||||
#[unstable(feature = "ptr_metadata", issue = "81513")]
|
||||
#[rustc_const_unstable(feature = "ptr_metadata", issue = "81513")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
pub const fn to_raw_parts(self) -> (NonNull<()>, <T as super::Pointee>::Metadata) {
|
||||
(self.cast(), super::metadata(self.as_ptr()))
|
||||
@ -386,6 +388,8 @@ impl<T: ?Sized> NonNull<T> {
|
||||
/// ```
|
||||
#[stable(feature = "nonnull_cast", since = "1.27.0")]
|
||||
#[rustc_const_stable(feature = "const_nonnull_cast", since = "1.36.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
pub const fn cast<U>(self) -> NonNull<U> {
|
||||
// SAFETY: `self` is a `NonNull` pointer which is necessarily non-null
|
||||
|
@ -1342,6 +1342,8 @@ impl CStr {
|
||||
/// assert_eq!(cstr.to_bytes(), b"foo");
|
||||
/// ```
|
||||
#[inline]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn to_bytes(&self) -> &[u8] {
|
||||
let bytes = self.to_bytes_with_nul();
|
||||
@ -1367,6 +1369,8 @@ impl CStr {
|
||||
/// assert_eq!(cstr.to_bytes_with_nul(), b"foo\0");
|
||||
/// ```
|
||||
#[inline]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn to_bytes_with_nul(&self) -> &[u8] {
|
||||
unsafe { &*(&self.inner as *const [c_char] as *const [u8]) }
|
||||
@ -1437,6 +1441,8 @@ impl CStr {
|
||||
/// Cow::Owned(String::from("Hello <20>World")) as Cow<'_, str>
|
||||
/// );
|
||||
/// ```
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[stable(feature = "cstr_to_str", since = "1.4.0")]
|
||||
pub fn to_string_lossy(&self) -> Cow<'_, str> {
|
||||
String::from_utf8_lossy(self.to_bytes())
|
||||
|
@ -576,6 +576,8 @@ impl OsStr {
|
||||
/// assert_eq!(os_str.to_str(), Some("foo"));
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
pub fn to_str(&self) -> Option<&str> {
|
||||
self.inner.to_str()
|
||||
@ -627,6 +629,8 @@ impl OsStr {
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
pub fn to_string_lossy(&self) -> Cow<'_, str> {
|
||||
self.inner.to_string_lossy()
|
||||
@ -644,6 +648,8 @@ impl OsStr {
|
||||
/// assert_eq!(os_string, OsString::from("foo"));
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
pub fn to_os_string(&self) -> OsString {
|
||||
OsString { inner: self.inner.to_owned() }
|
||||
|
@ -426,6 +426,8 @@ impl IpAddr {
|
||||
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x1)).to_canonical().is_loopback(), true);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[rustc_const_unstable(feature = "const_ip", issue = "76205")]
|
||||
#[unstable(feature = "ip", issue = "27709")]
|
||||
pub const fn to_canonical(&self) -> IpAddr {
|
||||
@ -901,6 +903,8 @@ impl Ipv4Addr {
|
||||
/// ```
|
||||
#[rustc_const_stable(feature = "const_ipv4", since = "1.50.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
pub const fn to_ipv6_compatible(&self) -> Ipv6Addr {
|
||||
let [a, b, c, d] = self.octets();
|
||||
@ -926,6 +930,8 @@ impl Ipv4Addr {
|
||||
/// ```
|
||||
#[rustc_const_stable(feature = "const_ipv4", since = "1.50.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
pub const fn to_ipv6_mapped(&self) -> Ipv6Addr {
|
||||
let [a, b, c, d] = self.octets();
|
||||
@ -1648,6 +1654,8 @@ impl Ipv6Addr {
|
||||
/// ```
|
||||
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
|
||||
#[unstable(feature = "ip", issue = "27709")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
pub const fn to_ipv4_mapped(&self) -> Option<Ipv4Addr> {
|
||||
match self.octets() {
|
||||
@ -1685,6 +1693,8 @@ impl Ipv6Addr {
|
||||
/// ```
|
||||
#[rustc_const_stable(feature = "const_ipv6", since = "1.50.0")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
pub const fn to_ipv4(&self) -> Option<Ipv4Addr> {
|
||||
if let [0, 0, 0, 0, 0, 0 | 0xffff, ab, cd] = self.segments() {
|
||||
@ -1708,9 +1718,11 @@ impl Ipv6Addr {
|
||||
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x1).is_loopback(), false);
|
||||
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x7f00, 0x1).to_canonical().is_loopback(), true);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
|
||||
#[unstable(feature = "ip", issue = "27709")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
pub const fn to_canonical(&self) -> IpAddr {
|
||||
if let Some(mapped) = self.to_ipv4_mapped() {
|
||||
return IpAddr::V4(mapped);
|
||||
|
@ -1952,6 +1952,8 @@ impl Path {
|
||||
/// assert_eq!(path.to_str(), Some("foo.txt"));
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
pub fn to_str(&self) -> Option<&str> {
|
||||
self.inner.to_str()
|
||||
@ -1978,6 +1980,8 @@ impl Path {
|
||||
/// Had `path` contained invalid unicode, the `to_string_lossy` call might
|
||||
/// have returned `"fo<66>.txt"`.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[inline]
|
||||
pub fn to_string_lossy(&self) -> Cow<'_, str> {
|
||||
self.inner.to_string_lossy()
|
||||
@ -1994,6 +1998,8 @@ impl Path {
|
||||
/// assert_eq!(path_buf, std::path::PathBuf::from("foo.txt"));
|
||||
/// ```
|
||||
#[rustc_conversion_suggestion]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn to_path_buf(&self) -> PathBuf {
|
||||
PathBuf::from(self.inner.to_os_string())
|
||||
|
@ -982,7 +982,8 @@ impl Config {
|
||||
config.rust_debug_assertions_std =
|
||||
debug_assertions_std.unwrap_or(config.rust_debug_assertions);
|
||||
config.rust_overflow_checks = overflow_checks.unwrap_or(default);
|
||||
config.rust_overflow_checks_std = overflow_checks_std.unwrap_or(default);
|
||||
config.rust_overflow_checks_std =
|
||||
overflow_checks_std.unwrap_or(config.rust_overflow_checks);
|
||||
|
||||
config.rust_debug_logging = debug_logging.unwrap_or(config.rust_debug_assertions);
|
||||
|
||||
|
@ -75,7 +75,9 @@ o("optimize-llvm", "llvm.optimize", "build optimized LLVM")
|
||||
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions")
|
||||
o("llvm-plugins", "llvm.plugins", "build LLVM with plugin interface")
|
||||
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions")
|
||||
o("debug-assertions-std", "rust.debug-assertions-std", "build the standard library with debugging assertions")
|
||||
o("overflow-checks", "rust.overflow-checks", "build with overflow checks")
|
||||
o("overflow-checks-std", "rust.overflow-checks-std", "build the standard library with overflow checks")
|
||||
o("llvm-release-debuginfo", "llvm.release-debuginfo", "build LLVM with debugger metadata")
|
||||
v("debuginfo-level", "rust.debuginfo-level", "debuginfo level for Rust code")
|
||||
v("debuginfo-level-rustc", "rust.debuginfo-level-rustc", "debuginfo level for the compiler")
|
||||
|
@ -39,8 +39,9 @@ static FILES_UNVERSIONED: Lazy<FxHashMap<&str, &[u8]>> = Lazy::new(|| {
|
||||
"SourceCodePro-Semibold.ttf.woff" => static_files::source_code_pro::SEMIBOLD,
|
||||
"SourceCodePro-It.ttf.woff" => static_files::source_code_pro::ITALIC,
|
||||
"SourceCodePro-LICENSE.txt" => static_files::source_code_pro::LICENSE,
|
||||
"noto-sans-kr-v13-korean-regular.woff" => static_files::noto_sans_kr::REGULAR,
|
||||
"noto-sans-kr-v13-korean-regular-LICENSE.txt" => static_files::noto_sans_kr::LICENSE,
|
||||
"noto-sans-kr-regular.woff2" => static_files::noto_sans_kr::REGULAR2,
|
||||
"noto-sans-kr-regular.woff" => static_files::noto_sans_kr::REGULAR,
|
||||
"noto-sans-kr-LICENSE.txt" => static_files::noto_sans_kr::LICENSE,
|
||||
"LICENSE-MIT.txt" => static_files::LICENSE_MIT,
|
||||
"LICENSE-APACHE.txt" => static_files::LICENSE_APACHE,
|
||||
"COPYRIGHT.txt" => static_files::COPYRIGHT,
|
||||
|
@ -75,12 +75,13 @@
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
/* Avoid using legacy CJK serif fonts in Windows like Batang */
|
||||
/* Avoid using legacy CJK serif fonts in Windows like Batang. */
|
||||
@font-face {
|
||||
font-family: 'Noto Sans KR';
|
||||
src: url("noto-sans-kr-v13-korean-regular.woff") format("woff");
|
||||
src: url("noto-sans-kr-regular.woff2") format("woff2"),
|
||||
url("noto-sans-kr-regular.woff") format("woff");
|
||||
font-display: swap;
|
||||
unicode-range: U+A960-A97F, U+AC00-D7AF, U+D7B0-D7FF;
|
||||
unicode-range: U+AC00-D7AF, U+3130-318F, U+1100-11FF, U+A960-A97F, U+D7B0-D7FF;
|
||||
}
|
||||
|
||||
* {
|
||||
|
Binary file not shown.
BIN
src/librustdoc/html/static/fonts/noto-sans-kr-regular.woff2
Normal file
BIN
src/librustdoc/html/static/fonts/noto-sans-kr-regular.woff2
Normal file
Binary file not shown.
@ -157,15 +157,14 @@ crate mod source_code_pro {
|
||||
}
|
||||
|
||||
crate mod noto_sans_kr {
|
||||
/// The file `noto-sans-kr-v13-korean-regular.woff`, the Regular variant of the Noto Sans KR
|
||||
/// font.
|
||||
crate static REGULAR: &[u8] =
|
||||
include_bytes!("static/fonts/noto-sans-kr-v13-korean-regular.woff");
|
||||
/// The file `noto-sans-kr.woff`, the Regular variant of the Noto Sans KR font.
|
||||
crate static REGULAR: &[u8] = include_bytes!("static/fonts/noto-sans-kr-regular.woff");
|
||||
|
||||
/// The file `noto-sans-kr-v13-korean-regular-LICENSE.txt`, the license text of the Noto Sans KR
|
||||
/// font.
|
||||
crate static LICENSE: &[u8] =
|
||||
include_bytes!("static/fonts/noto-sans-kr-v13-korean-regular-LICENSE.txt");
|
||||
/// The file `noto-sans-kr.woff2`, the Regular variant of the Noto Sans KR font.
|
||||
crate static REGULAR2: &[u8] = include_bytes!("static/fonts/noto-sans-kr-regular.woff2");
|
||||
|
||||
/// The file `noto-sans-kr-LICENSE.txt`, the license text of the Noto Sans KR font.
|
||||
crate static LICENSE: &[u8] = include_bytes!("static/fonts/noto-sans-kr-LICENSE.txt");
|
||||
}
|
||||
|
||||
/// Files related to the sidebar in rustdoc sources.
|
||||
|
21
src/test/ui/consts/issue-88071.rs
Normal file
21
src/test/ui/consts/issue-88071.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// check-pass
|
||||
//
|
||||
// regression test for #88071
|
||||
|
||||
#![feature(const_btree_new)]
|
||||
#![feature(const_fn_trait_bound)]
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
pub struct CustomMap<K, V>(BTreeMap<K, V>);
|
||||
|
||||
impl<K, V> CustomMap<K, V>
|
||||
where
|
||||
K: Ord,
|
||||
{
|
||||
pub const fn new() -> Self {
|
||||
CustomMap(BTreeMap::new())
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
22
src/test/ui/generic-associated-types/issue-87750.rs
Normal file
22
src/test/ui/generic-associated-types/issue-87750.rs
Normal file
@ -0,0 +1,22 @@
|
||||
#![feature(generic_associated_types)]
|
||||
|
||||
trait PointerFamily {
|
||||
type Pointer<T>;
|
||||
}
|
||||
|
||||
struct Rc<T>(Box<T>);
|
||||
struct RcFamily;
|
||||
|
||||
impl PointerFamily for RcFamily {
|
||||
type Pointer<T> = Rc<T>;
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
enum Node<T, P: PointerFamily> where P::Pointer<Node<T, P>>: Sized {
|
||||
Cons(P::Pointer<Node<T, P>>),
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _list: <RcFamily as PointerFamily>::Pointer<Node<i32, RcFamily>>;
|
||||
//~^ ERROR overflow evaluating the requirement `Node<i32, RcFamily>: Sized`
|
||||
}
|
9
src/test/ui/generic-associated-types/issue-87750.stderr
Normal file
9
src/test/ui/generic-associated-types/issue-87750.stderr
Normal file
@ -0,0 +1,9 @@
|
||||
error[E0275]: overflow evaluating the requirement `Node<i32, RcFamily>: Sized`
|
||||
--> $DIR/issue-87750.rs:20:16
|
||||
|
|
||||
LL | let _list: <RcFamily as PointerFamily>::Pointer<Node<i32, RcFamily>>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0275`.
|
@ -1,5 +1,5 @@
|
||||
// Here we check that type ascription is syntactically invalid when
|
||||
// not in the top position of a ascribing a let binding or function parameter.
|
||||
// not in the top position of an ascribing `let` binding or function parameter.
|
||||
|
||||
|
||||
// This has no effect.
|
||||
|
57
src/test/ui/traits/issue-52893.rs
Normal file
57
src/test/ui/traits/issue-52893.rs
Normal file
@ -0,0 +1,57 @@
|
||||
// check-fail
|
||||
//
|
||||
// regression test for issue 52893
|
||||
trait At<Name> {
|
||||
type AtRes;
|
||||
fn at(self) -> Self::AtRes;
|
||||
}
|
||||
|
||||
trait Push<T> {
|
||||
type PushRes;
|
||||
fn push(self, other: T) -> Self::PushRes;
|
||||
}
|
||||
|
||||
trait AddClass<Name, F> {
|
||||
type AddRes;
|
||||
fn init(self, func: F);
|
||||
}
|
||||
|
||||
trait ToRef {
|
||||
type RefRes;
|
||||
fn to_ref(&self) -> Self::RefRes;
|
||||
}
|
||||
|
||||
struct Class<P>(P);
|
||||
|
||||
impl<P> Class<P> {
|
||||
fn with<Name, F>(self) -> <Self as AddClass<Name, F>>::AddRes
|
||||
where
|
||||
Self: AddClass<Name, F>,
|
||||
{
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn from<F>(self) -> <Self as AddClass<P, F>>::AddRes
|
||||
where
|
||||
Self: AddClass<P, F>,
|
||||
{
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<F, Name, P> AddClass<Name, F> for Class<P>
|
||||
where
|
||||
Self: At<Name>,
|
||||
<Self as At<Name>>::AtRes: Push<F>,
|
||||
<<Self as At<Name>>::AtRes as Push<F>>::PushRes: ToRef<RefRes = Self> + Push<F>,
|
||||
{
|
||||
type AddRes = ();
|
||||
|
||||
fn init(self, func: F) {
|
||||
let builder = self.at().push(func);
|
||||
let output = builder.to_ref();
|
||||
builder.push(output); //~ ERROR mismatched types [E0308]
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
15
src/test/ui/traits/issue-52893.stderr
Normal file
15
src/test/ui/traits/issue-52893.stderr
Normal file
@ -0,0 +1,15 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-52893.rs:53:22
|
||||
|
|
||||
LL | impl<F, Name, P> AddClass<Name, F> for Class<P>
|
||||
| - this type parameter
|
||||
...
|
||||
LL | builder.push(output);
|
||||
| ^^^^^^ expected type parameter `F`, found struct `Class`
|
||||
|
|
||||
= note: expected type parameter `F`
|
||||
found struct `Class<P>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
47
src/test/ui/traits/issue-68295.rs
Normal file
47
src/test/ui/traits/issue-68295.rs
Normal file
@ -0,0 +1,47 @@
|
||||
// check-fail
|
||||
//
|
||||
// regression test for #68295
|
||||
|
||||
struct Matrix<R, C, S>(R, C, S);
|
||||
|
||||
impl<R, C, S> Matrix<R, C, S> {
|
||||
fn into_owned(self) -> Matrix<R, C, Owned<R, C, ()>>
|
||||
where
|
||||
(): Allocator<R, C>,
|
||||
{
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<D, S> Matrix<D, D, S> {
|
||||
fn hermitian_part(&self) -> Matrix<D, D, Owned<D, D, ()>>
|
||||
where
|
||||
(): Allocator<D, D>,
|
||||
{
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
trait Allocator<R, C> {
|
||||
type Buffer;
|
||||
}
|
||||
|
||||
trait Trait<R, C, A> {
|
||||
type Power;
|
||||
}
|
||||
|
||||
impl<R, C, A: Allocator<R, C>> Trait<R, C, A> for () {
|
||||
type Power = A::Buffer;
|
||||
}
|
||||
|
||||
type Owned<R, C, G> = <G as Trait<R, C, ()>>::Power;
|
||||
|
||||
fn crash<R, C>(input: Matrix<R, C, ()>) -> Matrix<R, C, u32>
|
||||
where
|
||||
(): Allocator<R, C>,
|
||||
{
|
||||
input.into_owned()
|
||||
//~^ ERROR mismatched types [E0308]
|
||||
}
|
||||
|
||||
fn main() {}
|
17
src/test/ui/traits/issue-68295.stderr
Normal file
17
src/test/ui/traits/issue-68295.stderr
Normal file
@ -0,0 +1,17 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-68295.rs:43:5
|
||||
|
|
||||
LL | fn crash<R, C>(input: Matrix<R, C, ()>) -> Matrix<R, C, u32>
|
||||
| ----------------- expected `Matrix<R, C, u32>` because of return type
|
||||
...
|
||||
LL | input.into_owned()
|
||||
| ^^^^^^^^^^^^^^^^^^ expected `u32`, found associated type
|
||||
|
|
||||
= note: expected struct `Matrix<_, _, u32>`
|
||||
found struct `Matrix<_, _, <() as Allocator<R, C>>::Buffer>`
|
||||
= help: consider constraining the associated type `<() as Allocator<R, C>>::Buffer` to `u32`
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
Loading…
Reference in New Issue
Block a user