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

Rollup of 10 pull requests #88535

Merged
merged 28 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cc15047
Add carrying_add, borrowing_sub, widening_mul, carrying_mul methods t…
clarfonthey May 7, 2021
523490e
Allow `~const` bounds on trait assoc functions
fee1-dead Aug 28, 2021
ee02c8e
Add test cases
fee1-dead Aug 28, 2021
ed30993
Use the correct type for Enum variant tuples
GuillaumeGomez Aug 27, 2021
a521388
Add rustdonc-json tests for enum variants
GuillaumeGomez Aug 27, 2021
147f74a
Clean up the lowering of AST items
inquisitivecrystal Aug 28, 2021
748a089
Disallow the aapcs CC on Aarch64
nagisa Aug 27, 2021
3b6777f
add `TcpStream::set_linger` and `TcpStream::linger`
ibraheemdev Aug 30, 2021
dafc147
clean up `c::linger` conversion
ibraheemdev Aug 30, 2021
4986bbf
Keep turbofish in prelude collision lint.
m-ou-se Aug 30, 2021
532be28
Test that turbofish does not swim away in prelude collusion suggestion.
m-ou-se Aug 30, 2021
4027629
Remove unnecessary `mut` from udp doctests
soenkehahn Aug 31, 2021
7bcc9ae
Avoid cloning LocalDecls
ptrojahn Jun 3, 2021
2a06daa
Pull Span::find_ancestor_inside loop into its own function.
m-ou-se Aug 30, 2021
a15dab9
Use right span in prelude collision suggestions with macros.
m-ou-se Aug 30, 2021
fc0fb38
Add macro test for prelude collision suggestions.
m-ou-se Aug 30, 2021
7c0479b
Use and_then instead of unwrap_or_default.
m-ou-se Aug 31, 2021
072e8c9
disable `tcp_linger` feature in `std`
ibraheemdev Aug 31, 2021
e7a247d
Rollup merge of #85017 - clarfonthey:carrying_widening, r=m-ou-se
m-ou-se Aug 31, 2021
175c8cb
Rollup merge of #86362 - ptrojahn:insert_vars_and_temps, r=jackh726
m-ou-se Aug 31, 2021
f4f5dd5
Rollup merge of #88391 - GuillaumeGomez:fix-json-enum-variant, r=came…
m-ou-se Aug 31, 2021
4d08908
Rollup merge of #88399 - nagisa:nagisa/aapcs-on-aarch, r=petrochenkov
m-ou-se Aug 31, 2021
ab37e49
Rollup merge of #88418 - fee1-dead:trait-assoc-tilde-const, r=oli-obk
m-ou-se Aug 31, 2021
41249ca
Rollup merge of #88445 - inquisitivecrystal:ast-lowering, r=cjgillot
m-ou-se Aug 31, 2021
c5a34d8
Rollup merge of #88495 - ibraheemdev:tcp-linger, r=joshtriplett
m-ou-se Aug 31, 2021
91c4fee
Rollup merge of #88501 - m-ou-se:prelude-collusion-oh-no-macros-help,…
m-ou-se Aug 31, 2021
13f6d7e
Rollup merge of #88504 - m-ou-se:turbofish-please-stay, r=oli-obk
m-ou-se Aug 31, 2021
f5cf967
Rollup merge of #88524 - soenkehahn:master, r=jyn514
m-ou-se Aug 31, 2021
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
Prev Previous commit
Next Next commit
Test that turbofish does not swim away in prelude collusion suggestion.
  • Loading branch information
m-ou-se committed Aug 30, 2021
commit 532be287c9ce0dff490983bbf3f809506469a4d1
28 changes: 28 additions & 0 deletions src/test/ui/rust-2021/future-prelude-collision-turbofish.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// See https://github.com/rust-lang/rust/issues/88442
// run-rustfix
// edition:2018
// check-pass
#![allow(unused)]
#![warn(rust_2021_prelude_collisions)]

trait AnnotatableTryInto {
fn try_into<T>(self) -> Result<T, Self::Error>
where Self: std::convert::TryInto<T> {
std::convert::TryInto::try_into(self)
}
}

impl<T> AnnotatableTryInto for T where T: From<u8> {}

fn main() -> Result<(), &'static str> {
let x: u64 = 1;
AnnotatableTryInto::try_into::<usize>(x).or(Err("foo"))?.checked_sub(1);
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!

AnnotatableTryInto::try_into::<usize>(x).or(Err("foo"))?;
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!

Ok(())
}
28 changes: 28 additions & 0 deletions src/test/ui/rust-2021/future-prelude-collision-turbofish.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// See https://github.com/rust-lang/rust/issues/88442
// run-rustfix
// edition:2018
// check-pass
#![allow(unused)]
#![warn(rust_2021_prelude_collisions)]

trait AnnotatableTryInto {
fn try_into<T>(self) -> Result<T, Self::Error>
where Self: std::convert::TryInto<T> {
std::convert::TryInto::try_into(self)
}
}

impl<T> AnnotatableTryInto for T where T: From<u8> {}

fn main() -> Result<(), &'static str> {
let x: u64 = 1;
x.try_into::<usize>().or(Err("foo"))?.checked_sub(1);
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!

x.try_into::<usize>().or(Err("foo"))?;
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!

Ok(())
}
25 changes: 25 additions & 0 deletions src/test/ui/rust-2021/future-prelude-collision-turbofish.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
warning: trait method `try_into` will become ambiguous in Rust 2021
--> $DIR/future-prelude-collision-turbofish.rs:19:5
|
LL | x.try_into::<usize>().or(Err("foo"))?.checked_sub(1);
| ^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `AnnotatableTryInto::try_into::<usize>(x)`
|
note: the lint level is defined here
--> $DIR/future-prelude-collision-turbofish.rs:6:9
|
LL | #![warn(rust_2021_prelude_collisions)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/prelude.html>

warning: trait method `try_into` will become ambiguous in Rust 2021
--> $DIR/future-prelude-collision-turbofish.rs:23:5
|
LL | x.try_into::<usize>().or(Err("foo"))?;
| ^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `AnnotatableTryInto::try_into::<usize>(x)`
|
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/prelude.html>

warning: 2 warnings emitted