forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#97180 - Dylan-DPC:rollup-aa5j2yw, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - rust-lang#96539 (Add release notes for 1.61.0) - rust-lang#97142 (move processing of `source_scope_data` into `MutVisitor`'s impl of `Integrator` when inline) - rust-lang#97155 (Fix doc typo) - rust-lang#97169 (Improve `u32 as char` cast diagnostic) - rust-lang#97170 (Remove unnecessay .report() on ExitCode) - rust-lang#97171 (Add regression test for rust-lang#88119) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
9 changed files
with
216 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// check-pass | ||
|
||
#![allow(incomplete_features)] | ||
#![feature(const_trait_impl, generic_const_exprs)] | ||
|
||
trait ConstName { | ||
const NAME_BYTES: &'static [u8]; | ||
} | ||
|
||
impl const ConstName for u8 { | ||
const NAME_BYTES: &'static [u8] = b"u8"; | ||
} | ||
|
||
const fn name_len<T: ?Sized + ConstName>() -> usize { | ||
T::NAME_BYTES.len() | ||
} | ||
|
||
impl<T: ?Sized + ConstName> const ConstName for &T | ||
where | ||
[(); name_len::<T>()]:, | ||
{ | ||
const NAME_BYTES: &'static [u8] = b"&T"; | ||
} | ||
|
||
impl<T: ?Sized + ConstName> const ConstName for &mut T | ||
where | ||
[(); name_len::<T>()]:, | ||
{ | ||
const NAME_BYTES: &'static [u8] = b"&mut T"; | ||
} | ||
|
||
pub const ICE_1: &'static [u8] = <&&mut u8 as ConstName>::NAME_BYTES; | ||
pub const ICE_2: &'static [u8] = <&mut &u8 as ConstName>::NAME_BYTES; | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters