Merge branch 'master' into stabilise/termination-test

This commit is contained in:
Dylan DPC 2018-06-04 10:58:56 +05:30 committed by GitHub
commit 72f2f1935d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
118 changed files with 2173 additions and 565 deletions

View file

@ -0,0 +1,22 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// no-prefer-dynamic
#![crate_type = "rlib"]
#![feature(panic_implementation)]
#![no_std]
use core::panic::PanicInfo;
#[panic_implementation]
fn panic(info: &PanicInfo) -> ! {
loop {}
}

View file

@ -14,9 +14,11 @@
#![feature(lang_items)]
#[lang = "panic_fmt"]
fn panic_fmt() -> ! {
//~^ ERROR: duplicate lang item found: `panic_fmt`.
use std::panic::PanicInfo;
#[lang = "panic_impl"]
fn panic_impl(info: &PanicInfo) -> ! {
//~^ ERROR: duplicate lang item found: `panic_impl`.
loop {}
}

View file

@ -12,8 +12,9 @@
// compile-flags: --edition 2015
// compile-pass
#![deny(rust_2018_idioms)]
#![warn(rust_2018_idioms)]
extern crate edition_extern_crate_allowed;
//~^ WARNING unused extern crate
fn main() {}

View file

@ -0,0 +1,21 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags:-C panic=abort
#![no_std]
#![no_main]
use core::panic::PanicInfo;
#[panic_implementation] //~ ERROR #[panic_implementation] is an unstable feature (see issue #44489)
fn panic(info: &PanicInfo) -> ! {
loop {}
}

View file

@ -21,4 +21,4 @@ fn main() {
#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "eh_unwind_resume"] extern fn eh_unwind_resume() {}
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
#[lang = "panic_impl"] fn panic_impl() -> ! { loop {} }

View file

@ -0,0 +1,24 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags:-C panic=abort
#![feature(panic_implementation)]
#![no_std]
#![no_main]
use core::panic::PanicInfo;
#[panic_implementation]
fn panic(
info: PanicInfo, //~ ERROR argument should be `&PanicInfo`
) -> () //~ ERROR return type should be `!`
{
}

View file

@ -0,0 +1,25 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags:-C panic=abort
#![feature(panic_implementation)]
#![no_std]
#![no_main]
use core::panic::PanicInfo;
#[panic_implementation]
fn panic(
info: &'static PanicInfo, //~ ERROR argument should be `&PanicInfo`
) -> !
{
loop {}
}

View file

@ -0,0 +1,22 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags:-C panic=abort
#![feature(panic_implementation)]
#![no_std]
#![no_main]
use core::panic::PanicInfo;
#[panic_implementation]
fn panic() -> ! { //~ ERROR function should have one argument
loop {}
}

View file

@ -0,0 +1,23 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags:-C panic=abort
#![feature(panic_implementation)]
#![no_std]
#![no_main]
use core::panic::PanicInfo;
#[panic_implementation]
fn panic<T>(pi: &PanicInfo) -> ! {
//~^ ERROR `#[panic_implementation]` function should have no type parameters
loop {}
}

View file

@ -0,0 +1,28 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags:-C panic=abort
#![feature(lang_items)]
#![feature(panic_implementation)]
#![no_std]
#![no_main]
use core::panic::PanicInfo;
#[panic_implementation]
fn panic(info: &PanicInfo) -> ! {
loop {}
}
#[lang = "panic_impl"]
fn panic2(info: &PanicInfo) -> ! { //~ ERROR duplicate lang item found: `panic_impl`.
loop {}
}

View file

@ -0,0 +1,26 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags:-C panic=abort
// error-pattern: language item required, but not found: `panic_info`
#![feature(lang_items)]
#![feature(no_core)]
#![feature(panic_implementation)]
#![no_core]
#![no_main]
#[panic_implementation]
fn panic() -> ! {
loop {}
}
#[lang = "sized"]
trait Sized {}

View file

@ -0,0 +1,22 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: duplicate lang item found: `panic_impl`.
#![feature(panic_implementation)]
use std::panic::PanicInfo;
#[panic_implementation]
fn panic(info: PanicInfo) -> ! {
loop {}
}
fn main() {}

View file

@ -0,0 +1,29 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// aux-build:some-panic-impl.rs
#![feature(panic_implementation)]
#![feature(lang_items)]
#![no_std]
#![no_main]
extern crate some_panic_impl;
use core::panic::PanicInfo;
#[panic_implementation]
fn panic(info: &PanicInfo) -> ! {
//~^ error duplicate lang item found: `panic_impl`
loop {}
}
#[lang = "eh_personality"]
fn eh() {}

View file

@ -15,8 +15,10 @@
#![no_std]
#![feature(lang_items)]
#[lang = "panic_fmt"]
fn panic_fmt() {}
use core::panic::PanicInfo;
#[lang = "panic_impl"]
fn panic_impl(info: &PanicInfo) -> ! { loop {} }
#[lang = "eh_personality"]
fn eh_personality() {}
#[lang = "eh_unwind_resume"]

View file

@ -9,7 +9,7 @@
// except according to those terms.
// aux-build:weak-lang-items.rs
// error-pattern: language item required, but not found: `panic_fmt`
// error-pattern: language item required, but not found: `panic_impl`
// error-pattern: language item required, but not found: `eh_personality`
// ignore-wasm32-bare compiled with panic=abort, personality not required

View file

@ -0,0 +1,21 @@
-include ../tools.mk
ifeq (musl,$(findstring musl,$(TARGET)))
all: skip
else
all: test
endif
test: foo
$(call RUN,foo)
skip:
echo "expected failure"
foo: foo.rs $(call NATIVE_STATICLIB,foo)
$(RUSTC) $< -lfoo $(EXTRACXXFLAGS)
$(TMPDIR)/libfoo.o: foo.cpp
$(call COMPILE_OBJ_CXX,$@,$<)
.PHONY: all test skip

View file

@ -0,0 +1,25 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#include <stdint.h>
struct A {
A() { v = 1234; }
~A() { v = 1; }
uint32_t v;
};
A a;
extern "C" {
uint32_t get() {
return a.v;
}
}

View file

@ -0,0 +1,18 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Tests that linking to C++ code with global destructors works.
extern { fn get() -> u32; }
fn main() {
let i = unsafe { get() };
assert_eq!(i, 1234);
}

View file

@ -0,0 +1,7 @@
-include ../../run-make-fulldeps/tools.mk
# NOTE we use --emit=llvm-ir to avoid running the linker (linking will fail because there's no main
# in this crate)
all:
$(RUSTC) panic-impl-provider.rs
$(RUSTC) panic-impl-consumer.rs -C panic=abort --emit=llvm-ir -L $(TMPDIR)

View file

@ -0,0 +1,15 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![no_std]
#![no_main]
// this crate provides the `panic_impl` lang item so we don't need to define it here
extern crate panic_impl_provider;

View file

@ -0,0 +1,20 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_type = "rlib"]
#![feature(panic_implementation)]
#![no_std]
use core::panic::PanicInfo;
#[panic_implementation]
fn panic(info: &PanicInfo) -> ! {
loop {}
}

View file

@ -59,12 +59,14 @@ endif
ifdef IS_MSVC
COMPILE_OBJ = $(CC) -c -Fo:`cygpath -w $(1)` $(2)
COMPILE_OBJ_CXX = $(CXX) -c -Fo:`cygpath -w $(1)` $(2)
NATIVE_STATICLIB_FILE = $(1).lib
NATIVE_STATICLIB = $(TMPDIR)/$(call NATIVE_STATICLIB_FILE,$(1))
OUT_EXE=-Fe:`cygpath -w $(TMPDIR)/$(call BIN,$(1))` \
-Fo:`cygpath -w $(TMPDIR)/$(1).obj`
else
COMPILE_OBJ = $(CC) -c -o $(1) $(2)
COMPILE_OBJ_CXX = $(CXX) -c -o $(1) $(2)
NATIVE_STATICLIB_FILE = lib$(1).a
NATIVE_STATICLIB = $(call STATICLIB,$(1))
OUT_EXE=-o $(TMPDIR)/$(1)

View file

@ -0,0 +1,32 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(const_int_ops)]
#![feature(test)]
extern crate test;
use test::black_box as b;
const BE_U32: u32 = 55u32.to_be();
const LE_U32: u32 = 55u32.to_le();
fn main() {
assert_eq!(BE_U32, b(55u32).to_be());
assert_eq!(LE_U32, b(55u32).to_le());
#[cfg(not(target_arch = "asmjs"))]
{
const BE_U128: u128 = 999999u128.to_be();
const LE_I128: i128 = -999999i128.to_le();
assert_eq!(BE_U128, b(999999u128).to_be());
assert_eq!(LE_I128, b(-999999i128).to_le());
}
}

