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 11 pull requests #80252

Closed
wants to merge 145 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
a8c4744
Use article_and_description for missing docs
camsteffen Nov 10, 2020
0387981
Add --no-deps command-line argument
ebroto Oct 17, 2020
192ccfb
Update README.md
ebroto Oct 17, 2020
7eda421
Apply suggestion regarding clippy_enabled bool
ebroto Nov 25, 2020
a83eb7c
Make --fix imply --no-deps
ebroto Nov 27, 2020
952b731
Reword bitrotten comment
ebroto Nov 27, 2020
f059feb
Add redundant else lint
camsteffen Nov 13, 2020
70f6a2c
Eat redundant else dogfood
camsteffen Nov 13, 2020
4e14c05
fix clippy test
vn-ki Dec 5, 2020
402f55f
Implement lowering of if-let guards to MIR
LeSeulArtichaut Nov 13, 2020
93c6135
Handle `Guard::IfLet` in clippy
LeSeulArtichaut Nov 15, 2020
8eca423
Merge commit 'c1664c50b27a51f7a78c93ba65558e7c33eabee6' into clippyup
flip1995 Dec 6, 2020
0e527ba
Retain assembly operands span when lowering AST to HIR
tmiasko Nov 27, 2020
e90b977
Fix FP in `unnecessary_lazy_evaluations`
giraffate Nov 22, 2020
ba12494
cargo dev fmt
giraffate Dec 7, 2020
aaed9d9
Auto merge of #6370 - giraffate:fix_fp_in_unnecessary_lazy_evaluation…
bors Dec 7, 2020
b81141c
Add lint print_stderr
justjosias Nov 22, 2020
51cee15
Add negative tests
justjosias Nov 29, 2020
b04bfbd
Fix print_stderr.stderr test
justjosias Dec 1, 2020
7063c36
Add eprint! to print_with_newline lint
justjosias Dec 4, 2020
e58c7dd
panic_in_result_fn: Extend to also check usages of [debug_]assert* ma…
dp304 Oct 31, 2020
bdad790
Apply suggestions from code review
dp304 Dec 3, 2020
16d0e56
Update reference file
ebroto Dec 7, 2020
856f4f3
Auto merge of #6280 - dp304:assert_in_result_fn, r=ebroto
bors Dec 7, 2020
50bca8a
Auto merge of #6330 - camsteffen:redundant-else, r=ebroto
bors Dec 8, 2020
bd7f9c6
Merge remote-tracking branch 'upstream/master' into sync-from-rust
giraffate Dec 8, 2020
f9fccbe
Auto merge of #6432 - giraffate:sync-from-rust, r=flip1995
bors Dec 8, 2020
3187cad
Factor out some code in write.rs
ebroto Dec 8, 2020
b02b0c7
Auto merge of #6367 - justjosias:6348-print-stderr, r=ebroto
bors Dec 8, 2020
a2d9925
Auto merge of #6188 - ebroto:primary_package, r=flip1995
bors Dec 9, 2020
f77f1db
Add a lint for maps with zero-sized values
korrat Oct 24, 2020
6c70133
Auto merge of #6218 - korrat:master, r=ebroto
bors Dec 9, 2020
613333a
Pin Clippy to a nightly
ebroto Nov 29, 2020
2e8b00a
Apply suggestions from PR review
ebroto Dec 9, 2020
77a32eb
Use new cache key
ebroto Dec 9, 2020
20d84fd
Enable internal lints for every test in CI
flip1995 Dec 10, 2020
41cab83
Fix toolchain installation in workflows
flip1995 Dec 10, 2020
26dcbf5
Stop caching on CI
flip1995 Dec 10, 2020
3f41fe2
Error in integration test, if required toolchain is not installed
flip1995 Dec 10, 2020
836325e
Fix integration test runner
flip1995 Dec 10, 2020
a6bb927
Lint wrong self convention in trait also
ThibsG Nov 9, 2020
4af9382
Common function to lint wrong self convention from impl and trait def
ThibsG Nov 10, 2020
db98651
Allow `wrong_self_convention` in `use_self` test for trait def
ThibsG Nov 10, 2020
1e0f85b
Update tests/ui/use_self.rs
ThibsG Nov 24, 2020
90a16e4
Add tests for unsized trait in `wrong_self_convention` lint
ThibsG Dec 10, 2020
a7cfffe
add MSRV to more lints specified in #6097
suyashb95 Dec 5, 2020
8df11e4
add instructions to include msrv in lints
suyashb95 Dec 8, 2020
9f27b74
add test for missing_const_for_fn. fix test stderr
suyashb95 Dec 9, 2020
27fd6ed
Auto merge of #6424 - Suyash458:master, r=flip1995
bors Dec 11, 2020
26c61c7
Fix FP of `manual_range_contains` in `const fn`
giraffate Nov 25, 2020
baf5f2d
Auto merge of #6401 - ebroto:pin_to_a_nightly, r=ebroto
bors Dec 11, 2020
30ef177
Move binder for dyn to each list item
jackh726 Dec 11, 2020
0b145d6
clone_double_ref: print reference type in lint message
matthiaskrgr Dec 12, 2020
b2cb6ff
clone_on_copy: show the type in the lint message
matthiaskrgr Dec 12, 2020
4bd9ed9
Rewrite update-all-references bash scripts in Rust
phansch Dec 2, 2020
41c562d
Improve variable naming
phansch Dec 10, 2020
b8501e1
Feed the dog :dog2:
phansch Dec 12, 2020
18c5ea4
Auto merge of #6413 - phansch:bless, r=flip1995
bors Dec 12, 2020
3b89a67
Auto merge of #6382 - giraffate:fix_fp_in_manual_range_contains_when_…
bors Dec 12, 2020
89c282f
Auto merge of #6318 - camsteffen:article-description, r=Manishearth
bors Dec 12, 2020
3af09b8
New internal lint: interning_defined_symbol
Dec 13, 2020
a6aa0ac
Fix dogfood errors
Dec 13, 2020
64e630c
Run 'cargo dev update_lints'
Dec 13, 2020
b7db5bf
Auto merge of #6442 - matthiaskrgr:clone-double-ref-ty, r=llogiq
bors Dec 13, 2020
cd2a62c
needless_borrow: print the type in the lint message
matthiaskrgr Dec 13, 2020
cc96955
Pass Clippy args also trough RUSTFLAGS
ebroto Dec 11, 2020
f93d965
Address comments from PR review
ebroto Dec 13, 2020
684f17e
Auto merge of #6441 - ebroto:use_rustflags, r=flip1995
bors Dec 13, 2020
1df2e38
Auto merge of #6443 - matthiaskrgr:clone_on_copy_type, r=ebroto
bors Dec 13, 2020
6b2b357
Auto merge of #6449 - matthiaskrgr:needless_borrow_ty, r=ebroto
bors Dec 13, 2020
404c50f
NFC: clippy cargo dev: move generation of clap config into a function
matthiaskrgr Dec 13, 2020
91fa25c
clippy dev fmt: don't format if we have a local rustc repo enabled as…
matthiaskrgr Dec 13, 2020
27dc565
cargo dev: rename ra-setup to ra_setup to be in line with the other c…
matthiaskrgr Dec 13, 2020
a642b42
Auto merge of #6450 - matthiaskrgr:dont_format_local_repo, r=ebroto
bors Dec 13, 2020
a37af06
Removing false positive for the match_single_binding lint
xFrednet Dec 9, 2020
d924164
Auto merge of #6435 - xFrednet:5552-false-positive-match-single-bindi…
bors Dec 13, 2020
426aba2
Fix links in CONTRIBUTING.md
giraffate Dec 14, 2020
5b03834
Auto merge of #6451 - giraffate:update_contributing_md, r=llogiq
bors Dec 14, 2020
8b1e9ed
bump pinned nightly from nightly-2020-12-09 to nightly-2020-12-14
matthiaskrgr Dec 14, 2020
6c83e56
Auto merge of #6452 - matthiaskrgr:bump_nightly, r=flip1995
bors Dec 14, 2020
3043a7b
Improve warnings on incompatible options involving -Zinstrument-coverage
richkadel Dec 14, 2020
ae288df
Convenience funcs for `some_option.unwrap_or(...)`
richkadel Dec 14, 2020
39aca5f
Auto merge of #78399 - vn-ki:gsgdt-graphviz, r=oli-obk
bors Dec 15, 2020
39bcf8e
Handle fatal errors when parsing doctests
ebroto Dec 15, 2020
41b5ebe
needless_doctest_main: add edition support
ebroto Dec 15, 2020
f732cc5
Remove unsafe code
Dec 16, 2020
142f0f5
Auto merge of #6448 - mikerite:interning_defined_symbol, r=Manishearth
bors Dec 16, 2020
1d6fac6
Typo: std::fs::crate_dir -> std::fs::create_dir
Dorumin Dec 16, 2020
5c00931
Auto merge of #6461 - Dorumin:patch-1, r=Manishearth
bors Dec 17, 2020
286e492
Rollup merge of #79051 - LeSeulArtichaut:if-let-guard, r=matthewjasper
JohnTitor Dec 17, 2020
bb68ec6
Apply suggestion from PR review
ebroto Dec 17, 2020
8e9a538
Auto merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakis
bors Dec 17, 2020
1eb7608
make needless_update ignore non_exhaustive structs
ahouts Dec 18, 2020
920c9a4
add more lints to msrv docs
suyashb95 Dec 18, 2020
88323e8
Auto merge of #6458 - ebroto:6022_parse_doctest, r=Manishearth
bors Dec 18, 2020
896d82f
Auto merge of #6465 - Suyash458:master, r=flip1995
bors Dec 18, 2020
f2743a5
Add array search aliases
jyn514 Dec 18, 2020
1f58c2b
Renamed the good first issue label for rustbot
xFrednet Dec 18, 2020
9be7045
Auto merge of #6468 - xFrednet:0000-rename-good-first-issue-for-rustb…
bors Dec 18, 2020
ced54f2
Renamed the good first issue label in CONTRIBUTING.md
xFrednet Dec 18, 2020
a898df4
Auto merge of #6470 - xFrednet:0000-rename-good-first-issue-in-docs, …
bors Dec 18, 2020
a24c6f1
remove example
ahouts Dec 19, 2020
0718eeb
Auto merge of #6464 - ahouts:make-needless_update-ignore-non_exhausti…
bors Dec 19, 2020
dfb4ea5
Fix blessing of new reference files
phansch Dec 19, 2020
f00b6ac
More rebinds
jackh726 Dec 17, 2020
73feb31
Auto merge of #6471 - phansch:fix-bless, r=flip1995
bors Dec 19, 2020
8ddf4ce
UI Tests: Separate suspicious_else_formatting tests
phansch Dec 19, 2020
0904f54
Auto merge of #6473 - phansch:split-up-ui-test, r=flip1995
bors Dec 19, 2020
2814ee4
Adapted the website search for better matching
xFrednet Dec 19, 2020
f4085f0
also const-check FakeRead
RalfJung Dec 19, 2020
9f9e9f7
Auto merge of #6316 - ThibsG:WrongSelfConventionTraitDef, r=ebroto
bors Dec 19, 2020
12a35ab
Auto merge of #6477 - xFrednet:0000-enable-search-with-dashes, r=ebroto
bors Dec 19, 2020
4ad53dc
Use pointer type in AtomicPtr::swap implementation
tmiasko Dec 20, 2020
b76c9be
Handle desugaring in impl trait bound suggestion
wabain Dec 19, 2020
a33f6ac
Fix ICE on suggesting calling function
ldm0 Dec 20, 2020
4eb28c3
Update compiler/rustc_typeck/src/check/op.rs
ldm0 Dec 20, 2020
883a3d1
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Dec 20, 2020
53d6e0c
Bump nightly to 2020-12-20
flip1995 Dec 20, 2020
4911ab1
Auto merge of #6482 - flip1995:rustup, r=flip1995
bors Dec 20, 2020
520761a
Merge commit '4911ab124c481430672a3833b37075e6435ec34d' into clippyup
flip1995 Dec 20, 2020
00bb293
Move test from compile-fail to ui/binop
ldm0 Dec 20, 2020
b228be2
Edit rustc_middle::ty::TyKind docs
pierwill Dec 18, 2020
fbc9d50
make sure installer only creates directories in DESTDIR
yshui Dec 20, 2020
f318f02
Edit rustc_middle docs
pierwill Dec 18, 2020
65f4f39
Get rid of `locate()` in markdown handling
jyn514 Dec 20, 2020
1e15c2f
Remove unnecessary scope
jyn514 Dec 20, 2020
93d5a80
Clean up with_generic_param_rib, avoid double hashing
bugadani Dec 20, 2020
62f593b
Precompute vector length in smart_resolve_path_fragment
bugadani Dec 20, 2020
91ea623
Remove unnecessary cloned
bugadani Dec 20, 2020
89bc399
Add missing semicolon
bugadani Dec 20, 2020
60d5567
Fix incorrect logic when merging matches
jyn514 Dec 20, 2020
f499601
Create closure outside of the loop
bugadani Dec 20, 2020
66c2872
Inline a single-use closure
bugadani Dec 20, 2020
6d71cc6
Move std_path construction into condition
bugadani Dec 20, 2020
f066f7c
Rollup merge of #80159 - jyn514:array, r=m-ou-se
Dylan-DPC Dec 21, 2020
582ef61
Rollup merge of #80166 - pierwill:pierwill-rustcmiddle-place, r=petro…
Dylan-DPC Dec 21, 2020
dc977bd
Rollup merge of #80170 - ldm0:fixice, r=lcnr
Dylan-DPC Dec 21, 2020
6c480d1
Rollup merge of #80171 - pierwill:pierwill-rustcmiddle-tykind, r=lcnr
Dylan-DPC Dec 21, 2020
4d6379b
Rollup merge of #80199 - RalfJung:const-fake, r=oli-obk
Dylan-DPC Dec 21, 2020
5752c37
Rollup merge of #80211 - wabain:async-fn-trait-bound-suggestion, r=pe…
Dylan-DPC Dec 21, 2020
293c9c0
Rollup merge of #80236 - tmiasko:atomic-swap, r=oli-obk
Dylan-DPC Dec 21, 2020
7fec417
Rollup merge of #80239 - flip1995:clippyup, r=Manishearth
Dylan-DPC Dec 21, 2020
937e0e4
Rollup merge of #80240 - yshui:master, r=Mark-Simulacrum
Dylan-DPC Dec 21, 2020
d0bc5e4
Rollup merge of #80244 - jyn514:spans, r=bugadani
Dylan-DPC Dec 21, 2020
0f7894a
Rollup merge of #80250 - bugadani:resolver-cleanup, r=petrochenkov
Dylan-DPC Dec 21, 2020
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
15 changes: 13 additions & 2 deletions compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,19 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
};

