forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
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#106892 - matthiaskrgr:rollup-ohneu8o, r=matth…
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#106072 (fix: misleading "add dyn keyword before derive macro" suggestion) - rust-lang#106859 (Suggestion for type mismatch when we need a u8 but the programmer wrote a char literal) - rust-lang#106863 (Remove various double spaces in compiler source comments.) - rust-lang#106865 (Add explanation comment for GUI test) - rust-lang#106867 (Fix the stability attributes for `std::os::fd`.) - rust-lang#106878 (Add regression test for rust-lang#92157) - rust-lang#106879 (Add regression test for rust-lang#42114) - rust-lang#106880 (doc: fix typo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
22 changed files
with
205 additions
and
15 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
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
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,40 @@ | ||
#![feature(no_core)] | ||
#![feature(lang_items)] | ||
|
||
#![no_core] | ||
|
||
#[cfg(target_os = "linux")] | ||
#[link(name = "c")] | ||
extern {} | ||
|
||
#[lang = "start"] | ||
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize { | ||
//~^ ERROR: incorrect number of parameters for the `start` lang item | ||
40+2 | ||
} | ||
|
||
#[lang = "sized"] | ||
pub trait Sized {} | ||
#[lang = "copy"] | ||
pub trait Copy {} | ||
|
||
#[lang = "drop_in_place"] | ||
#[allow(unconditional_recursion)] | ||
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { | ||
drop_in_place(to_drop) | ||
} | ||
|
||
#[lang = "add"] | ||
trait Add<RHS> { | ||
type Output; | ||
fn add(self, other: RHS) -> Self::Output; | ||
} | ||
|
||
impl Add<isize> for isize { | ||
type Output = isize; | ||
fn add(self, other: isize) -> isize { | ||
self + other | ||
} | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error: incorrect number of parameters for the `start` lang item | ||
--> $DIR/issue-92157.rs:11:1 | ||
| | ||
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: the `start` lang item should have four parameters, but found 3 | ||
= note: the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize` | ||
|
||
error: aborting due to previous error | ||
|
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 @@ | ||
// check-pass | ||
|
||
fn lifetime<'a>() | ||
where | ||
&'a (): 'a, | ||
{ | ||
/* do nothing */ | ||
} | ||
|
||
fn doesnt_work() | ||
where | ||
for<'a> &'a (): 'a, | ||
{ | ||
/* do nothing */ | ||
} | ||
|
||
fn main() { | ||
lifetime(); | ||
doesnt_work(); | ||
} |
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,18 @@ | ||
// Tests that a suggestion is issued for type mismatch errors when a | ||
// u8 is expected and a char literal which is ASCII is supplied. | ||
|
||
fn foo(_t: u8) {} | ||
|
||
fn main() { | ||
let _x: u8 = 'X'; | ||
//~^ ERROR: mismatched types [E0308] | ||
//~| HELP: if you meant to write a byte literal, prefix with `b` | ||
|
||
foo('#'); | ||
//~^ ERROR: mismatched types [E0308] | ||
//~| HELP: if you meant to write a byte literal, prefix with `b` | ||
|
||
// Do not issue the suggestion if the char literal isn't ASCII | ||
let _t: u8 = '€'; | ||
//~^ ERROR: mismatched types [E0308] | ||
} |
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,42 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/type-mismatch-byte-literal.rs:7:18 | ||
| | ||
LL | let _x: u8 = 'X'; | ||
| -- ^^^ expected `u8`, found `char` | ||
| | | ||
| expected due to this | ||
| | ||
help: if you meant to write a byte literal, prefix with `b` | ||
| | ||
LL | let _x: u8 = b'X'; | ||
| ~~~~ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/type-mismatch-byte-literal.rs:11:9 | ||
| | ||
LL | foo('#'); | ||
| --- ^^^ expected `u8`, found `char` | ||
| | | ||
| arguments to this function are incorrect | ||
| | ||
note: function defined here | ||
--> $DIR/type-mismatch-byte-literal.rs:4:4 | ||
| | ||
LL | fn foo(_t: u8) {} | ||
| ^^^ ------ | ||
help: if you meant to write a byte literal, prefix with `b` | ||
| | ||
LL | foo(b'#'); | ||
| ~~~~ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/type-mismatch-byte-literal.rs:16:18 | ||
| | ||
LL | let _t: u8 = '€'; | ||
| -- ^^^ expected `u8`, found `char` | ||
| | | ||
| expected due to this | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
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 @@ | ||
#[derive(Clone)] //~ trait objects must include the `dyn` keyword | ||
//~| trait objects must include the `dyn` keyword | ||
struct Foo; | ||
trait Foo {} //~ the name `Foo` is defined multiple times | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
error[E0428]: the name `Foo` is defined multiple times | ||
--> $DIR/issue-106072.rs:4:1 | ||
| | ||
LL | struct Foo; | ||
| ----------- previous definition of the type `Foo` here | ||
LL | trait Foo {} | ||
| ^^^^^^^^^ `Foo` redefined here | ||
| | ||
= note: `Foo` must be defined only once in the type namespace of this module | ||
|
||
error[E0782]: trait objects must include the `dyn` keyword | ||
--> $DIR/issue-106072.rs:1:10 | ||
| | ||
LL | #[derive(Clone)] | ||
| ^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0782]: trait objects must include the `dyn` keyword | ||
--> $DIR/issue-106072.rs:1:10 | ||
| | ||
LL | #[derive(Clone)] | ||
| ^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0428, E0782. | ||
For more information about an error, try `rustc --explain E0428`. |