View file

@ -10,7 +10,9 @@
// compile-pass
//! Test with [Foo::baz], [Bar::foo], [Uniooon::X]
//! Test with [Foo::baz], [Bar::foo], ...
//!
//! and [Uniooon::X].
pub struct Foo {
pub bar: usize,

View file

@ -1,6 +1,39 @@
warning: [Foo::baz] cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:13:1
|
13 | / //! Test with [Foo::baz], [Bar::foo], ...
14 | | //!
15 | | //! and [Uniooon::X].
| |_____________________^
|
= note: the link appears in this line:
Test with [Foo::baz], [Bar::foo], ...
^^^^^^^^
warning: [Bar::foo] cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:13:1
|
13 | / //! Test with [Foo::baz], [Bar::foo], ...
14 | | //!
15 | | //! and [Uniooon::X].
| |_____________________^
|
= note: the link appears in this line:
Test with [Foo::baz], [Bar::foo], ...
^^^^^^^^
warning: [Uniooon::X] cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:13:1
|
13 | / //! Test with [Foo::baz], [Bar::foo], ...
14 | | //!
15 | | //! and [Uniooon::X].
| |_____________________^
|
= note: the link appears in this line:
and [Uniooon::X].
^^^^^^^^^^

View file

@ -9,6 +9,7 @@
// except according to those terms.
// no-prefer-dynamic
// ignore-stage1
#![crate_type = "proc-macro"]

View file

@ -0,0 +1,32 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_name = "foo"]
// ignore-tidy-linelength
pub trait Foo {
// @has foo/trait.Foo.html '//h3[@id="tymethod.foo"]//div[@class="docblock attributes"]' '#[must_use]'
#[must_use]
fn foo();
}
#[must_use]
pub struct Bar;
impl Bar {
// @has foo/struct.Bar.html '//h4[@id="method.bar"]//div[@class="docblock attributes"]' '#[must_use]'
#[must_use]
pub fn bar() {}
// @has foo/struct.Bar.html '//h4[@id="method.bar2"]//div[@class="docblock attributes"]' '#[must_use]'
#[must_use]
pub fn bar2() {}
}