let ty = substs.type_at(0);
if int_type_width_signed(ty, bx.tcx()).is_some() {
bx.atomic_rmw(atom_op, args[0].immediate(), args[1].immediate(), order)
if int_type_width_signed(ty, bx.tcx()).is_some()
|| (ty.is_unsafe_ptr() && op == "xchg")
{
let mut ptr = args[0].immediate();
let mut val = args[1].immediate();
if ty.is_unsafe_ptr() {
// Some platforms do not support atomic operations on pointers,
// so we cast to integer first.
let ptr_llty = bx.type_ptr_to(bx.type_isize());
ptr = bx.pointercast(ptr, ptr_llty);
val = bx.ptrtoint(val, bx.type_isize());
}
bx.atomic_rmw(atom_op, ptr, val, order)
} else {
return invalid_monomorphization(ty);
}
Expand Down
20 changes: 10 additions & 10 deletions compiler/rustc_middle/src/hir/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ use rustc_target::abi::VariantIdx;
HashStable
)]
pub enum PlaceBase {
/// A temporary variable
/// A temporary variable.
Rvalue,
/// A named `static` item
/// A named `static` item.
StaticItem,
/// A named local variable
/// A named local variable.
Local(HirId),
/// An upvar referenced by closure env
/// An upvar referenced by closure env.
Upvar(ty::UpvarId),
}

