forked from rust-lang/glacier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rust-lang/rust#101076 rust-lang/rust#101036 rust-lang/rust#101020 rust-lang/rust#101001 rust-lang/rust#100878
- Loading branch information
1 parent
7ae9495
commit f4e4112
Showing
5 changed files
with
79 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#![crate_type = "lib"] | ||
pub fn get_u16_from_unaligned_manual(data: [u8; 1]) -> u8 { | ||
data[0] << 8 | ||
} | ||
|
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,8 @@ | ||
#!/bin/bash | ||
|
||
rustc --crate-type lib -Zmeta-stats - <<'EOF' | ||
pub fn a() {} | ||
EOF | ||
|
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,33 @@ | ||
#![feature(generic_associated_types)] | ||
pub trait LendingIterator { | ||
type Item<'a> | ||
where | ||
Self: 'a; | ||
|
||
fn consume<F>(self, _f: F) | ||
where | ||
Self: Sized, | ||
for<'a> Self::Item<'a>: FuncInput<'a, Self::Item<'a>>, | ||
{ | ||
} | ||
} | ||
|
||
impl<I: LendingIterator + ?Sized> LendingIterator for &mut I { | ||
type Item<'a> = I::Item<'a> where Self: 'a; | ||
} | ||
struct EmptyIter; | ||
impl LendingIterator for EmptyIter { | ||
type Item<'a> = &'a mut () where Self:'a; | ||
} | ||
pub trait FuncInput<'a, F> | ||
where | ||
F: Foo<Self>, | ||
Self: Sized, | ||
{ | ||
} | ||
impl<'a, T, F: 'a> FuncInput<'a, F> for T where F: Foo<T> {} | ||
trait Foo<T> {} | ||
|
||
fn map_test() { | ||
(&mut EmptyIter).consume(()); | ||
} |
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,13 @@ | ||
#![feature(generic_const_exprs)] | ||
|
||
const fn t<const N: usize>() -> u8 { | ||
N as u8 | ||
} | ||
|
||
#[repr(u8)] | ||
enum T<const N: u8 = { T::<0>::A as u8 + T::<0>::B as u8 }> | ||
where | ||
[(); N as usize]: | ||
{ | ||
A = t::<N>() as u8, B | ||
} |
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,20 @@ | ||
#!/bin/bash | ||
|
||
cat > out.rs <<'EOF' | ||
const _: () = { | ||
#[macro_export] | ||
macro_rules! first_macro { | ||
() => {} | ||
} | ||
mod foo { | ||
#[macro_export] | ||
macro_rules! second_macro { | ||
() => {} | ||
} | ||
} | ||
}; | ||
EOF | ||
|
||
rustdoc out.rs |