View file

@ -10,48 +10,90 @@
// compile-flags: --edition 2018
#![deny(unnecessary_extern_crates)]
#![deny(unused_extern_crates)]
#![feature(alloc, test, libc)]
extern crate alloc;
//~^ ERROR `extern crate` is unnecessary in the new edition
//~^ ERROR unused extern crate
//~| HELP remove
extern crate alloc as x;
//~^ ERROR `extern crate` is unnecessary in the new edition
//~| HELP use `use`
//~^ ERROR unused extern crate
//~| HELP remove
#[macro_use]
extern crate test;
pub extern crate test as y;
//~^ ERROR `extern crate` is unnecessary in the new edition
//~| HELP use `pub use`
pub extern crate libc;
//~^ ERROR `extern crate` is unnecessary in the new edition
//~| HELP use `pub use`
pub extern crate test as y;
//~^ ERROR `extern crate` is not idiomatic in the new edition
//~| HELP convert it to a `pub use`
pub extern crate libc;
//~^ ERROR `extern crate` is not idiomatic in the new edition
//~| HELP convert it to a `pub use`
pub(crate) extern crate libc as a;
//~^ ERROR `extern crate` is not idiomatic in the new edition
//~| HELP convert it to a `pub(crate) use`
crate extern crate libc as b;
//~^ ERROR `extern crate` is not idiomatic in the new edition
//~| HELP convert it to a `crate use`
mod foo {
pub(in crate::foo) extern crate libc as c;
//~^ ERROR `extern crate` is not idiomatic in the new edition
//~| HELP convert it to a `pub(in crate::foo) use`
pub(super) extern crate libc as d;
//~^ ERROR `extern crate` is not idiomatic in the new edition
//~| HELP convert it to a `pub(super) use`
extern crate alloc;
//~^ ERROR `extern crate` is unnecessary in the new edition
//~| HELP use `use`
//~^ ERROR unused extern crate
//~| HELP remove
extern crate alloc as x;
//~^ ERROR `extern crate` is unnecessary in the new edition
//~| HELP use `use`
//~^ ERROR unused extern crate
//~| HELP remove
pub extern crate test;
//~^ ERROR `extern crate` is unnecessary in the new edition
//~| HELP use `pub use`
//~^ ERROR `extern crate` is not idiomatic in the new edition
//~| HELP convert it
pub extern crate test as y;
//~^ ERROR `extern crate` is unnecessary in the new edition
//~| HELP use `pub use`
//~^ ERROR `extern crate` is not idiomatic in the new edition
//~| HELP convert it
mod bar {
extern crate alloc;
//~^ ERROR `extern crate` is unnecessary in the new edition
//~| HELP use `use`
//~^ ERROR unused extern crate
//~| HELP remove
extern crate alloc as x;
//~^ ERROR `extern crate` is unnecessary in the new edition
//~| HELP use `use`
//~^ ERROR unused extern crate
//~| HELP remove
pub(in crate::foo::bar) extern crate libc as e;
//~^ ERROR `extern crate` is not idiomatic in the new edition
//~| HELP convert it to a `pub(in crate::foo::bar) use`
fn dummy() {
unsafe {
e::getpid();
}
}
}
fn dummy() {
unsafe {
c::getpid();
d::getpid();
}
}
}
fn main() {}
fn main() {
unsafe { a::getpid(); }
unsafe { b::getpid(); }
}

