Commit Graph

130238 Commits

Author SHA1 Message Date
Jonas Schievink 2362659b00
Rollup merge of #78292 - bugadani:recursion, r=nagisa
Loop instead of recursion

I saw the comment `// FIXME: consider not using recursion to lower this.` and considered not using recursion :)
2020-10-24 14:12:15 +02:00
Jonas Schievink b6ae1fabee
Rollup merge of #78278 - lcnr:predicate-visit, r=matthewjasper
move `visit_predicate` into `TypeVisitor`

Seems easier than dealing with `PredicateVisitor` for me which I needed for object safety checks for `PredicateAtom::ConstEvaluatable`. Is there a reason I am missing for this split?

r? @matthewjasper
2020-10-24 14:12:13 +02:00
Jonas Schievink eaa982305d
Rollup merge of #78274 - Enet4:patch-1, r=jonas-schievink
Update description of Empty Enum for accuracy

An empty enum is similar to the never type `!`, rather than the unit type `()`.
2020-10-24 14:12:11 +02:00
Jonas Schievink 27cb587edc
Rollup merge of #78264 - JohnTitor:macro-test, r=petrochenkov
Add regression test for issue-77475

Closes #77475
2020-10-24 14:12:10 +02:00
Jonas Schievink 20ba9ffbee
Rollup merge of #78250 - camelid:document-inline-const, r=spastorino
Document inline-const

Part of #76001.

r? @spastorino
2020-10-24 14:12:08 +02:00
Jonas Schievink 77cd5b5485
Rollup merge of #78249 - lcnr:ct-infer-origin, r=varkor
improve const infer error

For type inference we probably have to be careful about subtyping and stuff but considering that subtyping shouldn't be relevant for constants I don't really see a reason why we may not want to reuse the const origin here.

r? `@varkor`
2020-10-24 14:12:06 +02:00
Jonas Schievink 6b2ed99a56
Rollup merge of #78243 - njasm:patch_test_args_description, r=jyn514
--test-args flag description

tiny enhancement/clarification for the help description of the `--test-args` option from `x.py test` subcommand.

Edit: ...as discussed in zulip [here](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/x.2Epy.20run.20single.20unit.20test.3F/near/214107842)
2020-10-24 14:12:05 +02:00
Jonas Schievink 86c07a4955
Rollup merge of #78198 - tmiasko:assert, r=davidtwco
Simplify assert terminator only if condition evaluates to expected value
2020-10-24 14:12:03 +02:00
Jonas Schievink d9acd7d148
Rollup merge of #78109 - cuviper:exhausted-rangeinc, r=dtolnay
Check for exhaustion in RangeInclusive::contains and slicing

When a range has finished iteration, `is_empty` returns true, so it
should also be the case that `contains` returns false.

Fixes #77941.
2020-10-24 14:12:01 +02:00
Jonas Schievink fb92b70f95
Rollup merge of #77716 - francesca64:revert-ios-dynamic-linking, r=jonas-schievink
Revert "Allow dynamic linking for iOS/tvOS targets."

This reverts PR #73516.