Expand All @@ -40,7 +40,7 @@ pub enum PlaceBase {
HashStable
)]
pub enum ProjectionKind {
/// A dereference of a pointer, reference or `Box<T>` of the given type
/// A dereference of a pointer, reference or `Box<T>` of the given type.
Deref,

/// `B.F` where `B` is the base expression and `F` is
Expand Down Expand Up @@ -71,16 +71,16 @@ pub enum ProjectionKind {
HashStable
)]
pub struct Projection<'tcx> {
/// Type after the projection is being applied.
/// Type after the projection is applied.
pub ty: Ty<'tcx>,

/// Defines the type of access
/// Defines the kind of access made by the projection.
pub kind: ProjectionKind,
}

/// A `Place` represents how a value is located in memory.
///
/// This is an HIR version of `mir::Place`
/// This is an HIR version of [`rustc_middle::mir::Place`].
#[derive(Clone, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, TypeFoldable, HashStable)]
pub struct Place<'tcx> {
/// The type of the `PlaceBase`
Expand All @@ -93,13 +93,13 @@ pub struct Place<'tcx> {

/// A `PlaceWithHirId` represents how a value is located in memory.
///
/// This is an HIR version of `mir::Place`
/// This is an HIR version of [`rustc_middle::mir::Place`].
#[derive(Clone, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, TypeFoldable, HashStable)]
pub struct PlaceWithHirId<'tcx> {
/// `HirId` of the expression or pattern producing this value.
pub hir_id: HirId,

