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#90347 - matthiaskrgr:rollup-rp2ms7j, r=matthi…
…askrgr Rollup of 5 pull requests Successful merges: - rust-lang#90239 (Consistent big O notation in map.rs) - rust-lang#90267 (fix: inner attribute followed by outer attribute causing ICE) - rust-lang#90288 (Add hint for people missing `TryFrom`, `TryInto`, `FromIterator` import pre-2021) - rust-lang#90304 (Add regression test for rust-lang#75961) - rust-lang#90344 (Add tracking issue number to const_cstr_unchecked) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
13 changed files
with
227 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
13 changes: 13 additions & 0 deletions
13
src/test/ui/parser/auxiliary/issue-89971-outer-attr-following-inner-attr-ice.rs
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 @@ | ||
// force-host | ||
// no-prefer-dynamic | ||
|
||
#![crate_type = "proc-macro"] | ||
|
||
extern crate proc_macro; | ||
|
||
use proc_macro::TokenStream; | ||
|
||
#[proc_macro_derive(ICE)] | ||
pub fn derive(_: TokenStream) -> TokenStream { | ||
r#"#[allow(missing_docs)] struct X { }"#.parse().unwrap() | ||
} |
15 changes: 15 additions & 0 deletions
15
src/test/ui/parser/issue-89971-outer-attr-following-inner-attr-ice.rs
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,15 @@ | ||
// aux-build:issue-89971-outer-attr-following-inner-attr-ice.rs | ||
|
||
#[macro_use] | ||
extern crate issue_89971_outer_attr_following_inner_attr_ice; | ||
|
||
fn main() { | ||
Mew(); | ||
X {}; | ||
} | ||
|
||
#![deny(missing_docs)] | ||
//~^ ERROR an inner attribute is not permitted in this context | ||
#[derive(ICE)] | ||
#[deny(missing_docs)] | ||
struct Mew(); |
18 changes: 18 additions & 0 deletions
18
src/test/ui/parser/issue-89971-outer-attr-following-inner-attr-ice.stderr
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 @@ | ||
error: an inner attribute is not permitted in this context | ||
--> $DIR/issue-89971-outer-attr-following-inner-attr-ice.rs:11:1 | ||
| | ||
LL | #![deny(missing_docs)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
... | ||
LL | struct Mew(); | ||
| ------------- the inner attribute doesn't annotate this struct | ||
| | ||
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files | ||
help: to annotate the struct, change the attribute from inner to outer style | ||
| | ||
LL - #![deny(missing_docs)] | ||
LL + #[deny(missing_docs)] | ||
| | ||
|
||
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
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,31 @@ | ||
// Make sure that trying to access `TryInto`, `TryFrom`, `FromIterator` in pre-2021 mentions | ||
// Edition 2021 change | ||
// edition:2018 | ||
|
||
fn test() { | ||
let _i: i16 = 0_i32.try_into().unwrap(); | ||
//~^ ERROR no method named `try_into` found for type `i32` in the current scope | ||
//~| NOTE method not found in `i32` | ||
//~| NOTE 'std::convert::TryInto' is included in the prelude starting in Edition 2021 | ||
|
||
let _i: i16 = TryFrom::try_from(0_i32).unwrap(); | ||
//~^ ERROR failed to resolve: use of undeclared type | ||
//~| NOTE not found in this scope | ||
//~| NOTE 'std::convert::TryFrom' is included in the prelude starting in Edition 2021 | ||
//~| NOTE 'core::convert::TryFrom' is included in the prelude starting in Edition 2021 | ||
|
||
let _i: i16 = TryInto::try_into(0_i32).unwrap(); | ||
//~^ ERROR failed to resolve: use of undeclared type | ||
//~| NOTE not found in this scope | ||
//~| NOTE 'std::convert::TryInto' is included in the prelude starting in Edition 2021 | ||
//~| NOTE 'core::convert::TryInto' is included in the prelude starting in Edition 2021 | ||
|
||
let _v: Vec<_> = FromIterator::from_iter(&[1]); | ||
//~^ ERROR failed to resolve: use of undeclared type | ||
//~| NOTE 'std::iter::FromIterator' is included in the prelude starting in Edition 2021 | ||
//~| NOTE 'core::iter::FromIterator' is included in the prelude starting in Edition 2021 | ||
} | ||
|
||
fn main() { | ||
test(); | ||
} |
76 changes: 76 additions & 0 deletions
76
src/test/ui/suggestions/suggest-tryinto-edition-change.stderr
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,76 @@ | ||
error[E0433]: failed to resolve: use of undeclared type `TryFrom` | ||
--> $DIR/suggest-tryinto-edition-change.rs:11:19 | ||
| | ||
LL | let _i: i16 = TryFrom::try_from(0_i32).unwrap(); | ||
| ^^^^^^^ not found in this scope | ||
| | ||
= note: 'std::convert::TryFrom' is included in the prelude starting in Edition 2021 | ||
= note: 'core::convert::TryFrom' is included in the prelude starting in Edition 2021 | ||
help: consider importing one of these items | ||
| | ||
LL | use core::convert::TryFrom; | ||
| | ||
LL | use std::convert::TryFrom; | ||
| | ||
|
||
error[E0433]: failed to resolve: use of undeclared type `TryInto` | ||
--> $DIR/suggest-tryinto-edition-change.rs:17:19 | ||
| | ||
LL | let _i: i16 = TryInto::try_into(0_i32).unwrap(); | ||
| ^^^^^^^ not found in this scope | ||
| | ||
= note: 'std::convert::TryInto' is included in the prelude starting in Edition 2021 | ||
= note: 'core::convert::TryInto' is included in the prelude starting in Edition 2021 | ||
help: consider importing one of these items | ||
| | ||
LL | use core::convert::TryInto; | ||
| | ||
LL | use std::convert::TryInto; | ||
| | ||
|
||
error[E0433]: failed to resolve: use of undeclared type `FromIterator` | ||
--> $DIR/suggest-tryinto-edition-change.rs:23:22 | ||
| | ||
LL | let _v: Vec<_> = FromIterator::from_iter(&[1]); | ||
| ^^^^^^^^^^^^ | ||
| | ||
::: $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL | ||
| | ||
LL | pub trait IntoIterator { | ||
| ---------------------- similarly named trait `IntoIterator` defined here | ||
| | ||
= note: 'std::iter::FromIterator' is included in the prelude starting in Edition 2021 | ||
= note: 'core::iter::FromIterator' is included in the prelude starting in Edition 2021 | ||
help: a trait with a similar name exists | ||
| | ||
LL | let _v: Vec<_> = IntoIterator::from_iter(&[1]); | ||
| ~~~~~~~~~~~~ | ||
help: consider importing one of these items | ||
| | ||
LL | use core::iter::FromIterator; | ||
| | ||
LL | use std::iter::FromIterator; | ||
| | ||
|
||
error[E0599]: no method named `try_into` found for type `i32` in the current scope | ||
--> $DIR/suggest-tryinto-edition-change.rs:6:25 | ||
| | ||
LL | let _i: i16 = 0_i32.try_into().unwrap(); | ||
| ^^^^^^^^ method not found in `i32` | ||
| | ||
::: $SRC_DIR/core/src/convert/mod.rs:LL:COL | ||
| | ||
LL | fn try_into(self) -> Result<T, Self::Error>; | ||
| -------- the method is available for `i32` here | ||
| | ||
= help: items from traits can only be used if the trait is in scope | ||
= note: 'std::convert::TryInto' is included in the prelude starting in Edition 2021 | ||
help: the following trait is implemented but not in scope; perhaps add a `use` for it: | ||
| | ||
LL | use std::convert::TryInto; | ||
| | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
Some errors have detailed explanations: E0433, E0599. | ||
For more information about an error, try `rustc --explain E0433`. |
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,7 @@ | ||
// check-pass | ||
|
||
pub fn foo<'a>(s: &'a mut ()) where &'a mut (): Clone { | ||
<&mut () as Clone>::clone(&s); | ||
} | ||
|
||
fn main() {} |