On macOS I compile static libs for iOS, automated using [cargo-mobile](https://github.com/BrainiumLLC/cargo-mobile), which has worked smoothly for the past 2 years. However, upon updating to Rust 1.46.0, I was no longer able to use Rust on iOS. I've bisected this to the PR referenced above.

For most projects tested, apps now immediately crash with a message like this:
```
dyld: Library not loaded: /Users/francesca/Projects/example/target/aarch64-apple-ios/debug/deps/libexample.dylib
  Referenced from: /private/var/containers/Bundle/Application/745912AF-A928-465C-B340-872BD1C9F368/example.app/example
  Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib:/Developer/Library/PrivateFrameworks/GPUTools.framework/libglInterpose.dylib:/usr/lib/libMTLCapture.dylib
```

This can be reproduced by using cargo-mobile to generate a winit example project, and then attempting to run it on an iOS device (`cargo mobile init && cargo apple open`).

In our projects that depend on DisplayLink, the build instead fails with a linker error:
```
= note: Undefined symbols for architecture arm64:
            "_CACurrentMediaTime", referenced from:
                display_link::ios::run_callback_ios10::hda81197ff46aedbd in libapp-4f0abc1d7684103f.rlib(app-4f0abc1d7684103f.40d4iro0yz1iy487.rcgu.o)
                display_link::ios::run_callback_pre_ios10::h91f085da19374320 in libapp-4f0abc1d7684103f.rlib(app-4f0abc1d7684103f.40d4iro0yz1iy487.rcgu.o)
          ld: symbol(s) not found for architecture arm64
```

After reverting the change to enable dynamic linking on iOS, everything works the same as it did on Rust 1.45.2 for me.

In the future, would it be possible for me to be pinged when iOS-related PRs are made? I work for a company that intends on using Rust on iOS in production, so I'd gladly provide testing.

cc @aspenluxxxy
2020-10-24 14:11:59 +02:00
Jonas Schievink d7c635b3a5
Rollup merge of #77392 - Canop:option_insert, r=m-ou-se
add `insert` to `Option`

This removes a cause of `unwrap` and code complexity.

This allows replacing

```
option_value = Some(build());
option_value.as_mut().unwrap()
```

with

```
option_value.insert(build())
```

It's also useful in contexts not requiring the mutability of the reference.

Here's a typical cache example:

```
let checked_cache = cache.as_ref().filter(|e| e.is_valid());
let content = match checked_cache {
	Some(e) => &e.content,
	None => {
	    cache = Some(compute_cache_entry());
	    // unwrap is OK because we just filled the option
	    &cache.as_ref().unwrap().content
	}
};
```

It can be changed into

```
let checked_cache = cache.as_ref().filter(|e| e.is_valid());
let content = match checked_cache {
	Some(e) => &e.content,
	None => &cache.insert(compute_cache_entry()).content,
};
```

*(edited: I removed `insert_with`)*
2020-10-24 14:11:57 +02:00
Jonas Schievink 8e756698df
Rollup merge of #76649 - nicbn:arc-spin-loop-hint, r=m-ou-se
Add a spin loop hint for Arc::downgrade

Adds `hint::spin_loop()` to the case where `Arc::downgrade` spins.
2020-10-24 14:11:56 +02:00
Dániel Buga 6533d010cf Don't generate multiple impl blocks 2020-10-24 11:55:00 +02:00
bors 2e8a54af60 Auto merge of #78316 - fusion-engineering-forks:fix-musl-ci-build, r=pietroalbini
Use different mirror for sabotage linux in musl-toolchain CI script.

Should hopefully fix the CI failure of #78309

`musl-cross-make` Makefile for reference: a54eb56f33/Makefile

r? `@pietroalbini`
2020-10-24 09:18:54 +00:00
Mara Bos 76e51b8987 Rollup merge of #78309 2020-10-24 11:17:02 +02:00
Mara Bos 21bd9eea74 Use own mirror for linux headers in musl-toolchain CI script. 2020-10-24 11:16:53 +02:00
Dániel Buga f88d6e8437 Loop instead of recursion 2020-10-24 01:24:58 +02:00
Rich Kadel f75a236fe0
Update compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
Co-authored-by: Wesley Wiser <wwiser@gmail.com>
2020-10-23 14:58:08 -07:00
Jonas Schievink f3265fec7a Fix Ubuntu download URL 2020-10-23 23:52:06 +02:00
Eduardo Broto ca11eeb563 Update Cargo.lock 2020-10-23 23:47:58 +02:00
Eduardo Broto e407cc5212 Remove duplicate import of `Target` 2020-10-23 23:45:37 +02:00
Eduardo Broto 9323443bdd Merge commit 'bf1c6f9871f430e284b17aa44059e0d0395e28a6' into clippyup 2020-10-23 22:16:59 +02:00
Tyler Mandry 6640a62e0e
Revert "Set .llvmbc and .llvmcmd sections as allocatable" 2020-10-23 12:54:00 -07:00
Esteban Küber f71e9ed7f1 review comments 2020-10-23 12:51:06 -07:00
Esteban Küber b334eef162 Do not ICE with TraitPredicates containing [type error]
Fix #77919.
2020-10-23 12:21:47 -07:00
Nicolas Nattis 929f80ece9 Add a spin loop hint for Arc::downgrade 2020-10-23 16:10:56 -03:00
Nelson J Morais c3cbaf64d3 x.py test --test-args flag description enhancement 2020-10-23 20:06:37 +01:00
Rich Kadel a7bc1a2edf Make codegen coverage_context optional, and check
Addresses Issue #78286

Libraries compiled with coverage and linked with out enabling coverage
would fail when attempting to add the library's coverage statements to
the codegen coverage context (None).

Now, if coverage statements are encountered while compiling / linking
with `-Z instrument-coverage` disabled, codegen will *not* attempt to
add code regions to a coverage map, and it will not inject the LLVM
instrprof_increment intrinsic calls.
2020-10-23 12:00:30 -07:00
bors 7bade6ef73 Auto merge of #77015 - davidtwco:check-attr-variant-closure-expr, r=lcnr
passes: `check_attr` on more targets

This PR modifies `check_attr` so that:

- Enum variants are now checked (some attributes would not have been prohibited on variants previously).
- `check_expr_attributes` and `check_stmt_attributes` are removed as `check_attributes` can perform the same checks. This means that codegen attribute errors aren't shown if there are other errors first (e.g. from other attributes, as shown in `src/test/ui/macros/issue-68060.rs` changes below).
2020-10-23 17:32:04 +00:00
nasso a0ce1e095e Always store Rustdoc theme when it's changed 2020-10-23 18:58:42 +02:00
bors bf1c6f9871 Auto merge of #6206 - ebroto:rustup, r=ebroto
Rustup

changelog: none

r? `@ghost`
2020-10-23 16:58:39 +00:00
Florian Warzecha ac2c599f23
fix validation for rustc_allow_const_fn_unstable targets
The validation was introduced in 3a63bf0299
without strict validation of functions, e. g. all function types were
allowed.
Now the validation only allows `const fn`s.
2020-10-23 17:54:48 +02:00
Florian Warzecha 13b481b247
rename allow_internal_unstable() to rustc_allow_const_fn_unstable() in rustc_mir
Followup rename from 05f4a9a42a,
which introduced `#[rustc_allow_const_fn_unstable]` for `const fn`s.
2020-10-23 17:14:57 +02:00
Florian Warzecha 83fbdddc99
ignore #[rustc_allow_const_fn_unstable] for macro expansion
Recognition for `rustc_allow_const_fn_unstable` attribute was errorneously
added in 05f4a9a42a.
2020-10-23 16:54:25 +02:00
Bastian Kauschke 47cb871f14 review 2020-10-23 15:04:12 +02:00
Eduardo Broto d17edaa152 Merge remote-tracking branch 'upstream/master' into rustup 2020-10-23 14:37:17 +02:00
Bastian Kauschke 972d9e886c move `visit_predicate` into `TypeVisitor` 2020-10-23 13:58:32 +02:00
Tim 7d30c53656
Bump backtrace-rs to enable Mach-O support on iOS. 2020-10-23 13:47:09 +02:00
Eduardo Pinho efedcb2344
Update description of Empty Enum for accuracy
An empty enum is similar to the never type `!`, rather than the unit type `()`.
2020-10-23 12:13:07 +01:00
Bastian Kauschke 6ad140ca19 const_eval_checked: deal with unused nodes + div 2020-10-23 12:16:58 +02:00
Canop 216d0fe364 add tracking issue number to option_insert feature gate 2020-10-23 11:44:58 +02:00
Canop 415a8e526d Update library/core/src/option.rs
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2020-10-23 11:41:19 +02:00
Canop 39557799c7 Update library/core/src/option.rs
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2020-10-23 11:41:19 +02:00
Canop cc8b77a7cf fix naming unconsistency between function doc and prototype 2020-10-23 11:41:19 +02:00
Canop 60a96cae33 more tests in option.insert, code cleaning in option
Code cleaning made according to suggestions in discussion
on PR ##77392 impacts insert, get_or_insert and get_or_insert_with.
2020-10-23 11:41:19 +02:00
Canop e8df2a4269 remove `option.insert_with`
`option.insert` covers both needs anyway, `insert_with` is
redundant.
2020-10-23 11:41:19 +02:00
Canop 9b90e1762e add `insert` and `insert_with` to `Option`
This removes a cause of `unwrap` and code complexity.

This allows replacing

```
option_value = Some(build());
option_value.as_mut().unwrap()
```

with

```
option_value.insert(build())
```

or

```
option_value.insert_with(build)
```

It's also useful in contexts not requiring the mutability of the reference.

Here's a typical cache example:

```
let checked_cache = cache.as_ref().filter(|e| e.is_valid());
let content = match checked_cache {
	Some(e) => &e.content,
	None => {
	    cache = Some(compute_cache_entry());
	    // unwrap is OK because we just filled the option
	    &cache.as_ref().unwrap().content
	}
};
```

It can be changed into

```
let checked_cache = cache.as_ref().filter(|e| e.is_valid());
let content = match checked_cache {
	Some(e) => &e.content,
	None => &cache.insert_with(compute_cache_entry).content,
};
```
2020-10-23 11:41:19 +02:00
bors 07a63e6d1f Auto merge of #78270 - JohnTitor:rollup-bldrjh5, r=JohnTitor
Rollup of 17 pull requests

Successful merges:

 - #77268 (Link to "Contributing to Rust" rather than "Getting Started".)
 - #77339 (Implement TryFrom between NonZero types.)
 - #77488 (Mark `repr128` as `incomplete_features`)
 - #77890 (Fixing escaping to ensure generation of welformed json.)
 - #77918 (Cleanup network tests)
 - #77920 (Avoid extraneous space between visibility kw and ident for statics)
 - #77969 (Doc formating consistency between slice sort and sort_unstable, and big O notation consistency)
 - #78098 (Clean up and improve some docs)
 - #78116 (Make inline const work in range patterns)
 - #78153 (Sync LLVM submodule if it has been initialized)
 - #78163 (Clean up lib docs)
 - #78169 (Update cargo)
 - #78231 (Make closures inherit the parent function's target features)
 - #78235 (Explain where the closure return type was inferred)
 - #78255 (Reduce diagram mess in 'match arms have incompatible types' error)
 - #78263 (Add regression test of issue-77668)
 - #78265 (Add some inference-related regression tests about incorrect diagnostics)

Failed merges:

r? `@ghost`
2020-10-23 09:31:44 +00:00
Yuki Okushi b5d2ff0fd8
Rollup merge of #78265 - JohnTitor:type-iference-diag-test, r=lcnr
Add some inference-related regression tests about incorrect diagnostics

Closes #71732
Closes #72616
2020-10-23 18:26:44 +09:00
Yuki Okushi 6884632be1
Rollup merge of #78263 - JohnTitor:mir-opt-ice-test, r=lcnr
Add regression test of issue-77668

Closes #77668
2020-10-23 18:26:42 +09:00