/// Information about the `Place`
/// Information about the `Place`.
pub place: Place<'tcx>,
}

Expand Down
8 changes: 5 additions & 3 deletions compiler/rustc_middle/src/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ impl BoundRegionKind {
}
}

/// Defines the kinds of types.
///
/// N.B., if you change this, you'll probably want to change the corresponding
/// AST structure in `librustc_ast/ast.rs` as well.
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable, Debug)]
Expand All @@ -110,7 +112,7 @@ pub enum TyKind<'tcx> {
/// A primitive floating-point type. For example, `f64`.
Float(ast::FloatTy),

/// Structures, enumerations and unions.
/// Algebraic data types (ADT). For example: structures, enumerations and unions.
///
/// InternalSubsts here, possibly against intuition, *may* contain `Param`s.
/// That is, even after substitution it is possible that there are type
Expand Down Expand Up @@ -170,11 +172,11 @@ pub enum TyKind<'tcx> {
/// `|a| yield a`.
Generator(DefId, SubstsRef<'tcx>, hir::Movability),

/// A type representin the types stored inside a generator.
/// A type representing the types stored inside a generator.
/// This should only appear in GeneratorInteriors.
GeneratorWitness(Binder<&'tcx List<Ty<'tcx>>>),

/// The never type `!`
/// The never type `!`.
Never,

/// A tuple type. For example, `(i32, bool)`.
Expand Down
11 changes: 5 additions & 6 deletions compiler/rustc_mir/src/transform/check_consts/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,17 +722,16 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
trace!("visit_statement: statement={:?} location={:?}", statement, location);

match statement.kind {
StatementKind::Assign(..) | StatementKind::SetDiscriminant { .. } => {
self.super_statement(statement, location);
}
self.super_statement(statement, location);

match statement.kind {
StatementKind::LlvmInlineAsm { .. } => {
self.super_statement(statement, location);
self.check_op(ops::InlineAsm);
}

StatementKind::FakeRead(..)
StatementKind::Assign(..)
| StatementKind::SetDiscriminant { .. }
| StatementKind::FakeRead(..)
| StatementKind::StorageLive(_)
| StatementKind::StorageDead(_)
| StatementKind::Retag { .. }
Expand Down
65 changes: 29 additions & 36 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use rustc_span::Span;
use smallvec::{smallvec, SmallVec};

use rustc_span::source_map::{respan, Spanned};
use std::collections::BTreeSet;
use std::collections::{hash_map::Entry, BTreeSet};
use std::mem::{replace, take};
use tracing::debug;

Expand Down Expand Up @@ -953,8 +953,8 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
});
};

