Skip to content
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

Format src/test/ui-fulldeps #98850

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ ignore = [
# tests for now are not formatted, as they are sometimes pretty-printing constrained
# (and generally rustfmt can move around comments in UI-testing incompatible ways)
"src/test",
# format ui-fulldeps as they aren't so susceptible to pretty-printing and
# UI-testing comments are used sparingly (and then mostly only error annotations).
"!src/test/ui-fulldeps",

# do not format submodules
"library/backtrace",
Expand Down
7 changes: 5 additions & 2 deletions src/test/ui-fulldeps/auxiliary/issue-13560-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@

#![crate_type = "rlib"]

#[macro_use] #[no_link] extern crate issue_13560_1 as t1;
#[macro_use] extern crate issue_13560_2 as t2;
#[macro_use]
#[no_link]
extern crate issue_13560_1 as t1;
#[macro_use]
extern crate issue_13560_2 as t2;
8 changes: 4 additions & 4 deletions src/test/ui-fulldeps/auxiliary/issue-16822.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#![crate_type="lib"]
#![crate_type = "lib"]

use std::cell::RefCell;

pub struct Window<Data>{
pub data: RefCell<Data>
pub struct Window<Data> {
pub data: RefCell<Data>,
}

impl<Data: Update> Window<Data> {
impl<Data: Update> Window<Data> {
pub fn update(&self, e: i32) {
match e {
1 => self.data.borrow_mut().update(),
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui-fulldeps/auxiliary/issue-18502.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![crate_type="lib"]
#![crate_type = "lib"]

struct Foo;
// This is the ICE trigger
Expand All @@ -12,7 +12,7 @@ impl Show for Foo {
fn fmt(&self) {}
}

fn bar<T>(f: extern "Rust" fn(&T), t: &T) { }
fn bar<T>(f: fn(&T), t: &T) {}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, hm. My eyes glanced over that initially. Removing code seems more of an actual problem even for fulldeps. I wasn't aware rustfmt did that. I'm not sure if that matters here but it's got me concerned enough to worry about doing this at all. And the issue (#18502) is from pre-1.0 Rust which makes it awkward for me to tell if this matters.

I'm fairly confident that the other tests aren't sensitive to formatting (or at least they aren't intending to be) but this is something different.


// ICE requirement: this has to be marked as inline
#[inline]
Expand Down
7 changes: 5 additions & 2 deletions src/test/ui-fulldeps/auxiliary/issue-24106.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#![crate_type="lib"]
#![crate_type = "lib"]

enum E { E0 = 0, E1 = 1 }
enum E {
E0 = 0,
E1 = 1,
}
const E0_U8: u8 = E::E0 as u8;
const E1_U8: u8 = E::E1 as u8;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ extern crate rustc_lint;
#[macro_use]
extern crate rustc_session;

use rustc_ast as ast;
use rustc_driver::plugin::Registry;
use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
use rustc_ast as ast;
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");

declare_lint_pass!(Pass => [TEST_LINT]);
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/auxiliary/lint-tool-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ extern crate rustc_lint;
#[macro_use]
extern crate rustc_session;

use rustc_ast as ast;
use rustc_driver::plugin::Registry;
use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintId, LintPass};
use rustc_ast as ast;
declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff");
declare_tool_lint!(
/// Some docs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#![feature(rustc_private)]

extern crate rustc_middle;
extern crate rustc_driver;
extern crate rustc_middle;

use rustc_driver::plugin::Registry;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/auxiliary/multiple-plugins-1.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![crate_type = "dylib"]
#![feature(rustc_private)]

extern crate rustc_middle;
extern crate rustc_driver;
extern crate rustc_middle;

use rustc_driver::plugin::Registry;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/auxiliary/multiple-plugins-2.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![crate_type = "dylib"]
#![feature(rustc_private)]

extern crate rustc_middle;
extern crate rustc_driver;
extern crate rustc_middle;

use rustc_driver::plugin::Registry;

Expand Down
8 changes: 4 additions & 4 deletions src/test/ui-fulldeps/auxiliary/outlive-expansion-phase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

#![feature(rustc_private)]

extern crate rustc_middle;
extern crate rustc_driver;
extern crate rustc_middle;

use rustc_driver::plugin::Registry;
use std::any::Any;
use std::cell::RefCell;
use rustc_driver::plugin::Registry;

struct Foo {
foo: isize
foo: isize,
}

impl Drop for Foo {
Expand All @@ -20,5 +20,5 @@ impl Drop for Foo {
#[no_mangle]
fn __rustc_plugin_registrar(_: &mut Registry) {
thread_local!(static FOO: RefCell<Option<Box<Any+Send>>> = RefCell::new(None));
FOO.with(|s| *s.borrow_mut() = Some(Box::new(Foo { foo: 10 }) as Box<Any+Send>));
FOO.with(|s| *s.borrow_mut() = Some(Box::new(Foo { foo: 10 }) as Box<Any + Send>));
}
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/auxiliary/proc-macro-panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![crate_type = "proc-macro"]

extern crate proc_macro;
use proc_macro::{TokenStream, Ident, Span};
use proc_macro::{Ident, Span, TokenStream};

#[proc_macro]
pub fn panic_in_libproc_macro(_: TokenStream) -> TokenStream {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/auxiliary/rlib-crate-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#![crate_type = "rlib"]
#![feature(rustc_private)]

extern crate rustc_middle;
extern crate rustc_driver;
extern crate rustc_middle;

use rustc_driver::plugin::Registry;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/compiler-calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extern crate rustc_interface;
use rustc_interface::interface;

struct TestCalls<'a> {
count: &'a mut u32
count: &'a mut u32,
}

impl rustc_driver::Callbacks for TestCalls<'_> {
Expand Down
12 changes: 7 additions & 5 deletions src/test/ui-fulldeps/dropck-tarena-cycle-checked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

extern crate rustc_arena;

use id::Id;
use rustc_arena::TypedArena;
use std::cell::Cell;
use id::Id;

mod s {
use std::sync::atomic::{AtomicUsize, Ordering};
Expand Down Expand Up @@ -57,14 +57,16 @@ trait HasId {
}

#[derive(Debug)]
struct CheckId<T:HasId> {
v: T
struct CheckId<T: HasId> {
v: T,
}

#[allow(non_snake_case)]
fn CheckId<T:HasId>(t: T) -> CheckId<T> { CheckId{ v: t } }
fn CheckId<T: HasId>(t: T) -> CheckId<T> {
CheckId { v: t }
}

impl<T:HasId> Drop for CheckId<T> {
impl<T: HasId> Drop for CheckId<T> {
fn drop(&mut self) {
assert!(self.v.count() > 0);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/dropck-tarena-cycle-checked.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0597]: `arena` does not live long enough
--> $DIR/dropck-tarena-cycle-checked.rs:116:7
--> $DIR/dropck-tarena-cycle-checked.rs:118:7
|
LL | f(&arena);
| ^^^^^^ borrowed value does not live long enough
Expand Down
20 changes: 15 additions & 5 deletions src/test/ui-fulldeps/dropck-tarena-unsound-drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,34 @@ extern crate rustc_arena;

use rustc_arena::TypedArena;

trait HasId { fn count(&self) -> usize; }
trait HasId {
fn count(&self) -> usize;
}

struct CheckId<T:HasId> { v: T }
struct CheckId<T: HasId> {
v: T,
}

// In the code below, the impl of HasId for `&'a usize` does not
// actually access the borrowed data, but the point is that the
// interface to CheckId does not (and cannot) know that, and therefore
// when encountering a value V of type CheckId<S>, we must
// conservatively force the type S to strictly outlive V.
impl<T:HasId> Drop for CheckId<T> {
impl<T: HasId> Drop for CheckId<T> {
fn drop(&mut self) {
assert!(self.v.count() > 0);
}
}

struct C<'a> { v: CheckId<&'a usize>, }
struct C<'a> {
v: CheckId<&'a usize>,
}

impl<'a> HasId for &'a usize { fn count(&self) -> usize { 1 } }
impl<'a> HasId for &'a usize {
fn count(&self) -> usize {
1
}
}

fn f<'a>(_arena: &'a TypedArena<C<'a>>) {}

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/dropck-tarena-unsound-drop.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0597]: `arena` does not live long enough
--> $DIR/dropck-tarena-unsound-drop.rs:41:7
--> $DIR/dropck-tarena-unsound-drop.rs:51:7
|
LL | f(&arena);
| ^^^^^^ borrowed value does not live long enough
Expand Down
21 changes: 15 additions & 6 deletions src/test/ui-fulldeps/dropck_tarena_sound_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,41 @@
// Compare against ui-fulldeps/dropck-tarena-unsound-drop.rs, which
// shows a similar setup, but restricts `f` so that the struct `C<'a>`
// is force-fed a lifetime equal to that of the borrowed arena.

#![allow(unstable)]
#![feature(rustc_private)]

extern crate rustc_arena;

use rustc_arena::TypedArena;

trait HasId { fn count(&self) -> usize; }
trait HasId {
fn count(&self) -> usize;
}

struct CheckId<T:HasId> { v: T }
struct CheckId<T: HasId> {
v: T,
}

// In the code below, the impl of HasId for `&'a usize` does not
// actually access the borrowed data, but the point is that the
// interface to CheckId does not (and cannot) know that, and therefore
// when encountering a value V of type CheckId<S>, we must
// conservatively force the type S to strictly outlive V.
impl<T:HasId> Drop for CheckId<T> {
impl<T: HasId> Drop for CheckId<T> {
fn drop(&mut self) {
assert!(self.v.count() > 0);
}
}

struct C<'a> { _v: CheckId<&'a usize>, }
struct C<'a> {
_v: CheckId<&'a usize>,
}

impl<'a> HasId for &'a usize { fn count(&self) -> usize { 1 } }
impl<'a> HasId for &'a usize {
fn count(&self) -> usize {
1
}
}

fn f<'a, 'b>(_arena: &'a TypedArena<C<'b>>) {}

Expand Down
28 changes: 14 additions & 14 deletions src/test/ui-fulldeps/fluent-messages/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,37 @@ mod missing_absolute {
use super::fluent_messages;

fluent_messages! {
missing_absolute => "/definitely_does_not_exist.ftl",
//~^ ERROR could not open Fluent resource
}
missing_absolute => "/definitely_does_not_exist.ftl",
//~^ ERROR could not open Fluent resource
}
}

mod missing_relative {
use super::fluent_messages;

fluent_messages! {
missing_relative => "../definitely_does_not_exist.ftl",
//~^ ERROR could not open Fluent resource
}
missing_relative => "../definitely_does_not_exist.ftl",
//~^ ERROR could not open Fluent resource
}
}

mod missing_message {
use super::fluent_messages;

fluent_messages! {
missing_message => "./missing-message.ftl",
//~^ ERROR could not parse Fluent resource
}
missing_message => "./missing-message.ftl",
//~^ ERROR could not parse Fluent resource
}
}

mod duplicate {
use super::fluent_messages;

fluent_messages! {
a => "./duplicate-a.ftl",
b => "./duplicate-b.ftl",
//~^ ERROR overrides existing message: `key`
}
a => "./duplicate-a.ftl",
b => "./duplicate-b.ftl",
//~^ ERROR overrides existing message: `key`
}
}

mod valid {
Expand All @@ -62,5 +62,5 @@ mod valid {
valid => "./valid.ftl",
}

use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, valid::valid};
use self::fluent_generated::{valid::valid, DEFAULT_LOCALE_RESOURCES};
}
Loading