View file

@ -1,4 +1,4 @@
error: `extern crate` is unnecessary in the new edition
error: unused extern crate
--> $DIR/unnecessary-extern-crate.rs:16:1
|
LL | extern crate alloc;
@ -7,62 +7,92 @@ LL | extern crate alloc;
note: lint level defined here
--> $DIR/unnecessary-extern-crate.rs:13:9
|
LL | #![deny(unnecessary_extern_crates)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
LL | #![deny(unused_extern_crates)]
| ^^^^^^^^^^^^^^^^^^^^
error: `extern crate` is unnecessary in the new edition
error: unused extern crate
--> $DIR/unnecessary-extern-crate.rs:19:1
|
LL | extern crate alloc as x;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x;`
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:25:1
error: `extern crate` is not idiomatic in the new edition
--> $DIR/unnecessary-extern-crate.rs:26:1
|
LL | pub extern crate test as y;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test as y;`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `pub use`
error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:28:1
error: `extern crate` is not idiomatic in the new edition
--> $DIR/unnecessary-extern-crate.rs:30:1
|
LL | pub extern crate libc;
| ^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use libc;`
| ^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `pub use`
error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:34:5
error: `extern crate` is not idiomatic in the new edition
--> $DIR/unnecessary-extern-crate.rs:34:1
|
LL | extern crate alloc;
| ^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc;`
LL | pub(crate) extern crate libc as a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `pub(crate) use`
error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:37:5
error: `extern crate` is not idiomatic in the new edition
--> $DIR/unnecessary-extern-crate.rs:38:1
|
LL | extern crate alloc as x;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x;`
LL | crate extern crate libc as b;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `crate use`
error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:40:5
|
LL | pub extern crate test;
| ^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test;`
error: `extern crate` is unnecessary in the new edition
error: `extern crate` is not idiomatic in the new edition
--> $DIR/unnecessary-extern-crate.rs:43:5
|
LL | pub extern crate test as y;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `pub use`: `pub use test as y;`
LL | pub(in crate::foo) extern crate libc as c;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `pub(in crate::foo) use`
error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:47:9
error: `extern crate` is not idiomatic in the new edition
--> $DIR/unnecessary-extern-crate.rs:47:5
|
LL | pub(super) extern crate libc as d;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `pub(super) use`
error: unused extern crate
--> $DIR/unnecessary-extern-crate.rs:51:5
|
LL | extern crate alloc;
| ^^^^^^^^^^^^^^^^^^^ help: remove it
error: unused extern crate
--> $DIR/unnecessary-extern-crate.rs:55:5
|
LL | extern crate alloc as x;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
error: `extern crate` is not idiomatic in the new edition
--> $DIR/unnecessary-extern-crate.rs:59:5
|
LL | pub extern crate test;
| ^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `pub use`
error: `extern crate` is not idiomatic in the new edition
--> $DIR/unnecessary-extern-crate.rs:63:5
|
LL | pub extern crate test as y;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `pub use`
error: unused extern crate
--> $DIR/unnecessary-extern-crate.rs:68:9
|
LL | extern crate alloc;
| ^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc;`
| ^^^^^^^^^^^^^^^^^^^ help: remove it
error: `extern crate` is unnecessary in the new edition
--> $DIR/unnecessary-extern-crate.rs:50:9
error: unused extern crate
--> $DIR/unnecessary-extern-crate.rs:72:9
|
LL | extern crate alloc as x;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use alloc as x;`
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
error: aborting due to 10 previous errors
error: `extern crate` is not idiomatic in the new edition
--> $DIR/unnecessary-extern-crate.rs:76:9
|
LL | pub(in crate::foo::bar) extern crate libc as e;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `pub(in crate::foo::bar) use`
error: aborting due to 15 previous errors

