-
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 #68803 - Dylan-DPC:rollup-b4x6ghj, r=Dylan-DPC
Rollup of 8 pull requests Successful merges: - #68678 (Install robots.txt into rust-docs tarballs) - #68711 (Added upper bound of what vecs and boxes can allocate) - #68744 (Do not ICE in `type-alias-impl-trait` with save-analysis) - #68777 (Clean up E0263 explanation) - #68787 (Optimize core::ptr::align_offset (part 1)) - #68797 (Fix links to types instead of modules) - #68798 (Test that `#[track_caller]` as `fn()` respects RT / CTFE equivalence) - #68800 (Stabilize `core::iter::once_with()`) Failed merges: r? @ghost
- Loading branch information
Showing
19 changed files
with
123 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
A lifetime name cannot be declared more than once in the same scope. For | ||
example: | ||
A lifetime was declared more than once in the same scope. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0263 | ||
// error, lifetime name `'a` declared twice in the same scope | ||
fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { } | ||
fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str, z: &'a str) { // error! | ||
} | ||
``` | ||
|
||
Two lifetimes cannot have the same name. To fix this example, change | ||
the second `'a` lifetime into something else (`'c` for example): | ||
|
||
``` | ||
fn foo<'a, 'b, 'c>(x: &'a str, y: &'b str, z: &'c str) { // ok! | ||
} | ||
``` |
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
32 changes: 32 additions & 0 deletions
32
src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.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,32 @@ | ||
// Ensure that a `#[track_caller]` function, returning `caller_location()`, | ||
// which coerced (to a function pointer) and called, inside a `const fn`, | ||
// in turn called, results in the same output irrespective of whether | ||
// we're in a const or runtime context. | ||
|
||
// run-pass | ||
// compile-flags: -Z unleash-the-miri-inside-of-you | ||
|
||
#![feature(core_intrinsics, const_caller_location, track_caller, const_fn)] | ||
|
||
type L = &'static std::panic::Location<'static>; | ||
|
||
#[track_caller] | ||
const fn attributed() -> L { | ||
std::intrinsics::caller_location() | ||
} | ||
|
||
const fn calling_attributed() -> L { | ||
// We need `-Z unleash-the-miri-inside-of-you` for this as we don't have `const fn` pointers. | ||
let ptr: fn() -> L = attributed; | ||
ptr() //~ WARN skipping const checks | ||
} | ||
|
||
fn main() { | ||
const CONSTANT: L = calling_attributed(); | ||
let runtime = calling_attributed(); | ||
|
||
assert_eq!( | ||
(runtime.file(), runtime.line(), runtime.column()), | ||
(CONSTANT.file(), CONSTANT.line(), CONSTANT.column()), | ||
); | ||
} |
6 changes: 6 additions & 0 deletions
6
src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.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,6 @@ | ||
warning: skipping const checks | ||
--> $DIR/caller-location-fnptr-rt-ctfe-equiv.rs:21:5 | ||
| | ||
LL | ptr() | ||
| ^^^^^ | ||
|
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,17 @@ | ||
// compile-flags: -Zsave-analysis | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
trait Trait {} | ||
|
||
trait Service { | ||
type Future: Trait; | ||
} | ||
|
||
struct Struct; | ||
|
||
impl Service for Struct { | ||
type Future = impl Trait; //~ ERROR: could not find defining uses | ||
} | ||
|
||
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,8 @@ | ||
error: could not find defining uses | ||
--> $DIR/issue-68621.rs:14:5 | ||
| | ||
LL | type Future = impl Trait; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
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
1 change: 1 addition & 0 deletions
1
src/test/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// compile-flags: -Zsave-analysis | ||
// check-pass | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|