Auto merge of #125948 - nnethercote:rustfmt-more-tests, r=lqd
rustfmt more tests This finishes the formatting of tests begun in #125759 and continued in #125912. r? `@lqd`
This commit is contained in:
commit
bc33782c23
17
rustfmt.toml
17
rustfmt.toml
@ -15,18 +15,13 @@ ignore = [
|
||||
"/tests/crashes/", # Many of these tests contain syntax errors.
|
||||
"/tests/debuginfo/", # These tests are somewhat sensitive to source code layout.
|
||||
"/tests/incremental/", # These tests are somewhat sensitive to source code layout.
|
||||
"/tests/pretty/",
|
||||
"/tests/pretty/", # These tests are very sensitive to source code layout.
|
||||
"/tests/run-make/translation/test.rs", # This test contains syntax errors.
|
||||
"/tests/run-make-fulldeps/",
|
||||
"/tests/run-pass-valgrind/",
|
||||
"/tests/rustdoc/",
|
||||
"/tests/rustdoc-gui/",
|
||||
"/tests/rustdoc-js/",
|
||||
"/tests/rustdoc-json/",
|
||||
"/tests/rustdoc-js-std/",
|
||||
"/tests/rustdoc-ui/",
|
||||
"/tests/ui/",
|
||||
"/tests/ui-fulldeps/",
|
||||
"/tests/rustdoc/", # Some have syntax errors, some are whitespace-sensitive.
|
||||
"/tests/rustdoc-gui/", # Some tests are sensitive to source code layout.
|
||||
"/tests/rustdoc-ui/", # Some have syntax errors, some are whitespace-sensitive.
|
||||
"/tests/ui/", # Some have syntax errors, some are whitespace-sensitive.
|
||||
"/tests/ui-fulldeps/", # Some are whitespace-sensitive (e.g. `// ~ERROR` comments).
|
||||
|
||||
# Do not format submodules.
|
||||
# FIXME: sync submodule list with tidy/bootstrap/etc
|
||||
|
@ -27,7 +27,9 @@
|
||||
struct TheBackend;
|
||||
|
||||
impl CodegenBackend for TheBackend {
|
||||
fn locale_resource(&self) -> &'static str { "" }
|
||||
fn locale_resource(&self) -> &'static str {
|
||||
""
|
||||
}
|
||||
|
||||
fn codegen_crate<'a, 'tcx>(
|
||||
&self,
|
||||
@ -62,7 +64,10 @@ fn link(
|
||||
codegen_results: CodegenResults,
|
||||
outputs: &OutputFilenames,
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
use rustc_session::{config::{CrateType, OutFileName}, output::out_filename};
|
||||
use rustc_session::{
|
||||
config::{CrateType, OutFileName},
|
||||
output::out_filename,
|
||||
};
|
||||
use std::io::Write;
|
||||
let crate_name = codegen_results.crate_info.local_crate_name;
|
||||
for &crate_type in sess.opts.crate_types.iter() {
|
||||
|
@ -1,8 +1,25 @@
|
||||
// #13544
|
||||
|
||||
#[derive(Debug)] pub struct A;
|
||||
#[derive(Debug)] pub struct B(isize);
|
||||
#[derive(Debug)] pub struct C { x: isize }
|
||||
#[derive(Debug)] pub enum D {}
|
||||
#[derive(Debug)] pub enum E { y }
|
||||
#[derive(Debug)] pub enum F { z(isize) }
|
||||
#[derive(Debug)]
|
||||
pub struct A;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct B(isize);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct C {
|
||||
x: isize,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum D {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum E {
|
||||
y,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum F {
|
||||
z(isize),
|
||||
}
|
||||
|
@ -2,14 +2,14 @@
|
||||
|
||||
// check dtor calling order when casting enums.
|
||||
|
||||
use std::mem;
|
||||
use std::sync::atomic;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::mem;
|
||||
|
||||
enum E {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
C = 2,
|
||||
}
|
||||
|
||||
static FLAG: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
|
||||
@ -19,7 +19,7 @@ fn drop(&mut self) {
|
||||
// avoid dtor loop
|
||||
unsafe { mem::forget(mem::replace(self, E::B)) };
|
||||
|
||||
FLAG.store(FLAG.load(Ordering::SeqCst)+1, Ordering::SeqCst);
|
||||
FLAG.store(FLAG.load(Ordering::SeqCst) + 1, Ordering::SeqCst);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,12 +7,15 @@
|
||||
struct Foo;
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {
|
||||
unsafe { DROP_RAN = true; }
|
||||
unsafe {
|
||||
DROP_RAN = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
trait Trait { fn dummy(&self) { } }
|
||||
trait Trait {
|
||||
fn dummy(&self) {}
|
||||
}
|
||||
impl Trait for Foo {}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -7,9 +7,15 @@
|
||||
pub fn main() {
|
||||
let _: Box<[isize]> = if true { Box::new([1, 2, 3]) } else { Box::new([1]) };
|
||||
|
||||
let _: Box<[isize]> = match true { true => Box::new([1, 2, 3]), false => Box::new([1]) };
|
||||
let _: Box<[isize]> = match true {
|
||||
true => Box::new([1, 2, 3]),
|
||||
false => Box::new([1]),
|
||||
};
|
||||
|
||||
// Check we don't get over-keen at propagating coercions in the case of casts.
|
||||
let x = if true { 42 } else { 42u8 } as u16;
|
||||
let x = match true { true => 42, false => 42u8 } as u16;
|
||||
let x = match true {
|
||||
true => 42,
|
||||
false => 42u8,
|
||||
} as u16;
|
||||
}
|
||||
|
@ -12,11 +12,20 @@ pub fn main() {
|
||||
};
|
||||
|
||||
let _: Box<[isize]> = match true {
|
||||
true => { let b: Box<_> = Box::new([1, 2, 3]); b }
|
||||
false => { let b: Box<_> = Box::new([1]); b }
|
||||
true => {
|
||||
let b: Box<_> = Box::new([1, 2, 3]);
|
||||
b
|
||||
}
|
||||
false => {
|
||||
let b: Box<_> = Box::new([1]);
|
||||
b
|
||||
}
|
||||
};
|
||||
|
||||
// Check we don't get over-keen at propagating coercions in the case of casts.
|
||||
let x = if true { 42 } else { 42u8 } as u16;
|
||||
let x = match true { true => 42, false => 42u8 } as u16;
|
||||
let x = match true {
|
||||
true => 42,
|
||||
false => 42u8,
|
||||
} as u16;
|
||||
}
|
||||
|
@ -27,13 +27,17 @@ fn drop(&mut self) {
|
||||
|
||||
impl Drop for Baz {
|
||||
fn drop(&mut self) {
|
||||
unsafe { HIT = true; }
|
||||
unsafe {
|
||||
HIT = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
std::thread::spawn(|| {
|
||||
FOO.with(|_| {});
|
||||
}).join().unwrap();
|
||||
})
|
||||
.join()
|
||||
.unwrap();
|
||||
assert!(unsafe { HIT });
|
||||
}
|
||||
|
@ -3,15 +3,19 @@
|
||||
struct Foo;
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {
|
||||
unsafe { DROP_RAN = true; }
|
||||
unsafe {
|
||||
DROP_RAN = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trait Trait { fn dummy(&self) { } }
|
||||
trait Trait {
|
||||
fn dummy(&self) {}
|
||||
}
|
||||
impl Trait for Foo {}
|
||||
|
||||
struct Fat<T: ?Sized> {
|
||||
f: T
|
||||
f: T,
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -3,12 +3,14 @@
|
||||
struct Foo;
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {
|
||||
unsafe { DROP_RAN += 1; }
|
||||
unsafe {
|
||||
DROP_RAN += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct Fat<T: ?Sized> {
|
||||
f: T
|
||||
f: T,
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -5,11 +5,15 @@
|
||||
struct Foo;
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {
|
||||
unsafe { DROP_RAN = true; }
|
||||
unsafe {
|
||||
DROP_RAN = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trait Trait { fn dummy(&self) { } }
|
||||
trait Trait {
|
||||
fn dummy(&self) {}
|
||||
}
|
||||
impl Trait for Foo {}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -5,7 +5,9 @@
|
||||
struct Foo;
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {
|
||||
unsafe { DROP_RAN += 1; }
|
||||
unsafe {
|
||||
DROP_RAN += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,6 @@ extern "rust-call" fn call_once(self, (): ()) -> Self::Output {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
let x = *(Box::new(A) as Box<dyn FnOnce<(), Output = String>>);
|
||||
assert_eq!(x.call_once(()), format!("hello"));
|
||||
|
@ -51,7 +51,6 @@ extern "rust-call" fn call_once(self, (s1, s2): (String, Box<str>)) -> Self::Out
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
let (s1, s2) = (format!("s1"), format!("s2").into_boxed_str());
|
||||
let x = *(Box::new(A) as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
|
||||
|
@ -36,7 +36,6 @@ fn foo(self) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
let x = *(Box::new(A) as Box<dyn Foo>);
|
||||
assert_eq!(x.foo(), format!("hello"));
|
||||
|
@ -5,22 +5,27 @@ pub trait MyTrait2<X> {
|
||||
pub trait MyTrait {
|
||||
type Item;
|
||||
fn next(&mut self) -> Option<Self::Item>;
|
||||
fn fold<B, F>(self, init: B, f: F) -> B where
|
||||
fn fold<B, F>(self, init: B, f: F) -> B
|
||||
where
|
||||
Self: Sized,
|
||||
F: MyTrait2<(B, Self::Item), Output=B>;
|
||||
F: MyTrait2<(B, Self::Item), Output = B>;
|
||||
}
|
||||
|
||||
pub struct Cloned<I>(I);
|
||||
|
||||
impl<'a, T, I> MyTrait for Cloned<I> where
|
||||
impl<'a, T, I> MyTrait for Cloned<I>
|
||||
where
|
||||
T: 'a + Clone,
|
||||
I: MyTrait<Item = &'a T>
|
||||
I: MyTrait<Item = &'a T>,
|
||||
{
|
||||
type Item = T;
|
||||
fn next(&mut self) -> Option<Self::Item> { loop {} }
|
||||
fn fold<B, F>(self, init: B, f: F) -> B where
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
loop {}
|
||||
}
|
||||
fn fold<B, F>(self, init: B, f: F) -> B
|
||||
where
|
||||
Self: Sized,
|
||||
F: MyTrait2<(B, Self::Item), Output=B>
|
||||
F: MyTrait2<(B, Self::Item), Output = B>,
|
||||
{
|
||||
loop {}
|
||||
}
|
||||
@ -32,7 +37,7 @@ pub trait MyFuture {
|
||||
|
||||
pub trait MyIntoFuture {
|
||||
type Output;
|
||||
type Fut: MyFuture<Output=Self::Output>;
|
||||
type Fut: MyFuture<Output = Self::Output>;
|
||||
fn into_future(self) -> Self::Fut;
|
||||
fn into_future_2(self, other: Self) -> Self::Fut;
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
#![crate_name="foo"]
|
||||
#![crate_name = "foo"]
|
||||
|
||||
// reduced from sqlx 0.7.3
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::pin::Pin;
|
||||
pub enum Error {}
|
||||
pub trait Acquire<'c> {
|
||||
type Database: Database;
|
||||
@ -16,7 +16,7 @@ pub trait Connection {
|
||||
type Database: Database;
|
||||
type Options: ConnectionOptions<Connection = Self>;
|
||||
fn begin(
|
||||
&mut self
|
||||
&mut self,
|
||||
) -> Pin<Box<dyn Future<Output = Result<Transaction<'_, Self::Database>, Error>> + Send + '_>>
|
||||
where
|
||||
Self: Sized;
|
||||
@ -28,7 +28,8 @@ pub struct Transaction<'c, DB: Database> {
|
||||
_db: &'c DB,
|
||||
}
|
||||
impl<'t, 'c, DB: Database> Acquire<'t> for &'t mut Transaction<'c, DB>
|
||||
where <DB as Database>::Connection: Send
|
||||
where
|
||||
<DB as Database>::Connection: Send,
|
||||
{
|
||||
type Database = DB;
|
||||
type Connection = &'t mut <DB as Database>::Connection;
|
||||
|
@ -77,17 +77,14 @@ pub trait Interner: Sized {
|
||||
type ClosureKind: Copy + Debug + Hash + Eq;
|
||||
|
||||
// Required method
|
||||
fn mk_canonical_var_infos(
|
||||
self,
|
||||
infos: &[CanonicalVarInfo<Self>]
|
||||
) -> Self::CanonicalVars;
|
||||
fn mk_canonical_var_infos(self, infos: &[CanonicalVarInfo<Self>]) -> Self::CanonicalVars;
|
||||
}
|
||||
|
||||
pub trait DebugWithInfcx<I: Interner>: Debug {
|
||||
// Required method
|
||||
fn fmt<Infcx: InferCtxtLike<Interner = I>>(
|
||||
this: WithInfcx<'_, Infcx, &Self>,
|
||||
f: &mut Formatter<'_>
|
||||
f: &mut Formatter<'_>,
|
||||
) -> std::fmt::Result;
|
||||
}
|
||||
|
||||
@ -130,11 +127,7 @@ pub trait Flags {
|
||||
|
||||
pub trait Ty<I: Interner<Ty = Self>> {
|
||||
// Required method
|
||||
fn new_anon_bound(
|
||||
interner: I,
|
||||
debruijn: DebruijnIndex,
|
||||
var: BoundVar
|
||||
) -> Self;
|
||||
fn new_anon_bound(interner: I, debruijn: DebruijnIndex, var: BoundVar) -> Self;
|
||||
}
|
||||
|
||||
pub trait PlaceholderLike {
|
||||
@ -152,12 +145,7 @@ pub trait PlaceholderLike {
|
||||
pub struct ConstKind<I>(std::marker::PhantomData<I>);
|
||||
pub trait Const<I: Interner<Const = Self>> {
|
||||
// Required method
|
||||
fn new_anon_bound(
|
||||
interner: I,
|
||||
debruijn: DebruijnIndex,
|
||||
var: BoundVar,
|
||||
ty: I::Ty
|
||||
) -> Self;
|
||||
fn new_anon_bound(interner: I, debruijn: DebruijnIndex, var: BoundVar, ty: I::Ty) -> Self;
|
||||
}
|
||||
|
||||
pub trait ConstTy<I: Interner> {
|
||||
@ -170,25 +158,28 @@ pub trait ConstTy<I: Interner> {
|
||||
pub struct RegionKind<I>(std::marker::PhantomData<I>);
|
||||
pub trait Region<I: Interner<Region = Self>> {
|
||||
// Required method
|
||||
fn new_anon_bound(
|
||||
interner: I,
|
||||
debruijn: DebruijnIndex,
|
||||
var: BoundVar
|
||||
) -> Self;
|
||||
fn new_anon_bound(interner: I, debruijn: DebruijnIndex, var: BoundVar) -> Self;
|
||||
}
|
||||
|
||||
pub trait TypeVisitor<I: Interner>: Sized {
|
||||
type Result: VisitorResult = ();
|
||||
|
||||
// Provided methods
|
||||
fn visit_binder<T: TypeVisitable<I>>(
|
||||
&mut self,
|
||||
t: &I::Binder<T>
|
||||
) -> Self::Result { unimplemented!() }
|
||||
fn visit_ty(&mut self, t: I::Ty) -> Self::Result { unimplemented!() }
|
||||
fn visit_region(&mut self, _r: I::Region) -> Self::Result { unimplemented!() }
|
||||
fn visit_const(&mut self, c: I::Const) -> Self::Result { unimplemented!() }
|
||||
fn visit_predicate(&mut self, p: I::Predicate) -> Self::Result { unimplemented!() }
|
||||
fn visit_binder<T: TypeVisitable<I>>(&mut self, t: &I::Binder<T>) -> Self::Result {
|
||||
unimplemented!()
|
||||
}
|
||||
fn visit_ty(&mut self, t: I::Ty) -> Self::Result {
|
||||
unimplemented!()
|
||||
}
|
||||
fn visit_region(&mut self, _r: I::Region) -> Self::Result {
|
||||
unimplemented!()
|
||||
}
|
||||
fn visit_const(&mut self, c: I::Const) -> Self::Result {
|
||||
unimplemented!()
|
||||
}
|
||||
fn visit_predicate(&mut self, p: I::Predicate) -> Self::Result {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
pub trait VisitorResult {
|
||||
@ -206,7 +197,9 @@ impl VisitorResult for () {
|
||||
fn output() -> Self {}
|
||||
fn from_residual(_: Self::Residual) -> Self {}
|
||||
fn from_branch(_: ControlFlow<Self::Residual>) -> Self {}
|
||||
fn branch(self) -> ControlFlow<Self::Residual> { ControlFlow::Continue(()) }
|
||||
fn branch(self) -> ControlFlow<Self::Residual> {
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WithInfcx<'a, Infcx: InferCtxtLike, T> {
|
||||
@ -221,24 +214,18 @@ pub trait InferCtxtLike {
|
||||
fn interner(&self) -> Self::Interner;
|
||||
fn universe_of_ty(&self, ty: TyVid) -> Option<UniverseIndex>;
|
||||
fn root_ty_var(&self, vid: TyVid) -> TyVid;
|
||||
fn probe_ty_var(
|
||||
&self,
|
||||
vid: TyVid
|
||||
) -> Option<<Self::Interner as Interner>::Ty>;
|
||||
fn probe_ty_var(&self, vid: TyVid) -> Option<<Self::Interner as Interner>::Ty>;
|
||||
fn universe_of_lt(
|
||||
&self,
|
||||
lt: <Self::Interner as Interner>::InferRegion
|
||||
lt: <Self::Interner as Interner>::InferRegion,
|
||||
) -> Option<UniverseIndex>;
|
||||
fn opportunistic_resolve_lt_var(
|
||||
&self,
|
||||
vid: <Self::Interner as Interner>::InferRegion
|
||||
vid: <Self::Interner as Interner>::InferRegion,
|
||||
) -> Option<<Self::Interner as Interner>::Region>;
|
||||
fn universe_of_ct(&self, ct: ConstVid) -> Option<UniverseIndex>;
|
||||
fn root_ct_var(&self, vid: ConstVid) -> ConstVid;
|
||||
fn probe_ct_var(
|
||||
&self,
|
||||
vid: ConstVid
|
||||
) -> Option<<Self::Interner as Interner>::Const>;
|
||||
fn probe_ct_var(&self, vid: ConstVid) -> Option<<Self::Interner as Interner>::Const>;
|
||||
}
|
||||
|
||||
pub struct TyVid;
|
||||
|
@ -16,7 +16,9 @@ impl Trait for Struct {
|
||||
const AssociatedConst: i32 = 12;
|
||||
|
||||
#[doc(alias = "ImplTraitFunction")]
|
||||
fn function() -> Self::Target { 0 }
|
||||
fn function() -> Self::Target {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "EnumItem")]
|
||||
@ -71,5 +73,5 @@ pub fn method(&self) {}
|
||||
#[doc(alias = "MacroItem")]
|
||||
#[macro_export]
|
||||
macro_rules! Macro {
|
||||
() => {}
|
||||
() => {};
|
||||
}
|
||||
|
@ -5,10 +5,14 @@ pub trait MyTrait {
|
||||
fn not_appearing(&self) -> Option<&Self::T>;
|
||||
}
|
||||
|
||||
pub fn my_fn<X>(t: X) -> X { t }
|
||||
pub fn my_fn<X>(t: X) -> X {
|
||||
t
|
||||
}
|
||||
|
||||
pub trait AutoCorrectConfounder {
|
||||
type InsertUnnecessarilyLongTypeNameHere;
|
||||
fn assoc_type_acts_like_generic(&self, x: &Self::InsertUnnecessarilyLongTypeNameHere)
|
||||
-> Option<&Self::InsertUnnecessarilyLongTypeNameHere>;
|
||||
fn assoc_type_acts_like_generic(
|
||||
&self,
|
||||
x: &Self::InsertUnnecessarilyLongTypeNameHere,
|
||||
) -> Option<&Self::InsertUnnecessarilyLongTypeNameHere>;
|
||||
}
|
||||
|
@ -2,12 +2,11 @@
|
||||
|
||||
pub mod aaaaaaa {
|
||||
|
||||
extern {
|
||||
extern "C" {
|
||||
pub type MyForeignType;
|
||||
}
|
||||
|
||||
impl MyForeignType {
|
||||
pub fn my_method() {}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,16 +2,26 @@ pub mod sac {
|
||||
pub struct Sac;
|
||||
|
||||
impl Sac {
|
||||
pub fn len(&self) -> usize { 0 }
|
||||
pub fn len(&self) -> usize {
|
||||
0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod b {
|
||||
pub struct Sac;
|
||||
impl Sac {
|
||||
pub fn len(&self) -> usize { 0 }
|
||||
pub fn bar(&self, w: u32) -> usize { 0 }
|
||||
pub fn bar2(&self, w: u32) -> u32 { 0 }
|
||||
pub fn string(w: String) -> u32 { 0 }
|
||||
pub fn len(&self) -> usize {
|
||||
0
|
||||
}
|
||||
pub fn bar(&self, w: u32) -> usize {
|
||||
0
|
||||
}
|
||||
pub fn bar2(&self, w: u32) -> u32 {
|
||||
0
|
||||
}
|
||||
pub fn string(w: String) -> u32 {
|
||||
0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,15 @@ pub trait Foo {
|
||||
type Assoc<T>;
|
||||
}
|
||||
|
||||
pub fn sample<X: Foo<Assoc<u8> = u8>>(_: X) -> u32 { loop {} }
|
||||
pub fn synergy(_: impl Foo<Assoc<u8> = u8>) -> ! { loop {} }
|
||||
pub fn consider(_: impl Foo<Assoc<u8> = u32>) -> bool { loop {} }
|
||||
pub fn integrate<T>(_: impl Foo<Assoc<T> = T>) -> T { loop {} }
|
||||
pub fn sample<X: Foo<Assoc<u8> = u8>>(_: X) -> u32 {
|
||||
loop {}
|
||||
}
|
||||
pub fn synergy(_: impl Foo<Assoc<u8> = u8>) -> ! {
|
||||
loop {}
|
||||
}
|
||||
pub fn consider(_: impl Foo<Assoc<u8> = u32>) -> bool {
|
||||
loop {}
|
||||
}
|
||||
pub fn integrate<T>(_: impl Foo<Assoc<T> = T>) -> T {
|
||||
loop {}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
use std::io::{Result as IoResult, Read};
|
||||
use std::io::{Read, Result as IoResult};
|
||||
|
||||
pub struct Aaaaaaa;
|
||||
|
||||
@ -29,7 +29,10 @@ pub fn fffffff(_: bool) -> u64 {
|
||||
pub fn ggggggg(self) -> u64 {
|
||||
1
|
||||
}
|
||||
pub fn hhhhhhh() -> Self where T: Default {
|
||||
pub fn hhhhhhh() -> Self
|
||||
where
|
||||
T: Default,
|
||||
{
|
||||
Ddddddd(T::default())
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,16 @@
|
||||
pub trait SomeTrait {}
|
||||
pub trait OtherThingxxxxxxxx {}
|
||||
|
||||
pub fn alef<T: OtherThingxxxxxxxx>() -> Result<T, ()> { loop {} }
|
||||
pub fn bet<T: SomeTrait>() -> Result<T, ()> { loop {} }
|
||||
pub fn alef<T: OtherThingxxxxxxxx>() -> Result<T, ()> {
|
||||
loop {}
|
||||
}
|
||||
pub fn bet<T: SomeTrait>() -> Result<T, ()> {
|
||||
loop {}
|
||||
}
|
||||
|
||||
pub fn alpha<T: OtherThingxxxxxxxx>(_param: Result<T, ()>) { loop {} }
|
||||
pub fn beta<T: SomeTrait>(_param: Result<T, ()>) { loop {} }
|
||||
pub fn alpha<T: OtherThingxxxxxxxx>(_param: Result<T, ()>) {
|
||||
loop {}
|
||||
}
|
||||
pub fn beta<T: SomeTrait>(_param: Result<T, ()>) {
|
||||
loop {}
|
||||
}
|
||||
|
@ -3,26 +3,41 @@
|
||||
pub struct R<T>(T);
|
||||
|
||||
// returns test
|
||||
pub fn alef() -> R<P> { loop {} }
|
||||
pub fn bet() -> R<Q> { loop {} }
|
||||
pub fn alef() -> R<P> {
|
||||
loop {}
|
||||
}
|
||||
pub fn bet() -> R<Q> {
|
||||
loop {}
|
||||
}
|
||||
|
||||
// in_args test
|
||||
pub fn alpha(_x: R<P>) { loop {} }
|
||||
pub fn beta(_x: R<Q>) { loop {} }
|
||||
pub fn alpha(_x: R<P>) {
|
||||
loop {}
|
||||
}
|
||||
pub fn beta(_x: R<Q>) {
|
||||
loop {}
|
||||
}
|
||||
|
||||
// test case with multiple appearances of the same type
|
||||
pub struct ExtraCreditStructMulti<T, U> { t: T, u: U }
|
||||
pub struct ExtraCreditStructMulti<T, U> {
|
||||
t: T,
|
||||
u: U,
|
||||
}
|
||||
pub struct ExtraCreditInnerMulti {}
|
||||
pub fn extracreditlabhomework(
|
||||
_param: ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>
|
||||
) { loop {} }
|
||||
pub fn redherringmatchforextracredit(
|
||||
_param: ExtraCreditStructMulti<ExtraCreditInnerMulti, ()>
|
||||
) { loop {} }
|
||||
_param: ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>,
|
||||
) {
|
||||
loop {}
|
||||
}
|
||||
pub fn redherringmatchforextracredit(_param: ExtraCreditStructMulti<ExtraCreditInnerMulti, ()>) {
|
||||
loop {}
|
||||
}
|
||||
|
||||
pub trait TraitCat {}
|
||||
pub trait TraitDog {}
|
||||
|
||||
pub fn gamma<T: TraitCat + TraitDog>(t: T) {}
|
||||
|
||||
pub fn super_soup(s: Result<String, i32>) -> Result<String, i32> { s }
|
||||
pub fn super_soup(s: Result<String, i32>) -> Result<String, i32> {
|
||||
s
|
||||
}
|
||||
|
@ -4,9 +4,9 @@
|
||||
pub struct Second<T>(T);
|
||||
pub struct Third<T>(T);
|
||||
|
||||
pub fn fn_ptr(_: fn (First<u32>) -> !, _: bool) {}
|
||||
pub fn fn_once(_: impl FnOnce (Second<u32>) -> !, _: u8) {}
|
||||
pub fn fn_mut(_: impl FnMut (Third<u32>) -> !, _: i8) {}
|
||||
pub fn fn_(_: impl Fn (u32) -> !, _: char) {}
|
||||
pub fn fn_ptr(_: fn(First<u32>) -> !, _: bool) {}
|
||||
pub fn fn_once(_: impl FnOnce(Second<u32>) -> !, _: u8) {}
|
||||
pub fn fn_mut(_: impl FnMut(Third<u32>) -> !, _: i8) {}
|
||||
pub fn fn_(_: impl Fn(u32) -> !, _: char) {}
|
||||
|
||||
pub fn multiple(_: impl Fn(&'static str, &'static str) -> i8) {}
|
||||
|
@ -1,10 +1,10 @@
|
||||
#[macro_export]
|
||||
macro_rules! abracadabra {
|
||||
() => {}
|
||||
() => {};
|
||||
}
|
||||
#[macro_export]
|
||||
macro_rules! abracadabra_b {
|
||||
() => {}
|
||||
() => {};
|
||||
}
|
||||
pub fn abracadabra() {}
|
||||
pub fn abracadabra_c() {}
|
||||
|
@ -3,11 +3,27 @@
|
||||
#[allow(nonstandard_style)]
|
||||
pub struct never;
|
||||
|
||||
pub fn loops() -> ! { loop {} }
|
||||
pub fn returns() -> never { never }
|
||||
pub fn loops() -> ! {
|
||||
loop {}
|
||||
}
|
||||
pub fn returns() -> never {
|
||||
never
|
||||
}
|
||||
|
||||
pub fn impossible(x: !) { match x {} }
|
||||
pub fn uninteresting(x: never) { match x { never => {} } }
|
||||
pub fn impossible(x: !) {
|
||||
match x {}
|
||||
}
|
||||
pub fn uninteresting(x: never) {
|
||||
match x {
|
||||
never => {}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn box_impossible(x: Box<!>) { match *x {} }
|
||||
pub fn box_uninteresting(x: Box<never>) { match *x { never => {} } }
|
||||
pub fn box_impossible(x: Box<!>) {
|
||||
match *x {}
|
||||
}
|
||||
pub fn box_uninteresting(x: Box<never>) {
|
||||
match *x {
|
||||
never => {}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
#![crate_name="abracadabra"]
|
||||
#![crate_name = "abracadabra"]
|
||||
|
||||
pub struct HocusPocusPrestidigitation;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// The alias needed to be there to reproduce the bug
|
||||
// that used to be here.
|
||||
#[doc(alias="other_alias")]
|
||||
#[doc(alias = "other_alias")]
|
||||
pub fn something_else() {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
//@ aux-crate: macro_in_module=macro-in-module.rs
|
||||
#![crate_name="foo"]
|
||||
#![crate_name = "foo"]
|
||||
extern crate macro_in_module;
|
||||
|
||||
// Test case based on the relationship between alloc and std.
|
||||
|
@ -1,5 +1,5 @@
|
||||
// This test enforces that the (renamed) reexports are present in the search results.
|
||||
#![crate_name="foo"]
|
||||
#![crate_name = "foo"]
|
||||
|
||||
pub mod fmt {
|
||||
pub struct Subscriber;
|
||||
@ -14,5 +14,5 @@ pub fn dostuff(&self) {}
|
||||
}
|
||||
}
|
||||
|
||||
pub use foo::AnotherOne;
|
||||
pub use fmt::Subscriber;
|
||||
pub use foo::AnotherOne;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// This test enforces that the (renamed) reexports are present in the search results.
|
||||
#![crate_name="foo"]
|
||||
#![crate_name = "foo"]
|
||||
|
||||
pub mod fmt {
|
||||
pub struct Subscriber;
|
||||
@ -8,5 +8,5 @@ mod foo {
|
||||
pub struct AnotherOne;
|
||||
}
|
||||
|
||||
pub use foo::AnotherOne;
|
||||
pub use fmt::Subscriber;
|
||||
pub use foo::AnotherOne;
|
||||
|
@ -9,5 +9,5 @@ mod foo {
|
||||
pub struct AnotherOne;
|
||||
}
|
||||
|
||||
pub use foo::AnotherOne;
|
||||
pub use fmt::Subscriber as FmtSubscriber;
|
||||
pub use foo::AnotherOne;
|
||||
|
@ -7,13 +7,17 @@ pub fn pinky(input: &usize, manage: usize) {
|
||||
pub struct Thumb;
|
||||
|
||||
impl Thumb {
|
||||
pub fn up(&self, finger: Thumb) { unimplemented!() }
|
||||
pub fn up(&self, finger: Thumb) {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
pub enum Index {}
|
||||
|
||||
impl Index {
|
||||
pub fn point(self, data: &Index) { unimplemented!() }
|
||||
pub fn point(self, data: &Index) {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
pub union Ring {
|
||||
@ -22,11 +26,15 @@ pub union Ring {
|
||||
}
|
||||
|
||||
impl Ring {
|
||||
pub fn wear(&mut self, extra: &Ring) { unimplemented!() }
|
||||
pub fn wear(&mut self, extra: &Ring) {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub type Middle;
|
||||
}
|
||||
|
||||
pub fn show(left: &&mut Middle, right: &mut &Middle) { unimplemented!() }
|
||||
pub fn show(left: &&mut Middle, right: &mut &Middle) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
@ -3,12 +3,20 @@
|
||||
pub struct R<T>(T);
|
||||
|
||||
// returns test
|
||||
pub fn alef() -> &'static [R<P>] { loop {} }
|
||||
pub fn bet() -> R<[Q; 32]> { loop {} }
|
||||
pub fn alef() -> &'static [R<P>] {
|
||||
loop {}
|
||||
}
|
||||
pub fn bet() -> R<[Q; 32]> {
|
||||
loop {}
|
||||
}
|
||||
|
||||
// in_args test
|
||||
pub fn alpha(_x: R<&'static [P]>) { loop {} }
|
||||
pub fn beta(_x: [R<Q>; 32]) { loop {} }
|
||||
pub fn alpha(_x: R<&'static [P]>) {
|
||||
loop {}
|
||||
}
|
||||
pub fn beta(_x: [R<Q>; 32]) {
|
||||
loop {}
|
||||
}
|
||||
|
||||
pub trait TraitCat {}
|
||||
pub trait TraitDog {}
|
||||
|
@ -3,6 +3,6 @@
|
||||
pub enum Enum {
|
||||
Bar {
|
||||
/// This is a name.
|
||||
name: String
|
||||
}
|
||||
name: String,
|
||||
},
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![crate_type = "lib"]
|
||||
#![crate_name = "summaries"]
|
||||
|
||||
#![allow(rustdoc::broken_intra_doc_links)]
|
||||
|
||||
//! This *summary* has a [link], [`code`], and [`Sidebar2`] intra-doc.
|
||||
|
@ -3,16 +3,24 @@
|
||||
pub struct R<T>(T);
|
||||
|
||||
// Checks that tuple and unit both work
|
||||
pub fn side_effect() { }
|
||||
pub fn side_effect() {}
|
||||
|
||||
// Check a non-tuple
|
||||
pub fn not_tuple() -> P { loop {} }
|
||||
pub fn not_tuple() -> P {
|
||||
loop {}
|
||||
}
|
||||
|
||||
// Check a 1-tuple
|
||||
pub fn one() -> (P,) { loop {} }
|
||||
pub fn one() -> (P,) {
|
||||
loop {}
|
||||
}
|
||||
|
||||
// Check a 2-tuple
|
||||
pub fn two() -> (P,P) { loop {} }
|
||||
pub fn two() -> (P, P) {
|
||||
loop {}
|
||||
}
|
||||
|
||||
// Check a nested tuple
|
||||
pub fn nest() -> (Q, R<(u32,)>) { loop {} }
|
||||
pub fn nest() -> (Q, R<(u32,)>) {
|
||||
loop {}
|
||||
}
|
||||
|
@ -1,15 +1,23 @@
|
||||
#![crate_name="foo"]
|
||||
#![crate_name = "foo"]
|
||||
|
||||
pub trait Some {}
|
||||
impl Some for () {}
|
||||
pub trait Other {}
|
||||
impl Other for () {}
|
||||
|
||||
pub fn alef<T: Some>() -> T { loop {} }
|
||||
pub fn alpha() -> impl Some { }
|
||||
pub fn alef<T: Some>() -> T {
|
||||
loop {}
|
||||
}
|
||||
pub fn alpha() -> impl Some {}
|
||||
|
||||
pub fn bet<T, U>(t: T) -> U { loop {} }
|
||||
pub fn bet<T, U>(t: T) -> U {
|
||||
loop {}
|
||||
}
|
||||
pub fn beta<T>(t: T) -> T {}
|
||||
|
||||
pub fn other<T: Other, U: Other>(t: T, u: U) { loop {} }
|
||||
pub fn alternate<T: Other>(t: T, u: T) { loop {} }
|
||||
pub fn other<T: Other, U: Other>(t: T, u: U) {
|
||||
loop {}
|
||||
}
|
||||
pub fn alternate<T: Other>(t: T, u: T) {
|
||||
loop {}
|
||||
}
|
||||
|
@ -4,27 +4,46 @@ pub trait Trait<T> {
|
||||
fn thank_you(x: T);
|
||||
}
|
||||
|
||||
pub fn abracadabra<X>(_: X) where X: Trait<Nested> {}
|
||||
pub fn abracadabra<X>(_: X)
|
||||
where
|
||||
X: Trait<Nested>,
|
||||
{
|
||||
}
|
||||
|
||||
pub fn alacazam<X>() -> X where X: Trait<Nested> {}
|
||||
pub fn alacazam<X>() -> X
|
||||
where
|
||||
X: Trait<Nested>,
|
||||
{
|
||||
}
|
||||
|
||||
pub trait T1 {}
|
||||
pub trait T2<'a, T> {
|
||||
fn please(_: &'a T);
|
||||
}
|
||||
|
||||
pub fn presto<A, B>(_: A, _: B) where A: T1, B: for <'b> T2<'b, Nested> {}
|
||||
pub fn presto<A, B>(_: A, _: B)
|
||||
where
|
||||
A: T1,
|
||||
B: for<'b> T2<'b, Nested>,
|
||||
{
|
||||
}
|
||||
|
||||
pub trait Shazam {}
|
||||
|
||||
pub fn bippety<X>() -> &'static X where X: Shazam {
|
||||
pub fn bippety<X>() -> &'static X
|
||||
where
|
||||
X: Shazam,
|
||||
{
|
||||
panic!()
|
||||
}
|
||||
|
||||
pub struct Drizzel<T>(T);
|
||||
|
||||
impl<T> Drizzel<T> {
|
||||
pub fn boppety(&self) -> &T where T: Shazam {
|
||||
pub fn boppety(&self) -> &T
|
||||
where
|
||||
T: Shazam,
|
||||
{
|
||||
panic!();
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,5 @@
|
||||
// @is "$.index[*][?(@.name=='longest')].inner.function.decl.output.borrowed_ref.type.primitive" \"str\"
|
||||
|
||||
pub fn longest<'a>(l: &'a str, r: &'a str) -> &'a str {
|
||||
if l.len() > r.len() {
|
||||
l
|
||||
} else {
|
||||
r
|
||||
}
|
||||
if l.len() > r.len() { l } else { r }
|
||||
}
|
||||
|
@ -12,4 +12,8 @@ pub trait Trait {}
|
||||
// @is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
|
||||
// @is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].name" \"T\"
|
||||
// @is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].kind" '{ "type": { "bounds": [], "default": null, "synthetic": false } }'
|
||||
pub fn foo() where for<'a, T> &'a Wrapper<T>: Trait {}
|
||||
pub fn foo()
|
||||
where
|
||||
for<'a, T> &'a Wrapper<T>: Trait,
|
||||
{
|
||||
}
|
||||
|
@ -16,12 +16,19 @@ pub trait Trait<T> {
|
||||
fn handle(value: T) -> Self;
|
||||
}
|
||||
|
||||
impl<T, U> Trait<U> for T where T: From<U> {
|
||||
fn handle(_: U) -> Self { unimplemented!() }
|
||||
impl<T, U> Trait<U> for T
|
||||
where
|
||||
T: From<U>,
|
||||
{
|
||||
fn handle(_: U) -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, R> Trait<&'a mut Events<R>> for Other {
|
||||
fn handle(_: &'a mut Events<R>) -> Self { unimplemented!() }
|
||||
fn handle(_: &'a mut Events<R>) -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
fn this_compiles<'a, R>(value: &'a mut Events<R>) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![feature(extern_types)]
|
||||
|
||||
extern {
|
||||
extern "C" {
|
||||
/// No inner information
|
||||
pub type Foo;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
// @has "$.index[*][?(@.name=='Ux')].inner.union"
|
||||
pub union Ux {
|
||||
a: u32,
|
||||
b: u64
|
||||
b: u64,
|
||||
}
|
||||
|
||||
// @is "$.index[*][?(@.name=='Num')].visibility" \"public\"
|
||||
|
@ -7,7 +7,6 @@ pub union Union {
|
||||
float: f32,
|
||||
}
|
||||
|
||||
|
||||
// @has "$.index[*][?(@.name=='make_int_union')].inner.function.decl.output.resolved_path"
|
||||
// @is "$.index[*][?(@.name=='make_int_union')].inner.function.decl.output.resolved_path.id" $Union
|
||||
pub fn make_int_union(int: i32) -> Union {
|
||||
|
Loading…
Reference in New Issue
Block a user