View file

@ -0,0 +1,63 @@
error[E0597]: borrowed value does not live long enough
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:15:21
|
LL | fn gimme_static_mut_let() -> &'static mut u32 {
| _______________________________________________-
LL | | let ref mut x = 1234543; //~ ERROR
| | ^^^^^^^ temporary value does not live long enough
LL | | x
LL | | }
| | -
| | |
| |_temporary value only lives until here
| borrow later used here
error[E0597]: borrowed value does not live long enough
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:20:25
|
LL | fn gimme_static_mut_let_nested() -> &'static mut u32 {
| ______________________________________________________-
LL | | let (ref mut x, ) = (1234543, ); //~ ERROR
| | ^^^^^^^^^^^ temporary value does not live long enough
LL | | x
LL | | }
| | -
| | |
| |_temporary value only lives until here
| borrow later used here
error[E0597]: borrowed value does not live long enough
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:25:11
|
LL | match 1234543 {
| ^^^^^^^ temporary value does not live long enough
...
LL | }
| - temporary value only lives until here
|
= note: borrowed value must be valid for the static lifetime...
error[E0597]: borrowed value does not live long enough
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:31:11
|
LL | match (123443,) {
| ^^^^^^^^^ temporary value does not live long enough
...
LL | }
| - temporary value only lives until here
|
= note: borrowed value must be valid for the static lifetime...
error[E0597]: borrowed value does not live long enough
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:37:10
|
LL | &mut 1234543 //~ ERROR
| ^^^^^^^ temporary value does not live long enough
LL | }
| - temporary value only lives until here
|
= note: borrowed value must be valid for the static lifetime...
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0597`.

View file

@ -0,0 +1,41 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test that we fail to promote the constant here which has a `ref
// mut` borrow.
fn gimme_static_mut_let() -> &'static mut u32 {
let ref mut x = 1234543; //~ ERROR
x
}
fn gimme_static_mut_let_nested() -> &'static mut u32 {
let (ref mut x, ) = (1234543, ); //~ ERROR
x
}
fn gimme_static_mut_match() -> &'static mut u32 {
match 1234543 {
ref mut x => x //~ ERROR
}
}
fn gimme_static_mut_match_nested() -> &'static mut u32 {
match (123443,) {
(ref mut x,) => x, //~ ERROR
}
}
fn gimme_static_mut_ampersand() -> &'static mut u32 {
&mut 1234543 //~ ERROR
}
fn main() {
}