for item in trait_items {
this.with_trait_items(trait_items, |this| {
this.with_trait_items(trait_items, |this| {
for item in trait_items {
match &item.kind {
AssocItemKind::Const(_, ty, default) => {
this.visit_ty(ty);
Expand Down Expand Up @@ -983,8 +983,8 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
panic!("unexpanded macro in resolve!")
}
};
});
}
}
});
});
});
}
Expand Down Expand Up @@ -1060,36 +1060,29 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
continue;
}

let def_kind = match param.kind {
GenericParamKind::Type { .. } => DefKind::TyParam,
GenericParamKind::Const { .. } => DefKind::ConstParam,
_ => unreachable!(),
};

let ident = param.ident.normalize_to_macros_2_0();
debug!("with_generic_param_rib: {}", param.id);

if seen_bindings.contains_key(&ident) {
let span = seen_bindings.get(&ident).unwrap();
let err = ResolutionError::NameAlreadyUsedInParameterList(ident.name, *span);
self.report_error(param.ident.span, err);
match seen_bindings.entry(ident) {
Entry::Occupied(entry) => {
let span = *entry.get();
let err = ResolutionError::NameAlreadyUsedInParameterList(ident.name, span);
self.report_error(param.ident.span, err);
}
Entry::Vacant(entry) => {
entry.insert(param.ident.span);
}
}
seen_bindings.entry(ident).or_insert(param.ident.span);

// Plain insert (no renaming).
let res = Res::Def(def_kind, self.r.local_def_id(param.id).to_def_id());

match param.kind {
GenericParamKind::Type { .. } => {
function_type_rib.bindings.insert(ident, res);
self.r.record_partial_res(param.id, PartialRes::new(res));
}
GenericParamKind::Const { .. } => {
function_value_rib.bindings.insert(ident, res);
self.r.record_partial_res(param.id, PartialRes::new(res));
}
let (rib, def_kind) = match param.kind {
GenericParamKind::Type { .. } => (&mut function_type_rib, DefKind::TyParam),
GenericParamKind::Const { .. } => (&mut function_value_rib, DefKind::ConstParam),
_ => unreachable!(),
}
};
let res = Res::Def(def_kind, self.r.local_def_id(param.id).to_def_id());
self.r.record_partial_res(param.id, PartialRes::new(res));
rib.bindings.insert(ident, res);
}

