-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 #126593 - matthiaskrgr:rollup-a5jfg7w, r=matthiaskrgr
Rollup of 3 pull requests Successful merges: - #126568 (mark undetermined if target binding in current ns is not got) - #126577 (const_refs_to_static test and cleanup) - #126584 (Do not ICE in privacy when type inference fails.) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
14 changed files
with
161 additions
and
50 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
// https://github.com/rust-lang/rust/issues/126389 | ||
|
||
mod a { | ||
pub mod b { | ||
pub mod c {} | ||
} | ||
} | ||
|
||
use a::*; | ||
|
||
use b::c; | ||
//~^ ERROR: unresolved import `b::c` | ||
//~| ERROR: cannot determine resolution for the import | ||
//~| ERROR: cannot determine resolution for the import | ||
use c as b; | ||
|
||
fn c() {} | ||
|
||
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,23 @@ | ||
error: cannot determine resolution for the import | ||
--> $DIR/shadow-glob-module-resolution-3.rs:11:5 | ||
| | ||
LL | use b::c; | ||
| ^^^^ | ||
|
||
error: cannot determine resolution for the import | ||
--> $DIR/shadow-glob-module-resolution-3.rs:11:5 | ||
| | ||
LL | use b::c; | ||
| ^^^^ | ||
| | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error[E0432]: unresolved import `b::c` | ||
--> $DIR/shadow-glob-module-resolution-3.rs:11:5 | ||
| | ||
LL | use b::c; | ||
| ^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0432`. |
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 @@ | ||
// https://github.com/rust-lang/rust/issues/126376 | ||
|
||
mod a { | ||
pub mod b { | ||
pub trait C {} | ||
} | ||
} | ||
|
||
use a::*; | ||
|
||
use e as b; | ||
|
||
use b::C as e; | ||
//~^ ERROR: unresolved import `b::C` | ||
//~| ERROR: cannot determine resolution for the import | ||
//~| ERROR: cannot determine resolution for the import | ||
|
||
fn e() {} | ||
|
||
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,23 @@ | ||
error: cannot determine resolution for the import | ||
--> $DIR/shadow-glob-module-resolution-4.rs:13:5 | ||
| | ||
LL | use b::C as e; | ||
| ^^^^^^^^^ | ||
|
||
error: cannot determine resolution for the import | ||
--> $DIR/shadow-glob-module-resolution-4.rs:13:5 | ||
| | ||
LL | use b::C as e; | ||
| ^^^^^^^^^ | ||
| | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error[E0432]: unresolved import `b::C` | ||
--> $DIR/shadow-glob-module-resolution-4.rs:13:5 | ||
| | ||
LL | use b::C as e; | ||
| ^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0432`. |
2 changes: 1 addition & 1 deletion
2
tests/crashes/122736.rs → ...ui/privacy/no-ice-on-inference-failure.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
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,27 @@ | ||
error: constant evaluation is taking a long time | ||
--> $DIR/no-ice-on-inference-failure.rs:5:9 | ||
| | ||
LL | / while n < 5 { | ||
LL | | | ||
LL | | x = &0; | ||
LL | | } | ||
| |_________^ | ||
| | ||
= note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval. | ||
If your compilation actually takes a long time, you can safely allow the lint. | ||
help: the constant being evaluated | ||
--> $DIR/no-ice-on-inference-failure.rs:2:22 | ||
| | ||
LL | let array = [(); { | ||
| ______________________^ | ||
LL | | let mut x = &0; | ||
LL | | let mut n = 0; | ||
LL | | while n < 5 { | ||
... | | ||
LL | | 0 | ||
LL | | }]; | ||
| |_____^ | ||
= note: `#[deny(long_running_const_eval)]` on by default | ||
|
||
error: aborting due to 1 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,26 @@ | ||
//! Check that we lose the information that `BAR` points to `FOO` | ||
//! when going through a const generic. | ||
//! This is not an intentional guarantee, it just describes the status quo. | ||
|
||
//@ run-pass | ||
// With optimizations, LLVM will deduplicate the constant `X` whose | ||
// value is `&42` to just be a reference to the static. This is correct, | ||
// but obscures the issue we're trying to show. | ||
//@ revisions: opt noopt | ||
//@[noopt] compile-flags: -Copt-level=0 | ||
//@[opt] compile-flags: -O | ||
|
||
#![feature(const_refs_to_static)] | ||
#![feature(adt_const_params)] | ||
#![allow(incomplete_features)] | ||
|
||
static FOO: usize = 42; | ||
const BAR: &usize = &FOO; | ||
fn foo<const X: &'static usize>() { | ||
// Without optimizations, `X` ends up pointing to a copy of `FOO` instead of `FOO` itself. | ||
assert_eq!(cfg!(opt), std::ptr::eq(X, &FOO)); | ||
} | ||
|
||
fn main() { | ||
foo::<BAR>(); | ||
} |