| author | bors <bors@rust-lang.org> 2023-12-10 01:02:42 UTC |
| committer | bors <bors@rust-lang.org> 2023-12-10 01:02:42 UTC |
| log | f7253f231748c5074bdcf201e85a1967e01c4848 |
| tree | 1bb4ffa8f17853e4f7e8478517b77f5b35995841 |
| parent | 8cd8d313690260e6cacc280b93710d62d4ffefb0 |
| parent | dd234696ed202d133eabbbeef588fde11020ea14 |
Rollup of 5 pull requests
Successful merges:
- #117966 (add safe compilation options)
- #118747 (Remove extra check cfg handled by libc directly)
- #118774 (add test for inductive cycle hangs)
- #118775 (chore: add test case for type with generic)
- #118782 (use `&` instead of start-process in x.ps1)
r? `@ghost`
`@rustbot` modify labels: rollup12 files changed, 152 insertions(+), 25 deletions(-)
config.example.toml+10| ... | ... | @@ -600,6 +600,16 @@ change-id = 117813 |
| 600 | 600 | # desired in distributions, for example. |
| 601 | 601 | #rpath = true |
| 602 | 602 | |
| 603 | # Indicates whether symbols should be stripped using `-Cstrip=symbols`. | |
| 604 | #strip = false | |
| 605 | ||
| 606 | # Indicates whether stack protectors should be used | |
| 607 | # via the unstable option `-Zstack-protector`. | |
| 608 | # | |
| 609 | # Valid options are : `none`(default),`basic`,`strong`, or `all`. | |
| 610 | # `strong` and `basic` options may be buggy and are not recommended, see rust-lang/rust#114903. | |
| 611 | #stack-protector = "none" | |
| 612 | ||
| 603 | 613 | # Prints each test name as it is executed, to help debug issues in the test harness itself. |
| 604 | 614 | #verbose-tests = false |
| 605 | 615 |
src/bootstrap/src/core/builder.rs+6| ... | ... | @@ -1667,6 +1667,12 @@ impl<'a> Builder<'a> { |
| 1667 | 1667 | } |
| 1668 | 1668 | } |
| 1669 | 1669 | |
| 1670 | cargo.env(profile_var("STRIP"), self.config.rust_strip.to_string()); | |
| 1671 | ||
| 1672 | if let Some(stack_protector) = &self.config.rust_stack_protector { | |
| 1673 | rustflags.arg(&format!("-Zstack-protector={stack_protector}")); | |
| 1674 | } | |
| 1675 | ||
| 1670 | 1676 | if let Some(host_linker) = self.linker(compiler.host) { |
| 1671 | 1677 | hostflags.arg(format!("-Clinker={}", host_linker.display())); |
| 1672 | 1678 | } |
src/bootstrap/src/core/config/config.rs+7| ... | ... | @@ -223,6 +223,8 @@ pub struct Config { |
| 223 | 223 | pub rust_debuginfo_level_tests: DebuginfoLevel, |
| 224 | 224 | pub rust_split_debuginfo: SplitDebuginfo, |
| 225 | 225 | pub rust_rpath: bool, |
| 226 | pub rust_strip: bool, | |
| 227 | pub rust_stack_protector: Option<String>, | |
| 226 | 228 | pub rustc_parallel: bool, |
| 227 | 229 | pub rustc_default_linker: Option<String>, |
| 228 | 230 | pub rust_optimize_tests: bool, |
| ... | ... | @@ -1002,6 +1004,8 @@ define_config! { |
| 1002 | 1004 | description: Option<String> = "description", |
| 1003 | 1005 | musl_root: Option<String> = "musl-root", |
| 1004 | 1006 | rpath: Option<bool> = "rpath", |
| 1007 | strip: Option<bool> = "strip", | |
| 1008 | stack_protector: Option<String> = "stack-protector", | |
| 1005 | 1009 | verbose_tests: Option<bool> = "verbose-tests", |
| 1006 | 1010 | optimize_tests: Option<bool> = "optimize-tests", |
| 1007 | 1011 | codegen_tests: Option<bool> = "codegen-tests", |
| ... | ... | @@ -1071,6 +1075,7 @@ impl Config { |
| 1071 | 1075 | config.docs = true; |
| 1072 | 1076 | config.docs_minification = true; |
| 1073 | 1077 | config.rust_rpath = true; |
| 1078 | config.rust_strip = false; | |
| 1074 | 1079 | config.channel = "dev".to_string(); |
| 1075 | 1080 | config.codegen_tests = true; |
| 1076 | 1081 | config.rust_dist_src = true; |
| ... | ... | @@ -1425,6 +1430,8 @@ impl Config { |
| 1425 | 1430 | set(&mut config.rust_optimize_tests, rust.optimize_tests); |
| 1426 | 1431 | set(&mut config.codegen_tests, rust.codegen_tests); |
| 1427 | 1432 | set(&mut config.rust_rpath, rust.rpath); |
| 1433 | set(&mut config.rust_strip, rust.strip); | |
| 1434 | config.rust_stack_protector = rust.stack_protector; | |
| 1428 | 1435 | set(&mut config.jemalloc, rust.jemalloc); |
| 1429 | 1436 | set(&mut config.test_compare_mode, rust.test_compare_mode); |
| 1430 | 1437 | set(&mut config.backtrace, rust.backtrace); |
src/bootstrap/src/lib.rs-2| ... | ... | @@ -83,8 +83,6 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &str, Option<&[&'static str]>)] = &[ |
| 83 | 83 | (Some(Mode::Std), "no_global_oom_handling", None), |
| 84 | 84 | (Some(Mode::Std), "no_rc", None), |
| 85 | 85 | (Some(Mode::Std), "no_sync", None), |
| 86 | (Some(Mode::Std), "freebsd12", None), | |
| 87 | (Some(Mode::Std), "freebsd13", None), | |
| 88 | 86 | (Some(Mode::Std), "backtrace_in_libstd", None), |
| 89 | 87 | /* Extra values not defined in the built-in targets yet, but used in std */ |
| 90 | 88 | (Some(Mode::Std), "target_env", Some(&["libnx"])), |
tests/ui/suggestions/suggest-assoc-fn-call-without-receiver.fixed+14| ... | ... | @@ -7,10 +7,24 @@ impl A { |
| 7 | 7 | fn test(_a: Self, _b: i32) {} |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | struct B<T> { | |
| 11 | _b: T | |
| 12 | } | |
| 13 | impl<T> B<T> { | |
| 14 | fn hello(_a: i32) {} | |
| 15 | fn test(_a: Self, _b: i32) {} | |
| 16 | } | |
| 17 | ||
| 10 | 18 | fn main() { |
| 11 | 19 | let _a = A {}; |
| 12 | 20 | A::hello(1); |
| 13 | 21 | //~^ ERROR no method named `hello` found |
| 14 | 22 | A::test(_a, 1); |
| 15 | 23 | //~^ ERROR no method named `test` found |
| 24 | ||
| 25 | let _b = B {_b: ""}; | |
| 26 | B::<&str>::hello(1); | |
| 27 | //~^ ERROR no method named `hello` found | |
| 28 | B::<&str>::test(_b, 1); | |
| 29 | //~^ ERROR no method named `test` found | |
| 16 | 30 | } |
tests/ui/suggestions/suggest-assoc-fn-call-without-receiver.rs+14| ... | ... | @@ -7,10 +7,24 @@ impl A { |
| 7 | 7 | fn test(_a: Self, _b: i32) {} |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | struct B<T> { | |
| 11 | _b: T | |
| 12 | } | |
| 13 | impl<T> B<T> { | |
| 14 | fn hello(_a: i32) {} | |
| 15 | fn test(_a: Self, _b: i32) {} | |
| 16 | } | |
| 17 | ||
| 10 | 18 | fn main() { |
| 11 | 19 | let _a = A {}; |
| 12 | 20 | _a.hello(1); |
| 13 | 21 | //~^ ERROR no method named `hello` found |
| 14 | 22 | _a.test(1); |
| 15 | 23 | //~^ ERROR no method named `test` found |
| 24 | ||
| 25 | let _b = B {_b: ""}; | |
| 26 | _b.hello(1); | |
| 27 | //~^ ERROR no method named `hello` found | |
| 28 | _b.test(1); | |
| 29 | //~^ ERROR no method named `test` found | |
| 16 | 30 | } |
tests/ui/suggestions/suggest-assoc-fn-call-without-receiver.stderr+41-3| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error[E0599]: no method named `hello` found for struct `A` in the current scope |
| 2 | --> $DIR/suggest-assoc-fn-call-without-receiver.rs:12:8 | |
| 2 | --> $DIR/suggest-assoc-fn-call-without-receiver.rs:20:8 | |
| 3 | 3 | | |
| 4 | 4 | LL | struct A {} |
| 5 | 5 | | -------- method `hello` not found for this struct |
| ... | ... | @@ -18,7 +18,7 @@ LL | fn hello(_a: i32) {} |
| 18 | 18 | | ^^^^^^^^^^^^^^^^^ |
| 19 | 19 | |
| 20 | 20 | error[E0599]: no method named `test` found for struct `A` in the current scope |
| 21 | --> $DIR/suggest-assoc-fn-call-without-receiver.rs:14:8 | |
| 21 | --> $DIR/suggest-assoc-fn-call-without-receiver.rs:22:8 | |
| 22 | 22 | | |
| 23 | 23 | LL | struct A {} |
| 24 | 24 | | -------- method `test` not found for this struct |
| ... | ... | @@ -36,6 +36,44 @@ note: the candidate is defined in an impl for the type `A` |
| 36 | 36 | LL | fn test(_a: Self, _b: i32) {} |
| 37 | 37 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 38 | 38 | |
| 39 | error: aborting due to 2 previous errors | |
| 39 | error[E0599]: no method named `hello` found for struct `B<&str>` in the current scope | |
| 40 | --> $DIR/suggest-assoc-fn-call-without-receiver.rs:26:8 | |
| 41 | | | |
| 42 | LL | struct B<T> { | |
| 43 | | ----------- method `hello` not found for this struct | |
| 44 | ... | |
| 45 | LL | _b.hello(1); | |
| 46 | | ---^^^^^--- | |
| 47 | | | | | |
| 48 | | | this is an associated function, not a method | |
| 49 | | help: use associated function syntax instead: `B::<&str>::hello(1)` | |
| 50 | | | |
| 51 | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter | |
| 52 | note: the candidate is defined in an impl for the type `B<T>` | |
| 53 | --> $DIR/suggest-assoc-fn-call-without-receiver.rs:14:5 | |
| 54 | | | |
| 55 | LL | fn hello(_a: i32) {} | |
| 56 | | ^^^^^^^^^^^^^^^^^ | |
| 57 | ||
| 58 | error[E0599]: no method named `test` found for struct `B<&str>` in the current scope | |
| 59 | --> $DIR/suggest-assoc-fn-call-without-receiver.rs:28:8 | |
| 60 | | | |
| 61 | LL | struct B<T> { | |
| 62 | | ----------- method `test` not found for this struct | |
| 63 | ... | |
| 64 | LL | _b.test(1); | |
| 65 | | ---^^^^--- | |
| 66 | | | | | |
| 67 | | | this is an associated function, not a method | |
| 68 | | help: use associated function syntax instead: `B::<&str>::test(_b, 1)` | |
| 69 | | | |
| 70 | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter | |
| 71 | note: the candidate is defined in an impl for the type `B<T>` | |
| 72 | --> $DIR/suggest-assoc-fn-call-without-receiver.rs:15:5 | |
| 73 | | | |
| 74 | LL | fn test(_a: Self, _b: i32) {} | |
| 75 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 76 | ||
| 77 | error: aborting due to 4 previous errors | |
| 40 | 78 | |
| 41 | 79 | For more information about this error, try `rustc --explain E0599`. |
tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs+6-2| ... | ... | @@ -3,8 +3,12 @@ |
| 3 | 3 | // Proving `W<?0>: Trait` instantiates `?0` with `(W<?1>, W<?2>)` and then |
| 4 | 4 | // proves `W<?1>: Trait` and `W<?2>: Trait`, resulting in a coinductive cycle. |
| 5 | 5 | // |
| 6 | // Proving coinductive cycles runs until we reach a fixpoint. This fixpoint is | |
| 7 | // never reached here and each step doubles the amount of nested obligations. | |
| 6 | // Proving coinductive cycles runs until we reach a fixpoint. However, after | |
| 7 | // computing `try_evaluate_added_goals` in the second fixpoint iteration, the | |
| 8 | // self type already has a depth equal to the number of steps. This results | |
| 9 | // in enormous constraints, causing the canonicalizer to hang without ever | |
| 10 | // reaching the recursion limit. We currently avoid that by erasing the constraints | |
| 11 | // from overflow. | |
| 8 | 12 | // |
| 9 | 13 | // This previously caused a hang in the trait solver, see |
| 10 | 14 | // https://github.com/rust-lang/trait-system-refactor-initiative/issues/13. |
tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr+2-2| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | 1 | error[E0275]: overflow evaluating the requirement `W<_>: Trait` |
| 2 | --> $DIR/fixpoint-exponential-growth.rs:29:13 | |
| 2 | --> $DIR/fixpoint-exponential-growth.rs:33:13 | |
| 3 | 3 | | |
| 4 | 4 | LL | impls::<W<_>>(); |
| 5 | 5 | | ^^^^ |
| 6 | 6 | | |
| 7 | 7 | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`fixpoint_exponential_growth`) |
| 8 | 8 | note: required by a bound in `impls` |
| 9 | --> $DIR/fixpoint-exponential-growth.rs:26:13 | |
| 9 | --> $DIR/fixpoint-exponential-growth.rs:30:13 | |
| 10 | 10 | | |
| 11 | 11 | LL | fn impls<T: Trait>() {} |
| 12 | 12 | | ^^^^^ required by this bound in `impls` |
tests/ui/traits/new-solver/cycles/inductive-fixpoint-hang.rs created+33| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | // compile-flags: -Ztrait-solver=next | |
| 2 | ||
| 3 | // This currently hangs if we do not erase constraints from | |
| 4 | // overflow. | |
| 5 | // | |
| 6 | // We set the provisional result of `W<?0>` to `?0 := W<_>`. | |
| 7 | // The next iteration does not simply result in a `?0 := W<W<_>` constraint as | |
| 8 | // one might expect, but instead each time we evaluate the nested `W<T>` goal we | |
| 9 | // apply the previously returned constraints: the first fixpoint iteration goes | |
| 10 | // as follows: `W<?1>: Trait` constrains `?1` to `W<?2>`, we then evaluate | |
| 11 | // `W<W<?2>>: Trait` the next time we try to prove the nested goal. This results | |
| 12 | // inn `W<W<W<?3>>>` and so on. This goes on until we reach overflow in | |
| 13 | // `try_evaluate_added_goals`. This means the provisional result after the | |
| 14 | // second fixpoint iteration is already `W<W<W<...>>>` with a size proportional | |
| 15 | // to the number of steps in `try_evaluate_added_goals`. The size then continues | |
| 16 | // to grow. The exponential blowup from having 2 nested goals per impl causes | |
| 17 | // the solver to hang without hitting the recursion limit. | |
| 18 | trait Trait {} | |
| 19 | ||
| 20 | struct W<T: ?Sized>(*const T); | |
| 21 | ||
| 22 | impl<T: ?Sized> Trait for W<W<T>> | |
| 23 | where | |
| 24 | W<T>: Trait, | |
| 25 | W<T>: Trait, | |
| 26 | {} | |
| 27 | ||
| 28 | fn impls_trait<T: Trait>() {} | |
| 29 | ||
| 30 | fn main() { | |
| 31 | impls_trait::<W<_>>(); | |
| 32 | //~^ ERROR overflow evaluating the requirement | |
| 33 | } |
tests/ui/traits/new-solver/cycles/inductive-fixpoint-hang.stderr created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | error[E0275]: overflow evaluating the requirement `W<_>: Trait` | |
| 2 | --> $DIR/inductive-fixpoint-hang.rs:31:19 | |
| 3 | | | |
| 4 | LL | impls_trait::<W<_>>(); | |
| 5 | | ^^^^ | |
| 6 | | | |
| 7 | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inductive_fixpoint_hang`) | |
| 8 | note: required by a bound in `impls_trait` | |
| 9 | --> $DIR/inductive-fixpoint-hang.rs:28:19 | |
| 10 | | | |
| 11 | LL | fn impls_trait<T: Trait>() {} | |
| 12 | | ^^^^^ required by this bound in `impls_trait` | |
| 13 | ||
| 14 | error: aborting due to 1 previous error | |
| 15 | ||
| 16 | For more information about this error, try `rustc --explain E0275`. |
x.ps1+3-16| ... | ... | @@ -8,12 +8,7 @@ $ErrorActionPreference = "Stop" |
| 8 | 8 | Get-Command -syntax ${PSCommandPath} >$null |
| 9 | 9 | |
| 10 | 10 | $xpy = Join-Path $PSScriptRoot x.py |
| 11 | # Start-Process for some reason splits arguments on spaces. (Isn't powershell supposed to be simpler than bash?) | |
| 12 | # Double-quote all the arguments so it doesn't do that. | |
| 13 | $xpy_args = @("""$xpy""") | |
| 14 | foreach ($arg in $args) { | |
| 15 | $xpy_args += """$arg""" | |
| 16 | } | |
| 11 | $xpy_args = @($xpy) + $args | |
| 17 | 12 | |
| 18 | 13 | function Get-Application($app) { |
| 19 | 14 | $cmd = Get-Command $app -ErrorAction SilentlyContinue -CommandType Application | Select-Object -First 1 |
| ... | ... | @@ -21,16 +16,8 @@ function Get-Application($app) { |
| 21 | 16 | } |
| 22 | 17 | |
| 23 | 18 | function Invoke-Application($application, $arguments) { |
| 24 | $process = Start-Process -NoNewWindow -PassThru $application $arguments | |
| 25 | # WORKAROUND: Caching the handle is necessary to make ExitCode work. | |
| 26 | # See https://stackoverflow.com/a/23797762 | |
| 27 | $handle = $process.Handle | |
| 28 | $process.WaitForExit() | |
| 29 | if ($null -eq $process.ExitCode) { | |
| 30 | Write-Error "Unable to read the exit code" | |
| 31 | Exit 1 | |
| 32 | } | |
| 33 | Exit $process.ExitCode | |
| 19 | & $application $arguments | |
| 20 | Exit $LASTEXITCODE | |
| 34 | 21 | } |
| 35 | 22 | |
| 36 | 23 | foreach ($python in "py", "python3", "python", "python2") { |