self.ribs[ValueNS].push(function_value_rib);
Expand Down Expand Up @@ -1778,7 +1771,6 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
path
);
let ns = source.namespace();
let is_expected = &|res| source.is_expected(res);

let report_errors = |this: &mut Self, res: Option<Res>| {
if this.should_report_errs() {
Expand Down Expand Up @@ -1881,7 +1873,8 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
crate_lint,
) {
Ok(Some(partial_res)) if partial_res.unresolved_segments() == 0 => {
if is_expected(partial_res.base_res()) || partial_res.base_res() == Res::Err {
if source.is_expected(partial_res.base_res()) || partial_res.base_res() == Res::Err
{
partial_res
} else {
report_errors(self, Some(partial_res.base_res()))
Expand All @@ -1898,11 +1891,11 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
self.r.trait_map.insert(id, traits);
}

let mut std_path = vec![Segment::from_ident(Ident::with_dummy_span(sym::std))];

std_path.extend(path);

if self.r.primitive_type_table.primitive_types.contains_key(&path[0].ident.name) {
let mut std_path = Vec::with_capacity(1 + path.len());

std_path.push(Segment::from_ident(Ident::with_dummy_span(sym::std)));
std_path.extend(path);
if let PathResult::Module(_) | PathResult::NonModule(_) =
self.resolve_path(&std_path, Some(ns), false, span, CrateLint::No)
{
Expand Down Expand Up @@ -1983,7 +1976,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
) -> Result<Option<PartialRes>, Spanned<ResolutionError<'a>>> {
let mut fin_res = None;

for (i, ns) in [primary_ns, TypeNS, ValueNS].iter().cloned().enumerate() {
for (i, &ns) in [primary_ns, TypeNS, ValueNS].iter().enumerate() {
if i == 0 || ns != primary_ns {
match self.resolve_qpath(id, qself, path, ns, span, crate_lint)? {
Some(partial_res)
Expand All @@ -1993,7 +1986,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
}
partial_res => {
if fin_res.is_none() {
fin_res = partial_res
fin_res = partial_res;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,27 +254,21 @@ fn suggest_restriction(
let pred = trait_ref.without_const().to_predicate(tcx).to_string();
let pred = pred.replace(&impl_trait_str, &type_param_name);
let mut sugg = vec![
// Find the last of the generic parameters contained within the span of
// the generics
match generics
.params
.iter()
.filter(|p| match p.kind {
hir::GenericParamKind::Type {
synthetic: Some(hir::SyntheticTyParamKind::ImplTrait),
..
} => false,
_ => true,
})
.last()
.map(|p| p.bounds_span().unwrap_or(p.span))
.filter(|&span| generics.span.contains(span) && span.desugaring_kind().is_none())
.max_by_key(|span| span.hi())
{
// `fn foo(t: impl Trait)`
// ^ suggest `<T: Trait>` here
None => (generics.span, format!("<{}>", type_param)),
// `fn foo<A>(t: impl Trait)`
// ^^^ suggest `<A, T: Trait>` here
Some(param) => (
param.bounds_span().unwrap_or(param.span).shrink_to_hi(),
format!(", {}", type_param),
),
Some(span) => (span.shrink_to_hi(), format!(", {}", type_param)),
},
// `fn foo(t: impl Trait)`
// ^ suggest `where <T as Trait>::A: Bound`
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/check/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
_ => (false, false, false),
};

// Type check the descriminant and get its type.
// Type check the discriminant and get its type.
let scrutinee_ty = if force_scrutinee_bool {
// Here we want to ensure:
//
Expand Down
10 changes: 8 additions & 2 deletions compiler/rustc_typeck/src/check/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if !self.tcx.has_typeck_results(def_id) {
return false;
}
// We're emitting a suggestion, so we can just ignore regions
let fn_sig = self.tcx.fn_sig(def_id).skip_binder();
// FIXME: Instead of exiting early when encountering bound vars in
// the function signature, consider keeping the binder here and
// propagating it downwards.
let fn_sig = if let Some(fn_sig) = self.tcx.fn_sig(def_id).no_bound_vars() {
fn_sig
} else {
return false;
};

let other_ty = if let FnDef(def_id, _) = *other_ty.kind() {
if !self.tcx.has_typeck_results(def_id) {
Expand Down
10 changes: 9 additions & 1 deletion library/core/src/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,16 @@ impl<T> AtomicPtr<T> {
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(target_has_atomic = "ptr")]
pub fn swap(&self, ptr: *mut T, order: Ordering) -> *mut T {
#[cfg(bootstrap)]
// SAFETY: data races are prevented by atomic intrinsics.
unsafe { atomic_swap(self.p.get() as *mut usize, ptr as usize, order) as *mut T }
unsafe {
atomic_swap(self.p.get() as *mut usize, ptr as usize, order) as *mut T
}
#[cfg(not(bootstrap))]
// SAFETY: data races are prevented by atomic intrinsics.
unsafe {
atomic_swap(self.p.get(), ptr, order)
}
}

/// Stores a value into the pointer if the current value is the same as the `current` value.
Expand Down
4 changes: 3 additions & 1 deletion library/std/src/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,10 @@ mod prim_unit {}
#[stable(feature = "rust1", since = "1.0.0")]
mod prim_pointer {}

#[doc(alias = "[]")]
#[doc(alias = "[T;N]")] // unfortunately, rustdoc doesn't have fuzzy search for aliases
#[doc(alias = "[T; N]")]
#[doc(primitive = "array")]
//
/// A fixed-size array, denoted `[T; N]`, for the element type, `T`, and the
/// non-negative compile-time constant size, `N`.
///
Expand Down
14 changes: 8 additions & 6 deletions src/bootstrap/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,7 @@ fn install_sh(
let docdir_default = datadir_default.join("doc/rust");
let libdir_default = PathBuf::from("lib");
let mandir_default = datadir_default.join("man");
let prefix = builder.config.prefix.as_ref().map_or(prefix_default, |p| {
fs::create_dir_all(p)
.unwrap_or_else(|err| panic!("could not create {}: {}", p.display(), err));
fs::canonicalize(p)
.unwrap_or_else(|err| panic!("could not canonicalize {}: {}", p.display(), err))
});
let prefix = builder.config.prefix.as_ref().unwrap_or(&prefix_default);
let sysconfdir = builder.config.sysconfdir.as_ref().unwrap_or(&sysconfdir_default);
let datadir = builder.config.datadir.as_ref().unwrap_or(&datadir_default);
let docdir = builder.config.docdir.as_ref().unwrap_or(&docdir_default);
Expand All @@ -103,6 +98,13 @@ fn install_sh(
let libdir = add_destdir(&libdir, &destdir);
let mandir = add_destdir(&mandir, &destdir);

let prefix = {
fs::create_dir_all(&prefix)
.unwrap_or_else(|err| panic!("could not create {}: {}", prefix.display(), err));
fs::canonicalize(&prefix)
.unwrap_or_else(|err| panic!("could not canonicalize {}: {}", prefix.display(), err))
};

let empty_dir = builder.out.join("tmp/empty_dir");

t!(fs::create_dir_all(&empty_dir));
Expand Down
Loading