View file

@ -0,0 +1,57 @@
error[E0597]: borrowed value does not live long enough
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:15:9
|
LL | let ref mut x = 1234543; //~ ERROR
| ^^^^^^^^^ temporary value does not live long enough
LL | x
LL | }
| - temporary value only lives until here
|
= note: borrowed value must be valid for the static lifetime...
error[E0597]: borrowed value does not live long enough
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:20:10
|
LL | let (ref mut x, ) = (1234543, ); //~ ERROR
| ^^^^^^^^^ borrowed value does not live long enough
LL | x
LL | }
| - borrowed value only lives until here
|
= note: borrowed value must be valid for the static lifetime...
error[E0597]: borrowed value does not live long enough
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:26:9
|
LL | ref mut x => x //~ ERROR
| ^^^^^^^^^ temporary value does not live long enough
LL | }
LL | }
| - temporary value only lives until here
|
= note: borrowed value must be valid for the static lifetime...
error[E0597]: borrowed value does not live long enough
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:32:10
|
LL | (ref mut x,) => x, //~ ERROR
| ^^^^^^^^^ borrowed value does not live long enough
LL | }
LL | }
| - borrowed value only lives until here
|
= note: borrowed value must be valid for the static lifetime...
error[E0597]: borrowed value does not live long enough
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:37:10
|
LL | &mut 1234543 //~ ERROR
| ^^^^^^^ temporary value does not live long enough
LL | }
| - temporary value only lives until here
|
= note: borrowed value must be valid for the static lifetime...
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0597`.

View file

@ -33,7 +33,7 @@ pub struct Bar(u32, u32, u32);
struct Y(usize);
#[derive(PartialEq)]
//~^ ERROR #[derive] can't be used on a non-Copy #[repr(packed)]
//~^ ERROR #[derive] can't be used
//~| hard error
#[repr(packed)]
struct X(Y);

View file

@ -21,7 +21,7 @@ LL | #[derive(Copy, Clone, PartialEq, Eq)]
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
error: #[derive] can't be used on a non-Copy #[repr(packed)] struct (error E0133)
error: #[derive] can't be used on a #[repr(packed)] struct that does not derive Copy (error E0133)
--> $DIR/deriving-with-repr-packed.rs:26:10
|
LL | #[derive(PartialEq, Eq)]
@ -30,7 +30,7 @@ LL | #[derive(PartialEq, Eq)]
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
error: #[derive] can't be used on a non-Copy #[repr(packed)] struct (error E0133)
error: #[derive] can't be used on a #[repr(packed)] struct that does not derive Copy (error E0133)
--> $DIR/deriving-with-repr-packed.rs:35:10
|
LL | #[derive(PartialEq)]

View file

@ -10,7 +10,7 @@
#![feature(lang_items)]
#[lang = "panic_fmt"]
#[lang = "panic_impl"]
struct Foo; //~ ERROR E0152
fn main() {

View file

@ -1,4 +1,4 @@
error[E0152]: duplicate lang item found: `panic_fmt`.
error[E0152]: duplicate lang item found: `panic_impl`.
--> $DIR/E0152.rs:14:1
|
LL | struct Foo; //~ ERROR E0152

View file

@ -6,7 +6,7 @@ LL | pub enum SomeEnum {
LL | B = SomeEnum::A,
| ^^^^^^^^^^^ variant not found in `SomeEnum`
|
= note: did you mean `variant::B`?
= note: did you mean `SomeEnum::B`?
error: aborting due to previous error

View file

@ -7,7 +7,7 @@ LL | enum Foo {
LL | Foo::Baz(..) => (),
| ^^^^^^^^^^^^ variant not found in `Foo`
|
= note: did you mean `variant::Bar`?
= note: did you mean `Foo::Bar`?
error: aborting due to previous error

View file

@ -20,7 +20,7 @@ warning: unused extern crate
--> $DIR/basic.rs:33:5
|
LL | extern crate core as _; //~ WARN unused extern crate
| ^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
|
note: lint level defined here
--> $DIR/basic.rs:14:25

View file

@ -0,0 +1,36 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// aux-build:edition-lint-paths.rs
// run-rustfix
// compile-flags:--edition 2018
// The "normal case". Ideally we would remove the `extern crate` here,
// but we don't.
#![feature(rust_2018_preview)]
#![deny(rust_2018_idioms)]
#![allow(dead_code)]
//~^ ERROR unused extern crate
use edition_lint_paths as bar;
//~^ ERROR `extern crate` is not idiomatic in the new edition
fn main() {
// This is not considered to *use* the `extern crate` in Rust 2018:
use edition_lint_paths::foo;
foo();
// But this should be a use of the (renamed) crate:
crate::bar::foo();
}

View file

@ -0,0 +1,36 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// aux-build:edition-lint-paths.rs
// run-rustfix
// compile-flags:--edition 2018
// The "normal case". Ideally we would remove the `extern crate` here,
// but we don't.
#![feature(rust_2018_preview)]
#![deny(rust_2018_idioms)]
#![allow(dead_code)]
extern crate edition_lint_paths;
//~^ ERROR unused extern crate
extern crate edition_lint_paths as bar;
//~^ ERROR `extern crate` is not idiomatic in the new edition
fn main() {
// This is not considered to *use* the `extern crate` in Rust 2018:
use edition_lint_paths::foo;
foo();
// But this should be a use of the (renamed) crate:
crate::bar::foo();
}

View file

@ -0,0 +1,21 @@
error: unused extern crate
--> $DIR/extern-crate-idiomatic-in-2018.rs:22:1
|
LL | extern crate edition_lint_paths;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
|
note: lint level defined here
--> $DIR/extern-crate-idiomatic-in-2018.rs:19:9
|
LL | #![deny(rust_2018_idioms)]
| ^^^^^^^^^^^^^^^^
= note: #[deny(unused_extern_crates)] implied by #[deny(rust_2018_idioms)]
error: `extern crate` is not idiomatic in the new edition
--> $DIR/extern-crate-idiomatic-in-2018.rs:25:1
|
LL | extern crate edition_lint_paths as bar;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
error: aborting due to 2 previous errors

View file

@ -16,12 +16,12 @@
#![warn(rust_2018_idioms)]
#![allow(unused_imports)]
use std as foo;
mod another {
use std as foo;
use std;
}
fn main() {}

View file

@ -1,31 +1,31 @@
warning: `extern crate` is unnecessary in the new edition
warning: unused extern crate
--> $DIR/removing-extern-crate.rs:19:1
|
LL | extern crate std as foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use std as foo;`
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
|
note: lint level defined here
--> $DIR/removing-extern-crate.rs:16:9
|
LL | #![warn(rust_2018_idioms)]
| ^^^^^^^^^^^^^^^^
= note: #[warn(unnecessary_extern_crates)] implied by #[warn(rust_2018_idioms)]
= note: #[warn(unused_extern_crates)] implied by #[warn(rust_2018_idioms)]
warning: `extern crate` is unnecessary in the new edition
warning: unused extern crate
--> $DIR/removing-extern-crate.rs:20:1
|
LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^ help: remove it
warning: `extern crate` is unnecessary in the new edition
warning: unused extern crate
--> $DIR/removing-extern-crate.rs:23:5
|
LL | extern crate std as foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `use`: `use std as foo;`
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
warning: `extern crate` is unnecessary in the new edition
warning: unused extern crate
--> $DIR/removing-extern-crate.rs:24:5
|
LL | extern crate std;
| ^^^^^^^^^^^^^^^^^ help: use `use`: `use std;`
| ^^^^^^^^^^^^^^^^^ help: remove it